Near Protocol Contract
Contract Address
Here to get MAPO mainnet and testnet MCS contract address.
Contract interface
Interact with contract interface
transfer_in
Transfer from Mapo to Near based on the proof data and event. Must attach enough NEAR funds to cover for storage of the proof.
input parameters
parameter | type | comment |
---|---|---|
receipt_proof | ReceiptProof | the proof of one receipt |
index | usize | the index of event among all the events in the receipt |
transfer_out_token
Transfer out tokens to other blockchain.
input parameters
parameter | type | comment |
---|---|---|
token | String | NEAR account of the mcs token contract |
to | Vec | the target account address on target blockchain |
amount | U128 | the amount of token to transfer out |
to_chain | u128 | the chain id of target blockchain |
transfer_out_native
Transfer out native token to other blockchain.
input parameters
parameter | type | comment |
---|---|---|
to | Vec | the target account address on target blockchain |
to_chain | u128 | the chain id of target blockchain |
deposit_out_native
Deposit out native token to MAP blockchain.
input parameters
parameter | type | comment |
---|---|---|
to | Vec | the target account address on MAP blockchain |
Management Interface
init
Initialize the contract with configuration parameters.
input parameters
parameter | type | comment |
---|---|---|
map_light_client | String | NEAR account of the MAP light client contract |
map_bridge_address | String | the address of the MCS contract on MAP blockchain, in hex |
wrapped_token | String | NEAR account of the wrap near contract |
near_chain_id | u128 | the chain id of the near blockchain |
version
Get the version info of the current MCS contract.
deploy_mcs_token
Deploy MCS token contract. The deployed token can be minted/burnt by MCS contract.
input parameters
parameter | type | comment |
---|---|---|
name | String | the name of MCS token, the full address of the token will be . |
is_used_event
Check if the event is ussed or not.
input parameters
parameter | type | comment |
---|---|---|
order_id | &CryptoHash | the order id of the event |
output parameters
type | comment |
---|---|
bool | true if the event is already used, false otherwise |
set_metadata
Get the record information( validators, threshold and epoch) for the epecified epoch.
input parameters
parameter | type | comment |
---|---|---|
address | String | the contract address of the MCS token |
name | Option | the human-readable name of the token |
symbol | Option | the abbreviation, like wETH or AMPL |
reference | Option | a link to a valid JSON file containing various keys offering supplementary details on the token |
reference_hash | Option | the base64-encoded sha256 hash of the JSON file contained in the reference field |
decimals | Option | used in frontends to show the proper significant digits of a token |
icon | Option | a small image associated with this token |
controller
Get the controller of the MCS contract.
output parameters
type | comment |
---|---|
Option | the controller account id of the MCS contract |
set_controller
Set the controller of the MCS contract.
input parameters
parameter | type | comment |
---|---|---|
controller | AccountId | the controller account id of the MCS contract |
controller_or_self
Check if the predecessor is controller or self.
output parameters
type | comment |
---|---|
bool | true if the predecessor is controller or self, false otherwise |
get_mcs_tokens
Get all deployed MCS tokens and their target chains.
output parameters
type | comment |
---|---|
Vec<(String, HashSet)> | deployed MCS tokens and their target chains |
get_fungible_tokens
Get all registered fungible tokens and their target chains.
output parameters
type | comment |
---|---|
Vec<(String, HashSet)> | registered fungible tokens and their target chains |
get_native_token_to_chains
Get all registered native token target chains.
output parameters
type | comment |
---|---|
HashSet | registered native token target chains |
add_native_to_chain
Add target chain for native token.
input parameters
parameter | type | comment |
---|---|---|
to_chain | u128 | target chain id |
remove_native_to_chain
Remove target chain for native token.
input parameters
parameter | type | comment |
---|---|---|
to_chain | u128 | target chain id |
add_mcs_token_to_chain
Allow the MCS token to be transfered to the target chain.
input parameters
parameter | type | comment |
---|---|---|
token | String | MCS token address |
to_chain | u128 | target chain id |
remove_mcs_token_to_chain
Remove the target chain id from the allow list of the MCS token.
input parameters
parameter | type | comment |
---|---|---|
token | String | MCS token address |
to_chain | u128 | target chain id |
valid_mcs_token_out
Check if the MCS token is allowed to be transfered to the target chain.
input parameters
parameter | type | comment |
---|---|---|
token | &String | MCS token address |
to_chain | u128 | target chain id |
output parameters
type | comment |
---|---|
bool | true if target chain is allowed, false otherwise |
add_fungible_token_to_chain
Allow the fungible token to be transfered to the target chain.
input parameters
parameter | type | comment |
---|---|---|
token | String | fungible token address |
to_chain | u128 | target chain id |
remove_fungible_token_to_chain
Remove the target chain id from the allow list of the fungible token.
input parameters
parameter | type | comment |
---|---|---|
token | String | fungible token address |
to_chain | u128 | target chain id |
valid_fungible_token_out
Check if the fungible token is allowed to be transfered to the target chain.
input parameters
parameter | type | comment |
---|---|---|
token | &String | MCS token address |
to_chain | u128 | target chain id |
output parameters
type | comment |
---|---|
bool | true if target chain is allowed, false otherwise |
Data structure
Here are some main data structure for map light client contract.
MapCrossChainService is the map cross chain service contract.
ReceiptProof includes the proof and the receipt to prove.
Last updated