Skip to content
Open
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
3 changes: 2 additions & 1 deletion deployments/prod/addresses/arc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"RFQVaultExecutor": "0x97caCa78AC2a94c67643d07843F85AFAa44a3ea5"
"RFQVaultExecutor": "0x97caCa78AC2a94c67643d07843F85AFAa44a3ea5",
"CctpClaimExecutor": "0x424a31a57f7c63918ecaa2fac38016a8af5a6ec2"
}
3 changes: 2 additions & 1 deletion deployments/prod/addresses/hyperEvm.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"RFQVaultExecutor": "0x97caCa78AC2a94c67643d07843F85AFAa44a3ea5",
"CctpClaimExecutor": "0x424a31a57f7c63918ecaa2fac38016a8af5a6ec2"
"CctpClaimExecutor": "0x424a31a57f7c63918ecaa2fac38016a8af5a6ec2",
"HypercoreDepositExecutor": "0x20dfbf72767129c9305d7b34d67770815a793fb8"
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"deploy:cctp-claim-executor:all": "ts-node scripts/deploy/deployCctpClaimExecutorAllChains.ts",
"deploy:rfq-vault-executor:all": "ts-node scripts/deploy/deployRFQVaultExecutorAllChains.ts",
"deploy:rfq-vault-executor": "hardhat run scripts/deploy/deployRFQVaultExecutor.ts --network",
"deploy:ethereal-executor": "hardhat run scripts/deploy/deployEtherealExecutor.ts --network",
"deploy:hypercore-executor": "hardhat run scripts/deploy/deployHypercoreExecutor.ts --network",
"deploy:sui-rfq-vault": "ts-node scripts/sui/deployRfqVault.ts",
"fund:sui-rfq-vault": "ts-node scripts/sui/fundRfqVault.ts",
"sui:rfq-vault:kms-solver": "ts-node scripts/sui/printKmsSolverKey.ts",
Expand Down
5 changes: 5 additions & 0 deletions scripts/deploy/cctpClaimExecutorConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ export const CCTP_CLAIM_EXECUTOR_CHAIN_CONFIG: Record<number, CctpClaimExecutorC
messageTransmitter: CCTP_MESSAGE_TRANSMITTER,
usdcAddress: '0x754704Bc059F8C67012fEd69BC8A327a5aafb603',
},
[CHAIN_IDS.ARC]: {
chainId: CHAIN_IDS.ARC,
messageTransmitter: CCTP_MESSAGE_TRANSMITTER,
usdcAddress: '0x3600000000000000000000000000000000000000',
},
Comment on lines +91 to +95

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Circle CCTP MessageTransmitter contract address on Arc mainnet chain 5042

💡 Result:

