Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cli-typescript/src/cmds/mainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
berachain,
bsc,
eth,
megaeth,
monad,
polygon,
sei,
Expand All @@ -35,6 +36,7 @@ export const mainMenu = async () => {
program.addCommand(arbitrum);
program.addCommand(abstract);
program.addCommand(avalanche);
program.addCommand(megaeth);
program.addCommand(monad);

await program.parseAsync(process.argv);
Expand Down
2 changes: 2 additions & 0 deletions cli-typescript/src/cmds/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import base from './base';
import berachain from './berachain';
import bsc from './bsc';
import eth from './eth';
import megaeth from './megaeth';
import monad from './monad';
import polygon from './polygon';
import sei from './sei';
Expand All @@ -19,6 +20,7 @@ export {
berachain,
bsc,
eth,
megaeth,
monad,
polygon,
sei,
Expand Down
31 changes: 31 additions & 0 deletions cli-typescript/src/cmds/networks/megaeth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { SUPPORTED_CHAINS } from '../../utils/constants';
import { createEvmCommand } from '../createCommand';
import { EvmPlatform } from '../../utils/evmUtils';
import { getSymbolFromChainId } from '../../utils/getters';

// Supported chain names
export enum MegaETHChains {
MAINNET = 'mainnet',
}

// Chain ids by the chain names
export const megaethChainIdsByName = new Map([
[MegaETHChains.MAINNET, SUPPORTED_CHAINS.MEGAETH],
]);

const megaethPlatform = new EvmPlatform(
'MegaETH',
getSymbolFromChainId(SUPPORTED_CHAINS.MEGAETH),
megaethChainIdsByName,
MegaETHChains.MAINNET,
);

export const megaeth = createEvmCommand({
platform: megaethPlatform,
commandAliases: [
getSymbolFromChainId(SUPPORTED_CHAINS.MEGAETH).toLowerCase(),
'mega',
],
});

export default megaeth;
9 changes: 9 additions & 0 deletions cli-typescript/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const MONAD_FACTORY_ADDRESS =
'0x00000000bEa935F8315156894Aa4a45D3c7a0075';
export const DEFAULT_FACTORY_ADDRESS =
'0x000000009e44eBa131196847C685F20Cd4b68aC4';
export const MEGAETH_FACTORY_ADDRESS =
'0x00000000bEa935F8315156894Aa4a45D3c7a0075';

export const ABSTRACT_REGISTRY_ADDRESS =
'0x9b60ad31F145ec7EE3c559153bB57928B65C0F87';
Expand All @@ -52,6 +54,8 @@ export const MONAD_REGISTRY_ADDRESS =
'0x000000000e447e71b2EC36CD62048Dd2a1Cd0a57';
export const DEFAULT_REGISTRY_ADDRESS =
'0x00000000caF1E3978e291c5Fb53FeedB957eC146';
export const MEGAETH_REGISTRY_ADDRESS =
'0x000000000e447e71b2EC36CD62048Dd2a1Cd0a57';

export const ICREATOR_TOKEN_INTERFACE_ID = '0xad0d7f6c'; // type(ICreatorToken).interfaceId
export const TRUE_HEX =
Expand Down Expand Up @@ -83,6 +87,7 @@ export enum SUPPORTED_CHAINS {
ABSTRACT = 2741,
BERACHAIN = 80094,
MONAD = 143,
MEGAETH = 4326,
}

export const supportedChainNames: { [key in SUPPORTED_CHAINS]: string } = {
Expand All @@ -98,6 +103,7 @@ export const supportedChainNames: { [key in SUPPORTED_CHAINS]: string } = {
[SUPPORTED_CHAINS.ABSTRACT]: 'abstract',
[SUPPORTED_CHAINS.BERACHAIN]: 'berachain',
[SUPPORTED_CHAINS.MONAD]: 'monad',
[SUPPORTED_CHAINS.MEGAETH]: 'megaeth',
};

export const rpcUrls: { [chainId in SUPPORTED_CHAINS]: string } = {
Expand All @@ -123,6 +129,8 @@ export const rpcUrls: { [chainId in SUPPORTED_CHAINS]: string } = {
'https://evm-router.magiceden.io/monad/mainnet/me2024', // Monad
[SUPPORTED_CHAINS.AVALANCHE]:
'https://evm-router.magiceden.io/avalanche/mainnet/me2024', // Avalanche
[SUPPORTED_CHAINS.MEGAETH]:
'https://evm-router.magiceden.io/megaeth/mainnet/me2024', // MegaETH
};

export const explorerUrls: { [chainId in SUPPORTED_CHAINS]: string } = {
Expand All @@ -138,6 +146,7 @@ export const explorerUrls: { [chainId in SUPPORTED_CHAINS]: string } = {
[SUPPORTED_CHAINS.BERACHAIN]: 'https://berascan.com', // Berachain
[SUPPORTED_CHAINS.MONAD]: 'https://monadvision.com', // Monad
[SUPPORTED_CHAINS.AVALANCHE]: 'https://snowtrace.io', // Avalanche
[SUPPORTED_CHAINS.MEGAETH]: 'https://TBD', // MegaETH
};

export const DEFAULT_TOKEN_URI_SUFFIX = '.json';
Expand Down
35 changes: 31 additions & 4 deletions cli-typescript/src/utils/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
ME_TRANSFER_VALIDATOR_V3,
MONAD_FACTORY_ADDRESS,
MONAD_REGISTRY_ADDRESS,
MEGAETH_FACTORY_ADDRESS,
MEGAETH_REGISTRY_ADDRESS,
SUPPORTED_CHAINS,
supportedChainNames,
TOKEN_STANDARD,
Expand All @@ -40,6 +42,21 @@ import {
} from 'viem/chains';
import { Hex } from 'viem';
import { setBaseDir } from './setters';
import { defineChain } from 'viem';

export const megaeth = defineChain({
id: 4326,
name: 'MegaETH',
nativeCurrency: { name: 'MEGA', symbol: 'MEGA', decimals: 18 },
rpcUrls: {
default: {
http: ['https://evm-router.magiceden.io/megaeth/mainnet/me2024'],
},
},
blockExplorers: {
default: { name: 'MegaETH Explorer', url: 'https://TBD' },
},
});

/**
* Retrieves the transfer validator address based on the network (chain ID).
Expand All @@ -65,6 +82,7 @@ export const getTransferValidatorAddress = (chainId: SUPPORTED_CHAINS): Hex => {
return LIMITBREAK_TRANSFER_VALIDATOR_V3_BERACHAIN;

case SUPPORTED_CHAINS.MONAD:
case SUPPORTED_CHAINS.MEGAETH:
return LIMITBREAK_TRANSFER_VALIDATOR_V5;

default:
Expand Down Expand Up @@ -115,6 +133,8 @@ export const getSymbolFromChainId = (chainId: SUPPORTED_CHAINS): string => {
return 'MON';
case SUPPORTED_CHAINS.AVALANCHE:
return 'AVAX';
case SUPPORTED_CHAINS.MEGAETH:
return 'MEGA';
default:
return 'Unknown';
}
Expand Down Expand Up @@ -166,14 +186,12 @@ export const getViemChainByChainId = (chainId: SUPPORTED_CHAINS) => {
return berachain;
case SUPPORTED_CHAINS.SEPOLIA:
return sepolia;
case SUPPORTED_CHAINS.ARBITRUM:
return arbitrum;
case SUPPORTED_CHAINS.ABSTRACT:
return abstract;
case SUPPORTED_CHAINS.MONAD:
return monad;
case SUPPORTED_CHAINS.AVALANCHE:
return avalanche;
case SUPPORTED_CHAINS.MEGAETH:
return megaeth;
default:
throw new Error(`Unsupported chain ID: ${chainId}`);
}
Expand Down Expand Up @@ -257,6 +275,10 @@ export const getFactoryAddress = (chainId: SUPPORTED_CHAINS): `0x${string}` => {
return MONAD_FACTORY_ADDRESS;
}

if (chainId === SUPPORTED_CHAINS.MEGAETH) {
return MEGAETH_FACTORY_ADDRESS;
}

return DEFAULT_FACTORY_ADDRESS;
};

Expand All @@ -275,6 +297,10 @@ export const getRegistryAddress = (
return MONAD_REGISTRY_ADDRESS;
}

if (chainId === SUPPORTED_CHAINS.MEGAETH) {
return MEGAETH_REGISTRY_ADDRESS;
}

return DEFAULT_REGISTRY_ADDRESS;
};

Expand Down Expand Up @@ -306,6 +332,7 @@ export const getImplId = (
case SUPPORTED_CHAINS.AVALANCHE:
return 6;
case SUPPORTED_CHAINS.MONAD:
case SUPPORTED_CHAINS.MEGAETH:
return 2;
default:
return 8;
Expand Down
3 changes: 3 additions & 0 deletions cli/cmds/utils
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set_rpc_url() {
80094) RPC_URL="https://rpc.berachain.com" ;; # Berachain
43114) RPC_URL="https://api.avax.network/ext/bc/C/rpc" ;; # Avalanche
143) RPC_URL="https://evm-router.magiceden.io/monad/mainnet/me2024" ;; # Monad
4326) RPC_URL="https://evm-router.magiceden.io/megaeth/mainnet/me2024" ;; # MegaETH
*) echo "Unsupported chain id"; exit 1 ;;
esac

Expand All @@ -40,6 +41,7 @@ chain_id_to_symbol() {
10143) echo "MON" ;;
43114) echo "AVAX" ;;
143) echo "MON" ;;
4326) echo "MEGA" ;;
*) echo "Unknown" ;;
esac
}
Expand All @@ -60,6 +62,7 @@ chain_id_to_explorer_url() {
10143) echo "https://testnet.monadexplorer.com" ;;
43114) echo "https://snowtrace.io" ;;
143) echo "https://monadvision.com" ;;
4326) echo "https://TBD" ;;
*) echo "Unknown" ;;
esac
}
Expand Down
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ berachain = {key = "${VERIFICATION_API_KEY_BERACHAIN}", chain = 80094, url = "ht
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"}
monad = {key = "${VERIFICATION_API_KEY_MONAD}", chain = 143, url = "https://sourcify-api-monad.blockvision.org"}
megaeth = {key = "${VERIFICATION_API_KEY_MEGAETH}", chain = 4326, url = "https://TBD"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this left as TBD intentionally? Would it be:

Perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are using https://megaeth-testnet-v3.blockscout.com/ as temp mainnet explorer and it requires password, we are waiting for their official launch and explorer address, so put here placeholder

2 changes: 2 additions & 0 deletions scripts-foundry/common/utils
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set_rpc_url() {
80094) RPC_URL="https://rpc.berachain.com" ;; # Berachain
2741) RPC_URL="https://api.mainnet.abs.xyz" ;; # Abstract
143) RPC_URL="https://evm-router.magiceden.io/monad/mainnet/me2024" ;; # Monad
4326) RPC_URL="https://evm-router.magiceden.io/megaeth/mainnet/me2024" ;; # MegaETH
*) echo "Unsupported chain id"; exit 1 ;;
esac

Expand All @@ -35,6 +36,7 @@ set_etherscan_api_key() {
2741) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_ABSTRACT ;;
43114) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_AVALANCHE ;;
143) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_MONAD ;;
4326) ETHERSCAN_API_KEY=$VERIFICATION_API_KEY_MEGAETH ;; # MegaETH
*) echo "Unsupported chain id"; exit 1 ;;
esac

Expand Down