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: poc deployless oracle #328

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

Conversation

penandlim
Copy link
Collaborator

Describe your changes

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

github-actions bot commented Apr 9, 2024

Semgrep report

┌─────────────────┐
│ 5 Code Findings │
└─────────────────┘

src/prices/DeploylessOracle.sol
 ❱ solidity.performance.non-payable-constructor.non-payable-constructor
      Consider making costructor payable to save gas.
      Details: https://sg.run/wRBd                   
                                                     
       52┆ constructor() {
       53┆     LogPricesHelper[] memory returnData = new LogPricesHelper[](8);
       54┆     _getPrice(returnData, 0, 0x7Fd8Af959B54A677a1D8F92265Bd0714274C56a3);
       55┆     _getPrice(returnData, 1, 0x28da6dE3e804bDdF0aD237CFA6048f2930D0b4Dc);
       56┆     _getPrice(returnData, 2, 0x81d93531720d86f0491DeE7D03f30b3b5aC24e59);
       57┆     _getPrice(returnData, 3, 0x6130E6cD924a40b24703407F246966D7435D4998);
       58┆     _getPrice(returnData, 4, 0x107717C98C8125A94D3d2Cc82b86a1b705f3A27C);
       59┆     _getPrice(returnData, 5, 0x622fA41799406B120f9a40dA843D358b7b2CFEE3);
       60┆     _getPrice(returnData, 6, 0x128e72DfD8b00cbF9d12cB75E846AC87B83DdFc9);
       61┆     _getPrice(returnData, 7, 0x5943F7090282Eb66575662EADf7C60a717a7cE4D);
         [hid 14 additional lines, adjust with --max-lines-per-finding] 
                                   
src/prices/DeploylessOracleViem.sol
 ❱ solidity.performance.non-payable-constructor.non-payable-constructor
      Consider making costructor payable to save gas.
      Details: https://sg.run/wRBd                   
                                                     
       89┆ constructor() { }

 ❱ solidity.performance.array-length-outside-loop.array-length-outside-loop
      Caching the array length outside a loop saves reading it on each iteration, as long as the array's
      length is not changed during the loop.                                                            
      Details: https://sg.run/r4LJ                                                                      
                                                                                                        
       96┆ for (uint256 i = 0; i < gaugeInfo.length; i++) {

 ❱ solidity.performance.unnecessary-checked-arithmetic-in-loop.unnecessary-checked-arithmetic-in-loop
      A lot of times there is no risk that the loop counter can overflow.  Using Solidity's unchecked
      block saves the overflow checks.                                                               
      Details: https://sg.run/OvDk                                                                   
                                                                                                     
       96┆ for (uint256 i = 0; i < gaugeInfo.length; i++) {

 ❱ solidity.performance.use-prefix-increment-not-postfix.use-prefix-increment-not-postfix
      Consider using the prefix increment expression whenever the return value is not needed. The prefix
      increment expression is cheaper in terms of gas.                                                  
      Details: https://sg.run/nxLr                                                                      
                                                                                                        
       96┆ for (uint256 i = 0; i < gaugeInfo.length; i++) {

Copy link

github-actions bot commented Apr 9, 2024

Changes to gas cost

Generated at commit: 31eb775faaf792dac6f8534fef1a382ca41dbd1f, compared to commit: ca2468e76f7f9534c77d5d92d09c25e0505e7d74

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
DYFIRedeemer 2,139,607 (0) receiveFlashLoan 23,419 (0) 0.00% 101,318 (-452) -0.44% 56,732 (0) 0.00% 279,843 (0) 0.00% 1,280 (0)
SwapAndLock 1,183,769 (0) setDYfiRedeemer 23,966 (0) 0.00% 63,711 (+2) +0.00% 76,054 (0) 0.00% 76,289 (0) 0.00% 1,296 (0)
YearnStakingDelegate 3,689,950 (0) deposit 26,589 (0) 0.00% 220,783 (+1) +0.00% 241,123 (+6) +0.00% 350,077 (0) 0.00% 3,334 (0)

Copy link

github-actions bot commented Apr 9, 2024

Slither report

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