Skip to content

Commit

Permalink
Save 3 gas on swap1 (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Omsify authored Jul 10, 2023
1 parent 5b34c49 commit e1e98c1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/tokens/ERC20.huff
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,8 @@
/// @notice Transfers an amount of tokens from one address to another.
#define macro _TRANSFER_GIVE_TO() = takes (3) returns (3) {
// input stack: [value, from, to]
dup3 // [to, value, from, to]
dup2 // [value, to, value, from, to]
swap1 // [to, value, value, from, to]
dup1 // [value, value, from, to]
dup4 // [to, value, value, from, to]
[BALANCE_SLOT] LOAD_ELEMENT_FROM_KEYS(0x00) // [balance, value, value, from, to]
add // [balance + value, value, from, to]
dup4 // [to, balance + value, value, from, to]
Expand Down

0 comments on commit e1e98c1

Please sign in to comment.