Skip to content

Commit

Permalink
fix(MToken): rename allowance in burn
Browse files Browse the repository at this point in the history
  • Loading branch information
PierrickGT committed Aug 29, 2024
1 parent eb8fd53 commit ed31631
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/MToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ contract MToken is IMToken, ContinuousIndexing, ERC20Extended {

/// @inheritdoc IMToken
function burn(address account_, uint256 amount_) external onlyPortal {
uint256 spenderAllowance_ = allowance[account_][msg.sender];
uint256 portalAllowance_ = allowance[account_][portal];

if (spenderAllowance_ != type(uint256).max) {
if (spenderAllowance_ < amount_)
revert IERC20Extended.InsufficientAllowance(msg.sender, spenderAllowance_, amount_);
if (portalAllowance_ != type(uint256).max) {
if (portalAllowance_ < amount_)
revert IERC20Extended.InsufficientAllowance(portal, portalAllowance_, amount_);

unchecked {
_setAllowance(account_, msg.sender, spenderAllowance_ - amount_);
_setAllowance(account_, portal, portalAllowance_ - amount_);
}
}

Expand Down

0 comments on commit ed31631

Please sign in to comment.