Skip to content

SAAVE-Finance/Contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAAVE Finance Contracts

Summary

Lets users deposit stablecoins like DAI, USDC, and USDT to generate yields from the most battle tested strategies.

  1. users can deposit any amount of DAI, USDC, and/or USDT.
  2. deposits are deployed into AAVE, Curve and Curve Gauge - all in 1 click
  3. withdrawls can be done at any time, funds are withdrawn from all positions, and the deposit + rewards are delivered to the user.

FUTURE UPDATES

  • A way to fund auto compounding
  • A way to pool CRV to increase returns

SAAVEFactory in SAAVE.sol - All user interactions will be done here.
SAAVE_Receiver - in SAAVE_Receiver.sol - Abstract contract used to interact with external DeFi protocols, inherits curveActions, AAVEActions
curveActions - in curveActions.sol - contains all methods and elements needed to interact with Curve Finance.
AAVEActions - in AAVEActions.sol - contains all methods and elements needed to interact with AAVE.

SAAVEFactory

Description

All user interactions will be done through this factory contract. This contract deploys Receiver contracts that will act as abstract accounts for each user.

deposit()

function deposit() public payable nonReentrant

💡Requires approval of user tokens to be deposited.

  • Initiates deposit of user funds into SAAVEFactory contract.
  • Deploys and assigns a user a SAAVE_Receiver contract if one has not been assigned yet.
  • User funds are transferred to the newly deployed receiver contract.


withdraw()

 function withdraw() public
  • withdraws user funds from all investment positions.
  • returns deposit + profit to user


checkUpKeep()

 function checkUpkeep(bytes calldata /* checkData */) external view override returns (bool upkeepNeeded, bytes memory /*performData*/)
  • check if required interval has been passed or not. Returns 'true' if upkeep neded.
  • Required for Chainlink Keepers.


performUpkeep()

 function performUpkeep(bytes calldata /*performData*/) external override
  • loops through all user accounts to check if they have a deposit > 0.
  • harvests CRV rewards if user account has > 0

SAAVE_Receiver

Description

Abstract contract that is used to interact with external contracts like AAVE, Curve and Chainlink.

constructor

    constructor(address SAAVEFactory, address _owner) {
        factory = SAAVEFactory;
        owner = _owner;
    }
  • specifies the address of the SAAVEFactory contract
  • assigns the owner of the contract to the owner address

deposit()

function deposit() external 
  • loans user's deposited stablecoins into AAVE V3 protocol
  • adds liquidity to AAVE Stablecoin Pool using aTokens received from AAVE
  • deposits LP Tokens received from Curve into the Curve Gauge to mine CRV

harvest()

function harvest() external 

Inactive, no way to fund harvesting, will maybe introduce a way in the future

  • swaps CRV through multiple pools to aquire more am3 LP
  • deposits more LP tokens into Curve Gauge to mine more CRV

widthdrawAll()

function withdrawAll() external
  • removes all positions
  • swaps CRV for USDC
  • returns all funds to user + profit

About

Yield Aggregator platform that focuses on fees generated from stablecoin vaults. Uses external protocols such as Curve Finance, AAVE, Compound and more.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published