var img = document.createElement('img'); img.src = "https://terradocs.matomo.cloud//piwik.php?idsite=1&rec=1&url=https://docs.terra.money" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

dApp migration guide

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

Changes

The new Terra chain 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 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 has removed the treasury module. Any queries to the treasury module to query the TaxRate or TaxCap will now fail. This logic is unnecessary without the native stablecoins and has been 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 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. feather.js changes.

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

🔥Update feather.js and Wallet Provider

All dApps on the new Terra chain must update @terra-money/feather.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.

_3
// all methods in these modules, including parameters() are deprecated
_3
const oracleParams = await lcd.oracle.parameters();
_3
const marketParams = await lcd.market.parameters();

  1. MsgSwap and uusd (which represents UST) are now deprecated.

_5
// Used to swap 1 Luna for UST
_5
const swap = new MsgSwap(
_5
'terra...9fj',
_5
new Coin('uluna', '1000000'),
_5
'uusd'

  1. TaxRate queries using the Terra Querier are deprecated.

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

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.