GithubHelp home page GithubHelp logo

2021-05-visorfinance's Introduction

Visor Finance contest details

Visor.sol is fork of Alchemist.wtc project's contracts/crucible/Crucible.sol which has been extended significantly. Of interest is the portion that has been added or altered.

Altered:

  • transferERC20- Transfer ERC20 tokens out of vault by owner
    • changed
      • IERC20(token).balanceOf(address(this)) >= getBalanceLocked(token).add(amount)
    • to
      • IERC20(token).balanceOf(address(this)) >= (getBalanceLocked(token).add(amount)).add(timelockERC20Balances[token]),

Added:

  • approveTransferERC20
    • Approve delegate account to transfer ERC721 tokens out of vault
  • approveTransferERC721
    • Approve delegate account to transfer ERC20 tokens out of vault
  • delegatedTransferERC20
    • Transfer ERC20 tokens out of vault with an approved account
  • transferERC721
    • Transfer ERC721 out of vault
  • onERC721Received
    • ERC721Reciever interface hook- add to nfts[]
  • timeLockERC721
    • Lock ERC721 in vault until expires, redeemable by recipient
  • timeUnlockERC721
    • Withdraw ERC721 in vault post expires by recipient
  • timeLockERC20
    • Lock ERC20 tokens for recipient in the vault for provided expiry timestamp
  • timeUnlockERC20
    • Withdraw ERC20 from vault post expires by recipient
  • getNftById
    • Get ERC721 contract address, tokenId from nfts[] by index
  • getNftIdByTokenIdAndAddr
    • Get index of ERC721 in nfts[] given ERC721 minter and tokenId
  • getTimeLockCount
    • Get number of ERC20 timelocks for given token address
  • getTimeLockERC721Count
    • Get number of timelocks for NFTs of a given ERC721 contract

Name: Visor.sol (639 lines)

Libraries, interfaces relevant to scope:

  • @openzeppelin/contracts/math/SafeMath.sol;
  • @openzeppelin/contracts/token/ERC20/IERC20.sol;
  • @openzeppelin/contracts/token/ERC721/IERC721.sol;
  • @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol;
  • @uniswap/lib/contracts/libraries/TransferHelper.sol;
  • @openzeppelin/contracts/utils/Address.sol;
  • /contracts/contracts/visor/OwnableERC721.sol
  • /contracts/contracts/interfaces/IUniversalVault.sol

Libraries, interfaces not used in scope:

  • @openzeppelin/contracts/proxy/Initializable.sol;
  • @openzeppelin/contracts/utils/EnumerableSet.sol;
  • /contracts/contracts/visor/ERC1271.sol
  • /contracts/contracts/visor/EIP712.sol
  • /contracts/contracts/interfaces/IVisorService.sol;

2021-05-visorfinance's People

Contributors

ninek9 avatar

Watchers

 avatar  avatar  avatar

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.