Decrease Batch Transfer gas usage 7%, reduce contract deployment gas by 21%#144
Open
tenthirtyone wants to merge 12 commits intome-foundation:mainfrom
Open
Decrease Batch Transfer gas usage 7%, reduce contract deployment gas by 21%#144tenthirtyone wants to merge 12 commits intome-foundation:mainfrom
tenthirtyone wants to merge 12 commits intome-foundation:mainfrom
Conversation
channing-magiceden
approved these changes
Jul 30, 2024
Contributor
|
Can you also update the contract address here: https://github.com/me-foundation/magicdrop/blob/424291130abdeb2645a159c3c5b28658b54f2958/scripts/send721Batch.ts#L3C10-L3C37 ? |
Contributor
Author
|
👍 @channing-magiceden Roger that. Contract deployed and verified on mainnet, polygon and base https://etherscan.io/address/0x2d9082592Db4A7C2536A1cEDc33Cc2a53a75Bf27#code |
Contributor
|
@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 <AlexSherbuck@gmail.com>
Contributor
Author
|
@nothing0012 good to go 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
batchTransferToSingleWallettransfers 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
batchTransferToSingleWalletfunction to the HH gas limit. Change.skipto.onlyor just remove.skipbut 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
fromaddresses and prefers to see msg.sender as thefromaddress. The contracts were correctly usingmsg.senderbut were instantiating a variable to do so.