MAPO Developer Docs
LearnDevelopRunWhitePaperBRC-201
English
English
  • Overview
  • Learn
    • About MAP Protocol
      • Background
      • Introduction of MAP Protocol
      • History of MAP Protocol
    • Comparison with other cross-chain models
      • MAP Protocol vs Cosmos & Polkadot
      • MAP vs other cross-chain solutions without relay chain
    • Technical Mechanism
      • MAP Protocol's Technical Mechanism
      • Three-layer Architecture
      • MAP Protocol Layer
        • Concept
        • Isomorphism with All Chains
        • Verification & Maintenance Network
      • MAP Omnichain Service (MOS) Layer
      • MAPO Application Layer
      • Peer-to-Peer Cross-chain Technology with ZK-enabled Light Clients
      • Interact with Bitcoin
    • Gas Fee Model
    • DAO
    • Construction of MAP Protocol
      • Developers
      • Validators
      • Maintainers
      • Messengers
      • Liquidity providers
      • End users
    • Tokenomics
    • Purchase $MAP
  • Develop
    • MAP Relay Chain
      • Getting Started
        • Build
        • Make Private Chain
        • How To Vote
        • How To Withdraw
        • Integrate an Exchange
        • Integrate MAP Relay Chain with EVM-Compatible Chains
      • Consensus
        • Overview
        • Proof-of-Stake
        • Validator
          • Validator
          • Locked MAP
        • Election
        • Rewards
        • Aggregated Seal
      • Contracts
        • Precompiled Contracts
        • Genesis Contracts
          • ABI
            • AccountsABI
            • ElectionABI
            • EpochRewardsABI
            • LockedGoldABI
            • ValidatorsABI
          • Deploy
      • Marker
        • Genesis
        • Validator
        • Vote
        • ContractOwner
        • Common
      • Account-Abstraction
    • Light Client
      • Verification based on Light Client
      • MAPO Light Client
        • EVM Chains
        • Near
      • Light Clients
        • Client Manager
        • BNB Smart Chain
        • Near Protocol
        • Polygon(Matic)
        • Ethereum 2.0
        • Klaytn
        • Conflux)
      • Maintainer
    • MAP Omnichain Service (MOS)
      • MOS Message Guides
        • How It Works
        • How To Use
        • EVM Chains Contract
      • MCS Guides
        • How It Works
        • How To Use
          • How To On Evm Chains
          • How To On Near Protocol
        • Relay Chain Contract
        • EVM Chains Contract
        • Near Protocol Contract
      • Messenger
      • API
    • OmniChain Examples
      • OmniApp
      • OmniDictionary
    • API & SDK
      • Butter SDK
      • Atlas JSON RPC
      • Atlas Consensus API
      • MAP Scan API
    • Connected Chains and Corresponding Addresses
  • Run
    • How To Become A New Validator
    • How To Become A New Validator[advanced]
    • Withdraw
Powered by GitBook
On this page
  • Build and Deploy
  • Register chain
  • Register EVM Chain
  • Register Near
  • Register token
  • Add Cross-chain Token
  • Token cross-chain transfer and deposit
  • List token mapped chain

Was this helpful?

  1. Develop
  2. MAP Omnichain Service (MOS)
  3. MCS Guides

How To Use

PreviousHow It WorksNextHow To On Evm Chains

Last updated 2 years ago

Was this helpful?

Build and Deploy

Register chain

Register EVM Chain

  1. Set relay contract on EVM Chains

    npx hardhat mosSetRelay --relay <Relay address> --chain <map chainId> --network <network>
  2. register in relay contract

    npx hardhat relayRegisterChain --address <MOS address> --chain <chain id> --network <network>

Register Near

npx hardhat relayRegisterChain --address <MOS address> --chain <near chain id> --type 2 --network <network>

NOTE: Near Protocol testnet chain id 5566818579631833089, mainnet chain id 5566818579631833088

Register token

  1. Deploy vault token on relay chain Every token has a vault token. The vault token will distribute to the users that provide cross-chain liquidity. The mos relay contract is manager of all vault tokens.

    npx hardhat vaultDeploy --token <relaychain token address> --name <vault token name> --symbol <vault token symbol> --network <network>
    
    npx hardhat vaultAddManager --vault <vault token address> --manager <manager address> --network <network>
  2. Register token on relay chain

    npx hardhat relayRegisterToken --token <relaychain mapping token address> --vault <vault token address> --mintable <true/false> --network <network>
  3. Set fee ratio on relay chain

    npx hardhat relaySetTokenFee --token <token address> --chain <relay chain id>  --min <minimum fee value> --max <maximum fee value> --rate <fee rate 0-1000000> --network <network>

Add Cross-chain Token

  1. Relay Chain Bind the token mapping relationship between the two chains that requires cross-chain

    npx hardhat relayMapToken --token <relay chain token address> --chain <cross-chain id> --chaintoken <cross-chain token> --decimals <cross-chain token decimals> --network <network>
  2. Relay Chain sets the token cross-chain fee ratio

    npx hardhat relaySetTokenFee --token <token address> --chain <chain id>  --min <minimum fee value> --max <maximum fee value> --rate <fee rate 0-1000000> --network <network>
  3. Altchain sets token mintable

    npx hardhat mosSetMintableToken --token <token address> --mintable <true/false> --network <network>

    NOTE: If set the token mintable, the token must grant the minter role to mos contract.

  4. Altchain sets bridge token

    npx hardhat mosRegisterToken --token <token address> --chains < chain ids,separated by ',' > --network <network>

Token cross-chain transfer and deposit

  1. token transfer

    npx hardhat transferOutToken --mos <mos or relay address> --token <token address> --address <receiver address> --value <transfer value> --chain <chain id> --network <network>
  2. token depsit

    npx hardhat depositOutToken --mos <mos address> --token <token address> --address <receiver address> --value <transfer value> --network <network>

    Note that the --token parameter is optional, if not set, it means to transfer out Native Token. Similarly --address is also an optional parameter. If it is not filled in, it will be the default caller's address.

  3. transfer native token to other chain:

    npx hardhat depositOutToken --mos <mos or relay address>  --address <receiver address> --value <transfer value> --network <network>
  4. transfer native token to sender's address:

    npx hardhat transferOutToken --mos <mos or relay address> --value <transfer value> --chain <chain id> --network <network>

List token mapped chain

  1. relay chain

    npx hardhat relayList --relay <relay address> --token <token address> --network <network>
  2. altchains

    npx hardhat mosList --mos <relay address> --token <token address> --network <network>
Build and deploy on EVM chains
Build and deploy on Near Protocol