Storm-Labs-Inc / cove-contracts-boosties

Core smart contracts of the Cove Protocol
Other
18 stars 6 forks source link

feat: add seralized deposits and redeems to router #342

Closed penandlim closed 4 months ago

penandlim commented 6 months ago

Describe your changes

Add two new functions serializedDeposits() and serializedRedeems() to support cheaper and more accurate batched serialized actions.

Checklist before requesting a review

github-actions[bot] commented 6 months ago

Slither report

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

github-actions[bot] commented 6 months ago

Changes to gas cost

Generated at commit: a843637d7980899887f893f1a148ddd984adf21e, compared to commit: 2e0454128e616a02abd08fec8309499955231499

๐Ÿงพ Summary (10% most significant diffs)

Contract Method Avg (+/-) %
Yearn4626RouterExt multicall
redeemVaultV2
selfPermit
-34,288 โœ…
+44,180 โŒ
+7,366 โŒ
-8.07%
+13.23%
+19.94%
DYFIRedeemer receiveFlashLoan +8,642 โŒ +9.26%
MiniChefV3 harvestAndWithdraw +5,011 โŒ +3.09%
YearnGaugeStrategy withdraw +4,936 โŒ +2.80%

Full diff report ๐Ÿ‘‡
| Contract | Deployment Cost (+/-) | Method | Min (+/-) | % | Avg (+/-) | % | Median (+/-) | % | Max (+/-) | % | # Calls (+/-) | |:-|-:|:-|-:|-:|-:|-:|-:|-:|-:|-:|-:| | **Yearn4626RouterExt** | 3,677,248 (+223,962) | _approve_
_deposit_
_multicall_
_previewDeposits_
_previewMints_
_previewRedeems_
_previewWithdraws_
_pullToken_
_pullTokenWithPermit2_
_redeemFromRouter_
_redeemStakeDaoGauge_
_redeemVaultV2_
_selfPermit_
_withdrawFromRouter_ | 25,150 (0)
101,194 (+22)
48,187 (-62)
697 (+24)
673 (+46)
607 (-65)
674 (+46)
30,888 (+22)
24,489 (+12)
82,780 (+53)
492,117 (+22)
132,893 (+17)
14,844 (0)
140,539 (+76) | **0.00%**
**+0.02%**
**-0.13%**
**+3.57%**
**+7.34%**
**-9.67%**
**+7.32%**
**+0.07%**
**+0.05%**
**+0.06%**
**+0.00%**
**+0.01%**
**0.00%**
**+0.05%** | 52,303 (+12)
135,975 (+1,230)
390,796 (-34,288)
54,812 (+51)
54,584 (-191)
52,340 (+79)
37,175 (+8)
30,888 (+22)
113,658 (+12)
146,500 (+250)
496,168 (+36)
378,142 (+44,180)
44,306 (+7,366)
142,888 (+76) | **+0.02%**
**+0.91%**
**-8.07%**
**+0.09%**
**-0.35%**
**+0.15%**
**+0.02%**
**+0.07%**
**+0.01%**
**+0.17%**
**+0.01%**
**+13.23%**
**+19.94%**
**+0.05%** | 52,462 (+264)
121,763 (+20)
309,606 (-21,676)
55,300 (-72)
55,528 (-194)
52,760 (-161)
37,394 (+7)
30,888 (+22)
108,945 (+12)
146,731 (+101)
496,168 (+36)
132,941 (+46)
59,037 (+22,097)
142,888 (+76) | **+0.51%**
**+0.02%**
**-6.54%**
**-0.13%**
**-0.35%**
**-0.30%**
**+0.02%**
**+0.07%**
**+0.01%**
**+0.07%**
**+0.01%**
**+0.03%**
**+59.82%**
**+0.05%** | 53,252 (+589)
162,409 (+22)
895,784 (+61)
70,612 (+15,240)
55,528 (-194)
83,575 (+28,596)
66,394 (+7)
30,888 (+22)
212,254 (+12)
151,585 (+53)
500,220 (+51)
759,884 (+22)
59,037 (0)
145,237 (+76) | **+1.12%**
**+0.01%**
**+0.01%**
**+27.52%**
**-0.35%**
**+52.01%**
**+0.01%**
**+0.07%**
**+0.01%**
**+0.03%**
**+0.01%**
**+0.00%**
**0.00%**
**+0.05%** | 1,039 (+10)
1,028 (0)
4 (+1)
263 (+2)
262 (0)
264 (+2)
264 (0)
2 (+1)
4 (0)
516 (0)
2 (0)
516 (0)
3 (+1)
2 (0) | | **CoveYearnGaugeFactory** | 2,532,785 (0) | _getAllGaugeInfo_ | 1,255 (0) | **0.00%** | 1,387 (-175) | **-11.20%** | 1,255 (0) | **0.00%** | 7,780 (0) | **0.00%** | 263 (0) | | **DYFIRedeemer** | 2,139,607 (0) | _currentYfiRedeem_
_massRedeem_
_minYfiRedeem_
_receiveFlashLoan_
_setSlippage_ | 23,811 (0)
30,408 (0)
23,676 (-76)
23,419 (0)
24,054 (+60) | **0.00%**
**0.00%**
**-0.32%**
**0.00%**
**+0.25%** | 78,542 (-1)
440,472 (-823)
23,751 (-1)
101,968 (+8,642)
38,845 (-19) | **-0.00%**
**-0.19%**
**-0.00%**
**+9.26%**
**-0.05%** | 79,811 (0)
440,099 (0)
23,752 (0)
65,058 (+40,623)
30,088 (0) | **0.00%**
**0.00%**
**0.00%**
**+166.25%**
**0.00%** | 79,811 (0)
689,094 (0)
23,752 (0)
279,843 (0)
53,508 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 265 (0)
1,545 (0)
256 (0)
1,280 (0)
513 (0) | | **MiniChefV3** | 3,232,710 (0) | _commitReward_
_deposit_
_harvestAndWithdraw_
_rescue_
_setRewardPerSecond_ | 40,814 (0)
24,361 (0)
22,233 (0)
34,784 (0)
24,104 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 76,575 (+105)
120,739 (+1)
167,416 (+5,011)
47,959 (+7)
44,379 (+41) | **+0.14%**
**+0.00%**
**+3.09%**
**+0.01%**
**+0.09%** | 76,698 (0)
120,915 (+12)
171,002 (+12)
53,963 (+12)
47,197 (0) | **0.00%**
**+0.01%**
**+0.01%**
**+0.02%**
**0.00%** | 76,998 (0)
124,061 (0)
171,122 (0)
67,902 (0)
53,549 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 1,036 (0)
786 (0)
261 (0)
1,027 (0)
1,547 (0) | | **YearnGaugeStrategy** | 1,802,550 (-15,315) | _approve_
_deposit_
_redeem_
_report_
_withdraw_ | 49,303 (0)
30,717 (0)
294,218 (0)
58,515 (0)
74,620 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 49,394 (+7)
293,501 (+1,416)
300,895 (+5)
303,117 (+29)
181,075 (+4,936) | **+0.01%**
**+0.48%**
**+0.00%**
**+0.01%**
**+2.80%** | 49,399 (-12)
309,101 (0)
299,054 (-12)
69,644 (0)
236,223 (+34,687) | **-0.02%**
**0.00%**
**-0.00%**
**0.00%**
**+17.21%** | 49,411 (0)
447,887 (0)
309,375 (0)
914,862 (0)
256,843 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 512 (0)
7,938 (0)
769 (0)
5,890 (0)
1,792 (0) | | **YearnStakingDelegate** | 3,689,914 (0) | _claimBoostRewards_
_claimExitRewards_
_deposit_
_execute_
_harvest_
_lockYfi_
_setBoostRewardSplit_
_setDepositLimit_
_setExitRewardSplit_
_setGaugeRewardSplit_
_withdraw(address,uint256)_
_withdraw(address,uint256,address)_ | 23,475 (0)
23,498 (0)
26,589 (0)
27,929 (0)
24,054 (0)
23,730 (0)
24,389 (+12)
48,062 (0)
24,446 (+12)
25,608 (+24)
22,081 (0)
22,507 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**+0.05%**
**0.00%**
**+0.05%**
**+0.09%**
**0.00%**
**0.00%** | 96,483 (+245)
95,807 (+245)
220,947 (+1,286)
138,583 (+1,870)
312,529 (+1,270)
242,142 (+2)
27,773 (+25)
48,128 (-6)
27,830 (+25)
35,739 (+6)
242,725 (+1,390)
107,150 (+2,100) | **+0.25%**
**+0.26%**
**+0.59%**
**+1.37%**
**+0.41%**
**+0.00%**
**+0.09%**
**-0.01%**
**+0.09%**
**+0.02%**
**+0.58%**
**+2.00%** | 94,945 (0)
94,964 (0)
241,117 (+12)
149,303 (+78)
352,133 (0)
407,442 (0)
28,136 (0)
48,062 (0)
28,193 (0)
25,856 (0)
278,682 (0)
90,560 (0) | **0.00%**
**0.00%**
**+0.00%**
**+0.05%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 768,123 (0)
577,652 (0)
350,077 (0)
149,609 (0)
431,958 (0)
407,490 (0)
53,834 (0)
48,434 (0)
53,891 (0)
54,789 (0)
279,042 (0)
193,370 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 260 (0)
260 (0)
3,334 (0)
268 (0)
1,803 (0)
1,043 (0)
1,025 (0)
526 (0)
1,025 (0)
1,283 (0)
769 (0)
512 (0) | | **GaugeRewardReceiver** | 1,428,645 (0) | _harvest_ | 5,864 (0) | **0.00%** | 296,406 (+3,736) | **+1.28%** | 350,867 (0) | **0.00%** | 455,946 (0) | **0.00%** | 2,058 (0) | | **YSDRewardsGauge** | 3,896,771 (0) | _deposit_
_depositRewardToken_
_redeem_ | 2,732 (0)
124,845 (0)
8,327 (0) | **0.00%**
**0.00%**
**0.00%** | 194,275 (+1,114)
149,064 (+195)
135,857 (+1,536) | **+0.58%**
**+0.13%**
**+1.14%** | 178,853 (0)
149,219 (0)
127,219 (0) | **0.00%**
**0.00%**
**0.00%** | 451,162 (0)
153,694 (0)
243,239 (0) | **0.00%**
**0.00%**
**0.00%** | 2,048 (0)
512 (0)
1,024 (0) | | **CoveToken** | 3,495,457 (0) | _addAllowedReceiver_
_addAllowedSender_
_mint_
_removeAllowedReceiver_
_removeAllowedSender_
_transfer_ | 26,282 (0)
26,283 (0)
26,613 (0)
31,007 (0)
31,020 (0)
28,520 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 50,934 (+3)
50,383 (+3)
67,360 (+231)
42,425 (+4)
42,444 (+5)
50,062 (+254) | **+0.01%**
**+0.01%**
**+0.34%**
**+0.01%**
**+0.01%**
**+0.51%** | 55,323 (0)
55,120 (0)
75,561 (+12)
31,235 (0)
31,248 (0)
57,862 (0) | **0.00%**
**0.00%**
**+0.02%**
**0.00%**
**0.00%**
**0.00%** | 55,335 (0)
55,336 (0)
98,393 (0)
53,805 (0)
53,829 (0)
92,556 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 1,793 (0)
1,593 (0)
1,537 (0)
513 (0)
513 (0)
3,585 (0) | | **RewardForwarder** | 936,966 (0) | _forwardRewardToken_ | 8,239 (0) | **0.00%** | 113,771 (+163) | **+0.14%** | 160,655 (0) | **0.00%** | 169,692 (0) | **0.00%** | 1,280 (0) | | **StakingDelegateRewards** | 1,990,696 (0) | _notifyRewardAmount_ | 24,268 (0) | **0.00%** | 104,260 (+113) | **+0.11%** | 161,388 (+19,900) | **+14.06%** | 161,736 (0) | **0.00%** | 527 (0) | | **ERC20RewardsGauge** | 3,604,944 (0) | _deposit_
_depositRewardToken_ | 2,755 (0)
7,707 (0) | **0.00%**
**0.00%** | 96,516 (+15)
148,524 (+56) | **+0.02%**
**+0.04%** | 79,389 (0)
147,383 (0) | **0.00%**
**0.00%** | 216,659 (0)
195,467 (0) | **0.00%**
**0.00%** | 4,866 (0)
4,610 (0) |