All Projects → naszam → wfil

naszam / wfil

Licence: AGPL-3.0 license
Wrapped Filecoin (WFIL), Team WrapFS at HackFS @ethglobal | APOLLO 🚀 @gitcoinco | ETHOnline @ethglobal

Programming Languages

javascript
184084 projects - #8 most used programming language
solidity
1140 projects

Projects that are alternatives of or similar to wfil

Awesome NFTs
A curated collection about NFTs - by bt3gl
Stars: ✭ 42 (+223.08%)
Mutual labels:  erc-20, defi
digital-copyright
Stamp your code with a trackable digital copyright
Stars: ✭ 17 (+30.77%)
Mutual labels:  filecoin, defi
estuary-www
https://estuary.tech
Stars: ✭ 32 (+146.15%)
Mutual labels:  filecoin
rube
A multi-chain DeFi development toolkit for Elixir
Stars: ✭ 27 (+107.69%)
Mutual labels:  defi
squeeth-monorepo
Squeeth is a new financial primitive in DeFi that gives traders exposure to ETH²
Stars: ✭ 156 (+1100%)
Mutual labels:  defi
scan
DeFi Scan, everything one-stop location for DeFi Blockchain. Powered by jellyfish & ocean network.
Stars: ✭ 31 (+138.46%)
Mutual labels:  defi
app-monorepo
Secure, open source and community driven crypto wallet runs on all platforms and trusted by millions.
Stars: ✭ 1,282 (+9761.54%)
Mutual labels:  defi
defi-dapps-solidity-smart-contracts
This is a Web 3 Smart Contract learning and teaching repo which will be used to teach students all across Pakistan.
Stars: ✭ 241 (+1753.85%)
Mutual labels:  defi
awesome-defi
Curated list of awesome DeFi protocols, dapps, wallets and other resources
Stars: ✭ 36 (+176.92%)
Mutual labels:  defi
governance-crosschain-bridges
This repo contains the crosschain governance bridges used for the aave markets deployed across different networks
Stars: ✭ 116 (+792.31%)
Mutual labels:  defi
defi
Tools for use in DeFi. Impermanent Loss calculations, staking and farming strategies, coingecko and pancakeswap API queries, liquidity pools and more
Stars: ✭ 464 (+3469.23%)
Mutual labels:  defi
ethereum-crowdsale
0xcert protocol crowdsale contracts for Ethereum blockchain.
Stars: ✭ 15 (+15.38%)
Mutual labels:  erc-20
zeneth
🏵️ Let Your ETH Chill — Gasless Ethereum account abstraction with Flashbots
Stars: ✭ 112 (+761.54%)
Mutual labels:  defi
wallet
DeFiChain Wallet. The DeFi Blockchain Light Wallet for iOS, Android & Web. + Desktop Coming Soon
Stars: ✭ 112 (+761.54%)
Mutual labels:  defi
templewallet-extension
🔐💰Cryptocurrency wallet for Tezos blockchain as Web extension for your Browser.
Stars: ✭ 176 (+1253.85%)
Mutual labels:  defi
pali-wallet
The Official Syscoin browser wallet. Open source, easy to use & multichain.
Stars: ✭ 30 (+130.77%)
Mutual labels:  defi
bridge-v2
An easy way to bridge cross-chain assets between blockchains.
Stars: ✭ 88 (+576.92%)
Mutual labels:  defi
react-native-defi-app
React Native Defi Decentralized Applications(dApps)
Stars: ✭ 31 (+138.46%)
Mutual labels:  defi
yearn-exporter
Realtime and historical Yearn metrics
Stars: ✭ 80 (+515.38%)
Mutual labels:  defi
market
🧜‍♀️ THE Data Market
Stars: ✭ 149 (+1046.15%)
Mutual labels:  defi

#ubuntu 18.04 #npm 12.19.0 #built_with_Truffle #solc 0.6.12 #testnet rinkeby

WFIL

Wrapped Filecoin, ERC20 Wrapper over Filecoin

WFIL is the fist ERC20 wrapper over Filecoin, backed by filecoin deposits on a custodial wallet (1:1 ratio).

The current iteration implements a custodial pattern where users need to send filecoins to a custodial wallet and they'll get automatically the correspondent amount in WFIL to their ethereum addresses.

Future Developments & Features:

We'd like to migrate to a non-custodial pattern where by leveraging on Filecoin smart contracts we'd be able to implement a fully decentralized application.

Extend the Filecoin Wallet into a MetaMask for Filecoin.

One of the features we're considering is to add the permit() function to WFIL to allow meta transactions by leveraging on OpenZeppelin ERC20Permit module (currently in progress) and incentivise adoption in the space.

Applications:

  • Uniswap
  • WFIL as Collateral on MakerDAO
  • De-Fi
  • ...

Mentors

Demo (HackFS)
HackFS
ETHOnline
Demo (APOLLO)
Pitch Deck
Newsletter
Demo (Beta Launch Preview)

Sections

Building Blocks

Smart Contracts Flow-Chart

WFIL

Implements an ERC20 token by leveraging on OpenZeppelin Library.

