Long farming with terrad

(Reposted from the Mirror Discord server for convenience)

For long farming with the old pools, terrad is probably the easiest way. I can’t give a walkthrough but I can share this as an example:

terrad=~/terra.classic.core1/terrad
mirrorstaking=terra17f7zu97865jmknk7p2glqvxzhduk78772ezac5
token=terra1227ppwxxj3jxz8cfgq00jgnxqcny7ryenvkwj6
providetokenamount=5020
provideuusdamount=2073102
from=wallet1
allowancemsg=$(cat <<END
{
  "increase_allowance": {
    "amount": "$providetokenamount",
    "spender": "$mirrorstaking"
  }
}
END
)
autostakemsg=$(cat <<END
{
  "auto_stake": {
    "assets": [
      {
        "amount": "$providetokenamount",
        "info": {
          "token": {
            "contract_addr": "$token"
          }
        }
      },
      {
        "amount": "$provideuusdamount",
        "info": {
          "native_token": {
            "denom": "uusd"
          }
        }
      }
    ],
    "slippage_tolerance": "0.02"
  }
}
END
)
"$terrad" tx wasm execute "$token" "$allowancemsg" --gas auto --gas-adjustment 1.2 --gas-prices 5.665uluna --from "$from" --broadcast-mode block --chain-id columbus-5 --node https://terra.stakesystems.io:2053
"$terrad" tx wasm execute "$mirrorstaking" "$autostakemsg" "${provideuusdamount}uusd" --gas auto --gas-adjustment 1.2 --gas-prices 5.665uluna --from "$from" --broadcast-mode block --chain-id columbus-5 --node https://terra.stakesystems.io:2053

In this example, tax and gas fees are calculated automatically by terrad. The gas price 5.665uluna was taken from https://columbus-fcd.terra.dev/v1/txs/gas_prices The public RPC node https://terra.stakesystems.io:2053 was taken from Terra Classic Discord #dev-faq.

The messages, amounts, contract addresses can be copied from the failing transaction performed by mirrorprotocol.app.

To learn terrad, read its documentation: Install Terrad | Terra Docs and terrad — Terra Classic Docs documentation Some things which are not explained in the docs:

  • Terra 2 core doesn’t work with Terra Classic, use classic-core from Releases · terra-money/classic-core · GitHub
  • I haven’t tested it on Windows but based on what Terra devs say, terrad requires WSL and following the Linux instructions (that’s why some Windows users may prefer the python SDK instead but it’s more low-level and not as easy to use as terrad)