-
Notifications
You must be signed in to change notification settings - Fork 41
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
Decrease Batch Transfer gas usage 7%, reduce contract deployment gas by 21% #144
base: main
Are you sure you want to change the base?
Decrease Batch Transfer gas usage 7%, reduce contract deployment gas by 21% #144
Conversation
Can you also update the contract address here: https://github.com/me-foundation/magicdrop/blob/424291130abdeb2645a159c3c5b28658b54f2958/scripts/send721Batch.ts#L3C10-L3C37 ? |
👍 @channing-magiceden Roger that. Contract deployed and verified on mainnet, polygon and base https://etherscan.io/address/0x2d9082592Db4A7C2536A1cEDc33Cc2a53a75Bf27#code |
@tenthirtyone can you rebase? |
* Clear _totalMintFee in withdraw * Fix more
* Add authorizedMint and whitelist Reservoir Relay EOA * Add ability to change authorizedMinter list * pump version
Signed-off-by: Alex Sherbuck <[email protected]>
@nothing0012 good to go 👍 |
Description
This change removes an ownership check and relies on the 721 standard's internal ownership check to enforce token ownership and reduces variable declarations. It increases gas usage effectiveness by ~7%. The previous max number of
batchTransferToSingleWallet
transfers was 777 under ideal conditions. With these changes 834 batch transfers are possible in the same amount of gas.The code removals also reduce the amount of gas needed to deploy from 499,259 to 390,851 ~ 21%. You can test the deployment gas changes by changing this line to be:
To Test
There is a new, skipped, unit test that pushes the
batchTransferToSingleWallet
function to the HH gas limit. Change.skip
to.only
or just remove.skip
but the test will take ~10s to use up the entire block gas.Notes
This also removes a false positive high risk from slither output. Slither doesn't like arbitrary
from
addresses and prefers to see msg.sender as thefrom
address. The contracts were correctly usingmsg.sender
but were instantiating a variable to do so.