Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This effort prototypes a simplified end-to-end flow of FIO Wrapping.

Use case

Wrap FIO Token:

  1. Alice (dApp) executes wraptokens on FIO chain

  2. Oracle monitors wraptokens for transfers

  3. Oracle executes ERC20 _mint

  4. Oracle executes ERC20 approve

  5. Alice (dApp) calls ERC20 balanceOf to get balance

  6. Alice (dApp) executes ERC20 transferFrom

Assumptions

  • Assume there is a single Oracle managing all transactions. Do NOT worry about multisigs, approvals, etc.

  • No validation on either chain is required.

  • Do not worry about oracle fee imbalances.

...

Diagram link: https://drive.google.com/file/d/12f8iOoZjj1txZCJprpuQ5VFb8Ejpc9Bp/view?usp=sharing

Deployment

  • fio.wrapping: contract deployed to DEV server with V1 History (eventually will move to Hyperion)

  • oracle: daemon running on server

  • ERC-20: open zeppelin contracts on Ropsten testnet

Prototype Review

approve vs transfer when wrapping

Tracks the discussion regarding the best way to transfer wfio. There are two options listed below. It is important to note that some kind of dApp will be needed on both sides of wrap/unwrap in either case. So, the question becomes what functionality belongs in the oracle and the contracts versus what belongs in the dApp. Constructed correctly, the difference between approve and transfer can be “hidden” from the end user--it would simply show up as an extra step in the dApp.

...

After several discussions with the team, it was decided that the extra steps for the user to transferFrom may not be worth the security benefits of using approve. We will go with the direct mint.

Prototype Testing

Prototype environment:

Prototype was tested:

  • Called wraptokens with Eth address

  • Used https://oneclickdapp.com/matrix-second allowance to confirm available wfio (Oracle account currently holds the minted wfio)

  • Used transferFrom to transfer tokens to ETH address.

  • Added wfio token contract to Metamask and the correct amount of wfio appeared.

Todo

  • Only initial validation was done on wraptokens.

  • Need to update oracle to use _mint (to user address).

...