It allows the owner of the contract, set as Default Admin to add/remove a Minter via grantRole(), revokeRole() functions by leveraging on AccessControl module by OpenZeppelin.

The contract implements the wrap() function to mint WFIL by passing the recepient address and the amount of Filecoin to wrap as parameters and emitting an event, Wrapped.

The contract also implements the unwrap() function to burn the WFIL by passing the filecoin address and the amount of WFIL to unwrap as parameters and emitting an event, Unwrapped.

The contract inherits OpenZeppelin AccessControl module to set the Pauser role to the owner of the contract that can call the pause(), unpause() functions in case of emergency (Circuit Breaker Design Pattern).

Once the owner call the pause() function, thanks to the _beforeTokenTransfer() hook, _mint(), _burn() and _transfer() internal functions, will revert.

To avoid users from sending WFIL to the contract address, _transfer() has been overidden to make sure the recipient address does not correspond to the contract address, and revert if it does.

To manage the wrapping - unwrapping fee, the contract set the Fee Setter role to the owner of the contract that can set the fee via setFee() and the recipient via setFeeTo(). The fee is public and can be queried via the getter function fee().

A Gnosis Safe Multisig is used to receive and store the wrapping fees and set inside the constructor.

Backend

Implements a custodial wallet by leveraging on Lotus APIs.

Via AWS Lambda, allows to automatically wrap/unwrap Filecoin, by minting WFIL from an account set as Minter and call the unwrap method to burn WFIL by the user.

It's also connected via Filscan APIs to Filecoin to check for transactions that are tracked via Textile ThreadDB.

Frontend

The Frontend has been implemented via Rimble UI & Rimble Web3 Components and deployed on IPFS via Fleek.

Filecoin Wallet

Implements a Filecoin client by leveraging on Lotus APIs.

Further developments of the project include building a MetaMask for Filecoin, creating an extension for Chrome.

Setup

Clone this GitHub repository.

Steps to compile and test

  • Local dependencies:
    • Truffle
    • Ganache CLI
    • OpenZeppelin Contracts v3.1.0
    • Truffle HD Wallet Provider
    • Truffle-Flattener
    • Truffle-Plugin-Verify
    • Solhint
    $ npm i
  • Global dependencies:
    • Truffle (recommended):
    $ npm install -g truffle
    • Ganache CLI (recommended):
    $ npm install -g ganache-cli
    • Slither (optional):
    $ git clone https://github.com/crytic/slither.git && cd slither
    $ sudo python3 setup.py install
    • MythX CLI (optional):
    $ git clone git://github.com/dmuhs/mythx-cli && cd mythx-cli
    $ sudo python setup.py install

Running the project with local test network (ganache-cli)

  • Start ganache-cli with the following command (global dependency):
    $ ganache-cli
  • Compile the smart contract using Truffle with the following command (global dependency):
    $ truffle compile
  • Deploy the smart contracts using Truffle & Ganache with the following command (global dependency):
    $ truffle migrate
  • Test the smart contracts using Mocha & OpenZeppelin Test Environment with the following command:
    $ npm test
  • Analyze the smart contracts using Slither with the following command (optional):
    $ slither .
  • Analyze the smart contracts using MythX CLI with the following command (optional):
    $ mythx analyze

Deploy

Deploy on Rinkeby Testnet

  • Get an Ethereum Account on Metamask.
  • On the landing page, click “Get Chrome Extension.”
  • Create a .secret file cointaining the menomic.
  • Get some test ether from a Rinkeby's faucet.
  • Signup Infura.
  • Create new project.
  • Copy the rinkeby URL into truffle-config.js.
  • Uncomment the following lines in truffle-config.js:
    // const HDWalletProvider = require("@truffle/hdwallet-provider");
    // const infuraKey = '...';
    // const infuraURL = 'https://rinkeby.infura.io/...';
    
    // const fs = require('fs');
    // const mnemonic = fs.readFileSync(".secret").toString().trim();
    
  • Install Truffle HD Wallet Provider:
    $ npm install @truffle/hdwallet-provider
  • Deploy the smart contract using Truffle & Infura with the following command:
    $ truffle migrate --network rinkeby
  • Verify WFIL contract on Rinkeby via Truffle Plugin Verify:
    $ truffle run verify WFIL --network rinkeby

Project deployed on Rinkeby

WFIL

Using the DApp

  • Install Ganache GUI.
  • Change Ganache GUI port to 8545.
  • Import Ganache GUI mnemonic into MetaMask.
  • Connect MetaMask to Ganache GUI, adding a custom RPC specifing the Ganache GUI's RPC server URL.
  • Deploy the smart contracts to Ganache GUI:
    $ truffle migrate
    
  • Move to client directory on the project:
    $ cd app
  • Install dependencies:
    $ yarn install
  • Start the Local Web Server:
    $ npm run start

About

Inspiration & References

Authors

Project created by Nazzareno Massari and Cristiam Da Silva.
Team WrapFS for HackFS ETHGlobal Virtual Hackathon.
Logo by Cristiam Da Silva.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].