Skip to content

Commit f8a3af8

Browse files
authored
Merge branch 'me-foundation:main' into main
2 parents 1f7eaac + 1b0132b commit f8a3af8

File tree

20 files changed

+1056
-215
lines changed

20 files changed

+1056
-215
lines changed

cli-typescript/package-lock.json

Lines changed: 206 additions & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli-typescript/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"clean": "sudo rm -rf ./dist",
1919
"clean:all": "sudo rm -rf ./dist ./node_modules ./package-lock.json",
2020
"lint": "npm run lint:js",
21-
"lint:js": "eslint . --fix"
21+
"lint:js": "eslint . --fix",
22+
"deploy": "ts-node .src/index.ts"
2223
},
2324
"keywords": [],
2425
"author": "",
@@ -32,6 +33,7 @@
3233
"eslint-config-prettier": "^10.1.1",
3334
"eslint-plugin-prettier": "^5.2.6",
3435
"prettier": "3.5.3",
36+
"ts-node": "^10.9.2",
3537
"typescript": "^5.8.2",
3638
"typescript-eslint": "^8.29.0"
3739
},
@@ -46,6 +48,6 @@
4648
"mkdirp": "^3.0.1",
4749
"open": "8.4.0",
4850
"ox": "^0.7.0",
49-
"viem": "^2.26.3"
51+
"viem": "^2.41.2"
5052
}
5153
}

cli-typescript/src/abis/index.ts

Lines changed: 139 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const SET_TRANSFER_VALIDATOR_ABI = {
1212
type: 'function',
1313
} as const;
1414