The Circle CCTP MessageTransmitterV2 contract address on the Arc mainnet (Chain ID 5042) is 0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275 [1][2]. This address is documented in the official Arc documentation for its cross-chain interoperability infrastructure [1][2]. Users integrating with CCTP on the Arc network should utilize this contract address for message transmission and receiving operations [2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== file map ==\n'
git ls-files | rg '^(scripts/deploy/cctpClaimExecutorConfig\.ts|.*CctpClaimExecutor.*|.*cctp.*)$' || true

printf '\n== relevant symbols ==\n'
rg -n "CCTP_MESSAGE_TRANSMITTER|usdcAddress|TokenMinter|mint\(|decimals|balanceOf|CctpClaimExecutor" scripts src . --glob '!**/node_modules/**' || true

Repository: SocketDotTech/openrouter

Length of output: 50380


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== cctpClaimExecutorConfig.ts ==\n'
wc -l scripts/deploy/cctpClaimExecutorConfig.ts
cat -n scripts/deploy/cctpClaimExecutorConfig.ts | sed -n '1,220p'

printf '\n== executor files ==\n'
for f in $(git ls-files | rg 'CctpClaimExecutor|cctp'); do
  echo "--- $f"
  wc -l "$f"
done

Repository: SocketDotTech/openrouter

Length of output: 6013


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== CctpClaimExecutor.sol ==\n'
cat -n src/executors/CctpClaimExecutor.sol | sed -n '1,220p'

printf '\n== deployment script uses ==\n'
cat -n scripts/deploy/deployCctpClaimExecutor.ts | sed -n '1,280p'

Repository: SocketDotTech/openrouter

Length of output: 15960


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== verifyCctpClaimExecutorBatch.ts (Arc-related sections) ==\n'
rg -n "ARC|messageTransmitter|CCTP_MESSAGE_TRANSMITTER|usdcAddress" scripts/deploy/verifyCctpClaimExecutorBatch.ts scripts/deploy/cctpClaimExecutorConfig.ts

printf '\n== create3 / config references ==\n'
rg -n "CCTP_MESSAGE_TRANSMITTER|CCTP_CLAIM_EXECUTOR_CHAIN_CONFIG|CHAIN_IDS\.ARC" scripts/deploy src test

Repository: SocketDotTech/openrouter

Length of output: 7580


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,180p' src/executors/CctpClaimExecutor.sol | cat -n

Repository: SocketDotTech/openrouter

Length of output: 5648


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,260p' scripts/deploy/deployCctpClaimExecutor.ts | cat -n

Repository: SocketDotTech/openrouter

Length of output: 10277


Use Arc’s chain-specific CCTP transmitter address. CctpClaimExecutor only does raw 6-decimal USDC balance accounting, so the USDC wrapper at 0x3600000000000000000000000000000000000000 is fine. The real issue is CCTP_MESSAGE_TRANSMITTER: Arc mainnet uses 0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275, so this entry should not reuse the global constant.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/deploy/cctpClaimExecutorConfig.ts` around lines 91 - 95, The ARC
entry in cctpClaimExecutorConfig is reusing the shared CCTP_MESSAGE_TRANSMITTER
constant instead of Arc’s chain-specific transmitter address. Update the
[CHAIN_IDS.ARC] config in cctpClaimExecutorConfig so its messageTransmitter is
set to Arc mainnet’s unique transmitter value, while keeping the existing
usdcAddress unchanged; use the CCTP_MESSAGE_TRANSMITTER symbol only as a
reference point for replacing the ARC-specific mapping.

};

export const CCTP_CLAIM_EXECUTOR_CHAIN_IDS = Object.keys(CCTP_CLAIM_EXECUTOR_CHAIN_CONFIG).map(
Expand Down
16 changes: 16 additions & 0 deletions scripts/deploy/create3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ export const CCTP_CLAIM_EXECUTOR_CREATE3_SALT = keccak256(
export const CCTP_CLAIM_EXECUTOR_V2_EXPECTED_ADDRESS =
'0x424a31A57F7C63918eCaA2Fac38016A8af5A6eC2';

/** CREATE3 salt label used by `deployEtherealExecutor.ts`. */
export const ETHEREAL_EXECUTOR_CREATE3_SALT_TEXT = 'EtherealExecutor';

/** Keccak256 salt for deterministic EtherealExecutor CREATE3 deployments. */
export const ETHEREAL_EXECUTOR_CREATE3_SALT = keccak256(
toUtf8Bytes(ETHEREAL_EXECUTOR_CREATE3_SALT_TEXT),
);

/** CREATE3 salt label used by `deployHypercoreExecutor.ts`. */
export const HYPERCORE_EXECUTOR_CREATE3_SALT_TEXT = 'HypercoreDepositExecutor';

/** Keccak256 salt for deterministic HypercoreDepositExecutor CREATE3 deployments. */
export const HYPERCORE_EXECUTOR_CREATE3_SALT = keccak256(
toUtf8Bytes(HYPERCORE_EXECUTOR_CREATE3_SALT_TEXT),
);

const ADDR_HEX_RE = /^0x[a-fA-F0-9]{40}$/;
const CREATE3_PROXY_INIT_CODE_HASH = keccak256(
'0x67363d3d37363d34f03d5260086018f3',
Expand Down
32 changes: 22 additions & 10 deletions scripts/deploy/deployCctpClaimExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,30 @@ async function main() {
address: executorAddress,
});

if (chainId !== 31337) {
if (networkName === 'arc') {
console.log(
'Skipping post-deploy Hardhat verification for arc; run `npm run verify:cctp-claim-executor -- arc` to submit via Sourcify.',
);
} else if (chainId !== 31337) {
await new Promise((resolve) => setTimeout(resolve, 5000));

await hre.run('verify:verify', {
address: executorAddress,
constructorArguments: [
owner,
chainConfig.messageTransmitter,
solverSigner,
chainConfig.usdcAddress,
],
});
try {
await hre.run('verify:verify', {
address: executorAddress,
constructorArguments: [
owner,
chainConfig.messageTransmitter,
solverSigner,
chainConfig.usdcAddress,
],
});
console.log('Contract verified on block explorer');
} catch (err) {
console.warn(
'Contract verification failed (deployment succeeded):',
err instanceof Error ? err.message : err,
);
}
}
}

Expand Down
275 changes: 275 additions & 0 deletions scripts/deploy/deployEtherealExecutor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
/**
* Deployment script for EtherealExecutor via CreateX CREATE3.
*
* Deploy on Ethereal only — the sole destination chain USDe deposits into ExchangeGateway.
*
* Usage:
* npx hardhat run scripts/deploy/deployEtherealExecutor.ts --network ethereal
*
* Required env vars:
* DEPLOYER_PRIVATE_KEY — deployer wallet private key
*
* Optional env vars:
* OWNER_ADDRESS — EtherealExecutor owner/EXECUTOR_ROLE holder; defaults to DEFAULT_OWNER_ADDRESS or deployer
* RESCUE_ADDRESS — RESCUE_ROLE holder; defaults to the resolved owner address
*/

import hre, { ethers } from 'hardhat';
import {
CREATE_X_FACTORY,
Create3ABI,
ETHEREAL_EXECUTOR_CREATE3_SALT,
ETHEREAL_EXECUTOR_CREATE3_SALT_TEXT,
CALLDATA_EXECUTOR_EXPECTED_ADDRESS,
decodeCreate3DeploymentFromTxReceipt,
hasContractBytecode,
} from './create3';
import { findDeploymentRegistryRow } from './deploymentRegistry';
import { writeEtherealExecutorAddress } from './etherealExecutorAddresses';
import { ETHEREAL_EXECUTOR_CHAIN_CONFIG } from './etherealExecutorConfig';

const DEFAULT_OWNER_ADDRESS = '0x0E1B5AB67aF1c99F8c7Ebc71f41f75D4D6211e53';

const ADDR_HEX_RE = /^0x[a-fA-F0-9]{40}$/;

function resolveOwnerAddress(deployerAddress: string): string {
const envOwner = process.env.OWNER_ADDRESS?.trim();
if (envOwner && ADDR_HEX_RE.test(envOwner)) {
return envOwner;
}

if (DEFAULT_OWNER_ADDRESS && ADDR_HEX_RE.test(DEFAULT_OWNER_ADDRESS)) {
return DEFAULT_OWNER_ADDRESS;
}

return deployerAddress;
}

function resolveRescueAddress(ownerAddress: string): string {
const envRescue = process.env.RESCUE_ADDRESS?.trim();
if (envRescue && ADDR_HEX_RE.test(envRescue)) {
return envRescue;
}

return ownerAddress;
}

function resolveCalldataExecutorAddress(chainId: number): string {
const row = findDeploymentRegistryRow(chainId);
const registryAddress = row?.calldataExecutorAddress?.trim();
if (registryAddress && ADDR_HEX_RE.test(registryAddress)) {
return registryAddress;
}

return CALLDATA_EXECUTOR_EXPECTED_ADDRESS;
}

async function getEtherealExecutorInitcode(params: {
owner: string;
rescueAddress: string;
calldataExecutor: string;
exchangeGateway: string;
depositToken: string;
}): Promise<string> {
const factory = await ethers.getContractFactory('EtherealExecutor');
const deployTransaction = await factory.getDeployTransaction(
params.owner,
params.rescueAddress,
params.calldataExecutor,
params.exchangeGateway,
params.depositToken,
);

if (!deployTransaction.data) {
throw new Error('EtherealExecutor deploy transaction data is empty');
}

return deployTransaction.data;
}

async function assertEtherealExecutorDeployment(params: {
address: string;
owner: string;
calldataExecutor: string;
exchangeGateway: string;
depositToken: string;
}): Promise<void> {
const contract = new ethers.Contract(
params.address,
[
'function owner() view returns (address)',
'function CALLDATA_EXECUTOR() view returns (address)',
'function exchangeGateway() view returns (address)',
'function DEPOSIT_TOKEN() view returns (address)',
],
ethers.provider,
);

const [owner, calldataExecutor, exchangeGateway, depositToken] = await Promise.all([
contract.owner() as Promise<string>,
contract.CALLDATA_EXECUTOR() as Promise<string>,
contract.exchangeGateway() as Promise<string>,
contract.DEPOSIT_TOKEN() as Promise<string>,
]);

if (owner.toLowerCase() !== params.owner.toLowerCase()) {
throw new Error(`EtherealExecutor owner mismatch: expected ${params.owner}, got ${owner}`);
}

if (calldataExecutor.toLowerCase() !== params.calldataExecutor.toLowerCase()) {
throw new Error(
`EtherealExecutor CALLDATA_EXECUTOR mismatch: expected ${params.calldataExecutor}, got ${calldataExecutor}`,
);
}

if (exchangeGateway.toLowerCase() !== params.exchangeGateway.toLowerCase()) {
throw new Error(
`EtherealExecutor exchangeGateway mismatch: expected ${params.exchangeGateway}, got ${exchangeGateway}`,
);
}

if (depositToken.toLowerCase() !== params.depositToken.toLowerCase()) {
throw new Error(
`EtherealExecutor DEPOSIT_TOKEN mismatch: expected ${params.depositToken}, got ${depositToken}`,
);
}
}

function printBackendConfigSnippet(chainId: number, address: string): void {
console.log('\n=== bungee-backend config snippet ===');
console.log(
'Update executorAddress in bungee-backend/src/modules/bungee-auto/constants.ts (ETHEREAL_DEPOSIT_CONFIG):',
);
console.log(` [${chainId}]: '${address}',`);
}

async function persistEtherealExecutorAddress(params: {
network: string;
chainId: number;
address: string;
}): Promise<void> {
const filePath = await writeEtherealExecutorAddress(params.network, params.address);
console.log('Deployment JSON:', filePath);
printBackendConfigSnippet(params.chainId, params.address);
}

async function main() {
const [deployer] = await ethers.getSigners();
const networkName = hre.network.name;
const chainId = Number((await ethers.provider.getNetwork()).chainId);

const chainConfig = ETHEREAL_EXECUTOR_CHAIN_CONFIG[chainId];
if (!chainConfig) {
throw new Error(`Chain ${chainId} is not configured for EtherealExecutor deployment`);
}

console.log('Deployer: ', deployer.address);
console.log('Network: ', networkName);
console.log('Chain ID: ', chainId);
console.log('CREATE3 salt: ', ETHEREAL_EXECUTOR_CREATE3_SALT_TEXT);
console.log('');

const owner = resolveOwnerAddress(deployer.address);
const rescueAddress = resolveRescueAddress(owner);
const calldataExecutor = resolveCalldataExecutorAddress(chainId);
const { exchangeGateway, depositToken } = chainConfig;

console.log('Owner: ', owner);
console.log('RescueAddress: ', rescueAddress);
console.log('CalldataExecutor: ', calldataExecutor);
console.log('ExchangeGateway: ', exchangeGateway);
console.log('DepositToken: ', depositToken);
console.log('');

const initcode = await getEtherealExecutorInitcode({
owner,
rescueAddress,
calldataExecutor,
exchangeGateway,
depositToken,
});

const create3Factory = new ethers.Contract(CREATE_X_FACTORY, Create3ABI, deployer);

const expectedAddress = (await create3Factory.deployCreate3.staticCall(
ETHEREAL_EXECUTOR_CREATE3_SALT,
initcode,
)) as string;

console.log('Expected address:', expectedAddress);

const existingBytecode = await ethers.provider.getCode(expectedAddress);
if (hasContractBytecode(existingBytecode)) {
console.log(`EtherealExecutor already deployed at ${expectedAddress}`);
await assertEtherealExecutorDeployment({
address: expectedAddress,
owner,
calldataExecutor,
exchangeGateway,
depositToken,
});
await persistEtherealExecutorAddress({
network: networkName,
chainId,
address: expectedAddress,
});
return;
}

console.log('Deploying EtherealExecutor via CREATE3...');
const create3Deployment = await create3Factory.deployCreate3(
ETHEREAL_EXECUTOR_CREATE3_SALT,
initcode,
);
console.log('CREATE3 deployment tx:', create3Deployment.hash);

const receipt = await create3Deployment.wait();
const executorAddress = decodeCreate3DeploymentFromTxReceipt({ receipt });
if (!executorAddress) {
throw new Error('EtherealExecutor address not found in CREATE3 deployment receipt');
}

if (executorAddress.toLowerCase() !== expectedAddress.toLowerCase()) {
throw new Error(
`Deployed address ${executorAddress} does not match staticCall ${expectedAddress}`,
);
}

await assertEtherealExecutorDeployment({
address: executorAddress,
owner,
calldataExecutor,
exchangeGateway,
depositToken,
});

console.log('\n=== Deployment Summary ===');
console.log(`EtherealExecutor (${networkName}): ${executorAddress}`);
await persistEtherealExecutorAddress({
network: networkName,
chainId,
address: executorAddress,
});

if (chainId !== 31337) {
await new Promise((resolve) => setTimeout(resolve, 5000));

try {
await hre.run('verify:verify', {
address: executorAddress,
constructorArguments: [owner, rescueAddress, calldataExecutor, exchangeGateway, depositToken],
});
console.log('Contract verified on block explorer');
} catch (err) {
console.warn(
'Contract verification failed (deployment succeeded):',
err instanceof Error ? err.message : err,
);
}
}
}

main().catch((err) => {
console.error(err);
process.exit(1);
});
Loading