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.
_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).
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.
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.
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.
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.
owner
address
The address of the allowance-granter account.
spender
address
The address of the allowance recipient account.
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.
account
address
The address of the account that the balance should be retrieved for.
amount
uint256
The amount of USX an account owns, in Wei units (18 decimals).
Last updated