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
  • contract interface
  • initialize
  • transferOut
  • transferIn
  • Data structure

Was this helpful?

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

EVM Chains Contract

Message EVM Chains Contract

contract interface

interface MessageEvmChainContract {
    enum MessageType {
        CALLDATA,
        MESSAGE
    }
    
    struct MessageData {
        bool relay;
        MessageType msgType;
        bytes target;
        bytes payload;
        uint256 gasLimit;
        uint256 value;
    }
    
    function initialize(address _wToken, address _lightNode) public;

 	function transferOut(
 		uint256 _toChain, 
 		bytes memory _messageData,
 		address _feeToken
  	) external payable  returns(bool);

     
    function transferIn(uint256 _chainId, bytes memory _receiptProof) external;
 
}

initialize

perform initialization

function

function initialize(address _wToken, address _lightNode)public

parameters

parameter
type
comment

_wToken

address

This is wrap contract address

_lightNode

address

This is the LightClient contract address

transferOut

Cross-chain transfer of message

function

function transferOut(uint256 _toChain,CallData memory _callData) external

parameters

parameter
type
comment

_toChain

address

Target chain id to transfer out

_messageData

bytes

This structure contains information across the chain

_feeToken

address

Toke address for payment of handling charges

transferIn

Perform cross-chain transfer

function

function transferIn(uint256 _chainId, bytes memory _receiptProof) external

parameters

parameter
type
comment

_chainId

uint256

source chain id

_receiptProof

bytes

source chain transfer proof

Data structure

ReceiptProof includes the proof and the receipt to prove.

struct istanbulExtra {
    //Addresses of added committee members
    address[] validators;
    //The public key of the added committee member
    bytes[] addedPubKey;
    //G1 public key of the added committee member
    bytes[] addedG1PubKey;
    //Members removed from the previous committee are removed by bit 1 after binary encoding
    uint256 removeList;
    //The signature of the previous committee on the current header
    //Reference for specific signature and encoding rules
    bytes seal;
    //Information on current committees
    istanbulAggregatedSeal aggregatedSeal;
    //Information on the previous committee
    istanbulAggregatedSeal parentAggregatedSeal;
}
 struct TxReceiptRlp {
 	 //This is an indication of the type of transaction
     uint256 receiptType;
     // This is the rlp encoded data of the transaction log
     bytes receiptRlp;
 }

struct receiptProof {
	// the block header where the receipt exists
    blockHeader header;
    //the istanbulExtra struct
    istanbulExtra ist;
    // the aggregated G2 public key of the signed validators
    G2 aggPk;
    // the TxReceiptRlp struct
    TxReceiptRlp txReceiptRlp;
    // the index of the receipt in the block
    bytes keyIndex;
    // the proof to prove the existance of the above receipt
    bytes[] proof;
}
	struct MessageData {
	    //Select whether you want the relay chain to assist in the operation
        bool relay;
        //Execute type options across chains
        MessageType msgType;
        //Target chain execution contract address
        bytes target;
        //Target chain execution calldata
        bytes payload;
        //The call method executes the gas maximum
        uint256 gasLimit;
        //The number of native tokens required by the target chain
        uint256 value;
    }
PreviousHow To UseNextMCS Guides

Last updated 1 year ago

Was this helpful?