Domain Wrapping - Oracle design
- 1 Links
- 2 Overview
- 3 Misc. Requirements
- 4 Functionality
- 4.1 Wrap
- 4.1.1 Exception handling
- 4.2 Unwrap
- 4.2.1 Exception handling
- 4.1 Wrap
Links
Wrapping Wiki: FIO Token and Domain NFT wrapping
ERC721 Design: fio.erc721 - FIONFT Contract Specification
Overview
ย
Misc. Requirements
Issue | Summary | Decision |
---|---|---|
Token wrapping and Domain wrapping oracle code should run in the same process | A single process should monitor both the ERC20 and ERC721 contracts and execute both token and domain wrap/unwrap. | ย |
Log events and exceptions | All events and errors should be logged. Because there will be limited validation, these logs will be the primary way for oracle node operators to troubleshoot issues. | ย |
V1 History | The initial implementation calls get_actions against V1 history. | ย |
Setting gasPrice and gasLimit | Use same process as token wrapping | ย |
Functionality
Wrap
Wrap creates a FIO Domain NFT on the Ethereum chain.
Functionality | ย |
---|---|
Oracle Initialization | Same as FIO Token wrapping |
Alice calls | Example: Calling TBD: Need screenshot |
|
TBD: @Casey Gardiner update with Domain wrapping info:
|
Oracle monitors | Process is same as with Token Wrapping except it is monitoring for |
Oracle validates the FIO chain | See โException handlingโ below |
Oracle executes | {
"account": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B",
"tokenURI": "https://127.0.0.1/info.json"}",
"obtid": "dfe50aad8e2271f84f87b8e603776d7e7970c636bb899c8993c08e9e2d21c106"
} |
|
TBD: Need to update with erc721 information. The below information is copied from the token wrapping document @Adam Androulidakis
|
| Example of three oracles calling TBD: Need to update with erc721 information @Adam Androulidakis Using these oracle, we call the wrap function on FIO token contract using web3.js like below.
instance.wrap[accounts[5], 10000, "99e20de9bb9f178f3ff1328c089925daff1d5dcb1da7dceaad7fc5126a08eaf5". {from: accounts[1]});
instance.wrap[accounts[5], 10000, "99e20de9bb9f178f3ff1328c089925daff1d5dcb1da7dceaad7fc5126a08eaf5". {from: accounts[2]});
instance.wrap[accounts[5], 10000, "99e20de9bb9f178f3ff1328c089925daff1d5dcb1da7dceaad7fc5126a08eaf5". {from: accounts[3]});
|
ย
Exception handling
Error condition | Trigger | Oracle Action |
---|---|---|
Invalid chain | Chain passed to | Oracle logs error and does no further processing of the transaction. |
Invalid Ethereum address | Public address passed to | Oracle logs error and does no further processing of the transaction. |
ย
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 | ย |
---|---|
Oracle Initialization | Same as Token wrapping |
Alice (dApp) executes | unwrap(tokenID, fio_address); |
|
|
Oracle monitors |
fioContract.getPastEvents('unwrapped',{
// filter: {id: 1},
fromBlock: lastBlockNumber,
toBlock: 'latest'
}
|
Oracle validates |
|
Oracle executes |
|
| fio.oracle contract Actions: TBD: need to update with
|
Exception handling
Error condition | Trigger | Oracle Action |
---|---|---|
Invalid FIO Address | FIO Address passed in with ERC-20 is not valid or does not exist | Oracle logs error and does no further processing of the transaction. |
ย | ย | ย |