@across-protocol/contracts 3.0.20 → 3.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/build-info/e986ccf2458b97f0dcb4be2c6dc68250.json +1 -0
- package/artifacts/contracts/Cher_SpokePool.sol/Cher_SpokePool.dbg.json +4 -0
- package/artifacts/contracts/Cher_SpokePool.sol/Cher_SpokePool.json +2316 -0
- package/contracts/Cher_SpokePool.sol +72 -0
- package/dist/deploy/consts.js +5 -0
- package/dist/deployments/deployments.json +11 -1
- package/dist/hardhat.config.js +17 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/scripts/svm/bridgeLiabilityToHubPool.js +4 -6
- package/dist/scripts/svm/closeRelayerPdas.js +1 -2
- package/dist/scripts/svm/enableRoute.js +3 -3
- package/dist/scripts/svm/executeRebalanceToHubPool.js +2 -4
- package/dist/scripts/svm/executeRebalanceToSpokePool.js +7 -11
- package/dist/scripts/svm/fakeFillWithRandomDistribution.js +2 -3
- package/dist/scripts/svm/initialize.js +1 -2
- package/dist/scripts/svm/queryDeposits.js +1 -2
- package/dist/scripts/svm/queryFills.js +1 -2
- package/dist/scripts/svm/queryRoute.js +3 -3
- package/dist/scripts/svm/queryState.js +2 -2
- package/dist/scripts/svm/remoteHubPoolPauseDeposits.js +2 -4
- package/dist/scripts/svm/remoteHubPoolSetDepositRoute.js +2 -4
- package/dist/scripts/svm/remotePauseDeposits.js +2 -4
- package/dist/scripts/svm/simpleDeposit.js +3 -3
- package/dist/scripts/svm/simpleFakeRelayerRepayment.js +3 -4
- package/dist/scripts/svm/simpleFill.js +2 -3
- package/dist/src/DeploymentUtils.d.ts +1 -1
- package/dist/src/svm/assets/idl/index.d.ts +6 -0
- package/dist/src/svm/assets/idl/index.js +15 -0
- package/dist/src/svm/assets/index.d.ts +6 -0
- package/dist/src/svm/assets/index.js +19 -0
- package/dist/src/svm/assets/message_transmitter.d.ts +1681 -0
- package/dist/src/svm/assets/message_transmitter.js +2 -0
- package/dist/src/svm/assets/multicall_handler.d.ts +37 -0
- package/dist/src/svm/assets/multicall_handler.js +2 -0
- package/dist/src/svm/assets/svm_spoke.d.ts +6012 -0
- package/dist/src/svm/assets/svm_spoke.js +2 -0
- package/dist/src/svm/assets/test.d.ts +249 -0
- package/dist/src/svm/assets/test.js +2 -0
- package/dist/src/svm/assets/token_messenger_minter.d.ts +2055 -0
- package/dist/src/svm/assets/token_messenger_minter.js +2 -0
- package/dist/src/svm/helpers.js +1 -1
- package/dist/src/svm/index.d.ts +2 -0
- package/dist/src/svm/index.js +2 -0
- package/dist/src/svm/programConnectors.d.ts +13 -0
- package/dist/src/svm/programConnectors.js +46 -0
- package/dist/src/types/svm.d.ts +4 -0
- package/dist/typechain/contracts/Cher_SpokePool.d.ts +1251 -0
- package/dist/typechain/contracts/Cher_SpokePool.js +2 -0
- package/dist/typechain/contracts/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/Cher_SpokePool__factory.d.ts +1833 -0
- package/dist/typechain/factories/contracts/Cher_SpokePool__factory.js +2347 -0
- package/dist/typechain/factories/contracts/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/index.js +3 -1
- package/dist/typechain/hardhat.d.ts +9 -0
- package/dist/typechain/index.d.ts +2 -0
- package/dist/typechain/index.js +5 -3
- package/package.json +6 -5
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
|
|
4
|
+
|
|
5
|
+
import "./Ovm_SpokePool.sol";
|
|
6
|
+
import "./external/interfaces/CCTPInterfaces.sol";
|
|
7
|
+
import { IOpUSDCBridgeAdapter } from "./external/interfaces/IOpUSDCBridgeAdapter.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @notice Cher SpokePool.
|
|
11
|
+
* @custom:security-contact bugs@across.to
|
|
12
|
+
*/
|
|
13
|
+
contract Cher_SpokePool is Ovm_SpokePool {
|
|
14
|
+
using SafeERC20 for IERC20;
|
|
15
|
+
|
|
16
|
+
// Address of the custom L2 USDC bridge.
|
|
17
|
+
address private constant USDC_BRIDGE = 0x8be79275FCfD08A931087ECf70Ba8a99aee3AC59;
|
|
18
|
+
|
|
19
|
+
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
20
|
+
constructor(
|
|
21
|
+
address _wrappedNativeTokenAddress,
|
|
22
|
+
uint32 _depositQuoteTimeBuffer,
|
|
23
|
+
uint32 _fillDeadlineBuffer,
|
|
24
|
+
IERC20 _l2Usdc,
|
|
25
|
+
ITokenMessenger _cctpTokenMessenger
|
|
26
|
+
)
|
|
27
|
+
Ovm_SpokePool(
|
|
28
|
+
_wrappedNativeTokenAddress,
|
|
29
|
+
_depositQuoteTimeBuffer,
|
|
30
|
+
_fillDeadlineBuffer,
|
|
31
|
+
_l2Usdc,
|
|
32
|
+
_cctpTokenMessenger
|
|
33
|
+
)
|
|
34
|
+
{} // solhint-disable-line no-empty-blocks
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @notice Construct the OVM Cher SpokePool.
|
|
38
|
+
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
|
|
39
|
+
* relay hash collisions.
|
|
40
|
+
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
|
|
41
|
+
* @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
|
|
42
|
+
*/
|
|
43
|
+
function initialize(
|
|
44
|
+
uint32 _initialDepositId,
|
|
45
|
+
address _crossDomainAdmin,
|
|
46
|
+
address _withdrawalRecipient
|
|
47
|
+
) public initializer {
|
|
48
|
+
__OvmSpokePool_init(_initialDepositId, _crossDomainAdmin, _withdrawalRecipient, Lib_PredeployAddresses.OVM_ETH);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @notice Cher-specific logic to bridge tokens back to the hub pool contract on L1.
|
|
53
|
+
* @param amountToReturn Amount of the token to bridge back.
|
|
54
|
+
* @param l2TokenAddress Address of the l2 Token to bridge back. This token will either be bridged back to the token defined in the mapping `remoteL1Tokens`,
|
|
55
|
+
* or via the canonical mapping defined in the bridge contract retrieved from `tokenBridges`.
|
|
56
|
+
* @dev This implementation deviates slightly from `_bridgeTokensToHubPool` in the `Ovm_SpokePool` contract since
|
|
57
|
+
* this chain uses Circle's bridged (upgradable to native) USDC standard, which uses a custom interface.
|
|
58
|
+
*/
|
|
59
|
+
function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal virtual override {
|
|
60
|
+
// Handle custom USDC bridge which doesn't conform to the standard bridge interface. In the future, CCTP may be used to bridge USDC to mainnet, in which
|
|
61
|
+
// case bridging logic is handled by the Ovm_SpokePool code. In the meantime, if CCTP is not enabled, then use the USDC bridge. Once CCTP is activated on
|
|
62
|
+
// Cher, this block of code will be unused.
|
|
63
|
+
if (l2TokenAddress == address(usdcToken) && !_isCCTPEnabled()) {
|
|
64
|
+
usdcToken.safeIncreaseAllowance(USDC_BRIDGE, amountToReturn);
|
|
65
|
+
IOpUSDCBridgeAdapter(USDC_BRIDGE).sendMessage(
|
|
66
|
+
withdrawalRecipient, // _to. Withdraw, over the bridge, to the l1 hub pool contract.
|
|
67
|
+
amountToReturn, // _amount.
|
|
68
|
+
l1Gas // _minGasLimit. Same value used in other OpStack bridges.
|
|
69
|
+
);
|
|
70
|
+
} else super._bridgeTokensToHubPool(amountToReturn, l2TokenAddress);
|
|
71
|
+
}
|
|
72
|
+
}
|
package/dist/deploy/consts.js
CHANGED
|
@@ -86,6 +86,11 @@ exports.OP_STACK_ADDRESS_MAP = {
|
|
|
86
86
|
L1StandardBridge: "0x88ff1e5b602916615391f55854588efcbb7663f0",
|
|
87
87
|
L1OpUSDCBridgeAdapter: common_1.ZERO_ADDRESS,
|
|
88
88
|
},
|
|
89
|
+
[utils_1.CHAIN_IDs.CHER]: {
|
|
90
|
+
L1CrossDomainMessenger: "0x9cf951e3f74b644e621b36ca9cea147a78d4c39f",
|
|
91
|
+
L1StandardBridge: "0xeb9bf100225c214efc3e7c651ebbadcf85177607",
|
|
92
|
+
L1OpUSDCBridgeAdapter: "0xC67A8c5f22b40274Ca7C4A56Db89569Ee2AD3FAb",
|
|
93
|
+
},
|
|
89
94
|
[utils_1.CHAIN_IDs.LISK]: {
|
|
90
95
|
L1CrossDomainMessenger: "0x31B72D76FB666844C41EdF08dF0254875Dbb7edB",
|
|
91
96
|
L1StandardBridge: "0x2658723Bf70c7667De6B25F99fcce13A16D25d08",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"Zora_Adapter": { "address": "0x024f2fc31cbdd8de17194b1892c834f98ef5169b", "blockNumber": 20512287 },
|
|
30
30
|
"WorldChain_Adapter": { "address": "0xA8399e221a583A57F54Abb5bA22f31b5D6C09f32", "blockNumber": 20963234 },
|
|
31
31
|
"AlephZero_Adapter": { "address": "0x6F4083304C2cA99B077ACE06a5DcF670615915Af", "blockNumber": 21131132 },
|
|
32
|
-
"Ink_Adapter": { "address": "0x7e90a40c7519b041a7df6498fbf5662e8cfc61d2", "blockNumber": 21438590 }
|
|
32
|
+
"Ink_Adapter": { "address": "0x7e90a40c7519b041a7df6498fbf5662e8cfc61d2", "blockNumber": 21438590 },
|
|
33
|
+
"Cher_Adapter": { "address": "0x0c9d064523177dBB55CFE52b9D0c485FBFc35FD2", "blockNumber": 21597341 }
|
|
33
34
|
},
|
|
34
35
|
"10": {
|
|
35
36
|
"SpokePool": { "address": "0x6f26Bf09B1C792e3228e5467807a900A503c0281", "blockNumber": 93903076 },
|
|
@@ -168,5 +169,14 @@
|
|
|
168
169
|
"SpokePool": { "address": "0xeF684C38F94F48775959ECf2012D7E864ffb9dd4", "blockNumber": 1139240 },
|
|
169
170
|
"SpokePoolVerifier": { "address": "0xB4A8d45647445EA9FC3E1058096142390683dBC2", "blockNumber": 1152853 },
|
|
170
171
|
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 1145284 }
|
|
172
|
+
},
|
|
173
|
+
"1810017368444177321": {
|
|
174
|
+
"SvmSpoke": { "address": "YVMQN27RnCNt23NRxzJPumXRd8iovEfKtzkqyMc5vDt", "blockNumber": 0 },
|
|
175
|
+
"MessageTransmitter": { "address": "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd", "blockNumber": 0 },
|
|
176
|
+
"TokenMessengerMinter": { "address": "CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3", "blockNumber": 0 }
|
|
177
|
+
},
|
|
178
|
+
"1868": {
|
|
179
|
+
"SpokePool": { "address": "0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96", "blockNumber": 1709997 },
|
|
180
|
+
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 1711482 }
|
|
171
181
|
}
|
|
172
182
|
}
|
package/dist/hardhat.config.js
CHANGED
|
@@ -102,6 +102,7 @@ const config = {
|
|
|
102
102
|
"contracts/Optimism_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
|
|
103
103
|
"contracts/WorldChain_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
|
|
104
104
|
"contracts/Ink_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
|
|
105
|
+
"contracts/Cher_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
|
|
105
106
|
},
|
|
106
107
|
},
|
|
107
108
|
zksolc: {
|
|
@@ -326,6 +327,13 @@ const config = {
|
|
|
326
327
|
accounts: { mnemonic },
|
|
327
328
|
companionNetworks: { l1: "mainnet" },
|
|
328
329
|
},
|
|
330
|
+
cher: {
|
|
331
|
+
chainId: constants_1.CHAIN_IDs.CHER,
|
|
332
|
+
url: (0, common_1.getNodeUrl)("cher", true, constants_1.CHAIN_IDs.CHER),
|
|
333
|
+
saveDeployments: true,
|
|
334
|
+
accounts: { mnemonic },
|
|
335
|
+
companionNetworks: { l1: "mainnet" },
|
|
336
|
+
},
|
|
329
337
|
},
|
|
330
338
|
gasReporter: { enabled: process.env.REPORT_GAS !== undefined, currency: "USD" },
|
|
331
339
|
etherscan: {
|
|
@@ -356,6 +364,7 @@ const config = {
|
|
|
356
364
|
worldchain: "blockscout",
|
|
357
365
|
alephzero: "blockscout",
|
|
358
366
|
ink: "blockscout",
|
|
367
|
+
cher: "blockscout",
|
|
359
368
|
},
|
|
360
369
|
customChains: [
|
|
361
370
|
{
|
|
@@ -390,6 +399,14 @@ const config = {
|
|
|
390
399
|
browserURL: "https://explorer.inkonchain.com",
|
|
391
400
|
},
|
|
392
401
|
},
|
|
402
|
+
{
|
|
403
|
+
network: "cher",
|
|
404
|
+
chainId: constants_1.CHAIN_IDs.CHER,
|
|
405
|
+
urls: {
|
|
406
|
+
apiURL: "https://blockscout.com/api",
|
|
407
|
+
browserURL: "https://blockscout.com",
|
|
408
|
+
},
|
|
409
|
+
},
|
|
393
410
|
{
|
|
394
411
|
network: "linea",
|
|
395
412
|
chainId: constants_1.CHAIN_IDs.LINEA,
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -56,16 +56,14 @@ const svm_1 = require("../../src/svm");
|
|
|
56
56
|
const constants_1 = require("@across-protocol/constants");
|
|
57
57
|
const common_1 = require("@uma/common");
|
|
58
58
|
const ethers_1 = require("ethers");
|
|
59
|
+
const svm_2 = require("../../src/svm");
|
|
59
60
|
const typechain_1 = require("../../typechain");
|
|
60
61
|
const helpers_1 = require("./utils/helpers");
|
|
61
62
|
// Set up Solana provider.
|
|
62
63
|
const provider = anchor_1.AnchorProvider.env();
|
|
63
64
|
anchor.setProvider(provider);
|
|
64
65
|
// Get Solana programs and IDLs.
|
|
65
|
-
const
|
|
66
|
-
const svmSpokeProgram = new anchor_1.Program(svmSpokeIdl, provider);
|
|
67
|
-
const messageTransmitterIdl = require("../../target/idl/message_transmitter.json");
|
|
68
|
-
const tokenMessengerMinterIdl = require("../../target/idl/token_messenger_minter.json");
|
|
66
|
+
const svmSpokeProgram = (0, svm_2.getSpokePoolProgram)(provider);
|
|
69
67
|
// CCTP domains.
|
|
70
68
|
const ethereumDomain = 0; // Ethereum
|
|
71
69
|
const solanaDomain = 5; // Solana
|
|
@@ -171,11 +169,11 @@ async function bridgeLiabilityToHubPool() {
|
|
|
171
169
|
console.log("✅ Bridge liability to hub pool completed successfully.");
|
|
172
170
|
}
|
|
173
171
|
async function bridgeTokensToHubPool(amount, signer, statePda, inputToken) {
|
|
174
|
-
const messageTransmitterProgram =
|
|
172
|
+
const messageTransmitterProgram = (0, svm_2.getMessageTransmitterProgram)(provider);
|
|
175
173
|
const vault = (0, spl_token_1.getAssociatedTokenAddressSync)(inputToken, statePda, true, spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
176
174
|
// Derive the transferLiability PDA
|
|
177
175
|
const [transferLiability] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("transfer_liability"), inputToken.toBuffer()], svmSpokeProgram.programId);
|
|
178
|
-
const tokenMessengerMinterProgram =
|
|
176
|
+
const tokenMessengerMinterProgram = (0, svm_2.getTokenMessengerMinterProgram)(provider);
|
|
179
177
|
const [tokenMessengerMinterSenderAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("sender_authority")], tokenMessengerMinterProgram.programId);
|
|
180
178
|
const [messageTransmitter] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter")], messageTransmitterProgram.programId);
|
|
181
179
|
const [tokenMessenger] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_messenger")], tokenMessengerMinterProgram.programId);
|
|
@@ -37,8 +37,7 @@ const svm_1 = require("../../src/svm");
|
|
|
37
37
|
// Set up the provider
|
|
38
38
|
const provider = anchor_1.AnchorProvider.env();
|
|
39
39
|
anchor.setProvider(provider);
|
|
40
|
-
const
|
|
41
|
-
const program = new anchor_1.Program(idl, provider);
|
|
40
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
42
41
|
const programId = program.programId;
|
|
43
42
|
// Parse arguments
|
|
44
43
|
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
@@ -29,15 +29,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
31
31
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
32
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
33
32
|
const spl_token_1 = require("@solana/spl-token");
|
|
33
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
34
34
|
const yargs_1 = __importDefault(require("yargs"));
|
|
35
35
|
const helpers_1 = require("yargs/helpers");
|
|
36
|
+
const svm_1 = require("../../src/svm");
|
|
36
37
|
// Set up the provider
|
|
37
38
|
const provider = anchor_1.AnchorProvider.env();
|
|
38
39
|
anchor.setProvider(provider);
|
|
39
|
-
const
|
|
40
|
-
const program = new anchor_1.Program(idl, provider);
|
|
40
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
41
41
|
const programId = program.programId;
|
|
42
42
|
console.log("SVM-Spoke Program ID:", programId.toString());
|
|
43
43
|
// Parse arguments
|
|
@@ -72,10 +72,8 @@ const svm_1 = require("../../src/svm");
|
|
|
72
72
|
const provider = anchor_1.AnchorProvider.env();
|
|
73
73
|
anchor.setProvider(provider);
|
|
74
74
|
// Get Solana programs.
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const messageTransmitterIdl = require("../../target/idl/message_transmitter.json");
|
|
78
|
-
const messageTransmitterProgram = new anchor_1.Program(messageTransmitterIdl, provider);
|
|
75
|
+
const svmSpokeProgram = (0, svm_1.getSpokePoolProgram)(provider);
|
|
76
|
+
const messageTransmitterProgram = (0, svm_1.getMessageTransmitterProgram)(provider);
|
|
79
77
|
const [messageTransmitterState] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter")], messageTransmitterProgram.programId);
|
|
80
78
|
const [authorityPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter_authority"), svmSpokeProgram.programId.toBuffer()], messageTransmitterProgram.programId);
|
|
81
79
|
const [selfAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("self_authority")], svmSpokeProgram.programId);
|
|
@@ -32,29 +32,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
33
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
34
34
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
35
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
36
35
|
const spl_token_1 = require("@solana/spl-token");
|
|
36
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
37
37
|
const common_1 = require("@uma/common");
|
|
38
38
|
// eslint-disable-next-line camelcase
|
|
39
|
-
const constants_1 = require("
|
|
39
|
+
const constants_1 = require("@across-protocol/constants");
|
|
40
|
+
const ethers_1 = require("ethers");
|
|
40
41
|
const yargs_1 = __importDefault(require("yargs"));
|
|
41
42
|
const helpers_1 = require("yargs/helpers");
|
|
42
43
|
const svm_1 = require("../../src/svm");
|
|
43
|
-
const ethers_1 = require("ethers");
|
|
44
|
-
// eslint-disable-next-line camelcase
|
|
45
44
|
const typechain_1 = require("../../typechain");
|
|
46
|
-
const poolRebalanceTree_1 = require("./utils/poolRebalanceTree");
|
|
47
45
|
const helpers_2 = require("./utils/helpers");
|
|
46
|
+
const poolRebalanceTree_1 = require("./utils/poolRebalanceTree");
|
|
48
47
|
// Set up Solana provider.
|
|
49
48
|
const provider = anchor_1.AnchorProvider.env();
|
|
50
49
|
anchor.setProvider(provider);
|
|
51
50
|
// Get Solana programs.
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const messageTransmitterProgram = new anchor_1.Program(messageTransmitterIdl, provider);
|
|
56
|
-
const tokenMessengerMinterIdl = require("../../target/idl/token_messenger_minter.json");
|
|
57
|
-
const tokenMessengerMinterProgram = new anchor_1.Program(tokenMessengerMinterIdl, provider);
|
|
51
|
+
const svmSpokeProgram = (0, svm_1.getSpokePoolProgram)(provider);
|
|
52
|
+
const messageTransmitterProgram = (0, svm_1.getMessageTransmitterProgram)(provider);
|
|
53
|
+
const tokenMessengerMinterProgram = (0, svm_1.getTokenMessengerMinterProgram)(provider);
|
|
58
54
|
// Set up Ethereum provider and signer.
|
|
59
55
|
const isDevnet = (0, svm_1.isSolanaDevnet)(provider);
|
|
60
56
|
const nodeURL = isDevnet ? (0, common_1.getNodeUrl)("sepolia", true) : (0, common_1.getNodeUrl)("mainnet", true);
|
|
@@ -30,8 +30,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
// Note that this should be run only on devnet as this is fake fill and all filled tokens are sent to random recipients.
|
|
31
31
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
32
32
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
33
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
34
33
|
const spl_token_1 = require("@solana/spl-token");
|
|
34
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
35
35
|
const yargs_1 = __importDefault(require("yargs"));
|
|
36
36
|
const helpers_1 = require("yargs/helpers");
|
|
37
37
|
const svm_1 = require("../../src/svm");
|
|
@@ -39,8 +39,7 @@ const svm_1 = require("../../src/svm");
|
|
|
39
39
|
const provider = anchor_1.AnchorProvider.env();
|
|
40
40
|
anchor.setProvider(provider);
|
|
41
41
|
const signer = anchor.AnchorProvider.env().wallet.payer;
|
|
42
|
-
const
|
|
43
|
-
const program = new anchor_1.Program(idl, provider);
|
|
42
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
44
43
|
const programId = program.programId;
|
|
45
44
|
// Parse arguments
|
|
46
45
|
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
@@ -36,8 +36,7 @@ const svm_1 = require("../../src/svm");
|
|
|
36
36
|
// Set up the provider
|
|
37
37
|
const provider = anchor_1.AnchorProvider.env();
|
|
38
38
|
anchor.setProvider(provider);
|
|
39
|
-
const
|
|
40
|
-
const program = new anchor_1.Program(idl, provider);
|
|
39
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
41
40
|
const programId = program.programId;
|
|
42
41
|
// Parse arguments
|
|
43
42
|
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
@@ -36,8 +36,7 @@ const svm_1 = require("../../src/svm");
|
|
|
36
36
|
// Set up the provider
|
|
37
37
|
const provider = anchor_1.AnchorProvider.env();
|
|
38
38
|
anchor.setProvider(provider);
|
|
39
|
-
const
|
|
40
|
-
const program = new anchor_1.Program(idl, provider);
|
|
39
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
41
40
|
const programId = program.programId;
|
|
42
41
|
console.log("SVM-Spoke Program ID:", programId.toString());
|
|
43
42
|
// Parse arguments
|
|
@@ -36,8 +36,7 @@ const svm_1 = require("../../src/svm");
|
|
|
36
36
|
// Set up the provider
|
|
37
37
|
const provider = anchor_1.AnchorProvider.env();
|
|
38
38
|
anchor.setProvider(provider);
|
|
39
|
-
const
|
|
40
|
-
const program = new anchor_1.Program(idl, provider);
|
|
39
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
41
40
|
const programId = program.programId;
|
|
42
41
|
// Parse arguments
|
|
43
42
|
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)).option("seed", {
|
|
@@ -29,15 +29,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
31
31
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
32
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
33
32
|
const spl_token_1 = require("@solana/spl-token");
|
|
33
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
34
34
|
const yargs_1 = __importDefault(require("yargs"));
|
|
35
35
|
const helpers_1 = require("yargs/helpers");
|
|
36
|
+
const svm_1 = require("../../src/svm");
|
|
36
37
|
// Set up the provider
|
|
37
38
|
const provider = anchor_1.AnchorProvider.env();
|
|
38
39
|
anchor.setProvider(provider);
|
|
39
|
-
const
|
|
40
|
-
const program = new anchor_1.Program(idl, provider);
|
|
40
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
41
41
|
const programId = program.programId;
|
|
42
42
|
console.log("SVM-Spoke Program ID:", programId.toString());
|
|
43
43
|
// Parse arguments
|
|
@@ -32,11 +32,11 @@ const anchor_1 = require("@coral-xyz/anchor");
|
|
|
32
32
|
const web3_js_1 = require("@solana/web3.js");
|
|
33
33
|
const yargs_1 = __importDefault(require("yargs"));
|
|
34
34
|
const helpers_1 = require("yargs/helpers");
|
|
35
|
+
const svm_1 = require("../../src/svm");
|
|
35
36
|
// Set up the provider
|
|
36
37
|
const provider = anchor_1.AnchorProvider.env();
|
|
37
38
|
anchor.setProvider(provider);
|
|
38
|
-
const
|
|
39
|
-
const program = new anchor_1.Program(idl, provider);
|
|
39
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
40
40
|
const programId = program.programId;
|
|
41
41
|
console.log("SVM-Spoke Program ID:", programId.toString());
|
|
42
42
|
// Parse arguments
|
|
@@ -64,11 +64,9 @@ async function remoteHubPoolPauseDeposit() {
|
|
|
64
64
|
// CCTP domains.
|
|
65
65
|
const remoteDomain = 0; // Ethereum
|
|
66
66
|
// Get Solana programs and accounts.
|
|
67
|
-
const
|
|
68
|
-
const svmSpokeProgram = new anchor_1.Program(svmSpokeIdl, provider);
|
|
67
|
+
const svmSpokeProgram = (0, svm_1.getSpokePoolProgram)(provider);
|
|
69
68
|
const [statePda, _] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("state"), seed.toArrayLike(Buffer, "le", 8)], svmSpokeProgram.programId);
|
|
70
|
-
const
|
|
71
|
-
const messageTransmitterProgram = new anchor_1.Program(messageTransmitterIdl, provider);
|
|
69
|
+
const messageTransmitterProgram = (0, svm_1.getMessageTransmitterProgram)(provider);
|
|
72
70
|
const [messageTransmitterState] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter")], messageTransmitterProgram.programId);
|
|
73
71
|
const [authorityPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter_authority"), svmSpokeProgram.programId.toBuffer()], messageTransmitterProgram.programId);
|
|
74
72
|
const [selfAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("self_authority")], svmSpokeProgram.programId);
|
|
@@ -71,8 +71,7 @@ async function remoteHubPoolSetDepositRoute() {
|
|
|
71
71
|
// CCTP domains.
|
|
72
72
|
const remoteDomain = 0; // Ethereum
|
|
73
73
|
// Get Solana programs and accounts.
|
|
74
|
-
const
|
|
75
|
-
const svmSpokeProgram = new anchor_1.Program(svmSpokeIdl, provider);
|
|
74
|
+
const svmSpokeProgram = (0, svm_1.getSpokePoolProgram)(provider);
|
|
76
75
|
const [statePda, _] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("state"), seed.toArrayLike(Buffer, "le", 8)], svmSpokeProgram.programId);
|
|
77
76
|
const [routePda] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
78
77
|
Buffer.from("route"),
|
|
@@ -81,8 +80,7 @@ async function remoteHubPoolSetDepositRoute() {
|
|
|
81
80
|
new anchor_1.BN(destinationChainId).toArrayLike(Buffer, "le", 8),
|
|
82
81
|
], svmSpokeProgram.programId);
|
|
83
82
|
const vault = (0, spl_token_1.getAssociatedTokenAddressSync)(originToken, statePda, true, spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
84
|
-
const
|
|
85
|
-
const messageTransmitterProgram = new anchor_1.Program(messageTransmitterIdl, provider);
|
|
83
|
+
const messageTransmitterProgram = (0, svm_1.getMessageTransmitterProgram)(provider);
|
|
86
84
|
const [messageTransmitterState] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter")], messageTransmitterProgram.programId);
|
|
87
85
|
const [authorityPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter_authority"), svmSpokeProgram.programId.toBuffer()], messageTransmitterProgram.programId);
|
|
88
86
|
const [selfAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("self_authority")], svmSpokeProgram.programId);
|
|
@@ -71,11 +71,9 @@ async function remotePauseDeposits() {
|
|
|
71
71
|
const remoteDomain = 0; // Ethereum
|
|
72
72
|
const localDomain = 5; // Solana
|
|
73
73
|
// Get Solana programs and accounts.
|
|
74
|
-
const
|
|
75
|
-
const svmSpokeProgram = new anchor_1.Program(svmSpokeIdl, provider);
|
|
74
|
+
const svmSpokeProgram = (0, svm_1.getSpokePoolProgram)(provider);
|
|
76
75
|
const [statePda, _] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("state"), seed.toArrayLike(Buffer, "le", 8)], svmSpokeProgram.programId);
|
|
77
|
-
const
|
|
78
|
-
const messageTransmitterProgram = new anchor_1.Program(messageTransmitterIdl, provider);
|
|
76
|
+
const messageTransmitterProgram = (0, svm_1.getMessageTransmitterProgram)(provider);
|
|
79
77
|
const [messageTransmitterState] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter")], messageTransmitterProgram.programId);
|
|
80
78
|
const [authorityPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("message_transmitter_authority"), svmSpokeProgram.programId.toBuffer()], messageTransmitterProgram.programId);
|
|
81
79
|
const [selfAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("self_authority")], svmSpokeProgram.programId);
|
|
@@ -29,15 +29,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
31
31
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
32
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
33
32
|
const spl_token_1 = require("@solana/spl-token");
|
|
33
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
34
34
|
const yargs_1 = __importDefault(require("yargs"));
|
|
35
35
|
const helpers_1 = require("yargs/helpers");
|
|
36
|
+
const svm_1 = require("../../src/svm");
|
|
36
37
|
// Set up the provider
|
|
37
38
|
const provider = anchor_1.AnchorProvider.env();
|
|
38
39
|
anchor.setProvider(provider);
|
|
39
|
-
const
|
|
40
|
-
const program = new anchor_1.Program(idl, provider);
|
|
40
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
41
41
|
const programId = program.programId;
|
|
42
42
|
console.log("SVM-Spoke Program ID:", programId.toString());
|
|
43
43
|
// Parse arguments
|
|
@@ -29,17 +29,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
31
31
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
32
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
33
32
|
const spl_token_1 = require("@solana/spl-token");
|
|
33
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
34
|
+
const MerkleTree_1 = require("@uma/common/dist/MerkleTree");
|
|
34
35
|
const yargs_1 = __importDefault(require("yargs"));
|
|
35
36
|
const helpers_1 = require("yargs/helpers");
|
|
36
|
-
const MerkleTree_1 = require("@uma/common/dist/MerkleTree");
|
|
37
37
|
const svm_1 = require("../../src/svm");
|
|
38
38
|
// Set up the provider
|
|
39
39
|
const provider = anchor_1.AnchorProvider.env();
|
|
40
40
|
anchor.setProvider(provider);
|
|
41
|
-
const
|
|
42
|
-
const program = new anchor_1.Program(idl, provider);
|
|
41
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
43
42
|
const programId = program.programId;
|
|
44
43
|
// Parse arguments
|
|
45
44
|
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
@@ -30,16 +30,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
32
32
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
33
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
34
33
|
const spl_token_1 = require("@solana/spl-token");
|
|
34
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
35
35
|
const yargs_1 = __importDefault(require("yargs"));
|
|
36
36
|
const helpers_1 = require("yargs/helpers");
|
|
37
37
|
const svm_1 = require("../../src/svm");
|
|
38
38
|
// Set up the provider
|
|
39
39
|
const provider = anchor_1.AnchorProvider.env();
|
|
40
40
|
anchor.setProvider(provider);
|
|
41
|
-
const
|
|
42
|
-
const program = new anchor_1.Program(idl, provider);
|
|
41
|
+
const program = (0, svm_1.getSpokePoolProgram)(provider);
|
|
43
42
|
const programId = program.programId;
|
|
44
43
|
// Parse arguments
|
|
45
44
|
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function getDeployedAddress(contractName: string, networkId: number, throwOnError?: boolean): string | undefined;
|
|
1
|
+
export declare function getDeployedAddress(contractName: string, networkId: number | string, throwOnError?: boolean): string | undefined;
|
|
2
2
|
export declare function getDeployedBlockNumber(contractName: string, networkId: number): number;
|
|
3
3
|
export declare function getContractInfoFromAddress(contractAddress: string): {
|
|
4
4
|
chainId: Number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const MessageTransmitterIdl: any;
|
|
2
|
+
declare const MulticallHandlerIdl: any;
|
|
3
|
+
declare const SvmSpokeIdl: any;
|
|
4
|
+
declare const TestIdl: any;
|
|
5
|
+
declare const TokenMessengerMinterIdl: any;
|
|
6
|
+
export { MessageTransmitterIdl, MulticallHandlerIdl, SvmSpokeIdl, TestIdl, TokenMessengerMinterIdl };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file has been autogenerated. Do not edit manually.
|
|
3
|
+
// Generated by a script.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.TokenMessengerMinterIdl = exports.TestIdl = exports.SvmSpokeIdl = exports.MulticallHandlerIdl = exports.MessageTransmitterIdl = void 0;
|
|
6
|
+
const MessageTransmitterIdl = require("./message_transmitter.json");
|
|
7
|
+
exports.MessageTransmitterIdl = MessageTransmitterIdl;
|
|
8
|
+
const MulticallHandlerIdl = require("./multicall_handler.json");
|
|
9
|
+
exports.MulticallHandlerIdl = MulticallHandlerIdl;
|
|
10
|
+
const SvmSpokeIdl = require("./svm_spoke.json");
|
|
11
|
+
exports.SvmSpokeIdl = SvmSpokeIdl;
|
|
12
|
+
const TestIdl = require("./test.json");
|
|
13
|
+
exports.TestIdl = TestIdl;
|
|
14
|
+
const TokenMessengerMinterIdl = require("./token_messenger_minter.json");
|
|
15
|
+
exports.TokenMessengerMinterIdl = TokenMessengerMinterIdl;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./idl";
|
|
2
|
+
export { MessageTransmitter as MessageTransmitterAnchor } from "./message_transmitter";
|
|
3
|
+
export { MulticallHandler as MulticallHandlerAnchor } from "./multicall_handler";
|
|
4
|
+
export { SvmSpoke as SvmSpokeAnchor } from "./svm_spoke";
|
|
5
|
+
export { Test as TestAnchor } from "./test";
|
|
6
|
+
export { TokenMessengerMinter as TokenMessengerMinterAnchor } from "./token_messenger_minter";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file has been autogenerated. Do not edit manually.
|
|
3
|
+
// Generated by a script.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
__exportStar(require("./idl"), exports);
|