Skip to content

Commit

Permalink
Merge 8bc218e into 5f83e1e
Browse files Browse the repository at this point in the history
  • Loading branch information
kamescg committed Jul 12, 2021
2 parents 5f83e1e + 8bc218e commit e6f2635
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions contracts/BadgerYieldSource.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ contract BadgerYieldSource is IYieldSource, ReentrancyGuard {
/// @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 nonReentrant {
badger.transferFrom(msg.sender, address(this), amount);
badger.approve(address(badgerSett), amount);

uint256 beforeBalance = badgerSett.balanceOf(address(this));
badgerSett.deposit(amount);
uint256 afterBalance = badgerSett.balanceOf(address(this));
IBadger _badger = badger;
IBadgerSett _badgerSett = badgerSett;
_badger.transferFrom(msg.sender, address(this), amount);
_badger.approve(address(_badgerSett), amount);

uint256 beforeBalance = _badgerSett.balanceOf(address(this));
_badgerSett.deposit(amount);
uint256 afterBalance = _badgerSett.balanceOf(address(this));
uint256 balanceDiff = afterBalance.sub(beforeBalance);
balances[to] = balances[to].add(balanceDiff);

Expand Down

0 comments on commit e6f2635

Please sign in to comment.