15+
// Transfer Validator V3 ABI (uses uint120)
1516
export const APPLY_LIST_TO_COLLECTION_ABI = {
1617
inputs: [
1718
{
@@ -31,6 +32,26 @@ export const APPLY_LIST_TO_COLLECTION_ABI = {
3132
type: 'function',
3233
} as const;
3334

35+
// Transfer Validator V5 ABI (uses uint48)
36+
export const APPLY_LIST_TO_COLLECTION_ABI_V5 = {
37+
inputs: [
38+
{
39+
internalType: 'address',
40+
name: 'collection',
41+
type: 'address',
42+
},
43+
{
44+
internalType: 'uint48',
45+
name: 'id',
46+
type: 'uint48',
47+
},
48+
],
49+
name: 'applyListToCollection',
50+
outputs: [],
51+
stateMutability: 'nonpayable',
52+
type: 'function',
53+
} as const;
54+
3455
export const IS_SETUP_LOCKED_ABI = {
3556
inputs: [],
3657
name: 'isSetupLocked',
@@ -65,16 +86,32 @@ export const SUPPORTS_INTERFACE_ABI = {
6586
],
6687
} as const;
6788

89+
// Legacy event (version 1.0.0, 1.0.1)
90+
export const NEW_CONTRACT_INITIALIZED_EVENT_ABI_LEGACY = {
91+
name: 'NewContractInitialized',
92+
type: 'event',
93+
inputs: [
94+
{ name: 'contractAddress', type: 'address', indexed: false },
95+
{ name: 'creator', type: 'address', indexed: false },
96+
{ name: 'implId', type: 'uint32', indexed: false },
97+
{ name: 'standardId', type: 'uint8', indexed: false },
98+
{ name: 'name', type: 'string', indexed: false },
99+
{ name: 'symbol', type: 'string', indexed: false },
100+
],
101+
} as const;
102+
103+
// New event (version >= 1.0.2) - includes an additional uint256 parameter
68104
export const NEW_CONTRACT_INITIALIZED_EVENT_ABI = {
69105
name: 'NewContractInitialized',
70106
type: 'event',
71107
inputs: [
72-
{ name: 'contractAddress', type: 'address' },
73-
{ name: 'creator', type: 'address' },
74-
{ name: 'implId', type: 'uint32' },
75-
{ name: 'standardId', type: 'uint8' },
76-
{ name: 'name', type: 'string' },
77-
{ name: 'symbol', type: 'string' },
108+
{ name: 'contractAddress', type: 'address', indexed: false },
109+
{ name: 'creator', type: 'address', indexed: false },
110+
{ name: 'implId', type: 'uint32', indexed: false },
111+
{ name: 'standardId', type: 'uint8', indexed: false },
112+
{ name: 'name', type: 'string', indexed: false },
113+
{ name: 'symbol', type: 'string', indexed: false },
114+
{ name: 'version', type: 'uint256', indexed: false },
78115
],
79116
} as const;
80117

@@ -258,7 +295,8 @@ export const ERC712M_ABIS = {
258295
stateMutability: 'nonpayable',
259296
type: 'function',
260297
},
261-
setStages: {
298+
// Legacy ABI (version 1.0.0, 1.0.1) - includes mintFee field
299+
setStagesLegacy: {
262300
inputs: [
263301
{
264302
components: [
@@ -308,6 +346,52 @@ export const ERC712M_ABIS = {
308346
stateMutability: 'nonpayable',
309347
type: 'function',
310348
},
349+
// New ABI (version >= 1.0.2) - no mintFee field
350+
setStages: {
351+
inputs: [
352+
{
353+
components: [
354+
{
355+
internalType: 'uint80',
356+
name: 'price',
357+
type: 'uint80',
358+
},
359+
{
360+
internalType: 'uint32',
361+
name: 'walletLimit',
362+
type: 'uint32',
363+
},
364+
{
365+
internalType: 'bytes32',
366+
name: 'merkleRoot',
367+
type: 'bytes32',
368+
},
369+
{
370+
internalType: 'uint24',
371+
name: 'maxStageSupply',
372+
type: 'uint24',
373+
},
374+
{
375+
internalType: 'uint256',
376+
name: 'startTimeUnixSeconds',
377+
type: 'uint256',
378+
},
379+
{
380+
internalType: 'uint256',
381+
name: 'endTimeUnixSeconds',
382+
type: 'uint256',
383+
},
384+
],
385+
internalType: 'struct IERC721M.MintStageInfo[]',
386+
name: 'newStages',
387+
type: 'tuple[]',
388+
},
389+
],
390+
name: 'setStages',
391+
outputs: [],
392+
stateMutability: 'nonpayable',
393+
type: 'function',
394+
},
311395
setGlobalWalletLimit: {
312396
inputs: [
313397
{
@@ -503,7 +587,8 @@ export const ERC1155M_ABIS = {
503587
stateMutability: 'nonpayable',
504588
type: 'function',
505589
},
506-
setStages: {
590+
// Legacy ABI (version 1.0.0, 1.0.1) - includes mintFee field
591+
setStagesLegacy: {
507592
inputs: [
508593
{
509594
components: [
@@ -553,6 +638,52 @@ export const ERC1155M_ABIS = {
553638
stateMutability: 'nonpayable',
554639
type: 'function',
555640
},
641+
// New ABI (version >= 1.0.2) - no mintFee field
642+
setStages: {
643+
inputs: [
644+
{
645+
components: [
646+
{
647+
internalType: 'uint80[]',
648+
name: 'price',
649+
type: 'uint80[]',
650+
},
651+
{
652+
internalType: 'uint32[]',
653+
name: 'walletLimit',
654+
type: 'uint32[]',
655+
},
656+
{
657+
internalType: 'bytes32[]',
658+
name: 'merkleRoot',
659+
type: 'bytes32[]',
660+
},
661+
{
662+
internalType: 'uint24[]',
663+
name: 'maxStageSupply',
664+
type: 'uint24[]',
665+
},
666+
{
667+
internalType: 'uint256',
668+
name: 'startTimeUnixSeconds',
669+
type: 'uint256',
670+
},
671+
{
672+
internalType: 'uint256',
673+
name: 'endTimeUnixSeconds',
674+
type: 'uint256',
675+
},
676+
],
677+
internalType: 'struct IERC1155M.MintStageInfo[]',
678+
name: 'newStages',
679+
type: 'tuple[]',
680+
},
681+
],
682+
name: 'setStages',
683+
outputs: [],
684+
stateMutability: 'nonpayable',
685+
type: 'function',
686+
},
556687
setGlobalWalletLimit: {
557688
inputs: [
558689
{

cli-typescript/src/cmds/createCommand.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
setGlobalWalletLimitCmd,
2828
setMaxMintableSupplyCmd,
2929
setMintableCmd,
30+
setMintFeeCmd,
3031
setStagesCmd,
3132
setTimestampExpiryCmd,
3233
setTokenURISuffixCmd,
@@ -207,6 +208,7 @@ export const createEvmCommand = ({
207208
newCmd.addCommand(setStagesCmd());
208209
newCmd.addCommand(setGlobalWalletLimitCmd());
209210
newCmd.addCommand(setMaxMintableSupplyCmd());
211+
newCmd.addCommand(setMintFeeCmd());
210212
newCmd.addCommand(setCosginerCmd());
211213
newCmd.addCommand(setTimestampExpiryCmd());
212214
newCmd.addCommand(withdrawContractBalanceCmd());

cli-typescript/src/cmds/general.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
getGlobalWalletLimitOption,
88
getIsMintableOption,
99
getMaxMintableSupplyOption,
10+
getMintFeeOption,
1011
getMinterActionOption,
1112
getMinterOption,
1213
getNewOwnerOption,
@@ -37,6 +38,7 @@ import { checkSignerBalanceAction } from '../utils/cmdActions/checkSignerBalance
3738
import { transferSignerBalanceAction } from '../utils/cmdActions/transferSignerBalanceAction';
3839
import getWalletInfoAction from '../utils/cmdActions/getWalletInfoAction';
3940
import getProjectConfigAction from '../utils/cmdActions/getProjectConfigAction';
41+
import { setMintFeeAction } from '../utils/cmdActions/setMintFeeAction';
4042

4143
export const createNewWalletCmd = () =>
4244
new Command('create-wallet')
@@ -65,7 +67,7 @@ export const setStagesCmd = () =>
6567
.command('set-stages <symbol>')
6668
.addOption(getStagesFileOption())
6769
.description(
68-
`Set the stages for the collection. Note: this will overwrite the existing stages. You can provide a stages file or update the existing stages in the config.`,
70+
'Set the stages for the collection. Note: this will overwrite the existing stages. You can provide a stages file or update the existing stages in the config.',
6971
)
7072
.action(setStagesAction);
7173

@@ -207,3 +209,13 @@ export const transferSignerBalanceCmd = () =>
207209
.addOption(getReceiverOption().makeOptionMandatory())
208210
.addOption(getGasLimitOption().default(STANDARD_GAS_LIMIT + 6000)) // Default gas limit with buffer
209211
.action(transferSignerBalanceAction);
212+
213+
export const setMintFeeCmd = () =>
214+
new Command('set-mint-fee')
215+
.command('set-mint-fee <symbol>')
216+
.alias('smf')
217+
.description(
218+
'Set the mint fee for the collection. Note: this feature is only available for contract version >= 1.0.2',
219+
)
220+
.addOption(getMintFeeOption().makeOptionMandatory())
221+
.action(setMintFeeAction);

cli-typescript/src/cmds/mainMenu.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
berachain,
1010
bsc,
1111
eth,
12+
megaeth,
1213
monad,
1314
polygon,
1415
sei,
@@ -35,6 +36,7 @@ export const mainMenu = async () => {
3536
program.addCommand(arbitrum);
3637
program.addCommand(abstract);
3738
program.addCommand(avalanche);
39+
program.addCommand(megaeth);
3840
program.addCommand(monad);
3941

4042
await program.parseAsync(process.argv);

cli-typescript/src/cmds/networks/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import base from './base';
66
import berachain from './berachain';
77
import bsc from './bsc';
88
import eth from './eth';
9+
import megaeth from './megaeth';
910
import monad from './monad';
1011
import polygon from './polygon';
1112
import sei from './sei';
@@ -19,6 +20,7 @@ export {
1920
berachain,
2021
bsc,
2122
eth,
23+
megaeth,
2224
monad,
2325
polygon,
2426
sei,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { SUPPORTED_CHAINS } from '../../utils/constants';
2+
import { createEvmCommand } from '../createCommand';
3+
import { EvmPlatform } from '../../utils/evmUtils';
4+
import { getSymbolFromChainId } from '../../utils/getters';
5+
6+
// Supported chain names
7+
export enum MegaETHChains {
8+
MAINNET = 'mainnet',
9+
}
10+
11+
// Chain ids by the chain names
12+
export const megaethChainIdsByName = new Map([
13+
[MegaETHChains.MAINNET, SUPPORTED_CHAINS.MEGAETH],
14+
]);
15+
16+
const megaethPlatform = new EvmPlatform(
17+
'MegaETH',
18+
getSymbolFromChainId(SUPPORTED_CHAINS.MEGAETH),
19+
megaethChainIdsByName,
20+
MegaETHChains.MAINNET,
21+
);
22+
23+
export const megaeth = createEvmCommand({
24+
platform: megaethPlatform,
25+
commandAliases: [
26+
getSymbolFromChainId(SUPPORTED_CHAINS.MEGAETH).toLowerCase(),
27+
'mega',
28+
],
29+
});
30+
31+
export default megaeth;

0 commit comments

Comments
 (0)