USX

The following describes relevant, public functions on the USX Token smart contract.

Description

The USX.sol token contract is an ERC20 token contract, augmented with cross-chain capabilities, allowing for seamless token transfers between different blockchains.

Write Methods

sendFrom

This function is used to send USX to an account on another blockchain.

function sendFrom(
    address _bridgeAddress,
    address payable _from,
    uint16 _dstChainId,
    bytes memory _toAddress,
    uint256 _amount
) public payable virtual override returns (uint64 sequence) {}
Parameter NameTypeDescription

_bridgeAddress

address

The address of the contract that implements the desired bridge protocol.

At present, Ax Protocol mandates that the WormholeBridge address is used for Wormhole-supported chains. The LayerZeroBridge address must only be used for Ax-supported chains that Wormhole does not yet support. See Deployed Contracts page.

_from

address

The account that the USX token will be sent from.

_dstChainId

uint16

The bridge-protocol-assigned chain identifier for the desired destination chain.

_toAddress

bytes

The abi-encoded recipient address on the destination chain: the account USX will get transferred to.

_amount

uint256

The amount of USX token to be transferred, in Wei units (18 decimals).

Transaction PropertyCurrencyDescription

msg.value

Source chain native

The amount used to pay for destination chain gas fees. For Wormhole chain routes, use the value returned from sendFeeLookup. For LayerZero chain routes, use the value returned from estimateSendFee. Please refer to the Deployed Contracts page to see the supported chain routes.

transfer

This ERC20-inherited function is used to send USX to another account on the same blockchain.

function transfer(address to, uint256 amount) public virtual returns (bool) {}
Parameter NameTypeDescription

to

address

The recipient address.

amount

uint256

The amount of USX to be transferred, in Wei units (18 decimals).

approve

This ERC20-inherited function is used to approve another account on the same blockchain to spend USX on behalf of the approving account.

function approve(address spender, uint256 amount) public virtual returns (bool) {}
Parameter NameTypeDescription

spender

address

The address of the account that an allowance should be granted to.

amount

uint256

The amount of USX to be granted as an allowance, in Wei units (18 decimals).

transferFrom

This ERC20-inherited function allows an account with a pre-approved allowance to transfer USX on behalf of the approving account. Tokens may be transferred to an account on the same blockchain or an account on a different blockchain.

function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {}
Parameter NameTypeDescription

from

address

The address of the account that USX will be sent from.

to

address

The address of the recipient account.

amount

address

The amount of USX to transfer, in Wei units (18 decimals).

View Methods

allowance

This ERC20-inherited function allows an account to check its allowance granted by another account.

mapping(address => mapping(address => uint256)) public allowance;
Parameter NameTypeDescription

owner

address

The address of the allowance-granter account.

spender

address

The address of the allowance recipient account.

Return ValueTypeDescription

amount

uint256

The USX allowance granted for the spender to use on the owner's behalf, in Wei units (18 decimals). This amount is 0 by default.

balanceOf

This ERC20-inherited function allows an account to check its USX balance.

mapping(address => uint256) public balanceOf;
Parameter NameTypeDescription

account

address

The address of the account that the balance should be retrieved for.

Return ValueTypeDescription

amount

uint256

The amount of USX an account owns, in Wei units (18 decimals).

Last updated