Skip to content

fopina/bulktransfer-contract

Repository files navigation

BulkTransfer

tests license

BulkTransfer main use case is for an EOA to save some gas by batching multiple transferFrom calls.

It has 3 functions

function description gas comments
bulkTransfer20(address token, Call[] calls) Transfers ERC20 token to an array of (target, amount) tuples. Comparing testGasBaseline20 with testGasTransfer20*, it's not worth using for less than 4 transfers
bulkTransfer721(address token, Call[] calls) Transfer ERC721 token to an array of (target, tokenId) tuples. Comparing testGasBaseline721 with testGasTransfer721*, it's already slightly worth for 2 transfers (and it gets better)
bulkTransfer721Lite(address token, address to, uint256[] tokenIds) Transfer an array of tokenIds of ERC721 token to a single address. Comparing testGasBaseline721 with testGasTransfer721Lite*, it's already quite worth for 2 transfers (and it gets even better)

Do not forget either approve (ERC20/721) or setApprovalForAll (ERC721) need to be used before any of these.

Usage

ABI is available in Snowtrace.

Check the examples.

Deployments

Check DEPLOYMENTS.md

Security

This contract is unaudited.

Development

This repo uses Foundry for development and testing and git submodules for dependency management.

Clone the repo and run forge test to run tests. Forge will automatically install any missing dependencies.

About

Save some gas by batching multiple transferFrom calls.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published