@across-protocol/sdk 4.3.47 → 4.3.49-alpha.0
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/dist/cjs/caching/IPFS/PinataIPFSClient.d.ts +0 -2
- package/dist/cjs/caching/IPFS/PinataIPFSClient.js +0 -6
- package/dist/cjs/caching/IPFS/PinataIPFSClient.js.map +1 -1
- package/dist/cjs/caching/Memory/MemoryCacheClient.d.ts +0 -2
- package/dist/cjs/caching/Memory/MemoryCacheClient.js +0 -6
- package/dist/cjs/caching/Memory/MemoryCacheClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.d.ts +5 -2
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +106 -75
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +2 -2
- package/dist/cjs/constants.d.ts +1 -1
- package/dist/cjs/constants.js +2 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/interfaces/CachingMechanism.d.ts +0 -2
- package/dist/cjs/interfaces/PubSubMechanism.d.ts +4 -0
- package/dist/cjs/interfaces/PubSubMechanism.js +3 -0
- package/dist/cjs/interfaces/PubSubMechanism.js.map +1 -0
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/interfaces/index.js +1 -0
- package/dist/cjs/interfaces/index.js.map +1 -1
- package/dist/cjs/utils/NetworkUtils.d.ts +1 -1
- package/dist/cjs/utils/NetworkUtils.js +7 -5
- package/dist/cjs/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/caching/IPFS/PinataIPFSClient.d.ts +0 -2
- package/dist/esm/caching/IPFS/PinataIPFSClient.js +0 -6
- package/dist/esm/caching/IPFS/PinataIPFSClient.js.map +1 -1
- package/dist/esm/caching/Memory/MemoryCacheClient.d.ts +0 -2
- package/dist/esm/caching/Memory/MemoryCacheClient.js +0 -6
- package/dist/esm/caching/Memory/MemoryCacheClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.d.ts +5 -2
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +146 -125
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +2 -2
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/interfaces/CachingMechanism.d.ts +0 -12
- package/dist/esm/interfaces/PubSubMechanism.d.ts +15 -0
- package/dist/esm/interfaces/PubSubMechanism.js +2 -0
- package/dist/esm/interfaces/PubSubMechanism.js.map +1 -0
- package/dist/esm/interfaces/index.d.ts +1 -0
- package/dist/esm/interfaces/index.js +1 -0
- package/dist/esm/interfaces/index.js.map +1 -1
- package/dist/esm/utils/NetworkUtils.d.ts +7 -6
- package/dist/esm/utils/NetworkUtils.js +14 -9
- package/dist/esm/utils/NetworkUtils.js.map +1 -1
- package/dist/types/caching/IPFS/PinataIPFSClient.d.ts +0 -2
- package/dist/types/caching/IPFS/PinataIPFSClient.d.ts.map +1 -1
- package/dist/types/caching/Memory/MemoryCacheClient.d.ts +0 -2
- package/dist/types/caching/Memory/MemoryCacheClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts +5 -2
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +2 -2
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/interfaces/CachingMechanism.d.ts +0 -12
- package/dist/types/interfaces/CachingMechanism.d.ts.map +1 -1
- package/dist/types/interfaces/PubSubMechanism.d.ts +16 -0
- package/dist/types/interfaces/PubSubMechanism.d.ts.map +1 -0
- package/dist/types/interfaces/index.d.ts +1 -0
- package/dist/types/interfaces/index.d.ts.map +1 -1
- package/dist/types/utils/NetworkUtils.d.ts +7 -6
- package/dist/types/utils/NetworkUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/caching/IPFS/PinataIPFSClient.ts +0 -8
- package/src/caching/Memory/MemoryCacheClient.ts +0 -8
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +65 -6
- package/src/constants.ts +1 -0
- package/src/interfaces/CachingMechanism.ts +0 -14
- package/src/interfaces/PubSubMechanism.ts +16 -0
- package/src/interfaces/index.ts +1 -0
- package/src/utils/NetworkUtils.ts +14 -9
|
@@ -74,8 +74,8 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
74
74
|
transactionHash?: string | undefined;
|
|
75
75
|
transactionIndex?: number | undefined;
|
|
76
76
|
}[];
|
|
77
|
-
refunds: Record<string, BigNumber>;
|
|
78
77
|
realizedLpFees: BigNumber;
|
|
78
|
+
refunds: Record<string, BigNumber>;
|
|
79
79
|
totalRefundAmount: BigNumber;
|
|
80
80
|
}>>;
|
|
81
81
|
bundleSlowFillsV3: Record<string, Record<string, {
|
|
@@ -334,8 +334,8 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
334
334
|
transactionHash?: string | undefined;
|
|
335
335
|
transactionIndex?: number | undefined;
|
|
336
336
|
}[];
|
|
337
|
-
refunds: Record<string, BigNumber>;
|
|
338
337
|
realizedLpFees: BigNumber;
|
|
338
|
+
refunds: Record<string, BigNumber>;
|
|
339
339
|
totalRefundAmount: BigNumber;
|
|
340
340
|
}>>, null>;
|
|
341
341
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CCTP_NO_DOMAIN, ChainFamily, CHAIN_IDs, MAINNET_CHAIN_IDs, PUBLIC_NETWORKS, PRODUCTION_NETWORKS, TESTNET_CHAIN_IDs, TOKEN_SYMBOLS_MAP, TOKEN_EQUIVALENCE_REMAPPING, } from "@across-protocol/constants";
|
|
1
|
+
export { CCTP_NO_DOMAIN, ChainFamily, CHAIN_IDs, MAINNET_CHAIN_IDs, OFT_NO_EID, PUBLIC_NETWORKS, PRODUCTION_NETWORKS, TESTNET_CHAIN_IDs, TOKEN_SYMBOLS_MAP, TOKEN_EQUIVALENCE_REMAPPING, } from "@across-protocol/constants";
|
|
2
2
|
export declare const ZERO_ADDRESS: string, ZERO_BYTES: string;
|
|
3
3
|
export declare const MAX_SAFE_ALLOWANCE = "79228162514264337593543950335";
|
|
4
4
|
export declare const MAX_SAFE_DEPOSIT_ID = "4294967295";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,EACd,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAqB,YAAY,UAAY,UAAU,QAAoB,CAAC;AAGnF,eAAO,MAAM,kBAAkB,kCAAkC,CAAC;AAIlE,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAGlC,eAAO,MAAM,2CAA2C,IAAI,CAAC;AAG7D,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAOtD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,UAA2B,CAAC;AAE1E,eAAO,MAAM,mBAAmB,QAAuB,CAAC;AACxD,eAAO,MAAM,wBAAwB,QAAU,CAAC;AAEhD,eAAO,MAAM,iCAAiC,+CAA+C,CAAC;AAC9F,eAAO,MAAM,qCAAqC,iDAAiD,CAAC;AACpG,eAAO,MAAM,sCAAsC,+CAA+C,CAAC;AAEnG,eAAO,MAAM,+BAA+B,gDAAgD,CAAC;AAE7F,e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hC,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAY/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAO7B,CAAC;AAKF,eAAO,MAAM,wBAAwB;;CAOpC,CAAC"}
|
|
@@ -23,17 +23,5 @@ export interface CachingMechanismInterface {
|
|
|
23
23
|
* @returns The ID of the value stored. If the value could not be stored, undefined is returned. If the caching mechanism uses the `key` as the ID, the `key` is returned.
|
|
24
24
|
*/
|
|
25
25
|
set<ObjectType, OverrideType>(key: string, value: ObjectType, ttl?: number, overrides?: OverrideType): Promise<string | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* Subscribes to a topic.
|
|
28
|
-
* @param topic The topic to subscribe to.
|
|
29
|
-
* @param callback The callback to call when a message is received.
|
|
30
|
-
*/
|
|
31
|
-
sub(topic: string, callback: (message: string, channel: string) => unknown): Promise<number>;
|
|
32
|
-
/**
|
|
33
|
-
* Publishes a message to the network.
|
|
34
|
-
* @param topic The topic to publish to.
|
|
35
|
-
* @param message The message to publish.
|
|
36
|
-
*/
|
|
37
|
-
pub(topic: string, message: string): Promise<number>;
|
|
38
26
|
}
|
|
39
27
|
//# sourceMappingURL=CachingMechanism.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CachingMechanism.d.ts","sourceRoot":"","sources":["../../../src/interfaces/CachingMechanism.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,GAAG,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,EACpC,GAAG,CAAC,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAC1C,SAAS,CAAC,EAAE,YAAY,GACvB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAE9B;;;;;;;;;;OAUG;IACH,GAAG,CAAC,UAAU,EAAE,YAAY,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,UAAU,EACjB,GAAG,CAAC,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,YAAY,GACvB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"CachingMechanism.d.ts","sourceRoot":"","sources":["../../../src/interfaces/CachingMechanism.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,GAAG,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,EACpC,GAAG,CAAC,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAC1C,SAAS,CAAC,EAAE,YAAY,GACvB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAE9B;;;;;;;;;;OAUG;IACH,GAAG,CAAC,UAAU,EAAE,YAAY,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,UAAU,EACjB,GAAG,CAAC,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,YAAY,GACvB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAChC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PubSubMechanismInterface {
|
|
2
|
+
/**
|
|
3
|
+
* Subscribes to a topic.
|
|
4
|
+
* @param topic The topic to subscribe to.
|
|
5
|
+
* @param callback The callback to call when a message is received.
|
|
6
|
+
*/
|
|
7
|
+
sub(topic: string, callback: (message: string, channel: string) => unknown): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Publishes a message to the network.
|
|
10
|
+
* @param topic The topic to publish to.
|
|
11
|
+
* @param message The message to publish.
|
|
12
|
+
* @returns The number of subscribers to the topic.
|
|
13
|
+
*/
|
|
14
|
+
pub(topic: string, message: string): Promise<number>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=PubSubMechanism.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PubSubMechanism.d.ts","sourceRoot":"","sources":["../../../src/interfaces/PubSubMechanism.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3F;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
|
|
@@ -59,12 +59,6 @@ export declare function chainIsArbitrum(chainId: number): boolean;
|
|
|
59
59
|
* @returns True if chainId is a Linea chain, otherwise false.
|
|
60
60
|
*/
|
|
61
61
|
export declare function chainIsLinea(chainId: number): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Determines whether a chain ID is a BSC implementation.
|
|
64
|
-
* @param chainId Chain ID to evaluate.
|
|
65
|
-
* @returns True if chainId is a BSC chain, otherwise false.
|
|
66
|
-
*/
|
|
67
|
-
export declare function chainIsBSC(chainId: number): boolean;
|
|
68
62
|
/**
|
|
69
63
|
* Determines whether a chain ID has a corresponding hub pool contract.
|
|
70
64
|
* @param chainId Chain ID to evaluate.
|
|
@@ -89,6 +83,13 @@ export declare function chainIsSvm(chainId: number): boolean;
|
|
|
89
83
|
* @returns True if chainId is a CCTP-bridging enabled chain, otherwise false.
|
|
90
84
|
*/
|
|
91
85
|
export declare function chainIsCCTPEnabled(chainId: number): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Determines whether a chain ID has the capacity for bridging via OFT. Must be evaluated in conjunction
|
|
88
|
+
* with a specific token.
|
|
89
|
+
* @param chainId Chain ID to evaluate.
|
|
90
|
+
* @returns True if chainId is an OFT-bridging enabled chain, otherwise false.
|
|
91
|
+
*/
|
|
92
|
+
export declare function chainIsOFTEnabled(chainId: number): boolean;
|
|
92
93
|
/**
|
|
93
94
|
* Determines if a chain ID requires a manual L1 -> L2 finalization step.
|
|
94
95
|
* @param chainId Chain ID to evaluate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/NetworkUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NetworkUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/NetworkUtils.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI9C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,oB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HANGED
|
@@ -89,12 +89,4 @@ export class PinataIPFSClient implements CachingMechanismInterface {
|
|
|
89
89
|
});
|
|
90
90
|
return storeValueInIPFS(key, JSON.stringify(value, jsonReplacerWithBigNumbers), this.client);
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
sub(_topic: string, _callback: (message: string, channel: string) => unknown): Promise<number> {
|
|
94
|
-
return Promise.resolve(1);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
pub(_topic: string, _message: string) {
|
|
98
|
-
return Promise.resolve(1);
|
|
99
|
-
}
|
|
100
92
|
}
|
|
@@ -32,12 +32,4 @@ export class MemoryCacheClient implements CachingMechanismInterface {
|
|
|
32
32
|
resolve(key);
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
sub(_topic: string, _callback: (message: string, channel: string) => unknown) {
|
|
37
|
-
return Promise.resolve(1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
pub(_topic: string, _message: string) {
|
|
41
|
-
return Promise.resolve(1);
|
|
42
|
-
}
|
|
43
35
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
PoolRebalanceLeaf,
|
|
11
11
|
Refund,
|
|
12
12
|
RunningBalances,
|
|
13
|
+
SpokePoolClientsByChain,
|
|
13
14
|
} from "../../../interfaces";
|
|
14
15
|
import {
|
|
15
16
|
bnZero,
|
|
@@ -18,6 +19,8 @@ import {
|
|
|
18
19
|
count2DDictionaryValues,
|
|
19
20
|
count3DDictionaryValues,
|
|
20
21
|
toAddressType,
|
|
22
|
+
getImpliedBundleBlockRanges,
|
|
23
|
+
EvmAddress,
|
|
21
24
|
} from "../../../utils";
|
|
22
25
|
import {
|
|
23
26
|
addLastRunningBalance,
|
|
@@ -28,6 +31,7 @@ import {
|
|
|
28
31
|
} from "./PoolRebalanceUtils";
|
|
29
32
|
import { AcrossConfigStoreClient } from "../../AcrossConfigStoreClient";
|
|
30
33
|
import { HubPoolClient } from "../../HubPoolClient";
|
|
34
|
+
import { BundleDataClient } from "../../BundleDataClient";
|
|
31
35
|
import { buildPoolRebalanceLeafTree } from "./MerkleTreeUtils";
|
|
32
36
|
|
|
33
37
|
// and expired deposits.
|
|
@@ -114,7 +118,7 @@ export function getEndBlockBuffers(
|
|
|
114
118
|
return chainIdListForBundleEvaluationBlockNumbers.map((chainId: number) => blockRangeEndBlockBuffer[chainId] ?? 0);
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
export function _buildPoolRebalanceRoot(
|
|
121
|
+
export async function _buildPoolRebalanceRoot(
|
|
118
122
|
latestMainnetBlock: number,
|
|
119
123
|
mainnetBundleEndBlock: number,
|
|
120
124
|
bundleV3Deposits: BundleDepositsV3,
|
|
@@ -122,9 +126,14 @@ export function _buildPoolRebalanceRoot(
|
|
|
122
126
|
bundleSlowFillsV3: BundleSlowFills,
|
|
123
127
|
unexecutableSlowFills: BundleExcessSlowFills,
|
|
124
128
|
expiredDepositsToRefundV3: ExpiredDepositsToRefundV3,
|
|
125
|
-
clients: {
|
|
129
|
+
clients: {
|
|
130
|
+
hubPoolClient: HubPoolClient;
|
|
131
|
+
configStoreClient: AcrossConfigStoreClient;
|
|
132
|
+
bundleDataClient: BundleDataClient;
|
|
133
|
+
spokePoolClients: SpokePoolClientsByChain;
|
|
134
|
+
},
|
|
126
135
|
maxL1TokenCountOverride?: number
|
|
127
|
-
): PoolRebalanceRoot {
|
|
136
|
+
): Promise<PoolRebalanceRoot> {
|
|
128
137
|
// Running balances are the amount of tokens that we need to send to each SpokePool to pay for all instant and
|
|
129
138
|
// slow relay refunds. They are decreased by the amount of funds already held by the SpokePool. Balances are keyed
|
|
130
139
|
// by the SpokePool's network and L1 token equivalent of the L2 token to refund.
|
|
@@ -297,9 +306,59 @@ export function _buildPoolRebalanceRoot(
|
|
|
297
306
|
});
|
|
298
307
|
});
|
|
299
308
|
|
|
300
|
-
// Add to the running balance value from the last valid root bundle proposal
|
|
301
|
-
//
|
|
302
|
-
|
|
309
|
+
// Add to the running balance value from the last valid root bundle proposal. A root bundle proposal which is still in liveness and has not yet been executed counts as a valid proposal.
|
|
310
|
+
// If the mainnetBundleEndBlock for this pool rebalance root corresponds to the pending root bundle or some root bundle before the pending root bundle, then we can fetch running balances directly from `ExecutedRootBundle` events.
|
|
311
|
+
if (
|
|
312
|
+
!clients.hubPoolClient.hasPendingProposal() ||
|
|
313
|
+
clients.hubPoolClient.getPendingRootBundle()!.bundleEvaluationBlockNumbers[1] <= mainnetBundleEndBlock
|
|
314
|
+
) {
|
|
315
|
+
addLastRunningBalance(latestMainnetBlock, runningBalances, clients.hubPoolClient);
|
|
316
|
+
} else {
|
|
317
|
+
// Otherwise, the pool rebalance root for this root bundle must be for an optimistic proposal, so we need to reconstruct the pool rebalance root for the pending root bundle to obtain the running balances.
|
|
318
|
+
// @dev It is safe to index the hub pool client's proposed root bundles here since there is guaranteed to be a pending proposal in this code block.
|
|
319
|
+
const mostRecentProposedRootBundle = clients.hubPoolClient.getLatestProposedRootBundle();
|
|
320
|
+
const blockRangesForChains = getImpliedBundleBlockRanges(
|
|
321
|
+
clients.hubPoolClient,
|
|
322
|
+
clients.configStoreClient,
|
|
323
|
+
mostRecentProposedRootBundle
|
|
324
|
+
);
|
|
325
|
+
// We are loading data from a pending root bundle, so we want to use arweave if possible.
|
|
326
|
+
const prevRootBundleData = await clients.bundleDataClient.loadData(
|
|
327
|
+
blockRangesForChains,
|
|
328
|
+
clients.spokePoolClients,
|
|
329
|
+
true
|
|
330
|
+
);
|
|
331
|
+
const prevPoolRebalanceRoot = await _buildPoolRebalanceRoot(
|
|
332
|
+
latestMainnetBlock,
|
|
333
|
+
blockRangesForChains[0][1],
|
|
334
|
+
prevRootBundleData.bundleDepositsV3,
|
|
335
|
+
prevRootBundleData.bundleFillsV3,
|
|
336
|
+
prevRootBundleData.bundleSlowFillsV3,
|
|
337
|
+
prevRootBundleData.unexecutableSlowFills,
|
|
338
|
+
prevRootBundleData.expiredDepositsToRefundV3,
|
|
339
|
+
clients,
|
|
340
|
+
maxL1TokenCountOverride
|
|
341
|
+
);
|
|
342
|
+
// Update the running balances by adding the pending root bundle's running balance amounts to this bundle's running balances.
|
|
343
|
+
const { runningBalances: prevRunningBalances } = prevPoolRebalanceRoot;
|
|
344
|
+
Object.keys(runningBalances).forEach((repaymentChainId) => {
|
|
345
|
+
Object.keys(runningBalances[Number(repaymentChainId)]).forEach((l1TokenAddress) => {
|
|
346
|
+
const updateRunningBalanceAmount = prevRunningBalances[Number(repaymentChainId)]?.[l1TokenAddress];
|
|
347
|
+
// If the pending root bundle didn't have a running balance, fall back to the last running balance for that token and chain pair.
|
|
348
|
+
const { runningBalance: fallbackRunningBalance } = clients.hubPoolClient.getRunningBalanceBeforeBlockForChain(
|
|
349
|
+
latestMainnetBlock,
|
|
350
|
+
Number(repaymentChainId),
|
|
351
|
+
EvmAddress.from(l1TokenAddress)
|
|
352
|
+
);
|
|
353
|
+
updateRunningBalance(
|
|
354
|
+
runningBalances,
|
|
355
|
+
Number(repaymentChainId),
|
|
356
|
+
l1TokenAddress,
|
|
357
|
+
updateRunningBalanceAmount ?? fallbackRunningBalance
|
|
358
|
+
);
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
}
|
|
303
362
|
|
|
304
363
|
const leaves: PoolRebalanceLeaf[] = constructPoolRebalanceLeaves(
|
|
305
364
|
mainnetBundleEndBlock,
|
package/src/constants.ts
CHANGED
|
@@ -34,18 +34,4 @@ export interface CachingMechanismInterface {
|
|
|
34
34
|
ttl?: number,
|
|
35
35
|
overrides?: OverrideType
|
|
36
36
|
): Promise<string | undefined>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Subscribes to a topic.
|
|
40
|
-
* @param topic The topic to subscribe to.
|
|
41
|
-
* @param callback The callback to call when a message is received.
|
|
42
|
-
*/
|
|
43
|
-
sub(topic: string, callback: (message: string, channel: string) => unknown): Promise<number>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Publishes a message to the network.
|
|
47
|
-
* @param topic The topic to publish to.
|
|
48
|
-
* @param message The message to publish.
|
|
49
|
-
*/
|
|
50
|
-
pub(topic: string, message: string): Promise<number>;
|
|
51
37
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PubSubMechanismInterface {
|
|
2
|
+
/**
|
|
3
|
+
* Subscribes to a topic.
|
|
4
|
+
* @param topic The topic to subscribe to.
|
|
5
|
+
* @param callback The callback to call when a message is received.
|
|
6
|
+
*/
|
|
7
|
+
sub(topic: string, callback: (message: string, channel: string) => unknown): Promise<void>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Publishes a message to the network.
|
|
11
|
+
* @param topic The topic to publish to.
|
|
12
|
+
* @param message The message to publish.
|
|
13
|
+
* @returns The number of subscribers to the topic.
|
|
14
|
+
*/
|
|
15
|
+
pub(topic: string, message: string): Promise<number>;
|
|
16
|
+
}
|
package/src/interfaces/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ChainFamily,
|
|
4
4
|
CHAIN_IDs,
|
|
5
5
|
MAINNET_CHAIN_IDs,
|
|
6
|
+
OFT_NO_EID,
|
|
6
7
|
PRODUCTION_NETWORKS,
|
|
7
8
|
PUBLIC_NETWORKS,
|
|
8
9
|
TESTNET_CHAIN_IDs,
|
|
@@ -105,15 +106,6 @@ export function chainIsLinea(chainId: number): boolean {
|
|
|
105
106
|
return [CHAIN_IDs.LINEA].includes(chainId);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
/**
|
|
109
|
-
* Determines whether a chain ID is a BSC implementation.
|
|
110
|
-
* @param chainId Chain ID to evaluate.
|
|
111
|
-
* @returns True if chainId is a BSC chain, otherwise false.
|
|
112
|
-
*/
|
|
113
|
-
export function chainIsBSC(chainId: number): boolean {
|
|
114
|
-
return [CHAIN_IDs.BSC].includes(chainId);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
109
|
/**
|
|
118
110
|
* Determines whether a chain ID has a corresponding hub pool contract.
|
|
119
111
|
* @param chainId Chain ID to evaluate.
|
|
@@ -154,6 +146,19 @@ export function chainIsCCTPEnabled(chainId: number): boolean {
|
|
|
154
146
|
return PRODUCTION_NETWORKS[chainId]?.cctpDomain !== CCTP_NO_DOMAIN && !cctpExceptions.includes(chainId);
|
|
155
147
|
}
|
|
156
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Determines whether a chain ID has the capacity for bridging via OFT. Must be evaluated in conjunction
|
|
151
|
+
* with a specific token.
|
|
152
|
+
* @param chainId Chain ID to evaluate.
|
|
153
|
+
* @returns True if chainId is an OFT-bridging enabled chain, otherwise false.
|
|
154
|
+
*/
|
|
155
|
+
export function chainIsOFTEnabled(chainId: number): boolean {
|
|
156
|
+
// Add chainIds to oftEnabled as they are supported by the protocol.
|
|
157
|
+
// This is backwards vs. CCTP logic because Across support for OFTs is limited vs. OFT deployments.
|
|
158
|
+
const oftEnabled = [CHAIN_IDs.ARBITRUM];
|
|
159
|
+
return oftEnabled.includes(chainId) && PRODUCTION_NETWORKS[chainId]?.oftEid !== OFT_NO_EID;
|
|
160
|
+
}
|
|
161
|
+
|
|
157
162
|
/**
|
|
158
163
|
* Determines if a chain ID requires a manual L1 -> L2 finalization step.
|
|
159
164
|
* @param chainId Chain ID to evaluate.
|