Try   HackMD

Potential yield pools / Ukraine design

Design goal:

  • Let people delegate their funds (stables/ETH) and donate the yield
  • Plug into as many yield sources w/ sufficient TVL
  • Something like https://rdai.money/, more flexible

Proposed Architecture:
accept arbitrary token -> swap for stablecoin -> tokenize stablecoin 1:1 -> deposit stablecoin into vault -> yToken held by proxy -> bot harvests yield and sends to donation add

For ETH, BTC and stables

Yearn vault integration flow:

  • User deposits stables into a proxy contract, can withdraw at anytime
  • Proxy contract deposits into yearn, holds yTokens on behalf
  • Every X hours, a public function which harvests the yield so far (after converting into ETH?) into a pre-defined EOA

Proxy contract design notes:

Zaps:

Yearn Zap In: https://etherscan.io/address/0x92Be6ADB6a12Da0CA607F9d87DB2F9978cD6ec3E
Yearn Zap Out: https://etherscan.io/address/0xd6b88257e91e4E4D4E990B3A858c849EF2DFdE8c

Deposit Contract Specification:

Deposit: Convert sellToken into stablecoin -> tokenize stablecoin 1:1 -> Zap into Yearn vault -> send 1:1 token back to user -> retain yToken in deposit contract

Withdraw: Transfer 1:1 token from user to deposit contract -> burn 1:1 token -> compute quantity of stablecoin owed -> withdraw stablecoin from vault -> transfer stablecoin to user

Harvest:

Testing Goals

Unit Testing

  • TBD

Integration Testing

  • TBD

End to End Testing

  • TBD

Scenario Testing:

  • Infra setup: forked mainnet

  • Gotcha: need consistent 0x calldata to pass in, maybe past calldata?

  • Tests:

    • arbitrary tokens being swapped
    • eth being swapped
    • token swap to stables
    • stable coin vault
      • eth swap to stable
      • stable coin flow through
      • other coin to stable
    • eth vault
      • stable swap to eth
      • eth flow through
      • other coins to eth
    • withdrawls
      • stable token, and eth
    • harvesting
      • actually transfers to donation
      • if user deposits, yield accrues, harvested, user gets same amount back
    • ensure that the contract works as expected if someone send vault tokens to it directly
  • Smocks Needed

  • Contracts Interacted With

    • Yearn Vaults