-
Notifications
You must be signed in to change notification settings - Fork 23
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
optimizooor #7
base: master
Are you sure you want to change the base?
optimizooor #7
Conversation
can you run a comparison of gas usage before and after your optimizations? npm test test/lendingPool.js should give you gas costs |
uint40 lastUpdateDailyBorrows; | ||
mapping(address => bool) public liquidators; | ||
mapping(address => uint) public liquidators; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you verified that this is in fact cheaper? i think it should be but havent verified it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saves 16168 gas on deployment and a whopping 12 gas on addLiquidator()
@@ -72,7 +72,11 @@ contract LendingPool is OwnableUpgradeable, ERC721Upgradeable, Clone { | |||
if(toReduce > currentDailyBorrows){ | |||
currentDailyBorrows = toAdd; | |||
} else { | |||
currentDailyBorrows = uint216(currentDailyBorrows - toReduce) + toAdd; | |||
unchecked { | |||
// Resulting daily borrow has to be over 10^47 ETH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is safu because we know toReduce <= currentDailyBorrows, so (currentDailyBorrows - toReduce) >= 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llama agrees
wen merge |
No description provided.