We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ye0lde
Eliminating intermediate variables and reducing state variable references can reduce gas usage and improve code clarity.
The handleFees function is here: https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L148-L151
handleFees
I suggest this refactoring for #L148-L151:
emit NewIBRatio(ibRatio = ibRatio * startSupply / totalSupply());
The updateIBRatio function is here: https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L266-L272
updateIBRatio
I suggest this refactoring:
function updateIBRatio(uint256 newRatio) onlyAuction external override returns (uint256) { emit NewIBRatio(ibRatio = newRatio); return newRatio; }
Visual Studio Code, Remix
See POC for details.
The text was updated successfully, but these errors were encountered:
ye0lde issue #161
f181cb7
No branches or pull requests
Handle
ye0lde
Vulnerability details
Impact
Eliminating intermediate variables and reducing state variable references can reduce gas usage and improve code clarity.
Proof of Concept
The
handleFees
function is here:https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L148-L151
I suggest this refactoring for #L148-L151:
The
updateIBRatio
function is here:https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L266-L272
I suggest this refactoring:
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
See POC for details.
The text was updated successfully, but these errors were encountered: