Skip to content

Commit

Permalink
Merge pull request #695 from Philogy/main
Browse files Browse the repository at this point in the history
Add ability to implicitly specify "self" in multi-send
  • Loading branch information
mmv08 authored Nov 13, 2023
2 parents b71c65f + 4cee6ee commit 5aad84f
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 5aad84f

Please sign in to comment.