Overview
The FIO Wrapping Status Page is a publicly hosted landing page(s) which display current activity of tokens and domains being wrapped. It collects information from FIO Chain and Destination Chains (Ethereum, Polygon). The FIO Oracle only monitors events on the FIO and Ethereum chains and takes wrapping actions and does NOT have any retry or historical lookup functionality. So, we need a way to monitor which transactions have failed so manual action may be taken by the oracle block producers. The FIO Wrapping Status Page provides that functionality.
...
The Wrapping status application will need to store wrap information so it does not constantly need to be querying the chains for old data.
FIO table
action (wrap/unwrap)
type (token/domain) (not sure if this is needed?)
FIO transaction_id
timestamp
actor
chaincode
amount
nftname
pubaddress
ETH table
action (wrap/unwrap)
type (token/domain) (not sure if this is needed?)
ETH transaction_id
From ETH address (the ETH address of the BP doing the approval)
Input data:
account
amount
obtid (This is the FIO transaction ID)
...
Wrap | |
---|---|
2022/04/27 11:03 fio@faucet Ethereum wraptoken 100.000000000 FIO Pending Or 2022/04/27 11:03 fio@faucet Polygon wrapnft mydomain Completed FIO Chain Transaction e1610cd98fb8695e85e1055327799be4e9ff3c23eb6f5bc60bc4fabcdb62ebe3 (links to bloks.io) Sent Recipient Address 0x6470204c5741d73f2f0b3a762ad5356436b8b470015159a89414cbf2f3b61b2d (links to etherscan or polyscan) Destination Chain Approvalshfdg2qumuvlc (link to ETH transaction) Wrapped qbxn5zhw2ypw) (link to ETH transaction) Wrapped wttywsmdmfew) (link to ETH transaction) Wrapped | Header
Examples: 2022/04/27 11:03 fio@faucet Ethereum 100.000000000 FIO Pending FIO Chain Transaction
Recipient Address
Destination Chain Approvals For each transaction: (this can all be in one line)
|
FIO Chain
For Wrapping, the token wraps are submitted to the FIO Chain by the user.
The following information is stored in the
fio.oracle
oracleldgrs
table:
Code Block |
---|
{ "id": 0, "actor": "gov3rf5qrixr", "chaincode": "ETH", "pubaddress": "0xe28FF0D44d533d15cD1f811f4DE8e6b1549945c9", "amount": 800000000000, "nftname": "", "content": "", "timestamp": 1645812548 } |
Process
Retrieve all wrap actions from the
fio.oracle
oracleldgrs
table.Record in local database:
timestamp
actor
chaincode
pubaddress
amount
nftname
Call
get_actions
on thefio.oracle
account_nameFor each
wraptokens
orwrapdomain
action:Retrieve:
data
actor
chain_code
amount or nftname
public_address
block_time
Then compare this data to the data in the FIO wrap table.
The
block_time
should be very close to the FIOtimestamp
. May need to have this match be approximate.
If a match is found, populate the FIO transaction_id in the FIO wrap table with
trx_id
from the action
Retrieve
wrap
transactions from erc20 contract (e.g., https://ropsten.etherscan.io/address/0x39e55E8Fcc19ACA3606Ed3CFe7177442185a14F9 )For each transaction retrieve and store:
ETH transaction_id
From ETH address (the ETH address of the BP doing the approval)
Input data, including
account address 0x4293d810F82aF4be0edBe62Fb34181f5392cCcCe
amount uint256 500000000000
obtid string 6abc10dc123e13a73f7130338ee6dcb69204fe9ec5f8d1d740f8bd79116d8401
The UX should now be able to display wrap transactions by matching the FIO transaction_id (From FIO table) and obtid (from ETH table)
FIO Token unwraps
Unwrap | |
---|---|
2022/04/27 11:03 fio@faucet Ethereum Unwrap 100.000000000 WFIO Completed Or 2022/04/27 11:03 fio@faucet Ethereum Unwrapnft mydomain Completed FIO Chain Transaction e1610cd98fb8695e85e1055327799be4e9ff3c23eb6f5bc60bc4fabcdb62ebe3 (links to bloks.io) Sent Recipient Address 0x6470204c5741d73f2f0b3a762ad5356436b8b470015159a89414cbf2f3b61b2d (links to etherscan or polyscan) Destination Chain Approvalshfdg2qumuvlc (link to ETH transaction) Unwrapped qbxn5zhw2ypw (link to ETH transaction) Unwrapped wttywsmdmfew (link to ETH transaction) Unwrapped | Header
Examples: 2022/04/27 11:03 fio@faucet Ethereum 100.000000000 WFIO Pending FIO Chain Transaction
Recipient Address
Destination Chain Approvals For each transaction: (this can all be in one line)
|
...
Code Block |
---|
{ "id": 1, "idhash": "0x4199434dc3be5569fe18e6ea0728497b", "obt_id": "0xa0cc9266b170c7e60cdfca23233e8ddbfa78f1e83723b03729da92fdd539a0a3", "fio_address": "eric@wraptest", "amount": 20000000000, "nftname": "", "timestamp": 1646089890, "voters": [ "wttywsmdmfew", "qbxn5zhw2ypw", "hfdg2qumuvlc" ], "isComplete": 1 }, { "id": 2, "idhash": "0x875274e465431c4e1c8b0f0476aa3fe9", "obt_id": "0x6a3836c414edba837926d2ba7fdc9041fc17d07d78d30d151d981ee3b4b95bfd", "fio_address": "fio@faucet", "amount": 100000000000, "nftname": "", "timestamp": 1649121857, "voters": [ "qbxn5zhw2ypw" ], "isComplete": 0 }, |
Process
Retrieve
unwrap
transactions from erc20 contract (e.g., https://ropsten.etherscan.io/address/0x39e55E8Fcc19ACA3606Ed3CFe7177442185a14F9 )For each transaction retrieve and store in the local ETH Table:
ETH transaction id
From ETH address (the ETH address of the account calling the
unwrap
action)Input data:
amount uint256 500000000000
tokenId
To retrieve associated unwrap actions from from FIO Chain:
For each ETH transaction id in the ETH Table:
Search the
fio.oracle
oravotes
table for the ETH transaction idSee info below for how to do this search
Record in local FIO Table database:
id
timestamp
obt_id
amount or nftname
voters
The UX should now be able to display unwrap transactions by matching the from
ETH transaction id
(from local ETH table) andobt_id
(from local FIO table)
Searching for ETH transaction id in the fio.oracle
oravotes
table:
...
Code Block |
---|
const {createHash} = require('crypto'); const rp = require('request-promise'); const fiourl = "http://3554.81202.8467.19476:8889/v1/chain/"; let stringToHash = (term) => { const hash = createHash('sha1'); return '0x' + hash.update(term).digest().slice(0, 16).reverse().toString('hex'); }; function callFioApi(apiCall, JSONObject) { return (new Promise(function(resolve, reject) { var options = { method: "POST", uri: fiourl + apiCall, body: JSONObject, json: true // Automatically stringifies the body to JSON }; rp(options) .then(function (body){ //console.log(body); resolve(body); }).catch(function(ex) { reject(ex); }); })); }; const main = async () => { const txnIdHash = stringToHash('0x098820f5efe3b1639078828b0ff2258cc2f0df6cdef43c44dfdc53ec9d399440'); const unwrapTxn = await callFioApi("get_table_rows", { json : true, code : 'fio.oracle', scope : 'fio.oracle', table : 'oravotes', upper_bound : txnIdHash.toString(), lower_bound : txnIdHash.toString(), key_type : 'i128', index_position: 2, reverse : true }); console.log('unwrapTxn: ', unwrapTxn); } main(); |
...
FIO Domains needed burning
This is a version 2 feature and does not need to be done for the initial release.
FIO Domains which have been burned on FIO Chain, but not on Destination Chain
Domains which have expired will be burned (deleted) after a certain amount of time. If someone has wrapped a domain and it gets "burned" we want to be able to note that in the Wrapping Status Page, so action can be taken on the Ethereum side.
fio_domain
date_burned
Link to etherescan for ERC-721 token ID