...
There are two main use cases that concern the Oracle, Wrap and Unwrap. These are detailed below.
TBD: What are the watchdog/monitoring routines we expect from the Oracles?
Wrap
Wrap creates wFIO on the Ethereum chain.
See the following page for an overview of the Wrap use case: Wrap
Functionality | |
---|
Alice (dApp) executes wraptokens on FIO chain | Alice called wraptokens inside the fio.oracle contract. Contract Actions: Parameter Validation ( ensuring amount, token codes, pubkey and fees are all properly set ) Search oracle registration table and tally up the total number of registered oracles Collect Oracle fees, sort, and find the median. Send fee to all oracles. Emplace wrapping details inside the receipts table. Send the wrapped amount from Alice to fio.oracle contract. Collect BP fees Increase Alices RAM by 512. Send successful response to Alice
|
Oracle monitors wraptokens for transfers | Todd G What was the Go code doing to monitor the chain? |
Oracle validates wraptokens transaction | Todd G Need bullet list of validations |
If exceptions are found, Oracle takes action to unwind transaction | See Exception handling below Todd G Need to flesh this out |
Oracle executes wrap on Ethereum
wrap(ethaddress, FIO (SUF) amount, obtid); ex. wrap(“0x00000000000”, 10000000, “0x123456789”);
| ethereum wallet provider (usually truffle/hd-wallet-provider) set to use oracles ethereum private key wFIO recipient eth address, wFIO amount to mint (must match what was wrapped on FIO chain exactly), and the obtid of the FIO transaction are provided as parameters to wrap action Transaction is executed address provided receives wrapped FIO assets event emitted: wrapped(address ethaddress, uint256 amount, uint256 obtid);
|
Listen for unwrapped events | |
Oracle validates wrap transaction | Todd G What type of validation is done on the Ethereum chain during a wrap? |
Once all Oracles have submitted wrap , the wFIO Tokens will be minted and transferred to designated Ethereum public address | Todd G 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 chain | Chain passed to wraptokens action is not Ethereum (Note: this restriction is not enforced in the FIO Contract to allow for wrapping chain expansion without deployment of code) | | | | | Oracle triggers unwraptokens action to send FIO back to originating address |
Invalid Ethereum address | Public address passed to wraptokens action is not a valid Ethereum address (Note: this restriction is not enforced in the FIO Contract to allow for wrapping chain expansion without deployment of code) | | | | | Oracle triggers unwraptokens action to send FIO back to originating address |
| | | | | | |
...
Functionality | |
---|
Alice (dApp) executes unwrap on Ethereum chain
unwrap(fio address, amount); ex. unwrap(hard@edge, 100000000); | |
Oracle monitors unwrap event for transfers | Todd G What was the Go code doing to monitor the chain? Does it confirm burn? |
Oracle validates unwrap transaction | Todd G Need bullet list of validations |
If exceptions are found, Oracle takes action to unwind transaction | See Exception handling below Todd G Need to flesh this out |
Oracle executes unwraptokens on FIO chain | Registered Oracles will call upwraptokens inside the fio.oracle contract Contract Actions: Parameter Validation ( min/max amount, fio address check ) Verify the actor is a registered oracle Find the fio.address inside the fionames table Search for previous votes of the same obt_id If found Search and verify actor has not voted prior copy vector and push account name to list of voted oracles to the vector of votes modify voters table with new vector
If not found
Compare number of votes with number of registered oracles Send successful response to the oracle
|
Oracle validates unwraptokens transaction | Todd G What type of validation is done on the Ethereum chain during a wrap? |
Once all Oracles have submitted unwraptokens , the FIO Tokens will be transferred to designated Ethereum public address | Todd G 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 wrap action to send wFIO back to originating addres |
| | | | | | |
| | | | | | |
...