How To On Near Protocol

1. deploy MCS contract

You can use below command to deploy MCS contract.

# configure some parameters first
MASTER_ACCOUNT=      # the master account to create MCS account
MCS_ACCOUNT=         # MCS contract account to create
CLIENT_ACCOUNT=      # MAP light client contract account
MAP_BRIDGE_ADDRESS=  # MCS contract address on MAP blockchain
WNEAR_ACCOUNT=       # "wrap.testnet" for testnet, "wrap.near" for mainnet 
NEAR_CHAIN_ID=       # Near blockchain ID
MCS_WASM_FILE=       # path to the MCS contract wasm file
INIT_ARGS_MCS='{
              "map_light_client": "'$CLIENT_ACCOUNT'",
              "map_bridge_address": "'$MAPO_BRIDGE_ADDRESS'",
              "wrapped_token": "'$WNEAR_ACCOUNT'",
              "near_chain_id": '$NEAR_CHAIN_ID'
            }'
            
echo "creating MCS contract account"
near create-account $MCS_ACCOUNT --masterAccount $MASTER_ACCOUNT --initialBalance 40

echo "deploying mcs contract"
near deploy --accountId $MCS_ACCOUNT --wasmFile $MCS_WASM_FILE

echo "initializing mcs contract"
near call $MCS_ACCOUNT init "$INIT_ARGS_MCS" --accountId $MASTER_ACCOUNT --gas 80000000000000

2. manage MCS token and transfer out MCS token

2.1 deploy MCS token and set metadata

2.2 add target chain for the MCS token to transfer to

2.3 transfer out some amount (if someone has already transferred in some amount of the MCS token)

You can see the amount changes before and after the MCS token is transferred.

2.4 remove target chain to disable transfer to

3. manage fungible token and transfer out fungible token

The difference between MCS tokens and fungible tokens is that the MCS contract has the privilege to mint/burn MCS tokens, but the fungible tokens are tokens deployed by others and already exists on NEAR blockchain.

3.1 add target chain for the fungible token to transfer to

3.2 transfer out some amount

You can see the amount changes before and after the fungible token is transferred.

3.3 remove target chain to disable transfer to

4. manage native token (NEAR) and transfer out native token

4.1 add target chain for the native token to transfer to

4.2 transfer out some amount

You can see the amount changes before and after the native token is transferred.

4.3 remove target chain to disable transfer to

Last updated

Was this helpful?