Skip to content

Commit

Permalink
gas optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrowDom committed Dec 17, 2024
1 parent eb957f1 commit d285b32
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/contracts/token/OUSD.sol
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,13 @@ contract OUSD is Governable {
uint256 _value
) external returns (bool) {
require(_to != address(0), "Transfer to zero address");
require(_value <= allowances[_from][msg.sender], "Allowance exceeded");
uint256 userAllowance = allowances[_from][msg.sender];
require(_value <= userAllowance, "Allowance exceeded");

allowances[_from][msg.sender] -= _value;

unchecked {
allowances[_from][msg.sender] = userAllowance - _value;
}

_executeTransfer(_from, _to, _value);

Expand Down

0 comments on commit d285b32

Please sign in to comment.