FIO Token and Domain NFT wrapping

In Progress

This project is in progress, see:

Committee

@Pawel Mastalerz @Luke Stokes @Casey Gardiner @Todd G @EOSUSA Michael @Michael Yeates

Overview

Wrapping is a process of taking a token from one chain and making it available on another chain. For example a wrapped Bitcoin is an ERC-20 representation of a Bitcoin token on the Ethereum chain.

It is believed that the ability to wrap FIO Tokens and Domain NFTs will be beneficial to the FIO Community. It will open up new use cases for FIO Tokens and Domains such as:

  • Enable FIO Domains to be traded on NFT trading sites such as Open Sea as ERC-721s.

  • Enable FIO tokens to be used in a rapidly growing Defi Ecosystem such as Uniswap which rewards token holders for providing liquidity to decentralized exchanges.

Wrapping is typically accomplished in the following way:

  • Alice transfers a token on Chain C to a designated address which is controlled by a centralized or decentralized Oracle O.

  • Oracle O, then issues a new token on Chain D and transfers it to an address designated by Alice.

  • Token on Chain C is now “locked” and not usable on Chain C until it is redeemed.

  • When Alice or new owner wants to redeem the token, they transfer it on Chain D to a designated address which is controlled by Oracle O.

  • Oracle O, then “unlocks” the token on Chain C and transfers it to a designated address.

The objective of this project is to:

  • Build into FIO Protocol ability to “lock” tokens and designate target blockchain and address. This would allow anyone to build oracle solutions for any blockchain

  • Build or engage an oracle solution which will monitor FIO and Ethereum, enabling wrapped FIO Tokens and Domain NFTs on Ethereum.

Sample flow diagram

Solution Specification

FIO Chain wrapping functionality

  • System smart contract on the FIO Chain.

  • It will be owned by eosio (controlled by BPs) who will register and unregister oracles using regoracle and unregoracle actions.

  • Users will

    • SEND: User will send FIO Domain using wrapdomain or FIO Tokens using wraptokens actions and pay Oracles fee they obtained using get_oracle_fees.

  • Oracles will:

    • Specify fees (in FIO) they want to be paid by user for wrapping services using setoraclefee action. These fees should cover gas fees on another chain.

    • TRANSFER: Once Oracles detect that a user on another chain wants to unwrap FIO Domain or FIO Tokens, they will submit their observation using unwrapdomain or unwraptokens actions. Once all Oracles have submitted their observation, the FIO Domain or FIO Tokens will be transferred.

  • See FIP-17 for details.

Ethereum Chain wrapping functionality

  • Smart contract on:

    • FIO Token wrapping

      • Ethereum L1 Chain

    • FIO Domain Wrapping

      • Polygon, Ethereum L2 Chain.

        • Due to high fees on Ethereum L1, the FIO Domain wrapping will be deployed on Polygon exclusively.

  • Custodians

    • The smart contract owner key will be destroyed after deployment

    • Starting set of 10 custodian keys will be hard-coded into contract

    • Custodians will be able to:

      • Register Oracle

        • Request

          • Ethereum public address

        • Processing

          • Oracle is added after 2/3 + 1 custodians have registered the same public address

      • Unregister Oracle

        • Request

          • Ethereum public address

        • Processing

          • Oracle is removed after 2/3 + 1 custodians have unregistered the same public address

      • Register Custodian

        • Request

          • Ethereum public address

        • Processing

          • Custodian is added after 2/3 + 1 custodians have registered the same public address

      • Unregister Custodian

        • Request

          • Ethereum public address

        • Processing

          • Custodian is removed after 2/3 + 1 custodians have unregistered the same public address

  • Oracles will

    • MINT: Once Oracles detect that a user on FIO Chain wants to wrap FIO Domain or FIO Tokens, they will submit their observation to this Ethereum smart contract. Once all Oracles have submitted their observation, the wrapped FIO Domain or wrapped FIO Tokens will be minted and transferred to designated Ethereum public address.

      • Oracle can trigger minting of wrapped tokens

    • BURN: Once Oracles detect that a FIO Domain has been burned on the FIO Chain, they will submit their observation to this Ethereum smart contract. Once all Oracles have submitted their observation, the wrapped FIO Domain will be burned.

      • Oracle can trigger burning of ERC-721 tokens

  • Users will

    • SEND: Send ERC-721 FIO Domain or WFIO ERC-20 to this Ethereum smart contract without additional fee other than Ethereum gas passing:

      • ERC-721

        • ERC-721 Domain - previously minted on Ethereum

        • FIO Address where FIO Domain should be delivered on FIO Chain

          • Basic regex validation should be enforced

      • ERC-20

        • Amount of WFIO - previously minted on Ethereum

        • FIO Address where FIO Tokens should be delivered on FIO Chain

          • Basic regex validation should be enforced

  • Automatic generation of ERC-721 metadata

    • ERC-721 requires that a url to a json file be provided.

    • The metadata should be served by a service hosted by the Foundation, which will dynamically generate it based on the query parameter in the url, e.g. https://metadata.fioprotocol.io/domainnft/sampledomain.json

    • Response meta data:

