Giter Site home page Giter Site logo

vault's Introduction

Vault

Specifications

There should be a ‘deposit’, and ‘withdraw’ function that any user can use to deposit and withdraw any whitelisted ERC-20 token on the contract.

There should also be three additional functions that only admins can call.

  • pause prevents new deposits or withdrawals from occurring.

  • unpause enables new deposits or withdrawals from occurring.

  • whitelistToken admins call to whitelist tokens.

The code repository should contain testing for the contract as well.

  • The repository should also contain instructions in the readme for running tests.

The vault should be usable by any number of users.

Smart Contract Functions

Admin functions

  • pause() Pause new deposits / withdraws.

  • unpause() Enables new deposits / withdraws.

  • whitelistToken(address token, bool whitelist) Add/remove token from whitelist.

User functions

  • deposit(address token, uint256 amount) Deposits ERC20 token.

  • withdraw(address token, uint256 amount) Withdraws ERC20 token.

Query functions

  • isWhitelistedToken(address token) Returns if token is whitelisted or not.

  • allWhitelistedTokens() Returns all whitelisted tokens in array.

How to run the tests

Install

yarn install

Compile

yarn compile

Run test

yarn test

Run coverage test

yarn coverage
Coverage result

------------------|----------|----------|----------|----------|----------------|

File % Stmts % Branch % Funcs % Lines Uncovered Lines
contracts/ 100 100 100 100
Vault.sol 100 100 100 100
contracts/mocks/ 100 100 100 100
ERC20Mock.sol 100 100 100 100
------------------ ---------- ---------- ---------- ---------- ----------------
All files 100 100 100 100
------------------ ---------- ---------- ---------- ---------- ----------------

vault's People

Contributors

soloph1 avatar

Watchers

 avatar

Forkers

dashbaord202401

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.