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

refactor(SwapAndLock): lock yfi via CoveYFI instead of directly w/ YSD #297

Merged
merged 8 commits into from
Mar 28, 2024

Conversation

penandlim
Copy link
Collaborator

@penandlim penandlim commented Mar 25, 2024

Describe your changes

Currently SwapAndLock directly locks YFI via YearnStakingDelegate which does not mint new CoveYFI tokens.

This PR modifies SwapAndLock so it locks YFI via CoveYFI, and sends the newly minted CoveYFI tokens to the treasury set in the YearnStakingDelegate.

Checklist before requesting a review

  • Title follows conventional commits style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • Newly added functions follow Check-effects-interaction
  • Gas usage has been minimized (ex. Storage variable access is minimized)

Copy link

Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary

Copy link

github-actions bot commented Mar 25, 2024

Changes to gas cost

Generated at commit: 1ee62cf736fe8268b080753287e6c5ee415b9ce8, compared to commit: 08dd75f4bf24156f49a520dc6655ed39e80899bb

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %
DYFIRedeemer receiveFlashLoan +1,596 ❌ +1.69%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
SwapAndLock 1,183,769 (+10,534) dYfiRedeemer
setDYfiRedeemer
343 (-22)
23,966 (-6)
-6.03%
-0.03%
343 (-22)
63,712 (-12)
-6.03%
-0.02%
343 (-22)
76,054 (-6)
-6.03%
-0.01%
343 (-22)
76,289 (-6)
-6.03%
-0.01%
768 (0)
1,296 (0)
DYFIRedeemer 2,139,607 (0) massRedeem
receiveFlashLoan
setSlippage
30,408 (0)
23,419 (0)
24,054 (+36)
0.00%
0.00%
+0.15%
441,297 (+15)
96,168 (+1,596)
38,867 (+2)
+0.00%
+1.69%
+0.01%
440,099 (0)
25,238 (-256)
30,088 (0)
0.00%
-1.00%
0.00%
689,094 (0)
279,843 (0)
53,508 (0)
0.00%
0.00%
0.00%
1,545 (0)
1,280 (0)
513 (0)
YearnStakingDelegate 3,639,792 (0) deposit
execute
harvest
setDepositLimit
setGaugeRewardSplit
setSwapAndLock
treasury
withdraw(address,uint256)
withdraw(address,uint256,address)
26,589 (0)
27,929 (0)
24,054 (0)
48,062 (0)
25,584 (0)
24,116 (0)
443 (0)
22,081 (0)
22,507 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
127,735 (+1)
137,755 (+147)
311,379 (-16)
48,133 (+1)
35,732 (-1)
47,417 (+2)
446 (+3)
95,290 (+2)
104,740 (-2)
+0.00%
+0.11%
-0.01%
+0.00%
-0.00%
+0.00%
+0.68%
+0.00%
-0.00%
110,791 (0)
149,225 (0)
352,133 (0)
48,062 (0)
25,856 (0)
47,540 (0)
443 (0)
59,896 (0)
90,250 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
249,863 (0)
149,609 (0)
431,958 (0)
48,434 (0)
54,789 (0)
53,849 (0)
2,443 (+2,000)
172,423 (0)
192,751 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+451.47%
0.00%
0.00%
3,334 (0)
268 (0)
1,803 (0)
526 (0)
1,283 (0)
280 (0)
513 (+1)
769 (0)
512 (0)
YearnGaugeStrategy 1,817,865 (0) deposit
redeem
report
setDYfiRedeemer
withdraw
30,717 (0)
293,599 (0)
58,515 (0)
27,506 (0)
74,620 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
291,876 (+18)
300,265 (-1)
302,958 (+1)
75,256 (-4)
176,029 (+123)
+0.01%
-0.00%
+0.00%
-0.01%
+0.07%
308,482 (0)
298,435 (0)
69,644 (0)
79,805 (0)
201,040 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
447,268 (0)
308,756 (0)
914,852 (-10)
79,824 (0)
256,348 (0)
0.00%
0.00%
-0.00%
0.00%
0.00%
7,938 (0)
769 (0)
5,890 (0)
3,587 (0)
1,792 (0)
GaugeRewardReceiver 1,428,645 (0) harvest 5,864 (0) 0.00% 293,144 (+157) +0.05% 350,867 (0) 0.00% 455,946 (0) 0.00% 2,058 (0)
StakingDelegateRewards 1,990,696 (0) notifyRewardAmount
setRewardReceiver
24,268 (0)
45,291 (0)
0.00%
0.00%
104,145 (+3)
45,447 (-1)
+0.00%
-0.00%
141,488 (0)
45,519 (0)
0.00%
0.00%
161,736 (0)
45,519 (0)
0.00%
0.00%
527 (0)
257 (0)

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.72%. Comparing base (8b90a4e) to head (4a59ad9).
Report is 1 commits behind head on master.

❗ Current head 4a59ad9 differs from pull request most recent head 62314f2. Consider uploading reports for the commit 62314f2 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #297      +/-   ##
==========================================
- Coverage   97.75%   97.72%   -0.03%     
==========================================
  Files          19       19              
  Lines         980      969      -11     
  Branches      200      198       -2     
==========================================
- Hits          958      947      -11     
  Partials       22       22              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@penandlim penandlim marked this pull request as ready for review March 27, 2024 14:30
@alphastorm alphastorm merged commit 637e7ed into master Mar 28, 2024
7 checks passed
@alphastorm alphastorm deleted the john/fixLockYfiViaCoveYfi branch March 28, 2024 17:13
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.

3 participants