{ "name": "FIO Domain: sampledomain", "description": "Owners of FIO Domains can create unlimited number of human-readable FIO Addresses to be used to receive or request crypto using FIO Protocol.", "image": "https://metadata.fioprotocol.io/domainnft/sampledomain.svg" }

Oracle functionality

  • Customized solution based on Alien Teleport developed by @Michael Yeates.

  • Oracle code will be ran by designated FIO Chain BPs with access to:

    • FIO Chain: BPs already run FIO nodes.

    • Ethereum Chain: local Ethereum node is preferred, but Infura or Etherscan can also be used.

  • Oracle will:

    • FIO Chain

      • Monitor specific account by inspecting every block and looking for wrapdomain or wraptokens action

      • TRANSFER FIO Domains or FIO Tokens

    • Ethereum Chain

      • Monitor Ethereum smart contract for inbound transfers of ERC-721s or ERC-20s

      • MINT ERC-721 or ERC-20

  • Possible exceptions (exception handling should not be automated at this stage):

    • FIO Chain

      • Chain passed to wrapdomain or wraptokens actions is not Ethereum (this restriction is not enforced on the FIO Chain level to allow for wrapping chain expansion without deployment of code)

        • Oracles can trigger unwrapdomain or unwraptokens actions to originating address

      • Public address passed to wrapdomain or wraptokens actions is not a valid Ethereum address (this restriction is not enforced on the FIO Chain level to allow for wrapping chain expansion without deployment of code)

        • Oracles can trigger unwrapdomain or unwraptokens actions to originating address

    • Ethereum Chain

      • FIO Address passed in with ERC-20 is not valid or does not exist

        • Oracles can trigger a refund deducting amount to cover gas

      • FIO Address passed in with ERC-721 is not valid or does not exist

        • Oracle can at their discretion trigger a refund or manually resolve the issue with sender

Other options considered

FIO Chain wrapping functionality

Oracle functionality

Ethereum Chain wrapping functionality

FIO Chain wrapping functionality

Oracle functionality

Ethereum Chain wrapping functionality

  • None

  • Custom code

    • Why built if exists

  • Liquid Apps

  • Chainlink

    • More complex to implement.

    • Requires link token payments.

  • Band Protocol

    • BAND relies information securely, but an oracle to trigger transactions on FIO and Ethereum would still be required.

  • THOR Chain

    • Very interesting solution utilizing one-way pegs

    • Mainnet not yet launched.

  • Proposal from ScopeLift to build this for $1,500 - $2,250 based on similar projects.

    • Alien Teleport already has Ethereum contract and adding ERC-721 would not be very complex.

 

 

Initiative link

https://fioprotocol.atlassian.net/browse/WP-93