Home

Awesome

REPO MOVED TO

https://github.com/CosmosContracts/tokenfactory-contracts

CW20 Migrations to TokenFactory

Deposit/Send in an old CW20 token and receive the new token-factory native token :D

Modes: Mint or send from this contract's bank balance

Mode: mint

This mode requires the Core middleware Contract. It allows for multiple contracts to mint for a single native token-factory denomination. Once this contract is initialized and the admin token set to the middleware, you are then ready to get this contract set up.

Steps to enable mint mode:

// Example: e2e/test_e2e.sh upload_cw20mint
{
    "mode":"mint",
    "cw20_token_address":"juno1MyCW20ContractTokenAddress",
    "contract_minter_address":"juno1CoreMiddlewareContractAddress",
    "tf_denom":"factory/juno1.../token"
}
// Core middleware contract
{
    "add_whitelist":{"addresses":["juno1MigrateContractAddress"]}
}

Your contract is now ready for users to deposit a CW20, and in return, the Middleware contract will mint the new token-factory native token for them!

Mode: balance

In this mode, the contract does not require the core middleware contract. It will simply send the native token-factory denom from the contract's bank balance to the user. This could mean the contract runs out of funds.

Steps to enable balance mode:

// Example: e2e/test_e2e.sh upload_cw20balance
{
    "mode":"balance",
    "cw20_token_address":"juno1MyCW20ContractTokenAddress",    
    "tf_denom":"factory/juno1.../token"
}
# mint tokens to the admin account via the CLI
junod tx tokenfactory mint 1000factory/juno1...addr.../abcde $FLAGS

# send those tokens to the balance migration contract
junod tx bank send [key] <$CW20_BALANCE_CONTRACT> 1000factory/juno1...addr.../abcde $FLAGS

# NOTE: You could have a whitelisted member of the core TF middleware mint tokens to this address from another contract / user if you so choose.

Other Ideas

Will work on these after Juno v13 launch

https://hackmd.io/@reecepbcups/cw20-to-tokenfactory