From ab03510d589271002e3aa38a51b4f6d3eacb8b46 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Thu, 24 Apr 2025 16:51:13 +0100 Subject: [PATCH 01/12] update contract addresses and impl ids --- cli/cmds/const | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/cli/cmds/const b/cli/cmds/const index 1323e25d..6a83d9d6 100644 --- a/cli/cmds/const +++ b/cli/cmds/const @@ -38,39 +38,25 @@ DEFAULT_IMPL_ID="0" get_factory_address() { # abstract factory address if [ "$chain_id" == "2741" ]; then - echo "0x4a08d3F6881c4843232EFdE05baCfb5eAaB35d19" + echo "0x01c1C2f5271aDeA338dAfba77121Fc20B5176620" else # default - echo "0x000000009e44eBa131196847C685F20Cd4b68aC4" + echo "0x00000000bEa935F8315156894Aa4a45D3c7a0075" fi } get_registry_address() { # abstract registry address if [ "$chain_id" == "2741" ]; then - echo "0x9b60ad31F145ec7EE3c559153bB57928B65C0F87" + echo "0x17c9921D99c1Fa6d3dC992719DA1123dCb2CaedA" else # default - echo "0x00000000caF1E3978e291c5Fb53FeedB957eC146" + echo "0x000000000e447e71b2EC36CD62048Dd2a1Cd0a57" fi } # The latest MagicDrop v1.0.1 implementation ID for each supported chain. get_impl_id() { if [ "$token_standard" == "ERC721" ] && [ "$use_erc721c" == "true" ]; then - if [ "$chain_id" == "2741" ]; then - echo "7" # ERC721C implementation ID / abstract - elif [ "$chain_id" == "8453" ]; then - echo "11" # base - elif [ "$chain_id" == "1" ]; then - echo "10" # ethereum - elif [ "$chain_id" == "80094" ]; then - echo "5" # berachain - elif [ "$chain_id" == "10143"]; then - echo "5" # monad testnet - elif [ "$chain_id" == "43114" ]; then - echo "6" # avalanche - else - echo "8" # all other chains - fi + echo "2" # 721C implementation ID on all chains else echo $DEFAULT_IMPL_ID fi From 4c1c5d99e702572e8602fab40653f00349ef32b6 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Thu, 24 Apr 2025 17:40:48 +0100 Subject: [PATCH 02/12] migrate to global mintFee from stage based --- cli/cmds/common | 9 ++++ cli/cmds/contract | 44 +++++++++++++++++++- cli/cmds/main_menu | 4 ++ cli/cmds/utils | 11 +++++ cli/collections/example/erc1155_example.json | 4 +- cli/collections/example/erc721_example.json | 4 +- scripts/utils/getStagesData.ts | 17 +------- scripts/utils/parseMintFee.ts | 3 ++ 8 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 scripts/utils/parseMintFee.ts diff --git a/cli/cmds/common b/cli/cmds/common index 51fc5e28..c4d5c32f 100644 --- a/cli/cmds/common +++ b/cli/cmds/common @@ -219,6 +219,15 @@ set_cosigner_address() { fi } +set_mint_fee() { + if is_unset_or_null "$mint_fee"; then + show_title "$title" "> Enter mint fee <" + mint_fee=$(get_numeric_input "Enter a decimal mint fee") + check_input "$mint_fee" "mint fee" + clear + fi +} + set_timestamp_expiry() { if is_unset_or_null "$timestamp_expiry"; then show_title "$title" "> Enter the timestamp expiry <" diff --git a/cli/cmds/contract b/cli/cmds/contract index 111d751a..6f576591 100644 --- a/cli/cmds/contract +++ b/cli/cmds/contract @@ -448,9 +448,9 @@ set_stages_contract() { if gum confirm "Do you want to proceed?"; then if [ "$token_standard" == "ERC1155" ]; then - set_stages_selector="setStages((uint80[],uint80[],uint32[],bytes32[],uint24[],uint256,uint256)[])" + set_stages_selector="setStages((uint80[],uint32[],bytes32[],uint24[],uint256,uint256)[])" elif [ "$token_standard" == "ERC721" ]; then - set_stages_selector="setStages((uint80,uint80,uint32,bytes32,uint24,uint256,uint256)[])" + set_stages_selector="setStages((uint80,uint32,bytes32,uint24,uint256,uint256)[])" else echo "Unknown token standard" exit 1 @@ -475,6 +475,46 @@ set_stages_contract() { fi } +set_mint_fee_contract() { + clear + trap "echo 'Exiting...'; exit 1" SIGINT + + title="Set Mint Fee" + + set_chain + set_contract_address + set_mint_fee + + echo "" + echo "You are about to set the mint fee of $(format_address $contract_address) to $mint_fee" + echo "" + + print_signer_with_balance $chain_id + + if gum confirm "Do you want to proceed?"; then + set_mint_fee_selector="setMintFee(uint256)" + password=$(get_password_if_set) + + echo "Setting mint fee... this will take a moment." + + parsed_mint_fee=$(parse_mint_fee "$mint_fee") + + output=$(cast send $contract_address \ + $set_mint_fee_selector \ + $parsed_mint_fee \ + $password \ + $(zksync_flag) \ + --chain-id $chain_id \ + --rpc-url "$RPC_URL" \ + --json) + + print_transaction_hash + else + echo "Set mint fee cancelled." + echo "" + fi +} + set_cosigner_contract() { clear trap "echo 'Exiting...'; exit 1" SIGINT diff --git a/cli/cmds/main_menu b/cli/cmds/main_menu index f8f957ee..f10bf487 100755 --- a/cli/cmds/main_menu +++ b/cli/cmds/main_menu @@ -62,6 +62,7 @@ contract_management_menu() { "Set Base URI (ERC721 Only)" \ "Set URI (ERC1155 Only)" \ "Set Stages" \ + "Set Mint Fee" \ "Set Royalties" \ "Set Global Wallet Limit" \ "Set Max Mintable Supply" \ @@ -94,6 +95,9 @@ contract_management_menu() { "Set Stages") set_stages_contract ;; + "Set Mint Fee") + set_mint_fee_contract + ;; "Set Timestamp Expiry") set_timestamp_expiry_contract ;; diff --git a/cli/cmds/utils b/cli/cmds/utils index 6f80ed66..bb865184 100644 --- a/cli/cmds/utils +++ b/cli/cmds/utils @@ -92,6 +92,17 @@ process_stages() { fi } +parse_mint_fee() { + parsed_mint_fee=$(npx ts-node "$BASE_DIR/../../scripts/utils/parseMintFee.ts" "$mint_fee") + + if [[ $? -ne 0 ]]; then + echo "Error: Failed to parse mint fee" + exit 1 + fi + + echo "$parsed_mint_fee" +} + get_contract_address_from_logs() { local deployment_data="$1" local event_sig="$2" diff --git a/cli/collections/example/erc1155_example.json b/cli/collections/example/erc1155_example.json index 90603ded..cc7325ed 100644 --- a/cli/collections/example/erc1155_example.json +++ b/cli/collections/example/erc1155_example.json @@ -12,17 +12,16 @@ "mintable": true, "cosigner": "0x0000000000000000000000000000000000000000", "uri": "https://example.com/token/", + "mintFee": "0.0001", "stages": [ { "price": ["0.0069"], - "mintFee": ["0.0001"], "walletLimit": [5], "startTime": "2024-11-04T16:30:00Z", "endTime": "2024-11-07T16:25:00Z" }, { "price": ["0.0042"], - "mintFee": ["0.0001"], "walletLimit": [5], "maxStageSupply": [420], "startTime": "2024-11-07T16:30:00Z", @@ -30,7 +29,6 @@ }, { "price": ["0.069"], - "mintFee": ["0.0001"], "walletLimit": [5], "maxStageSupply": [69], "startTime": "2024-12-09T16:05:00Z", diff --git a/cli/collections/example/erc721_example.json b/cli/collections/example/erc721_example.json index 1c853bc1..ae277b3b 100644 --- a/cli/collections/example/erc721_example.json +++ b/cli/collections/example/erc721_example.json @@ -14,17 +14,16 @@ "tokenUriSuffix": ".json", "uri": "https://example.com/token/", "useERC721C": false, + "mintFee": "0.0001", "stages": [ { "price": "0.0069", - "mintFee": "0.0001", "walletLimit": 5, "startTime": "2024-11-04T16:30:00Z", "endTime": "2024-11-07T16:25:00Z" }, { "price": "0.0042", - "mintFee": "0.0001", "walletLimit": 5, "maxStageSupply": 420, "startTime": "2024-11-07T16:30:00Z", @@ -32,7 +31,6 @@ }, { "price": "0.069", - "mintFee": "0.0001", "walletLimit": 5, "maxStageSupply": 69, "startTime": "2024-12-09T16:05:00Z", diff --git a/scripts/utils/getStagesData.ts b/scripts/utils/getStagesData.ts index 0f25b0f1..016c2dc4 100644 --- a/scripts/utils/getStagesData.ts +++ b/scripts/utils/getStagesData.ts @@ -6,7 +6,6 @@ import path from 'path'; type Stage = { price: number; - mintFee: number; walletLimit: number; whitelistPath?: string; maxStageSupply: number; @@ -16,7 +15,6 @@ type Stage = { type Stage1155 = { price: number[]; - mintFee: number[]; walletLimit: number[]; whitelistPath?: string[]; maxStageSupply: number[]; @@ -201,11 +199,6 @@ function isStage(stage: any): stage is Stage { isValid = false; } - if (!isNumberOrString(stage.mintFee)) { - console.error('Invalid mintFee', stage.mintFee); - isValid = false; - } - if (!isNumberOrString(stage.walletLimit)) { console.error('Invalid walletLimit', stage.walletLimit); isValid = false; @@ -252,11 +245,6 @@ function isStage1155(stage: any): stage is Stage1155 { isValid = false; } - if (!Array.isArray(stage.mintFee) || !stage.mintFee.every(isNumberOrString)) { - console.error('Invalid mintFee array', stage.mintFee); - isValid = false; - } - if ( !Array.isArray(stage.walletLimit) || !stage.walletLimit.every(isNumberOrString) @@ -307,7 +295,7 @@ function isStage1155(stage: any): stage is Stage1155 { * @throws Error if any arrays have inconsistent lengths * * @remarks - * - Required arrays (must exist): price, mintFee, walletLimit + * - Required arrays (must exist): price, walletLimit * - Optional arrays: whitelistPath, maxStageSupply * - All present arrays must have the same length as they correspond to different * properties for each token ID in the collection @@ -316,7 +304,6 @@ function verifyStage1155ArrayLengths(stage: Stage1155): void { // Define required fields that must always be arrays const requiredArrayFields = [ { name: 'price', array: stage.price }, - { name: 'mintFee', array: stage.mintFee }, { name: 'walletLimit', array: stage.walletLimit }, ]; @@ -375,7 +362,6 @@ const processERC1155Stage = async ( return formatStageData([ `[${stage.price.map((p) => ethers.utils.parseEther(p.toString())).join(',')}]`, - `[${stage.mintFee.map((f) => ethers.utils.parseEther(f.toString())).join(',')}]`, `[${stage.walletLimit.join(',')}]`, `[${merkleRoots.join(',')}]`, `[${maxStageSupply.join(',')}]`, @@ -458,7 +444,6 @@ const processERC721Stage = async ( return formatStageData([ ethers.utils.parseEther(stage.price.toString()), - ethers.utils.parseEther(stage.mintFee.toString()), stage.walletLimit, merkleRoot, stage.maxStageSupply ?? 0, diff --git a/scripts/utils/parseMintFee.ts b/scripts/utils/parseMintFee.ts new file mode 100644 index 00000000..bdfa6fc4 --- /dev/null +++ b/scripts/utils/parseMintFee.ts @@ -0,0 +1,3 @@ +import { ethers } from 'ethers'; + +export const parseMintFee = (mintFee: number) => ethers.utils.parseEther(mintFee.toString()); \ No newline at end of file From b175a8e531a26921a363f46ecfa994bca5bb9216 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Thu, 24 Apr 2025 17:48:30 +0100 Subject: [PATCH 03/12] update examples --- cli/collections/template/erc1155_template.json | 2 +- cli/collections/template/erc721_template.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/collections/template/erc1155_template.json b/cli/collections/template/erc1155_template.json index 059058d4..35772dc4 100644 --- a/cli/collections/template/erc1155_template.json +++ b/cli/collections/template/erc1155_template.json @@ -12,10 +12,10 @@ "mintable": true, "cosigner": "0x0000000000000000000000000000000000000000", "uri": "", + "mintFee": "", "stages": [ { "price": [""], - "mintFee": [""], "walletLimit": [0], "startTime": "2024-11-04T16:30:00Z", "endTime": "2024-11-07T16:25:00Z" diff --git a/cli/collections/template/erc721_template.json b/cli/collections/template/erc721_template.json index 5a37000f..76fd51e9 100644 --- a/cli/collections/template/erc721_template.json +++ b/cli/collections/template/erc721_template.json @@ -14,10 +14,10 @@ "tokenUriSuffix": ".json", "uri": "", "useERC721C": false, + "mintFee": "", "stages": [ { "price": "", - "mintFee": "", "walletLimit": 0, "startTime": "2024-11-04T16:30:00Z", "endTime": "2024-11-07T16:25:00Z" From 89d2a8745f0777102ac4f44690c6d97398f3944a Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Thu, 24 Apr 2025 19:51:04 +0100 Subject: [PATCH 04/12] fix flow --- cli/cmds/common | 10 +++---- cli/cmds/contract | 27 +++++++++++++++---- cli/cmds/display | 1 + cli/collections/example/erc1155_example.json | 1 - cli/collections/example/erc721_example.json | 1 - .../template/erc1155_template.json | 1 - cli/collections/template/erc721_template.json | 1 - scripts/utils/parseMintFee.ts | 14 +++++++++- 8 files changed, 40 insertions(+), 16 deletions(-) diff --git a/cli/cmds/common b/cli/cmds/common index c4d5c32f..031c64f8 100644 --- a/cli/cmds/common +++ b/cli/cmds/common @@ -220,12 +220,10 @@ set_cosigner_address() { } set_mint_fee() { - if is_unset_or_null "$mint_fee"; then - show_title "$title" "> Enter mint fee <" - mint_fee=$(get_numeric_input "Enter a decimal mint fee") - check_input "$mint_fee" "mint fee" - clear - fi + show_title "$title" "> Enter mint fee <" + mint_fee=$(gum input --placeholder "Enter a decimal mint fee (e.g. 0.0001)") + check_input "$mint_fee" "mint fee" + clear } set_timestamp_expiry() { diff --git a/cli/cmds/contract b/cli/cmds/contract index 6f576591..3e2236ef 100644 --- a/cli/cmds/contract +++ b/cli/cmds/contract @@ -29,6 +29,12 @@ deploy_contract() { value="--value $deployment_fee" fi + echo "Fetching mint fee..." + mint_fee=$(cast call $registry_address "getMintFee(uint8,uint32)" $standard_id $impl_id --rpc-url "$RPC_URL" $password) + if [ "$mint_fee" == "0" ]; then + value="--value $mint_fee" + fi + confirm_deployment echo "Deploying contract... this may take a minute." @@ -50,7 +56,7 @@ deploy_contract() { print_transaction_hash - sig_event=$(cast sig-event "NewContractInitialized(address,address,uint32,uint8,string,string)") + sig_event=$(cast sig-event "NewContractInitialized(address,address,uint32,uint8,string,string,uint256)") event_data=$(get_contract_address_from_logs "$output" "$sig_event") chunks=($(echo "$event_data" | fold -w64)) contract_address=$(decode_address "${chunks[0]}") @@ -80,6 +86,11 @@ deploy_contract() { if gum confirm "Would you like to setup the contract?"; then setup_contract fi + + # ask if they would like to set the mint fee now + if gum confirm "Would you like to set the mint fee?"; then + set_mint_fee_contract + fi } supports_icreatortoken() { @@ -201,9 +212,9 @@ setup_contract() { password=$(get_password_if_set) if [ "$token_standard" == "ERC1155" ]; then - setup_selector="setup(string,uint256[],uint256[],address,address,(uint80[],uint80[],uint32[],bytes32[],uint24[],uint256,uint256)[],address,uint96)" + setup_selector="setup(string,uint256[],uint256[],address,address,(uint80[],uint32[],bytes32[],uint24[],uint256,uint256)[],address,uint96)" elif [ "$token_standard" == "ERC721" ]; then - setup_selector="setup(string,string,uint256,uint256,address,address,(uint80,uint80,uint32,bytes32,uint24,uint256,uint256)[],address,uint96)" + setup_selector="setup(string,string,uint256,uint256,address,address,(uint80,uint32,bytes32,uint24,uint256,uint256)[],address,uint96)" else echo "Unknown token standard" exit 1 @@ -497,11 +508,17 @@ set_mint_fee_contract() { echo "Setting mint fee... this will take a moment." + # Add error handling for parse_mint_fee parsed_mint_fee=$(parse_mint_fee "$mint_fee") + if [ $? -ne 0 ]; then + echo "Error: Failed to parse mint fee" + exit 1 + fi + echo "Parsed mint fee: $parsed_mint_fee" output=$(cast send $contract_address \ - $set_mint_fee_selector \ - $parsed_mint_fee \ + "$set_mint_fee_selector" \ + "$parsed_mint_fee" \ $password \ $(zksync_flag) \ --chain-id $chain_id \ diff --git a/cli/cmds/display b/cli/cmds/display index 9db1e390..a1a0d3a9 100644 --- a/cli/cmds/display +++ b/cli/cmds/display @@ -80,6 +80,7 @@ confirm_deployment() { fi echo "Chain ID: $(gum style --foreground 212 "$chain_id")" echo "Deployment Fee: $(gum style --foreground 212 "$deployment_fee")" + echo "Mint Fee: $(gum style --foreground 212 "$mint_fee")" echo "============================================================" echo "" diff --git a/cli/collections/example/erc1155_example.json b/cli/collections/example/erc1155_example.json index cc7325ed..e9a3a0c8 100644 --- a/cli/collections/example/erc1155_example.json +++ b/cli/collections/example/erc1155_example.json @@ -12,7 +12,6 @@ "mintable": true, "cosigner": "0x0000000000000000000000000000000000000000", "uri": "https://example.com/token/", - "mintFee": "0.0001", "stages": [ { "price": ["0.0069"], diff --git a/cli/collections/example/erc721_example.json b/cli/collections/example/erc721_example.json index ae277b3b..3e787966 100644 --- a/cli/collections/example/erc721_example.json +++ b/cli/collections/example/erc721_example.json @@ -14,7 +14,6 @@ "tokenUriSuffix": ".json", "uri": "https://example.com/token/", "useERC721C": false, - "mintFee": "0.0001", "stages": [ { "price": "0.0069", diff --git a/cli/collections/template/erc1155_template.json b/cli/collections/template/erc1155_template.json index 35772dc4..76afdb51 100644 --- a/cli/collections/template/erc1155_template.json +++ b/cli/collections/template/erc1155_template.json @@ -12,7 +12,6 @@ "mintable": true, "cosigner": "0x0000000000000000000000000000000000000000", "uri": "", - "mintFee": "", "stages": [ { "price": [""], diff --git a/cli/collections/template/erc721_template.json b/cli/collections/template/erc721_template.json index 76fd51e9..6a291e49 100644 --- a/cli/collections/template/erc721_template.json +++ b/cli/collections/template/erc721_template.json @@ -14,7 +14,6 @@ "tokenUriSuffix": ".json", "uri": "", "useERC721C": false, - "mintFee": "", "stages": [ { "price": "", diff --git a/scripts/utils/parseMintFee.ts b/scripts/utils/parseMintFee.ts index bdfa6fc4..1e4638f4 100644 --- a/scripts/utils/parseMintFee.ts +++ b/scripts/utils/parseMintFee.ts @@ -1,3 +1,15 @@ import { ethers } from 'ethers'; -export const parseMintFee = (mintFee: number) => ethers.utils.parseEther(mintFee.toString()); \ No newline at end of file +const mintFee = process.argv[2]; +if (!mintFee) { + console.error('No mint fee provided'); + throw new Error('No mint fee provided'); +} + +try { + const parsedFee = ethers.utils.parseEther(mintFee); + console.log(parsedFee.toString()); +} catch (error: any) { + console.error('Failed to parse mint fee:', error.message); + throw new Error('Failed to parse mint fee'); +} \ No newline at end of file From a84bb1f4c9547d55dc7fe26cb443cd7baefd6338 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Mon, 19 May 2025 16:46:22 +0100 Subject: [PATCH 05/12] remove mintFee from getStagesData --- scripts/utils/getStagesData.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/utils/getStagesData.ts b/scripts/utils/getStagesData.ts index b9bd0c1f..bcf94ea4 100644 --- a/scripts/utils/getStagesData.ts +++ b/scripts/utils/getStagesData.ts @@ -353,7 +353,6 @@ const processERC1155Stage = async ( ): Promise< | { price: string[]; - mintFee: string[]; walletLimit: number[]; merkleRoot: string[]; maxStageSupply: number[]; @@ -377,9 +376,6 @@ const processERC1155Stage = async ( price: stage.price.map((p) => ethers.utils.parseEther(p.toString()).toString(), ), - mintFee: stage.mintFee.map((f) => - ethers.utils.parseEther(f.toString()).toString(), - ), walletLimit: stage.walletLimit, merkleRoot: merkleRoots, maxStageSupply, @@ -466,7 +462,6 @@ const processERC721Stage = async ( ): Promise< | { price: string; - mintFee: string; walletLimit: number; merkleRoot: string; maxStageSupply: number; @@ -484,7 +479,6 @@ const processERC721Stage = async ( const data = { price: ethers.utils.parseEther(stage.price.toString()).toString(), - mintFee: ethers.utils.parseEther(stage.mintFee.toString()).toString(), walletLimit: stage.walletLimit, merkleRoot, maxStageSupply: stage.maxStageSupply ?? 0, From ccfc90b766643e4b8a096fbd2e3465da43d295b6 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Wed, 16 Jul 2025 13:51:55 +0100 Subject: [PATCH 06/12] add megaETH testnet vars --- cli/cmds/utils | 3 +++ foundry.toml | 1 + scripts-foundry/common/.env.example | 1 + scripts-foundry/common/utils | 2 ++ 4 files changed, 7 insertions(+) diff --git a/cli/cmds/utils b/cli/cmds/utils index b34311ac..95b8117b 100644 --- a/cli/cmds/utils +++ b/cli/cmds/utils @@ -18,6 +18,7 @@ set_rpc_url() { 80094) RPC_URL="https://rpc.berachain.com" ;; # Berachain 10143) RPC_URL="https://testnet-rpc.monad.xyz" ;; # Monad Testnet 43114) RPC_URL="https://api.avax.network/ext/bc/C/rpc" ;; # Avalanche + 6342) RPC_URL="https://carrot.megaeth.com/rpc" ;; # MegaETH Testnet *) echo "Unsupported chain id"; exit 1 ;; esac @@ -39,6 +40,7 @@ chain_id_to_symbol() { 80094) echo "BERA" ;; 10143) echo "MON" ;; 43114) echo "AVAX" ;; + 6342) echo "ETH" ;; *) echo "Unknown" ;; esac } @@ -58,6 +60,7 @@ chain_id_to_explorer_url() { 80094) echo "https://berascan.com" ;; 10143) echo "https://testnet.monadexplorer.com" ;; 43114) echo "https://snowtrace.io" ;; + 6342) echo "https://megaexplorer.xyz" ;; *) echo "Unknown" ;; esac } diff --git a/foundry.toml b/foundry.toml index 65977d6f..a309e1a2 100644 --- a/foundry.toml +++ b/foundry.toml @@ -18,3 +18,4 @@ arbitrum = {key = "${VERIFICATION_API_KEY_ARBISCAN}", chain = 42161, url = "http berachain = {key = "${VERIFICATION_API_KEY_BERACHAIN}", chain = 80094, url = "https://api.berascan.com/api"} abstract = {key = "${VERIFICATION_API_KEY_ABSTRACT}", chain = 2741, url = "https://api.abscan.org/api"} avalanche = {key = "${VERIFICATION_API_KEY_AVALANCHE}", chain = 43114, url = "https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan"} +megaeth_testnet = {key = "${VERIFICATION_API_KEY_MEGAETH_TESTNET}", chain = 6342, url = "https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/megaeth-testnet"} \ No newline at end of file diff --git a/scripts-foundry/common/.env.example b/scripts-foundry/common/.env.example index 15836070..d7017711 100644 --- a/scripts-foundry/common/.env.example +++ b/scripts-foundry/common/.env.example @@ -12,6 +12,7 @@ VERIFICATION_API_KEY_BERACHAIN= VERIFICATION_API_KEY_MONAD_TESTNET= VERIFICATION_API_KEY_ABSTRACT= VERIFICATION_API_KEY_AVALANCHE= +VERIFICATION_API_KEY_MEGAETH_TESTNET= # Deployment Configuration PRIVATE_KEY= diff --git a/scripts-foundry/common/utils b/scripts-foundry/common/utils index fa735596..36dff6ce 100644 --- a/scripts-foundry/common/utils +++ b/scripts-foundry/common/utils @@ -14,6 +14,7 @@ set_rpc_url() { 80094) RPC_URL="https://rpc.berachain.com" ;; # Berachain 10143) RPC_URL="https://testnet-rpc2.monad.xyz/f8146cc42d8671ba15204cff0e3608faf370d983" ;; # Monad Testnet 2741) RPC_URL="https://api.mainnet.abs.xyz" ;; # Abstract + 6342) RPC_URL="https://carrot.megaeth.com/rpc" ;; # MegaETH Testnet *) echo "Unsupported chain id"; exit 1 ;; esac @@ -35,6 +36,7 @@ set_etherscan_api_key() { 10143) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_MONAD_TESTNET ;; 2741) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_ABSTRACT ;; 43114) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_AVALANCHE ;; + 6342) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_MEGAETH_TESTNET ;; *) echo "Unsupported chain id"; exit 1 ;; esac From b12edab430893e5e4f07767022504587c1127d29 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Wed, 16 Jul 2025 14:07:51 +0100 Subject: [PATCH 07/12] add megaETH testnet vars to ts cli --- cli-typescript/src/utils/constants.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli-typescript/src/utils/constants.ts b/cli-typescript/src/utils/constants.ts index ed18eabd..0c6f0cf5 100644 --- a/cli-typescript/src/utils/constants.ts +++ b/cli-typescript/src/utils/constants.ts @@ -73,6 +73,7 @@ export enum SUPPORTED_CHAINS { ABSTRACT = 2741, BERACHAIN = 80094, MONAD_TESTNET = 10143, + MEGAETH_TESTNET = 6342, } export const supportedChainNames: { [key in SUPPORTED_CHAINS]: string } = { @@ -88,6 +89,7 @@ export const supportedChainNames: { [key in SUPPORTED_CHAINS]: string } = { [SUPPORTED_CHAINS.ABSTRACT]: 'abstract', [SUPPORTED_CHAINS.BERACHAIN]: 'berachain', [SUPPORTED_CHAINS.MONAD_TESTNET]: 'monadTestnet', + [SUPPORTED_CHAINS.MEGAETH_TESTNET]: 'megaethTestnet', }; export const rpcUrls: { [chainId in SUPPORTED_CHAINS]: string } = { @@ -113,6 +115,8 @@ export const rpcUrls: { [chainId in SUPPORTED_CHAINS]: string } = { 'https://evm-router.magiceden.io/monad/testnet/me2024', // Monad Testnet [SUPPORTED_CHAINS.AVALANCHE]: 'https://evm-router.magiceden.io/avalanche/mainnet/me2024', // Avalanche + [SUPPORTED_CHAINS.MEGAETH_TESTNET]: + 'https://evm-router.magiceden.io/megaeth/testnet/me2024', // MegaETH Testnet }; export const explorerUrls: { [chainId in SUPPORTED_CHAINS]: string } = { @@ -128,6 +132,7 @@ export const explorerUrls: { [chainId in SUPPORTED_CHAINS]: string } = { [SUPPORTED_CHAINS.BERACHAIN]: 'https://berascan.com', // Berachain [SUPPORTED_CHAINS.MONAD_TESTNET]: 'https://testnet.monadexplorer.com', // Monad Testnet [SUPPORTED_CHAINS.AVALANCHE]: 'https://subnets.avax.network/', // Avalanche + [SUPPORTED_CHAINS.MEGAETH_TESTNET]: 'https://megaexplorer.xyz', // MegaETH Testnet }; export const DEFAULT_TOKEN_URI_SUFFIX = '.json'; From 60bd5bef40958f73cc6d8d678fec69db35cad068 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Wed, 16 Jul 2025 14:11:29 +0100 Subject: [PATCH 08/12] add to supported chains --- cli/cmds/const | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/cmds/const b/cli/cmds/const index 02d0eb79..8b31e3cc 100644 --- a/cli/cmds/const +++ b/cli/cmds/const @@ -13,6 +13,7 @@ SUPPORTED_CHAINS=( "2741:Abstract" "80094:Berachain" "10143:MonadTestnet" + "6342:MegaETHTestnet" ) MAGIC_DROP_KEYSTORE="MAGIC_DROP_KEYSTORE" From c0d3c2663ad2766caf3be3a85c39f4ede2397cc8 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Wed, 16 Jul 2025 14:30:43 +0100 Subject: [PATCH 09/12] hardhat --- hardhat.config.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hardhat.config.ts b/hardhat.config.ts index 552a1cd9..190933ff 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -143,6 +143,11 @@ const config: HardhatUserConfig = { accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], }, + megaeth_testnet: { + url: process.env.MEGAETH_TESTNET_URL || 'https://carrot.megaeth.com/rpc', + accounts: + process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], + }, }, gasReporter: { enabled: process.env.REPORT_GAS !== undefined, @@ -175,6 +180,14 @@ const config: HardhatUserConfig = { browserURL: 'https://snowtrace.io/' }, }, + { + network: 'megaeth_testnet', + chainId: 6342, + urls: { + apiURL: 'https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/megaeth-testnet', + browserURL: 'https://megaexplorer.xyz/' + }, + }, ] }, sourcify: { From ab2eebd76954cc5b710768df793312344061b449 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Wed, 16 Jul 2025 15:13:08 +0100 Subject: [PATCH 10/12] remove dupe avalance --- scripts-foundry/common/utils | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts-foundry/common/utils b/scripts-foundry/common/utils index 36dff6ce..76e7de34 100644 --- a/scripts-foundry/common/utils +++ b/scripts-foundry/common/utils @@ -35,7 +35,6 @@ set_etherscan_api_key() { 80094) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_BERACHAIN ;; 10143) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_MONAD_TESTNET ;; 2741) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_ABSTRACT ;; - 43114) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_AVALANCHE ;; 6342) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_MEGAETH_TESTNET ;; *) echo "Unsupported chain id"; exit 1 ;; esac From 9aecf530ad5ce4497b54244d3b899a89a5544a85 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Wed, 16 Jul 2025 15:16:22 +0100 Subject: [PATCH 11/12] fix space --- scripts-foundry/common/1a-deploy-magicdrop-impl-registry.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts-foundry/common/1a-deploy-magicdrop-impl-registry.sh b/scripts-foundry/common/1a-deploy-magicdrop-impl-registry.sh index 4205d9ec..59f4940d 100755 --- a/scripts-foundry/common/1a-deploy-magicdrop-impl-registry.sh +++ b/scripts-foundry/common/1a-deploy-magicdrop-impl-registry.sh @@ -45,7 +45,7 @@ if [ $ZK_SYNC ]; then usage fi else - if [ -z "$CHAIN_ID" ] || [ -z "$REGISTRY_SALT" ] || [ -z "$REGISTRY_EXPECTED_ADDRESS"]; then + if [ -z "$CHAIN_ID" ] || [ -z "$REGISTRY_SALT" ] || [ -z "$REGISTRY_EXPECTED_ADDRESS" ]; then usage fi fi From b103674f56956d3f95bce7b118eba3670bc60449 Mon Sep 17 00:00:00 2001 From: Tom Hirst Date: Wed, 16 Jul 2025 16:15:54 +0100 Subject: [PATCH 12/12] remove uneeded --- foundry.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/foundry.toml b/foundry.toml index a309e1a2..65977d6f 100644 --- a/foundry.toml +++ b/foundry.toml @@ -18,4 +18,3 @@ arbitrum = {key = "${VERIFICATION_API_KEY_ARBISCAN}", chain = 42161, url = "http berachain = {key = "${VERIFICATION_API_KEY_BERACHAIN}", chain = 80094, url = "https://api.berascan.com/api"} abstract = {key = "${VERIFICATION_API_KEY_ABSTRACT}", chain = 2741, url = "https://api.abscan.org/api"} avalanche = {key = "${VERIFICATION_API_KEY_AVALANCHE}", chain = 43114, url = "https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan"} -megaeth_testnet = {key = "${VERIFICATION_API_KEY_MEGAETH_TESTNET}", chain = 6342, url = "https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/megaeth-testnet"} \ No newline at end of file