Skip to content

Crosschain events

gaozhengxin edited this page Mar 22, 2022 · 2 revisions

Crosschain Events

Bridge (V2)

Crosschain deposit

  • Chain: Source chain
  • Contract: ERC20 token to get bridged
  • Event: Transfer(address indexed from, address indexed to, uint256 value) in which to is MPC address.

User has sent token to MPC address, waiting for receipt on dest chain.

Param Type Description
from address token sender
to address token receiver, should be the MPC address
value uint256 deposit amount

Crosschain deposit arrive

  • Chain: Destination chain
  • Contract: AnyswapV6ERC20
  • Event: LogSwapin(bytes32 indexed txhash, address indexed account, uint amount)
Param Type Description
txhash bytes32 transaction hash of source chain deposit event
account address address of the receiver
amount uint receive amount

Crosschain withdraw

  • Chain: Destination chain
  • Contract: AnyswapV6ERC20
  • Event: LogSwapout(address indexed account, address indexed bindaddr, uint amount)

User has burnt on dest chain, waiting for receipt on source chain.

Param Type Description
account address token sender
bindaddr address token receiver
amount uint withdraw amount

Crosschain withdraw arrive

  • Chain: Source chain
  • Contract: ERC20 token to get bridged
  • Event: Transfer(address indexed from, address indexed to, uint256 value) in which from is MPC address.
Param Type Description
from address token sender, shoud be the MPC address
to address token receiver
value uint256 receive amount

Router (v3)

Crosschain transfer

  • Chain: Origin chain
  • Contract: AnyswapV6Router Event: LogAnySwapOut(address indexed token, address indexed from, address indexed to, uint amount, uint fromChainID, uint toChainID)

User has burnt his token or locked it in vault, waiting for receipt on target chain.

Param Type Description
token address address of AnyswapERC20 on origin chain
from address sender
to address receiver
amount uint transfer amount
fromChainID uint origin chain ID
toChainID uint target chain ID

Crosschain transfer arrive

  • Chain: Target chain
  • Contract: AnyswapV6Router
  • Event: LogAnySwapIn(bytes32 indexed txhash, address indexed token, address indexed to, uint amount, uint fromChainID, uint toChainID)
Param Type Description
txhash bytes32 transaction hash of the crosschain transfer on origin chain
token address address of AnyswapERC20 on target chain
to address receiver
amount uint transfer amount
fromChainID uint origin chain ID
toChainID uint target chain ID