FIO Wrapping Status Page

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.

Functional specification

Architecture

UI

Development setup

Content

Custodians

Displays currently registered custodians on each destination chains.

Oracles

Displays currently registered oracles on each destination chains.

Local tables/data needed for the wrapping and unwrapping for the Admin Status Application

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)

FIO Wrapping

Wrap

 

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 Approvals

hfdg2qumuvlc (link to ETH transaction) Wrapped

qbxn5zhw2ypw) (link to ETH transaction) Wrapped

wttywsmdmfew) (link to ETH transaction) Wrapped

Header

  • timestamp

  • crypto handle

  • chain

  • Depending on wrap type:

    • Amount: <amount>

    • NFT: <nftname>

  • Status (Completed or Pending)

Examples:

2022/04/27 11:03 fio@faucet Ethereum 100.000000000 FIO Pending
2022/04/27 11:03 fio@faucet Polygon mydomain Completed

FIO Chain Transaction

  • FIO chain transaction ID linked to bloks.io

Recipient Address

  • ETH public_address linked to etherscan

Destination Chain Approvals

For each transaction: (this can all be in one line)

  • BP Crypto Handle

  • Timestamp

  • ETH transaction ID linked to etherscan

  • 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:

1 2 3 4 5 6 7 8 9 10 { "id": 0, "actor": "gov3rf5qrixr", "chaincode": "ETH", "pubaddress": "0xe28FF0D44d533d15cD1f811f4DE8e6b1549945c9", "amount": 800000000000, "nftname": "", "content": "", "timestamp": 1645812548 }

Process

  1. Retrieve all wrap actions from the fio.oracle oracleldgrs table.

    1. Record in local database:

      • timestamp

      • actor

      • chaincode

      • pubaddress

      • amount

      • nftname

  2. Call get_actions on the fio.oracle account_name

    1. For each wraptokens or wrapdomain action:

      1. Retrieve:

        1. data

          1. actor

          2. chain_code

          3. amount or nftname

          4. public_address

        2. block_time

      2. Then compare this data to the data in the FIO wrap table.

        1. The block_time should be very close to the FIO timestamp. May need to have this match be approximate.

      3. If a match is found, populate the FIO transaction_id in the FIO wrap table with trx_id from the action

  3. Retrieve wrap transactions from erc20 contract (e.g., https://ropsten.etherscan.io/address/0x39e55E8Fcc19ACA3606Ed3CFe7177442185a14F9 )

    1. For each transaction retrieve and store:

      1. ETH transaction_id

      2. From ETH address (the ETH address of the BP doing the approval)

      3. Input data, including

        • account address 0x4293d810F82aF4be0edBe62Fb34181f5392cCcCe

        • amount uint256 500000000000

        • obtid string 6abc10dc123e13a73f7130338ee6dcb69204fe9ec5f8d1d740f8bd79116d8401

  4. 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

 

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 Approvals

hfdg2qumuvlc (link to ETH transaction) Unwrapped

qbxn5zhw2ypw (link to ETH transaction) Unwrapped

wttywsmdmfew (link to ETH transaction) Unwrapped

Header

  • timestamp

  • crypto handle

  • chain

  • Type (Unwrap or Unwrapnft)

  • Depending on wrap type:

    • Amount: <amount>

    • NFT: <nftname>

  • Status (Completed or Pending)

Examples:

2022/04/27 11:03 fio@faucet Ethereum 100.000000000 WFIO Pending
2022/04/27 11:03 fio@faucet Polygon mydomain Completed

FIO Chain Transaction

  • FIO chain transaction ID linked to bloks.io

Recipient Address

  • ETH public_address linked to etherscan

Destination Chain Approvals

For each transaction: (this can all be in one line)

  • BP Crypto Handle

  • Timestamp

  • ETH transaction ID linked to etherscan

  • FIO Token unwraps are submitted (by users) to erc20 contract.

  • FIO Token unwraps submitted (by oracles) to the FIO Chain

    • In order for a wrap or unwrap to happen, all of the registered oracles need to have called the unwrap action on the FIO Chain.

    • In the case of unwrap the votes are found in the fio.oracle > oravotes table on the FIO server. This table show which oracle have voted and whether the unwrap succeeded (isComplete = 1).

    • The following is an example of a completed and incomplete unwrap:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 { "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

  1. Retrieve unwrap transactions from erc20 contract (e.g., https://ropsten.etherscan.io/address/0x39e55E8Fcc19ACA3606Ed3CFe7177442185a14F9 )

    1. For each transaction retrieve and store in the local ETH Table:

      1. ETH transaction id

      2. From ETH address (the ETH address of the account calling the unwrap action)

      3. Input data:

        • amount uint256 500000000000

        • tokenId

  2. To retrieve associated unwrap actions from from FIO Chain:

    1. For each ETH transaction id in the ETH Table:

      1. Search the fio.oracle oravotes table for the ETH transaction id

        1. See info below for how to do this search

      2. Record in local FIO Table database:

        • id

        • timestamp

        • obt_id

        • amount or nftname

        • voters

  3. The UX should now be able to display unwrap transactions by matching the from ETH transaction id (from local ETH table) and obt_id (from local FIO table)

 

Searching for ETH transaction id in the fio.oracle oravotes table:

a. Hash the transaction id

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 const {createHash} = require('crypto'); const rp = require('request-promise'); const fiourl = "http://35.81.84.194: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 Domain wraps and unwraps

Transactions on FIO and Destination Chain should be linked.

  • FIO Chain

    • FIO Domain wraps submitted (by user)

      • timestamp

      • actor

      • chain_code

      • public_address

      • fio_domain

      • FIO Chain tx_id

    • FIO Domain unwraps submitted (by oracles)

      • status

        • Completed

        • Pending

      • oracles which have called unwrap

      • for each oracle tx

        • timestamp

        • actor

        • chain_code

        • fio_address

        • fio_domain

        • Destination Chain tx_id

        • FIO Chain tx_id

  • Destination Chain

    • FIO Domain wraps submitted (by oracles)

      • status

        • Completed

        • Pending

      • oracles which have called wrap

      • for each oracle tx

        • timestamp

        • FIO Chain tx_id

        • Destination Chain tx_id

          • Link to etherescan

    • FIO Domain unwraps submitted (by user)

      • timestamp

      • fio_domain

      • fio_address

      • Destination Chain tx_id

        • Link to etherescan

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