Wrapped FIO Token
Overview
A FIO Token can be wrapped (moved to a different chain) and unwrapped (moved back to FIO Chain from another chain).
An integrator may consider the following integration options related to wrapped FIO Token.
Native Integration
For wallets desiring full control over the registration user experience, the best strategy is to execute mapping actions directly to the FIO Chain.
How FIO Token Wrapping works
Token wrapping is accomplished using the wraptokens action on the FIO Chain and passing in the amount of FIO Tokens to wrap. Wrapped tokens may be unwrapped by calling the unwrap
action on the Ethereum WFIO ERC20 contract. (see information below). Note that wrapping and unwrapping cannot be accomplished entirely inside the FIO Protocol and requires FIO Bridge and an ERC20 contract on the Ethereum chain.
The following gives an overview of the token wrapping process:
- Alice wants to wrap 100 FIO tokens to her Ethereum public address on the Ethereum chain.
- Alice fetches the Oracle fee using
/get_oracle_fees
. - Alice executes the wraptokens action and passes in:
- amount: 100000000000 (the amount of FIO to be wrapped, in SUFs)
- publicaddress: "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B" (the Ethereum address where tokens should be delivered)_
- chaincode: "ETH" (For the initial version, only token wrapping to the ETH chain is supported)_
- maxoracle_fee: 2000000000 (maximum amount of FIO user A is willing to pay the Oracles)_
- maxfee: 1000000000 (maximum amount of FIO user A is willing to pay for the FIO chain fee)_
- tpid: "rewards@wallet"
- actor: "aftyershcu22"
- 100 FIO tokens are transferred from Alice to the wrapping smart contract account on the FIO chain.
- Oracle fee is transferred from Alice and distributed evenly to all registered Oracles.
- Oracles monitor every block looking for the
wraptoken
action. - Once detected Oracles trigger minting of wrapped
WFIO
tokens to Alice's public address on the Ethereum chain.
The following gives an overview of the token unwrapping process:
- Alice wants to unwrap 50 WFIO tokens from Ethereum to her crypto handle on FIO Chain.
- Alice executes the
unwrap
action on the Ethereum contract. - Oracles monitor unwrap events on the Ethereum contract.
- Once detected each Oracle executes the
unwraptoken
action on the FIO chain and passes in:- amount: 50000000000 (the amount of FIO to be unwrapped, in SUFs)
- fio_address: "alice@wallet" (The crypto handle which will recieve the unwrapped tokens)
- Once the last Oracle executes
unwraptokens
action, the tokens are transferred to Alice's FIO account.
Write Transactions
Integrating these actions require the integrator to have access to user's Private key and properly serialize and sign each transaction. For additional information, see Write Transaction.
Available FIO Token Actions
Action | Description | Can be paid with bundled tx? |
---|---|---|
wraptokens | This action wraps FIO Tokens to another chain. | No |
Link to FIO App
Alternatively to Native Integration, the application may link the user to to the FIO App, a comprehensive website to register and manage FIO Handles and many other functionality related to FIO Protocol.
For additional information, see FIO App.
Supported Wrapping Chains
Protocol | Token Code | Source Code | Contracts |
---|---|---|---|
Ethereum | WFIO | https://github.com/fioprotocol/fio.erc20 | Mainnet:0xbEA269038Eb75BdAB47a9C04D0F5c572d94b93D5 Testnet (Goerli): 0xb622F030Be649aAAa9f32faa2b0C0E02986D75F2 |
Ethereum
Transferring WFIO
WFIO tokens on the Ethereum chain are transferred using the transferFrom action. The action requires an Ethereum Address for the payer (the person sending the funds), the payee (the person receiving the funds), and an amount, in SUFs.
Checking Token Balance
Token balance can be obtained by passing a user's Ethereum address to balanceOf contract method.
Retrieving Account Balances and Transaction History
WFIO token transaction history will conform to other ERC20 tokens supported in your wallet or exchange. Centralized Ethereum API services such as Infura and Alchemy enable the retrieval of transaction history for a smart contract or a user.
Updated 12 months ago