sendToFx

sendToFx cross chain means that the contract deployed on other chains communicates with f(x)Core through cross chain bridge to realize cross chain with f(x)Core.

supported external chains:

  • Ethereum

  • Binance Smart Chain

  • Polygon

  • Tron

  • Avalanche

  • Optimism

  • Arbitrum

Bridge Contract

Method

sendToFx

send token from external chain to f(x)Core

must be approved before calling this method

function sendToFx(address _tokenContract, bytes32 _destination, bytes32 _targetIBC, uint256 _amount) external;
  • _tokenContract: the contract address of the token on the external chain

  • _destination: the destination address on the f(x)Core chain or other cosmos chain

  • _targetIBC: the target of the token on the f(x)Core chain(more details see Target)

    • _targetIBC represents cross chain destination, such as f(x)Core, Pundix, Marginx

    • destination f(x)Core: _targetIBC is empty

    • destination erc20 token: _targetIBC is erc20

    • destination other cosmos chain(example Pundix): _targetIBC is ibc/{id}/{prefix}.

      • id is the channel id of the target chain on f(x)Core(examples: Pundix: 0)

      • prefix is the address prefix of the target chain(examples: Pundix: px)

  • _amount: the amount of the token to be cross chain

_destination convert address to bytes, if less than 32, fill in 0 in front, until 32 bytes

_targetIBC convert string to bytes, if less than 32, fill in 0 in behind, until 32 bytes

getBridgeTokenList

get cross chain token list

function getBridgeTokenList() external view returns (BridgeToken[] memory);

BridgeToken struct

struct BridgeToken {
    address addr;
    string name;
    string symbol;
    uint8 decimals;
}

checkAssetStatus

check if the token is supported cross chain

function checkAssetStatus(address _tokenAddr) external view returns (bool status);
  • _tokenAddr: the contract address of the token on the external chain

  • status: true means good condition

Last updated