Skip to content

Commit

Permalink
Update LibBonds.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Jul 3, 2024
1 parent 5fe7f36 commit 509e8a8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/protocol/contracts/L1/libs/LibBonds.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ library LibBonds {
)
internal
{
IERC20 tko = IERC20(_resolver.resolve(LibStrings.B_TAIKO_TOKEN, false));
tko.transferFrom(msg.sender, address(this), _amount);
_tko(_resolver).transferFrom(msg.sender, address(this), _amount);
_state.bondBalance[msg.sender] += _amount;
}

Expand All @@ -45,8 +44,7 @@ library LibBonds {
internal
{
_state.bondBalance[msg.sender] -= _amount;
IERC20 tko = IERC20(_resolver.resolve(LibStrings.B_TAIKO_TOKEN, false));
tko.transfer(msg.sender, _amount);
_tko(_resolver).transfer(msg.sender, _amount);
}

/// @dev Debits Taiko tokens as bonds.
Expand All @@ -70,8 +68,7 @@ library LibBonds {
}
emit BondDebited(_user, _amount);
} else {
IERC20 tko = IERC20(_resolver.resolve(LibStrings.B_TAIKO_TOKEN, false));
tko.transferFrom(_user, address(this), _amount);
_tko(_resolver).transferFrom(_user, address(this), _amount);
}
}

Expand All @@ -98,4 +95,8 @@ library LibBonds {
{
return _state.bondBalance[_user];
}

function _tko(IAddressResolver _resolver) private view returns (IERC20) {
return IERC20(_resolver.resolve(LibStrings.B_TAIKO_TOKEN, false));
}
}

0 comments on commit 509e8a8

Please sign in to comment.