dApp migration guide

Use this guide to Migrate from Terra Classic to the new Terra chain.

Changes

Terra 2.0 will be starting from a blank state when it comes to CosmWasm. This means no existing code IDs or smart contracts will be migrated.

  • CosmWasm smart contracts will need to be uploaded to the new chain and instantiated.

  • Cosmwasm versions need to be upgraded to 1.0.

  • In addition to needing to re-deploy smart contracts, there are some breaking changes that developers should be aware of.

1. No UST or other native stablecoins (KRT, SDT, etc).

Terra 2.0 has removed all native stablecoins. Any logic that accepts, queries, or sends Terra stablecoins will need to be removed or updated.

Terra developers are working on getting alternative stablecoins on chain as soon as possible.

2. No stablecoin tax queries to the treasury module.

Terra 2.0 has removed the treasury module. Any queries to the treasury module to query the TaxRate or TaxCap will now fail. Without the native stablecoins this logic isn’t necessary, so it can be removed.

3. No market module.

Any attempts to swap Luna for UST or other stablecoins through the market module will fail. Specifically the market/MsgSwap message has been removed. However, LUNA can still be swapped onchain for other assets using a DEX. This includes any liquid stablecoins on Terra.

4. No oracle module.

Terra 2.0 has removed the oracle module. Any queries to fetch ExchangeRates from the oracle module will fail. However, there are other oracle solutions that can be employed.

Band protocol is one such solution. Band works over IBC. See the oracle module documentation for more details

5. Terra.js changes

Outside of the deprecation of the treasury, market, and oracle modules, Terra.js functionality remains relatively unchanged. There are a few additions to allow for legacy commands which are explained in Using Terra Classic.

Update Terra.js and Wallet Provider

All dApps on new Terra chain must update @terra-money/terra.js and @terra-money/wallet-provider to the latest versions.

Apps remaining on the Terra Classic chain should not upgrade.

Upgrade Cosmwasm

Update your Cosmwasm version to 1.0 using the Cosmwasm upgrade guide.

Examples of Deprecated Functionality

The following are code snippets with functionality that will no longer be supported.

  1. All oracle and market related methods are now deprecated.

// all methods in these modules, including parameters() are deprecated
const oracleParams = await lcd.oracle.parameters();
const marketParams = await lcd.market.parameters();
  1. MsgSwap and uusd (which represents UST) are now deprecated.

// Used to swap 1 Luna for UST
const swap = new MsgSwap(
  'terra...9fj',
  new Coin('uluna', '1000000'),
  'uusd'
  1. TaxRate queries using the Terra Querier are deprecated.

pub fn compute_tax(deps: Deps, coin: &Coin) -> StdResult<Uint256> {
    let terra_querier = TerraQuerier::new(&deps.querier);
    let tax_rate = Decimal256::from((terra_querier.query_tax_rate()?).rate);
    let tax_cap = Uint256::from((terra_querier.query_tax_cap(coin.denom.to_string())?).cap);
    let amount = Uint256::from(coin.amount);
    Ok(std::cmp::min(
        amount * Decimal256::one() - amount / (Decimal256::one() + tax_rate),
        tax_cap,
    ))
}

Migrating CW20/CW721 balances

A tool was created that will generate a snapshot of CW20 or CW721 holders and balances at a specific block height:

token-snapshot

Once a snapshot is created, you can airdrop the correct balances to users as defined by the snapshot.