Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transfer helper #480

Merged
merged 15 commits into from
Jun 10, 2022
Merged

Add transfer helper #480

merged 15 commits into from
Jun 10, 2022

Conversation

stephankmin
Copy link
Contributor

Motivation

Add a helper contract to allow bulk transfers of ERC20/ERC721/ERC1155 to a specified recipient.

Solution

  • add TransferHelper.sol, TransferHelperInterface.sol, and TransferHelperStructs.sol
  • add Hardhat and Forge tests

@stephankmin stephankmin requested review from stuckinaboot and 0age June 9, 2022 18:48
Copy link
Contributor

@stuckinaboot stuckinaboot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! If possible address the GitHub action lints (about lines too long) but other than that looks good to me

@0age 0age merged commit 0a8e82c into main Jun 10, 2022
@0age 0age deleted the transfer-helper branch June 10, 2022 05:13
}

// Call the conduit and execute bulk transfers.
ConduitInterface(conduit).execute(conduitTransfers);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no validation this returns the magic, so solely TransferHelper depends on setup correctly with a valid conduit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this piece doesn't even use the conduitController, but derives an address from from the key. So as long as returndata is returned this is considered successful. Should really check the magic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and/or should perform the same check the ConduitController is doing: conduit.codehash == _CONDUIT_RUNTIME_CODE_HASH.

else {
// Derive the conduit address from the deployer, conduit key
// and creation code hash.
address conduit = address(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would make sense instead having a public function for this on the conduit, though that has a call cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants