Skip to content

Commit

Permalink
Add ability to implicitly specify "self" in multi-send
Browse files Browse the repository at this point in the history
  • Loading branch information
Philogy committed Nov 8, 2023
1 parent 52ce39c commit 4cee6ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/libraries/MultiSend.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ contract MultiSend {
// We offset the load address by 1 byte (operation byte)
// We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data.
let to := shr(0x60, mload(add(transactions, add(i, 0x01))))
// Defaults `to` to `address(this)` if `address(0)` is provided.
to := or(to, mul(iszero(to), address()))
// We offset the load address by 21 byte (operation byte + 20 address bytes)
let value := mload(add(transactions, add(i, 0x15)))
// We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes)
Expand Down
2 changes: 2 additions & 0 deletions contracts/libraries/MultiSendCallOnly.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ contract MultiSendCallOnly {
// We offset the load address by 1 byte (operation byte)
// We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data.
let to := shr(0x60, mload(add(transactions, add(i, 0x01))))
// Defaults `to` to `address(this)` if `address(0)` is provided.
to := or(to, mul(iszero(to), address()))
// We offset the load address by 21 byte (operation byte + 20 address bytes)
let value := mload(add(transactions, add(i, 0x15)))
// We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes)
Expand Down

0 comments on commit 4cee6ee

Please sign in to comment.