Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(1inch): add generic DAI_X base strategy and implement DAI_LDO #52

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bergben
Copy link

@bergben bergben commented Oct 3, 2021

Implements new DAI_X base strategy for 1inch and implements dai-ldo strategy.

DAI-stETH Liquidity on 1inch:
image

1inch-ETH Liquidity on 1inch:
image

LDO-ETH Liquidity on sushi:
image

APY / APR:

Overall APR: 24.090694066592675 %
Overall APY: 27.23015113442888 %

Test output on block 13352188 (npx hardhat test ./test/1inch/dai-ldo.js):

Mainnet DAI/LDO
Impersonating...
0xf00dD244228F51547f0563e60bCa65a30FBF5f7f
0x37e46caEfEF61D30E680cf754998B4A39e5d8325
Fetching Underlying at:  0xC1A900Ae76dB21dC5aa8E418Ac0F4E888A4C7431
New Vault Deployed:  0xb08FCB4c6eEE50A60a1bb77A690e637ACDe5B951
Strategy Deployed:  0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6
Strategy and vault added to Controller.
transfering farmerBalance 8507879389637754862489
    Happy path
loop  0
old shareprice:  1000000000000000000
new shareprice:  1000000000000000000
growth:  1
instant APR: 0 %
instant APY: 0 %
loop  1
old shareprice:  1000000000000000000
new shareprice:  1000242383358344769
growth:  1.000242383358345
instant APR: 24.06381981648385 %
instant APY: 27.195986113394042 %
loop  2
old shareprice:  1000242383358344769
new shareprice:  1000484831038594290
growth:  1.0002423889292067
instant APR: 24.064372891640566 %
instant APY: 27.196689141234963 %
loop  3
old shareprice:  1000484831038594290
new shareprice:  1000727336992077088
growth:  1.0002423884360456
instant APR: 24.06432393060978 %
instant APY: 27.19662690547193 %
loop  4
old shareprice:  1000727336992077088
new shareprice:  1000969894995372391
growth:  1.0002423817101114
instant APR: 24.06365617985704 %
instant APY: 27.19577811146938 %
loop  5
old shareprice:  1000969894995372391
new shareprice:  1001212517738150713
growth:  1.0002423876522075
instant APR: 24.064246111162664 %
instant APY: 27.196527987014708 %
loop  6
old shareprice:  1001212517738150713
new shareprice:  1001455198943741384
growth:  1.000242387306682
instant APR: 24.06421180738029 %
instant APY: 27.196484382544828 %
loop  7
old shareprice:  1001455198943741384
new shareprice:  1001697938639691283
growth:  1.0002423869746804
instant APR: 24.064178846267655 %
instant APY: 27.196442484802684 %
loop  8
old shareprice:  1001697938639691283
new shareprice:  1001940736847508888
growth:  1.0002423866501586
instant APR: 24.06414662774903 %
instant APY: 27.196401530995338 %
loop  9
old shareprice:  1001940736847508888
new shareprice:  1002183593585348723
growth:  1.0002423863297585
instant APR: 24.064114818422052 %
instant APY: 27.196361097349133 %
earned!
Overall APR: 24.090694066592675 %
Overall APY: 27.23015113442888 %
      ✓ Farmer should earn money (60775ms)


  1 passing (1m)

Copy link
Contributor

@CryptJS13 CryptJS13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments. Liquidations for both 1INCH and stETH can be done through 1INCH. See the discord.

contracts/strategies/convex/base/ConvexStrategyUL.sol Outdated Show resolved Hide resolved
contracts/strategies/1inch/base/OneInchStrategy_DAI_X.sol Outdated Show resolved Hide resolved
@bergben bergben marked this pull request as ready for review October 4, 2021 21:48
Copy link
Contributor

@CryptJS13 CryptJS13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright looks good! 1 minor comment, which is not critical at all, would just make it more homogeneous with the rest of the repo.

Thanks for the work on this! I guess for the future we could look into making it even more general by not assuming DAI as token0, but leaving that open. We'll see if another 1INCH farm arises, this for now seems good to go for me. @breadforthepeople @bergben

@bergben
Copy link
Author

bergben commented Oct 5, 2021

Alright looks good! 1 minor comment, which is not critical at all, would just make it more homogeneous with the rest of the repo.

Thanks for the work on this! I guess for the future we could look into making it even more general by not assuming DAI as token0, but leaving that open. We'll see if another 1INCH farm arises, this for now seems good to go for me. @breadforthepeople @bergben

Yes sounds great. I didn't want to spend any more time on this currently for such a generic baseStrategy because rewards only last until 24th October and also for my learning curve it helped to do a somewhat half generic baseStrategy first before going all the way. Great learnings though, thank you!

@CryptJS13
Copy link
Contributor

Yes sounds great. I didn't want to spend any more time on this currently for such a generic baseStrategy because rewards only last until 24th October and also for my learning curve it helped to do a somewhat half generic baseStrategy first before going all the way. Great learnings though, thank you!

Great to hear, you seem to be picking all this up very quickly, so that's very nice to see! As for the strategy actually getting shipped, I'm not 100% sure it's gonna be worth it with the rewards ending is less than 3 weeks. Might not be fair to users to offer it, as it's gonna be near impossible to earn back the gas fees for depositing/withdrawing, but maybe it's just fine if we can get it released today before emissions. But @breadforthepeople will have to weigh in on that. At least it was a useful learning experience! :)

@CryptJS13
Copy link
Contributor

@breadforthepeople @Cryo45 I think this can be closed, we can revisit when some new farming op shows up on 1INCH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants