Giter Club home page Giter Club logo

earn-protocol's Introduction

Earn protocol Install, lint and test pipeline

Earn protocol

Core smart contract of OptyFi's Earn protocol

Prerequisite

To run the project :

Installation

Clone earn-protocol

git clone https://github.com/Opty-Fi/earn-protocol.git

Run yarn install to install necessary dependencies.

Run yarn run to view all available tasks.

Compile and Test

Compile all contracts

yarn compile

Test all contracts

yarn test

Setup and Deployments

For setting up all essential actions (deploying contracts, executing functions).

# hardhat
    yarn setup
# localhost
    yarn setup:local
# staging
    yarn setup:staging

For deploying infrastructure contracts in Optyfi protocol.

# hardhat
    yarn deploy-infra
# localhost
    yarn deploy-infra:local
# staging
    yarn deploy-infra:staging

View more tasks

earn-protocol's People

Contributors

0xhafa avatar deepcrazy avatar dhruvingbc avatar dhruvinparikh avatar fiqureshi1 avatar leodinh avatar mariogutval avatar

Watchers

 avatar

Forkers

dhruvinparikh

earn-protocol's Issues

Vault and StrategyManager

  • Handle strategy manager when OPTYTokenDistributor and ODEFIVaultBooster are zero addresses
  • Document with clarity for _emergencyBrake() inVault.sol
  • Document getPricePerFullShare and getPricePerFullShareWrite in Vault.sol stating the edge case scenario when last step step is curve
  • In RegistryProxy.sol, remove initialization of setOPTYDistributor(msg.sender) from constructor
  • In ModifierController.sol, check that _OPTYDistributor is not an EOA.
  • Write unit test to verify all the changes.
  • Vault exceeds 24kb

Withdraw/Deposit For

Two new functions:

  1. withdrawFor
  2. depositFor

The purpose of these functions is to permit a contract to perform a withdraw or deposit function on behalf of a user - in particular it is useful for tracking deposits/withdrawals made by LimitOrder contract suite on behalf of users (order.maker).

Refactor config contracts

  • Remove returns(bool) from setter functions
  • Repetitive checks and do code re-use
  • No need to check address(0) if isContract() check is done.

Include MKR token edge case in `_getBestAPR` in APROracle.sol

  • _getBestAPR is handling the edge for WETH token as of now. However, if using getTokenConfigBySymbol(symbol) of Compound, then MKR token's edge case can be added as MKR contract returns MKR's symbol's hash and not "MKR" as string.
  • This has to be explored bit more as well as if MKR is possible scenario or not.
  • Also, Maybe we can use getTokenConfigByUnderlying(token) with an exception for MKR. However, this function also returns error right now for MKR token address and therefore needs more exploration.

DForce adapter test cases

There is uncertainty of protocols distributing rewards. This should be handle dynamically by making web3 calls when test cases are executed.

This refactoring to dynamically determine the status of reward distribution can be applied across other protocol adapters as well.

This is with respect to this PR.

Verify that deposit and withdraw to/from strategy occurred in vault

Problem

  • Whenever Vault deposit to the strategy through series of function call using MultiCall contract, it does not consider return values if any protocol returns on deposit.
  • Whenever Vault withdraws from the strategy through series of function call using MultiCall contract, it does not consider return values if any protocol returns during withdraw.

Possible Solution

  • Deposit : Check the difference of vault balance in underlying token before and after deposit. Some protocols may limit the investment so consider that via calls made to the adapter.Revert if the difference is not as expected
  • Withdraw : Check the difference of vault balance in underlying token before and after withdraw. Revert if the difference is not as expected.

APR Oracle

  • The strategy hash compose is incorrect.
  • Perform keccak256 hash of tokensHash and strategy step

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.