Skip to content

Commit 45f7395

Browse files
committed
feat: add monad
1 parent e00c928 commit 45f7395

21 files changed

+928
-69
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,5 @@ HYPEREVM_RPC=' '
139139
SEI_RPC=' '
140140

141141
PLASMA_RPC=' '
142+
143+
MONAD_RPC=' '

deployments/prod_addresses.json

Lines changed: 712 additions & 53 deletions
Large diffs are not rendered by default.

deployments/prod_verification.json

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,152 @@
972972
["0x5fD7D0d6b91CC4787Bcb86ca47e0Bd4ea0346d34", 10]
973973
]
974974
],
975+
"143": [
976+
[
977+
"0xcd620187f4846ba5a42ab41270aC550467dc9FbB",
978+
"SwitchboardSimulator",
979+
"contracts/mocks/fee-updater/SwitchboardSimulator.sol",
980+
[
981+
"0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836",
982+
"0x8c36353db4F3a2DDDeed38405199d13DCF8a1B82",
983+
143,
984+
1000,
985+
"0x1CAdCd88fC148D3966eDe75D029937C886f66009"
986+
]
987+
],
988+
[
989+
"0x09A03E0d298AA13a07A9a3e36a606d4F6a4b8bB7",
990+
"SimulatorUtils",
991+
"contracts/mocks/fee-updater/SimulatorUtils.sol",
992+
[
993+
"0x8c36353db4F3a2DDDeed38405199d13DCF8a1B82",
994+
"0x1CAdCd88fC148D3966eDe75D029937C886f66009",
995+
"0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836",
996+
143
997+
]
998+
],
999+
[
1000+
"0x8c36353db4F3a2DDDeed38405199d13DCF8a1B82",
1001+
"SocketSimulator",
1002+
"contracts/mocks/fee-updater/SocketSimulator.sol",
1003+
[
1004+
143,
1005+
143,
1006+
"0x9B8c323468AEC7A7Cb041CeD48F92559bFF33705",
1007+
"0x1CAdCd88fC148D3966eDe75D029937C886f66009",
1008+
"IMLI"
1009+
]
1010+
],
1011+
[
1012+
"0xb4Db1838d0B97BD58C7663b3E487eEbC9a996472",
1013+
"Counter",
1014+
"contracts/examples/Counter.sol",
1015+
["0x0CC93650bF4D98237628DACf87f94E443956D8dF"]
1016+
],
1017+
[
1018+
"0xd9E3a8Ba9Be55919C5C0De6694e3103F5a35820E",
1019+
"SocketBatcher",
1020+
"contracts/socket/SocketBatcher.sol",
1021+
["0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836"]
1022+
],
1023+
[
1024+
"0x3043Ad9C9e01664bc3A68477f0870Df35dC4bFf8",
1025+
"OptimisticSwitchboard",
1026+
"contracts/switchboard/default-switchboards/OptimisticSwitchboard.sol",
1027+
[
1028+
"0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836",
1029+
"0x0CC93650bF4D98237628DACf87f94E443956D8dF",
1030+
143,
1031+
7200,
1032+
"0x1CAdCd88fC148D3966eDe75D029937C886f66009"
1033+
]
1034+
],
1035+
[
1036+
"0x525a6489a1df5fF1ae077fAf628E43b7F52298eF",
1037+
"FastSwitchboard",
1038+
"contracts/switchboard/default-switchboards/FastSwitchboard.sol",
1039+
[
1040+
"0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836",
1041+
"0x0CC93650bF4D98237628DACf87f94E443956D8dF",
1042+
143,
1043+
7200,
1044+
"0x1CAdCd88fC148D3966eDe75D029937C886f66009"
1045+
]
1046+
],
1047+
[
1048+
"0x657e72B305Dc1c41e98d9efC2350EC10e3c83E21",
1049+
"TransmitManager",
1050+
"contracts/TransmitManager.sol",
1051+
[
1052+
"0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836",
1053+
143,
1054+
"0x0CC93650bF4D98237628DACf87f94E443956D8dF",
1055+
"0x1CAdCd88fC148D3966eDe75D029937C886f66009"
1056+
]
1057+
],
1058+
[
1059+
"0xb3314456567986e657d4C65Ec9e8cB736B92d11D",
1060+
"ExecutionManagerDF",
1061+
"contracts/ExecutionManagerDF.sol",
1062+
[
1063+
"0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836",
1064+
143,
1065+
"0x0CC93650bF4D98237628DACf87f94E443956D8dF",
1066+
"0x1CAdCd88fC148D3966eDe75D029937C886f66009"
1067+
]
1068+
],
1069+
[
1070+
"0x0CC93650bF4D98237628DACf87f94E443956D8dF",
1071+
"Socket",
1072+
"contracts/socket/Socket.sol",
1073+
[
1074+
143,
1075+
"0x9B8c323468AEC7A7Cb041CeD48F92559bFF33705",
1076+
"0xb4Ef469c9d8317851270346070dA0ecE24616E6b",
1077+
"0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836",
1078+
"IMLI"
1079+
]
1080+
],
1081+
[
1082+
"0xb4Ef469c9d8317851270346070dA0ecE24616E6b",
1083+
"CapacitorFactory",
1084+
"contracts/CapacitorFactory.sol",
1085+
["0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836", 10]
1086+
],
1087+
[
1088+
"0x9B8c323468AEC7A7Cb041CeD48F92559bFF33705",
1089+
"Hasher",
1090+
"contracts/utils/Hasher.sol",
1091+
["0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836"]
1092+
],
1093+
[
1094+
"0x1CAdCd88fC148D3966eDe75D029937C886f66009",
1095+
"SignatureVerifier",
1096+
"contracts/utils/SignatureVerifier.sol",
1097+
["0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836"]
1098+
],
1099+
[
1100+
"0xbe7241e9D11EC2D1Ac86CE217c4A37b7aD1701cE",
1101+
"MultiSigWrapper",
1102+
"contracts/utils/multisig/MultiSigWrapper.sol",
1103+
[
1104+
"0xB0BBff6311B7F245761A7846d3Ce7B1b100C1836",
1105+
"0xA49f876C8F49414859cC9b0c4fEF794F0795Ccb4"
1106+
]
1107+
],
1108+
[
1109+
"0x1F6bc87f3309B5D31Eb0BdaBE3ED7d3110d3B9c3",
1110+
"SafeProxyFactory",
1111+
"contracts/utils/multisig/proxies/SafeProxyFactory.sol",
1112+
[]
1113+
],
1114+
[
1115+
"0xc8a4D2fd77c155fd52e65Ab07F337aBF84495Ead",
1116+
"SafeL2",
1117+
"contracts/utils/multisig/SafeL2.sol",
1118+
[]
1119+
]
1120+
],
9751121
"146": [
9761122
[
9771123
"0xeA964e160dEaed1960E31a20c1fA57D079d4e616",

scripts/constants/overrides.ts

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ export const chainOverrides: {
2828
},
2929
[ChainSlug.MAINNET]: {
3030
gasLimit: 6_000_000,
31+
type: 2,
3132
gasPriceMultiplier: 1.25,
3233
},
3334

3435
[ChainSlug.POLYGON_MAINNET]: {
3536
gasPriceMultiplier: 2,
37+
type: 2,
3638
gasLimit: 3_000_000,
3739
},
3840
[ChainSlug.ZKEVM]: {
@@ -121,7 +123,11 @@ export const chainOverrides: {
121123
},
122124
[ChainSlug.PLASMA]: {
123125
gasLimit: 5_000_000,
124-
gasPriceMultiplier: 0.00001,
126+
gasPrice: 100_000_000,
127+
type: 2,
128+
},
129+
[ChainSlug.MONAD]: {
130+
gasLimit: 3_00_000,
125131
},
126132
};
127133

@@ -134,9 +140,14 @@ export const chainOverrides: {
134140
* a. Use `gasPriceMultiplier` from chainOverrides if provided
135141
* b. If not, use DEFAULT_GAS_PRICE_MULTIPLIER
136142
*
143+
* For EIP-1559 transactions (type 2):
144+
* - Uses maxFeePerGas and maxPriorityFeePerGas instead of gasPrice
145+
* - Multiplier applies to maxFeePerGas
146+
* - maxPriorityFeePerGas = maxFeePerGas - baseFee
147+
*
137148
* @param chainSlug - The chain identifier
138149
* @param provider - The network provider
139-
* @returns An object with gasLimit, gasPrice, and transaction type
150+
* @returns An object with gasLimit, gasPrice/maxFeePerGas/maxPriorityFeePerGas, and transaction type
140151
*/
141152
export const getOverrides = async (
142153
chainSlug: ChainSlug,
@@ -145,16 +156,40 @@ export const getOverrides = async (
145156
const overrides = chainOverrides[chainSlug] || {};
146157
const { gasLimit, type = defaultType } = overrides;
147158

148-
let gasPrice = overrides.gasPrice;
149-
if (!gasPrice) {
150-
const baseGasPrice = await provider.getGasPrice();
151-
const multiplier =
152-
overrides.gasPriceMultiplier || DEFAULT_GAS_PRICE_MULTIPLIER;
153-
gasPrice = baseGasPrice
154-
.mul(Math.round(multiplier * 100000))
155-
.div(100000)
156-
.toNumber();
157-
}
159+
if (type === 2) {
160+
// EIP-1559 transaction
161+
let maxFeePerGas = overrides.gasPrice;
162+
if (!maxFeePerGas) {
163+
const feeData = await provider.getFeeData();
164+
const baseGasPrice =
165+
feeData.maxFeePerGas || (await provider.getGasPrice());
166+
const multiplier =
167+
overrides.gasPriceMultiplier || DEFAULT_GAS_PRICE_MULTIPLIER;
168+
maxFeePerGas = baseGasPrice
169+
.mul(Math.round(multiplier * 100000))
170+
.div(100000)
171+
.toNumber();
172+
}
173+
174+
// Get base fee to calculate maxPriorityFeePerGas
175+
const block = await provider.getBlock("latest");
176+
const baseFee = block.baseFeePerGas?.toNumber() || 0;
177+
const maxPriorityFeePerGas = Math.max(maxFeePerGas - baseFee, 0);
178+
console.log(chainSlug, gasLimit, maxFeePerGas, maxPriorityFeePerGas, type);
179+
return { gasLimit, maxFeePerGas, maxPriorityFeePerGas, type };
180+
} else {
181+
// Legacy transaction (type 0 or 1)
182+
let gasPrice = overrides.gasPrice;
183+
if (!gasPrice) {
184+
const baseGasPrice = await provider.getGasPrice();
185+
const multiplier =
186+
overrides.gasPriceMultiplier || DEFAULT_GAS_PRICE_MULTIPLIER;
187+
gasPrice = baseGasPrice
188+
.mul(Math.round(multiplier * 100000))
189+
.div(100000)
190+
.toNumber();
191+
}
158192

159-
return { gasLimit, gasPrice, type };
193+
return { gasLimit, gasPrice, type };
194+
}
160195
};

scripts/deploy/scripts/registerSwitchboard.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export default async function registerSwitchboardForSibling(
5353
if (isSubmitted) return;
5454
const tx = await signer.sendTransaction(transaction);
5555
console.log(
56-
`Registering Switchboard remoteChainSlug - ${remoteChainSlug} ${switchBoardAddress}: ${tx.hash}`
56+
`Registering Switchboard on ${await signer.getChainId()} for remoteChainSlug - ${remoteChainSlug} ${switchBoardAddress}: ${
57+
tx.hash
58+
}`
5759
);
5860
await tx.wait();
5961
}

scripts/rpcConfig/constants/batcherSupportedChainSlug.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ export const batcherSupportedChainSlugs = [
6565
ChainSlug.HYPEREVM,
6666
ChainSlug.SEI,
6767
ChainSlug.PLASMA,
68+
ChainSlug.MONAD,
6869
];

scripts/rpcConfig/constants/explorers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ export const explorers = {
4444
[ChainSlug.HYPEREVM]: "https://www.hyperscan.com/",
4545
[ChainSlug.SEI]: "https://seitrace.com/",
4646
[ChainSlug.PLASMA]: "https://plasmascan.to/",
47+
[ChainSlug.MONAD]: "https://mainnet-beta.monvision.io/",
4748
};

scripts/rpcConfig/constants/icons.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ export const icons = {
4242
[ChainSlug.HYPEREVM]: "",
4343
[ChainSlug.SEI]: "",
4444
[ChainSlug.PLASMA]: "",
45+
[ChainSlug.MONAD]: "",
4546
};

scripts/rpcConfig/constants/rpc.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ export const rpcs = {
7777
[ChainSlug.HYPEREVM]: checkEnvValue("HYPEREVM_RPC"),
7878
[ChainSlug.SEI]: checkEnvValue("SEI_RPC"),
7979
[ChainSlug.PLASMA]: checkEnvValue("PLASMA_RPC"),
80+
[ChainSlug.MONAD]: checkEnvValue("MONAD_RPC"),
8081
};

scripts/rpcConfig/constants/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { DeploymentMode } from "../../../src";
22

33
export const version = {
44
[DeploymentMode.DEV]: "1.0.5",
5-
[DeploymentMode.PROD]: "1.0.106",
5+
[DeploymentMode.PROD]: "1.0.110",
66
};

0 commit comments

Comments
 (0)