Links
Wrapping Wiki: FIO Token and Domain NFT wrapping
Overview of development environment: [FIP-17.a] FIO Token Wrapping
Wrap use case: Wrap
Unwrap use case: Unwrap
Overview
Oracle code will be run by designated FIO Chain BPs with access to:
Oracles will:
On the FIO Chain
Monitor specific account by inspecting every block and looking for FIO contract
wraptokens
actionExecute ERC20
wrap
action to mint wFIO to the designated account
On the Ethereum Chain
Monitor Ethereum smart contract for inbound transfers of ERC-20 wFIO
Execute FIO contract
unwrap
action to transfer FIO to the designated account
Oracle Go Prototype
The original Oracle prototype code was written in Go and is located at: https://github.com/blockpane/fio.oracle
The FIO wrapping/unwrapping contract
The FIO wrapping/unwrapping contract specification is detailed in FIP 17.a: https://github.com/fioprotocol/fips/blob/master/fip-0017a.md
Github
fio.oracle
contract: https://github.com/fioprotocol/fio.contracts/tree/oracle/tokenwrap/contracts/fio.oracle
The Ethereum ERC20 wrapping/unwrapping contract
The Ethereum wrapping/unwrapping contract specification is detailed on the wiki: fio.erc20 - wFIO Contract Specification
Github
fio.erc20
repository: https://github.com/fioprotocol/fio.erc20
Misc. Requirements
Issue | Summary | Decision |
---|---|---|
Storage of latest block number | The Oracle is getting the latest action from FIO history every 5 seconds. But when we restart the server, we read the all latest actions and calling wrap function from the start. Of course, it doesn't mint again but I think wrapping time can be long in this case. To prevent this problem, we need to save the latest block number to database or any external storage.what do you think about my suggest? | Casey Gardiner should we track block number in the
|
Admin front-end UI | Is there a need for a front-end UI to review different transactions, or can we just rely on table lookups, etc.? | Pawel Mastalerz thoughts? |
Functionality
There are two main use cases that concern the Oracle, Wrap and Unwrap. These are detailed below.
Watchdog routines
In addition to wrap/unwrap, the Oracle should also have certain watchdog/monitoring routines that ensure the processes and routines executed by the Oracle healthy. For example:
Make sure a loop didn’t get stuck.
Ensure there are no blocked channels.
Ensure the health of the daemon itself.
Wrap
Wrap creates wFIO on the Ethereum chain.
See the following page for an overview of the Wrap use case: Wrap
Functionality | |
---|---|
Alice (via dApp) called |
|
Oracle monitors |
TBD: Both methods require a history node so we should reach out to BPs with the requirements and ask which method they prefer Finality Check:
|
Oracle validates | See Exception handling below |
Oracle executes | wrap(ethaddress, FIO (SUF) amount, obtid);
|
Oracle validates |
|
Once all Oracles have submitted | TBD: Does the oracle do any kind of monitoring or validation of the overall transaction (post consensus?) TBD: What happens if the Oracle does not have enough ETH to cover the transaction? Does it roll back? Does it stay in the queue? |
Exception handling
Error condition | Trigger | Type | fields:name | fields:value | Error message | Oracle Action |
---|---|---|---|---|---|---|
Invalid chain | Chain passed to | Oracle triggers TBD: How do other oracle get notified when a transaction is getting unwound? TBD: What if one oracle approves the transaction and another oracle rejects? | ||||
Invalid Ethereum address | Public address passed to | Oracle triggers | ||||
Unwrap
Unwrap converts wFIO on Ethereum chain to FIO Tokens on FIO chain.
See the following page for an overview of the Unwrap use case: Unwrap
Functionality | |
---|---|
Alice (dApp) executes | unwrap(fio address, amount);
|
Oracle monitors |
|
Oracle validates | Validation includes:
|
If exceptions are found, Oracle takes action to unwind transaction | See Exception handling below |
Registered Oracles call | fio.oracle contract Actions:
|
Oracle validates |
|
Once all Oracles have submitted | TBD: Does the oracle do any kind of monitoring or validation of the overall transaction (post consensus?) |
Exception handling
Error condition | Trigger | Type | fields:name | fields:value | Error message | Oracle Action |
---|---|---|---|---|---|---|
Invalid FIO Address | FIO Address passed in with ERC-20 is not valid or does not exist | Oracle triggers a ERC20
| ||||
0 Comments