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

reduce SLOAD calls in supplyTokenTo #15

Merged
merged 2 commits into from
Jul 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions contracts/SushiYieldSource.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ contract SushiYieldSource is IYieldSource {
/// @param amount The amount of `token()` to be supplied
/// @param to The user whose balance will receive the tokens
function supplyTokenTo(uint256 amount, address to) external override {
sushiAddr.transferFrom(msg.sender, address(this), amount);
sushiAddr.approve(address(sushiBar), amount);

ISushiBar bar = sushiBar;
ISushi sushi = sushiAddr;

sushi.transferFrom(msg.sender, address(this), amount);
sushi.approve(address(bar), amount);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure when you merge to include your safe pr! #11


uint256 beforeBalance = bar.balanceOf(address(this));

bar.enter(amount);
Expand Down