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

Decrease Batch Transfer gas usage 7%, reduce contract deployment gas by 21% #144

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
update ERC721BatchTransferContract address in constants
tenthirtyone committed Aug 8, 2024
commit c34b7403efc8a36d26536754e63ccdce198d9825
42 changes: 20 additions & 22 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dotenv/config';

import "@nomicfoundation/hardhat-verify";
import '@nomicfoundation/hardhat-verify';
import '@nomiclabs/hardhat-waffle';
import '@typechain/hardhat';
import 'hardhat-contract-sizer';
@@ -56,7 +56,7 @@ const config: HardhatUserConfig = {
runs: 20,
details: {
yulDetails: {
optimizerSteps: "dhfoD[xarrscLMcCTU]uljmul",
optimizerSteps: 'dhfoD[xarrscLMcCTU]uljmul',
},
},
},
@@ -77,8 +77,8 @@ const config: HardhatUserConfig = {
networks: {
hardhat: {
accounts: {
accountsBalance: '1000000000000000000000'
}
accountsBalance: '1000000000000000000000',
},
},
base: {
url: process.env.BASE_URL || '',
@@ -130,8 +130,8 @@ const config: HardhatUserConfig = {
apiKey: process.env.ETHERSCAN_API_KEY,
},
sourcify: {
enabled: true
}
enabled: true,
},
};

task('setStages', 'Set stages for ERC721M')
@@ -146,7 +146,6 @@ task('setStages', 'Set stages for ERC721M')
)
.setAction(setStages);


task('set1155Stages', 'Set stages for ERC721M')
.addParam('contract', 'contract address')
.addParam('stages', 'stages json file')
@@ -181,10 +180,7 @@ task('deploy', 'Deploy ERC721M')
'ERC-20 contract address (if minting with ERC-20)',
'0x0000000000000000000000000000000000000000',
)
.addOptionalParam(
'fundreceiver',
'The treasury wallet to receive mint fund',
)
.addOptionalParam('fundreceiver', 'The treasury wallet to receive mint fund')
.addParam<boolean>(
'useoperatorfilterer',
'whether or not to use operator filterer, used with legacy 721M contract',
@@ -228,7 +224,6 @@ task('deploy', 'Deploy ERC721M')
await deploy(tasksArgs, hre);
});


task('deploy1155', 'Deploy ERC1155M')
.addParam('name', 'name')
.addParam('symbol', 'symbol')
@@ -240,10 +235,7 @@ task('deploy1155', 'Deploy ERC1155M')
'ERC-20 contract address (if minting with ERC-20)',
'0x0000000000000000000000000000000000000000',
)
.addOptionalParam(
'fundreceiver',
'The treasury wallet to receive mint fund',
)
.addOptionalParam('fundreceiver', 'The treasury wallet to receive mint fund')
.addParam<boolean>(
'openedition',
'whether or not a open edition mint (unlimited supply, 999,999,999)',
@@ -267,7 +259,7 @@ task('deploy1155', 'Deploy ERC1155M')
await hre.run('compile');
console.log('Deploying...');
await deploy1155(tasksArgs, hre);
});
});

task('setBaseURI', 'Set the base uri')
.addParam('uri', 'uri')
@@ -309,7 +301,6 @@ task('ownerMint1155', 'Mint token(s) as owner for ERC1155M')
.addOptionalParam('gaslimit', 'Set maximum gas units to spend on transaction')
.setAction(ownerMint1155);


task('setGlobalWalletLimit', 'Set the global wallet limit')
.addParam('contract', 'contract address')
.addParam('limit', 'global wallet limit (0 for no global limit)')
@@ -459,13 +450,16 @@ task('thawTrading', 'Thaw trading for 721Cv2')

task('cleanWhitelist', 'Clean up whitelist')
.addOptionalParam('whitelistpath', 'plain whitelist path')
.addOptionalParam('variablewalletlimitpath', 'variable wallet limit whitelist path')
.setAction(cleanWhitelist)
.addOptionalParam(
'variablewalletlimitpath',
'variable wallet limit whitelist path',
)
.setAction(cleanWhitelist);

task('deployCloneFactory', 'Deploy 721CMRoyalties clone factory')
.addOptionalParam('gaspricegwei', 'Set gas price in Gwei')
.addOptionalParam('gaslimit', 'Set maximum gas units to spend on transaction')
.setAction(deployCloneFactory)
.setAction(deployCloneFactory);

task('deployClone', 'Create 721CMRoyalties cline')
.addParam('name', 'name')
@@ -474,7 +468,11 @@ task('deployClone', 'Create 721CMRoyalties cline')
.addParam('tokenurisuffix', 'token uri suffix', '.json')
.addParam('globalwalletlimit', 'global wallet limit', '0')
.addParam('timestampexpiryseconds', 'timestamp expiry in seconds', '300')
.addParam('mintcurrency','ERC-20 contract address. 0x0 if using native token','0x0000000000000000000000000000000000000000')
.addParam(
'mintcurrency',
'ERC-20 contract address. 0x0 if using native token',
'0x0000000000000000000000000000000000000000',
)
.addParam('fundreceiver', 'The treasury wallet to receive mint fund')
.addParam('royaltyreceiver', 'erc2198 royalty receiver address')
.addParam('royaltyfeenumerator', 'erc2198 royalty fee numerator')
5 changes: 3 additions & 2 deletions scripts/common/constants.ts
Original file line number Diff line number Diff line change
@@ -13,11 +13,12 @@ export const ContractDetails = {
} as const;

export const ERC721BatchTransferContract =
'0x38F7ba911f7efc434D29D6E39c814E9d4De3FEef';
'0x2d9082592Db4A7C2536A1cEDc33Cc2a53a75Bf27';

export const ERC721CV2_VALIDATOR = '0x721C00182a990771244d7A71B9FA2ea789A3b433';
export const ERC721CV2_FREEZE_LEVEL = 4;
export const ERC721CV2_EMPTY_LIST = 4;

// Mainnet, Polygon, Base
export const ERC721CMRoyaltiesCloneFactoryContract = '0x7cEEd7215D71393d56966dA48C5727851326e101';
export const ERC721CMRoyaltiesCloneFactoryContract =
'0x7cEEd7215D71393d56966dA48C5727851326e101';