@across-protocol/contracts 3.0.17 → 3.0.19
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/README.md +2 -0
- package/artifacts/build-info/9cb910e5bb5dd730cd01af84a0fb0466.json +1 -0
- package/artifacts/contracts/Ink_SpokePool.sol/Ink_SpokePool.dbg.json +4 -0
- package/artifacts/contracts/Ink_SpokePool.sol/Ink_SpokePool.json +2316 -0
- package/contracts/Ink_SpokePool.sol +72 -0
- package/dist/deploy/consts.js +8 -2
- package/dist/deployments/deployments.json +7 -1
- package/dist/hardhat.config.js +17 -0
- package/dist/scripts/svm/addressToPublicKey.d.ts +1 -0
- package/dist/scripts/svm/addressToPublicKey.js +20 -0
- package/dist/scripts/svm/bridgeLiabilityToHubPool.d.ts +25 -0
- package/dist/scripts/svm/bridgeLiabilityToHubPool.js +221 -0
- package/dist/scripts/svm/closeRelayerPdas.js +8 -9
- package/dist/scripts/svm/enableRoute.js +7 -1
- package/dist/scripts/svm/executeRebalanceToHubPool.d.ts +29 -0
- package/dist/scripts/svm/executeRebalanceToHubPool.js +345 -0
- package/dist/scripts/svm/executeRebalanceToSpokePool.d.ts +1 -0
- package/dist/scripts/svm/executeRebalanceToSpokePool.js +240 -0
- package/dist/scripts/svm/fakeFillWithRandomDistribution.js +6 -7
- package/dist/scripts/svm/initialize.js +2 -2
- package/dist/scripts/svm/proposeRebalanceToHubPool.d.ts +27 -0
- package/dist/scripts/svm/proposeRebalanceToHubPool.js +117 -0
- package/dist/scripts/svm/proposeRebalanceToSpokePool.d.ts +1 -0
- package/dist/scripts/svm/proposeRebalanceToSpokePool.js +97 -0
- package/dist/scripts/svm/publicKeyToAddress.d.ts +1 -0
- package/dist/scripts/svm/publicKeyToAddress.js +20 -0
- package/dist/scripts/svm/queryDeposits.js +3 -2
- package/dist/scripts/svm/queryFills.js +12 -14
- package/dist/scripts/svm/queryRoute.js +7 -1
- package/dist/scripts/svm/queryState.js +1 -0
- package/dist/scripts/svm/remoteHubPoolPauseDeposits.d.ts +1 -0
- package/dist/scripts/svm/remoteHubPoolPauseDeposits.js +191 -0
- package/dist/scripts/svm/remoteHubPoolSetDepositRoute.js +16 -29
- package/dist/scripts/svm/remotePauseDeposits.js +21 -27
- package/dist/scripts/svm/simpleDeposit.js +7 -1
- package/dist/scripts/svm/simpleFakeRelayerRepayment.js +3 -3
- package/dist/scripts/svm/simpleFill.js +6 -6
- package/dist/scripts/svm/utils/constants.d.ts +4 -0
- package/dist/scripts/svm/utils/constants.js +8 -1
- package/dist/scripts/svm/utils/helpers.d.ts +33 -0
- package/dist/scripts/svm/utils/helpers.js +60 -1
- package/dist/scripts/svm/utils/poolRebalanceTree.d.ts +22 -0
- package/dist/scripts/svm/utils/poolRebalanceTree.js +20 -0
- package/dist/src/svm/coders.d.ts +37 -0
- package/dist/src/svm/coders.js +250 -0
- package/dist/src/svm/conversionUtils.d.ts +22 -0
- package/dist/src/svm/conversionUtils.js +73 -0
- package/dist/src/svm/index.d.ts +6 -0
- package/dist/src/svm/index.js +22 -0
- package/dist/src/svm/instructionParamsUtils.d.ts +31 -0
- package/dist/src/svm/instructionParamsUtils.js +128 -0
- package/dist/src/svm/relayHashUtils.d.ts +30 -0
- package/dist/src/svm/relayHashUtils.js +209 -0
- package/dist/src/svm/solanaProgramUtils.d.ts +38 -0
- package/dist/src/svm/solanaProgramUtils.js +147 -0
- package/dist/src/svm/transactionUtils.d.ts +8 -0
- package/dist/src/svm/transactionUtils.js +55 -0
- package/dist/src/types/svm.d.ts +118 -0
- package/dist/src/types/svm.js +2 -0
- package/dist/target/types/svm_spoke.d.ts +47 -42
- package/dist/tasks/enableL1TokenAcrossEcosystem.js +3 -33
- package/dist/tasks/types.d.ts +2 -0
- package/dist/tasks/types.js +2 -0
- package/dist/tasks/utils.d.ts +12 -0
- package/dist/tasks/utils.js +34 -0
- package/dist/test/svm/MulticallHandler.js +2 -2
- package/dist/test/svm/SvmSpoke.Bundle.js +59 -60
- package/dist/test/svm/SvmSpoke.Deposit.js +23 -31
- package/dist/test/svm/SvmSpoke.Fill.AcrossPlus.js +16 -18
- package/dist/test/svm/SvmSpoke.Fill.js +38 -40
- package/dist/test/svm/SvmSpoke.HandleReceiveMessage.js +2 -2
- package/dist/test/svm/SvmSpoke.Ownership.js +11 -17
- package/dist/test/svm/SvmSpoke.RefundClaims.js +12 -11
- package/dist/test/svm/SvmSpoke.Routes.js +11 -7
- package/dist/test/svm/SvmSpoke.SlowFill.AcrossPlus.js +72 -16
- package/dist/test/svm/SvmSpoke.SlowFill.js +33 -28
- package/dist/test/svm/SvmSpoke.TokenBridge.js +15 -17
- package/dist/test/svm/SvmSpoke.common.d.ts +1 -49
- package/dist/test/svm/SvmSpoke.common.js +6 -5
- package/dist/test/svm/cctpHelpers.js +2 -2
- package/dist/test/svm/utils.d.ts +5 -67
- package/dist/test/svm/utils.js +10 -220
- package/dist/typechain/contracts/Ink_SpokePool.d.ts +1251 -0
- package/dist/typechain/contracts/Ink_SpokePool.js +2 -0
- package/dist/typechain/contracts/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/Ink_SpokePool__factory.d.ts +1833 -0
- package/dist/typechain/factories/contracts/Ink_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 +2 -2
- package/dist/src/SvmUtils.d.ts +0 -50
- package/dist/src/SvmUtils.js +0 -415
|
@@ -808,11 +808,7 @@ export type SvmSpoke = {
|
|
|
808
808
|
"### Required Accounts:",
|
|
809
809
|
"- signer (Signer): The account that authorizes the closure. Must be the relayer in the fill_status PDA.",
|
|
810
810
|
"- state (Writable): Spoke state PDA. Seed: [\"state\",state.seed] where seed is 0 on mainnet.",
|
|
811
|
-
"- fill_status (Writable): The FillStatusAccount PDA to be closed.
|
|
812
|
-
"",
|
|
813
|
-
"### Parameters:",
|
|
814
|
-
"- _relay_hash: The hash identifying the relay for which the fill status account is being closed.",
|
|
815
|
-
"- relay_data: The data structure containing information about the relay."
|
|
811
|
+
"- fill_status (Writable): The FillStatusAccount PDA to be closed."
|
|
816
812
|
];
|
|
817
813
|
"discriminator": [
|
|
818
814
|
224,
|
|
@@ -855,45 +851,9 @@ export type SvmSpoke = {
|
|
|
855
851
|
{
|
|
856
852
|
"name": "fillStatus";
|
|
857
853
|
"writable": true;
|
|
858
|
-
"pda": {
|
|
859
|
-
"seeds": [
|
|
860
|
-
{
|
|
861
|
-
"kind": "const";
|
|
862
|
-
"value": [
|
|
863
|
-
102,
|
|
864
|
-
105,
|
|
865
|
-
108,
|
|
866
|
-
108,
|
|
867
|
-
115
|
|
868
|
-
];
|
|
869
|
-
},
|
|
870
|
-
{
|
|
871
|
-
"kind": "arg";
|
|
872
|
-
"path": "relayHash";
|
|
873
|
-
}
|
|
874
|
-
];
|
|
875
|
-
};
|
|
876
|
-
}
|
|
877
|
-
];
|
|
878
|
-
"args": [
|
|
879
|
-
{
|
|
880
|
-
"name": "relayHash";
|
|
881
|
-
"type": {
|
|
882
|
-
"array": [
|
|
883
|
-
"u8",
|
|
884
|
-
32
|
|
885
|
-
];
|
|
886
|
-
};
|
|
887
|
-
},
|
|
888
|
-
{
|
|
889
|
-
"name": "relayData";
|
|
890
|
-
"type": {
|
|
891
|
-
"defined": {
|
|
892
|
-
"name": "v3RelayData";
|
|
893
|
-
};
|
|
894
|
-
};
|
|
895
854
|
}
|
|
896
855
|
];
|
|
856
|
+
"args": [];
|
|
897
857
|
},
|
|
898
858
|
{
|
|
899
859
|
"name": "closeInstructionParams";
|
|
@@ -5041,6 +5001,19 @@ export type SvmSpoke = {
|
|
|
5041
5001
|
66
|
|
5042
5002
|
];
|
|
5043
5003
|
},
|
|
5004
|
+
{
|
|
5005
|
+
"name": "tokensBridged";
|
|
5006
|
+
"discriminator": [
|
|
5007
|
+
200,
|
|
5008
|
+
201,
|
|
5009
|
+
199,
|
|
5010
|
+
39,
|
|
5011
|
+
5,
|
|
5012
|
+
238,
|
|
5013
|
+
214,
|
|
5014
|
+
196
|
|
5015
|
+
];
|
|
5016
|
+
},
|
|
5044
5017
|
{
|
|
5045
5018
|
"name": "v3FundsDeposited";
|
|
5046
5019
|
"discriminator": [
|
|
@@ -5375,6 +5348,10 @@ export type SvmSpoke = {
|
|
|
5375
5348
|
{
|
|
5376
5349
|
"name": "relayer";
|
|
5377
5350
|
"type": "pubkey";
|
|
5351
|
+
},
|
|
5352
|
+
{
|
|
5353
|
+
"name": "fillDeadline";
|
|
5354
|
+
"type": "u32";
|
|
5378
5355
|
}
|
|
5379
5356
|
];
|
|
5380
5357
|
};
|
|
@@ -5808,6 +5785,34 @@ export type SvmSpoke = {
|
|
|
5808
5785
|
];
|
|
5809
5786
|
};
|
|
5810
5787
|
},
|
|
5788
|
+
{
|
|
5789
|
+
"name": "tokensBridged";
|
|
5790
|
+
"type": {
|
|
5791
|
+
"kind": "struct";
|
|
5792
|
+
"fields": [
|
|
5793
|
+
{
|
|
5794
|
+
"name": "amountToReturn";
|
|
5795
|
+
"type": "u64";
|
|
5796
|
+
},
|
|
5797
|
+
{
|
|
5798
|
+
"name": "chainId";
|
|
5799
|
+
"type": "u64";
|
|
5800
|
+
},
|
|
5801
|
+
{
|
|
5802
|
+
"name": "leafId";
|
|
5803
|
+
"type": "u32";
|
|
5804
|
+
},
|
|
5805
|
+
{
|
|
5806
|
+
"name": "l2TokenAddress";
|
|
5807
|
+
"type": "pubkey";
|
|
5808
|
+
},
|
|
5809
|
+
{
|
|
5810
|
+
"name": "caller";
|
|
5811
|
+
"type": "pubkey";
|
|
5812
|
+
}
|
|
5813
|
+
];
|
|
5814
|
+
};
|
|
5815
|
+
},
|
|
5811
5816
|
{
|
|
5812
5817
|
"name": "transferLiability";
|
|
5813
5818
|
"type": {
|
|
@@ -5,38 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const config_1 = require("hardhat/config");
|
|
7
7
|
const assert_1 = __importDefault(require("assert"));
|
|
8
|
-
const utils_1 = require("./utils");
|
|
9
8
|
const constants_1 = require("../utils/constants");
|
|
10
|
-
|
|
11
|
-
* Given a token symbol, determine whether it is a valid key for the TOKEN_SYMBOLS_MAP object.
|
|
12
|
-
*/
|
|
13
|
-
function isTokenSymbol(symbol) {
|
|
14
|
-
return constants_1.TOKEN_SYMBOLS_MAP[symbol] !== undefined;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Given a token symbol from the HubPool chain and a remote chain ID, resolve the relevant token symbol and address.
|
|
18
|
-
*/
|
|
19
|
-
function resolveTokenOnChain(mainnetSymbol, chainId) {
|
|
20
|
-
(0, assert_1.default)(isTokenSymbol(mainnetSymbol), `Unrecognised token symbol (${mainnetSymbol})`);
|
|
21
|
-
let symbol = mainnetSymbol;
|
|
22
|
-
// Handle USDC special case where L1 USDC is mapped to different token symbols on L2s.
|
|
23
|
-
if (mainnetSymbol === "USDC") {
|
|
24
|
-
const symbols = ["USDC", "USDC.e", "USDbC", "USDzC"];
|
|
25
|
-
const tokenSymbol = symbols.find((symbol) => constants_1.TOKEN_SYMBOLS_MAP[symbol]?.addresses[chainId]);
|
|
26
|
-
if (!isTokenSymbol(tokenSymbol)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
symbol = tokenSymbol;
|
|
30
|
-
}
|
|
31
|
-
else if (symbol === "DAI" && chainId === constants_1.CHAIN_IDs.BLAST) {
|
|
32
|
-
symbol = "USDB";
|
|
33
|
-
}
|
|
34
|
-
const address = constants_1.TOKEN_SYMBOLS_MAP[symbol].addresses[chainId];
|
|
35
|
-
if (!address) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
return { symbol, address };
|
|
39
|
-
}
|
|
9
|
+
const utils_1 = require("./utils");
|
|
40
10
|
const { ARBITRUM, OPTIMISM } = constants_1.CHAIN_IDs;
|
|
41
11
|
const NO_SYMBOL = "----";
|
|
42
12
|
const NO_ADDRESS = "------------------------------------------";
|
|
@@ -65,7 +35,7 @@ const getChainsFromList = (taskArgInput) => taskArgInput
|
|
|
65
35
|
throw new Error(`Defaulted to network \`hardhat\`; specify \`--network mainnet\` or \`--network sepolia\``);
|
|
66
36
|
}
|
|
67
37
|
const _matchedSymbol = Object.keys(constants_1.TOKEN_SYMBOLS_MAP).find((_symbol) => _symbol === symbol);
|
|
68
|
-
(0, assert_1.default)(isTokenSymbol(_matchedSymbol));
|
|
38
|
+
(0, assert_1.default)((0, utils_1.isTokenSymbol)(_matchedSymbol));
|
|
69
39
|
const matchedSymbol = _matchedSymbol;
|
|
70
40
|
const l1Token = constants_1.TOKEN_SYMBOLS_MAP[matchedSymbol].addresses[hubChainId];
|
|
71
41
|
(0, assert_1.default)(l1Token !== undefined, `Could not find ${symbol} in TOKEN_SYMBOLS_MAP`);
|
|
@@ -98,7 +68,7 @@ const getChainsFromList = (taskArgInput) => taskArgInput
|
|
|
98
68
|
const chainIds = enabledChainIds.filter((chainId) => inputChains.includes(chainId));
|
|
99
69
|
console.log("\nLoading L2 companion token address for provided L1 token.");
|
|
100
70
|
const tokens = Object.fromEntries(chainIds.map((chainId) => {
|
|
101
|
-
const token = resolveTokenOnChain(matchedSymbol, chainId);
|
|
71
|
+
const token = (0, utils_1.resolveTokenOnChain)(matchedSymbol, chainId);
|
|
102
72
|
if (token === undefined) {
|
|
103
73
|
return [chainId, { symbol: NO_SYMBOL, address: NO_ADDRESS }];
|
|
104
74
|
}
|
package/dist/tasks/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TokenSymbol } from "./types";
|
|
1
2
|
export declare const zeroAddress = "0x0000000000000000000000000000000000000000";
|
|
2
3
|
export declare const minimalSpokePoolInterface: ({
|
|
3
4
|
inputs: ({
|
|
@@ -46,3 +47,14 @@ export declare const minimalAdapterInterface: {
|
|
|
46
47
|
type: string;
|
|
47
48
|
}[];
|
|
48
49
|
export declare function askYesNoQuestion(query: string): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Given a token symbol from the HubPool chain and a remote chain ID, resolve the relevant token symbol and address.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveTokenOnChain(mainnetSymbol: string, chainId: number): {
|
|
54
|
+
symbol: TokenSymbol;
|
|
55
|
+
address: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Given a token symbol, determine whether it is a valid key for the TOKEN_SYMBOLS_MAP object.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isTokenSymbol(symbol: unknown): symbol is TokenSymbol;
|
package/dist/tasks/utils.js
CHANGED
|
@@ -5,8 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.minimalAdapterInterface = exports.minimalSpokePoolInterface = exports.zeroAddress = void 0;
|
|
7
7
|
exports.askYesNoQuestion = askYesNoQuestion;
|
|
8
|
+
exports.resolveTokenOnChain = resolveTokenOnChain;
|
|
9
|
+
exports.isTokenSymbol = isTokenSymbol;
|
|
10
|
+
const assert_1 = __importDefault(require("assert"));
|
|
8
11
|
const ethers_1 = require("ethers");
|
|
9
12
|
const readline_1 = __importDefault(require("readline"));
|
|
13
|
+
const constants_1 = require("../utils/constants");
|
|
10
14
|
exports.zeroAddress = ethers_1.ethers.constants.AddressZero;
|
|
11
15
|
exports.minimalSpokePoolInterface = [
|
|
12
16
|
{
|
|
@@ -162,3 +166,33 @@ async function askYesNoQuestion(query) {
|
|
|
162
166
|
return false;
|
|
163
167
|
return askYesNoQuestion(query);
|
|
164
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Given a token symbol from the HubPool chain and a remote chain ID, resolve the relevant token symbol and address.
|
|
171
|
+
*/
|
|
172
|
+
function resolveTokenOnChain(mainnetSymbol, chainId) {
|
|
173
|
+
(0, assert_1.default)(isTokenSymbol(mainnetSymbol), `Unrecognised token symbol (${mainnetSymbol})`);
|
|
174
|
+
let symbol = mainnetSymbol;
|
|
175
|
+
// Handle USDC special case where L1 USDC is mapped to different token symbols on L2s.
|
|
176
|
+
if (mainnetSymbol === "USDC") {
|
|
177
|
+
const symbols = ["USDC", "USDC.e", "USDbC", "USDzC"];
|
|
178
|
+
const tokenSymbol = symbols.find((symbol) => constants_1.TOKEN_SYMBOLS_MAP[symbol]?.addresses[chainId]);
|
|
179
|
+
if (!isTokenSymbol(tokenSymbol)) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
symbol = tokenSymbol;
|
|
183
|
+
}
|
|
184
|
+
else if (symbol === "DAI" && chainId === constants_1.CHAIN_IDs.BLAST) {
|
|
185
|
+
symbol = "USDB";
|
|
186
|
+
}
|
|
187
|
+
const address = constants_1.TOKEN_SYMBOLS_MAP[symbol].addresses[chainId];
|
|
188
|
+
if (!address) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
return { symbol, address };
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Given a token symbol, determine whether it is a valid key for the TOKEN_SYMBOLS_MAP object.
|
|
195
|
+
*/
|
|
196
|
+
function isTokenSymbol(symbol) {
|
|
197
|
+
return constants_1.TOKEN_SYMBOLS_MAP[symbol] !== undefined;
|
|
198
|
+
}
|
|
@@ -27,7 +27,7 @@ const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
|
27
27
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
28
28
|
const web3_js_1 = require("@solana/web3.js");
|
|
29
29
|
const spl_token_1 = require("@solana/spl-token");
|
|
30
|
-
const
|
|
30
|
+
const svm_1 = require("../../src/svm");
|
|
31
31
|
const SvmSpoke_common_1 = require("./SvmSpoke.common");
|
|
32
32
|
const { provider, owner, connection, assertSE } = SvmSpoke_common_1.common;
|
|
33
33
|
describe("multicall_handler", () => {
|
|
@@ -47,7 +47,7 @@ describe("multicall_handler", () => {
|
|
|
47
47
|
const recipient = web3_js_1.Keypair.generate().publicKey;
|
|
48
48
|
const recipientATA = (await (0, spl_token_1.getOrCreateAssociatedTokenAccount)(connection, payer, mint, recipient)).address;
|
|
49
49
|
const transferIx = (0, spl_token_1.createTransferCheckedInstruction)(handlerATA, mint, recipientATA, handlerSigner, tokenAmount, mintDecimals);
|
|
50
|
-
const multicallHandlerCoder = new
|
|
50
|
+
const multicallHandlerCoder = new svm_1.MulticallHandlerCoder([transferIx]);
|
|
51
51
|
const handlerMessage = multicallHandlerCoder.encode();
|
|
52
52
|
await program.methods
|
|
53
53
|
.handleV3AcrossMessage(handlerMessage)
|