@across-protocol/sdk 4.2.16-alpha.0 → 4.2.16-alpha.2
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/arch/evm/SpokeUtils.d.ts +6 -2
- package/dist/cjs/arch/evm/SpokeUtils.js +21 -6
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +9 -5
- package/dist/cjs/arch/svm/SpokeUtils.js +70 -71
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +3 -5
- package/dist/cjs/arch/svm/utils.js +20 -28
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +60 -56
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -2
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +11 -8
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
- package/dist/cjs/clients/HubPoolClient.js +83 -58
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +64 -45
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +15 -9
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -3
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +40 -36
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +3 -4
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +3 -3
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/HubPool.d.ts +19 -14
- package/dist/cjs/interfaces/SpokePool.d.ts +13 -13
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +10 -10
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +5 -5
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +42 -49
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +12 -13
- package/dist/cjs/utils/AddressUtils.js +44 -46
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/EventUtils.js +1 -1
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
- package/dist/cjs/utils/SpokeUtils.js +4 -22
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +4 -4
- package/dist/cjs/utils/TokenUtils.js +4 -6
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +6 -2
- package/dist/esm/arch/evm/SpokeUtils.js +22 -7
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +9 -5
- package/dist/esm/arch/svm/SpokeUtils.js +74 -75
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +6 -8
- package/dist/esm/arch/svm/utils.js +21 -27
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +5 -3
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +12 -9
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +23 -22
- package/dist/esm/clients/HubPoolClient.js +97 -63
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +67 -47
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +42 -38
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +4 -5
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +3 -3
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/HubPool.d.ts +19 -14
- package/dist/esm/interfaces/SpokePool.d.ts +13 -13
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +11 -11
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +44 -51
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +13 -14
- package/dist/esm/utils/AddressUtils.js +50 -56
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/EventUtils.js +2 -2
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +3 -8
- package/dist/esm/utils/SpokeUtils.js +4 -26
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +4 -16
- package/dist/esm/utils/TokenUtils.js +5 -7
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts +6 -2
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +9 -5
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +6 -8
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- package/dist/types/clients/HubPoolClient.d.ts +23 -22
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -3
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +3 -3
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/HubPool.d.ts +19 -14
- package/dist/types/interfaces/HubPool.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +13 -13
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -6
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +13 -14
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +3 -8
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +4 -16
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/arch/evm/SpokeUtils.ts +52 -12
- package/src/arch/svm/SpokeUtils.ts +108 -59
- package/src/arch/svm/utils.ts +11 -20
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
- package/src/clients/BundleDataClient/BundleDataClient.ts +57 -53
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
- package/src/clients/BundleDataClient/utils/FillUtils.ts +10 -4
- package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +13 -9
- package/src/clients/HubPoolClient.ts +126 -82
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +6 -0
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +118 -35
- package/src/clients/mocks/MockHubPoolClient.ts +24 -19
- package/src/clients/mocks/MockSpokePoolClient.ts +39 -27
- package/src/clients/mocks/MockSvmCpiEventsClient.ts +3 -5
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
- package/src/interfaces/HubPool.ts +23 -14
- package/src/interfaces/SpokePool.ts +13 -13
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +14 -12
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +42 -46
- package/src/relayFeeCalculator/relayFeeCalculator.ts +20 -12
- package/src/utils/AddressUtils.ts +58 -60
- package/src/utils/EventUtils.ts +2 -2
- package/src/utils/SpokeUtils.ts +11 -33
- package/src/utils/TokenUtils.ts +10 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperstructUtils.js","sourceRoot":"","sources":["../../../../../src/clients/BundleDataClient/utils/SuperstructUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,IAAI,GACL,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"SuperstructUtils.js","sourceRoot":"","sources":["../../../../../src/clients/BundleDataClient/utils/SuperstructUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,IAAI,GACL,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAA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|
1
1
|
import { Contract, EventFilter } from "ethers";
|
|
2
2
|
import winston from "winston";
|
|
3
|
-
import { CachingMechanismInterface, CancelledRootBundle, CrossChainContractsSet, Deposit, DepositWithBlock, DestinationTokenWithBlock, DisputedRootBundle, ExecutedRootBundle,
|
|
3
|
+
import { CachingMechanismInterface, CancelledRootBundle, CrossChainContractsSet, Deposit, DepositWithBlock, DestinationTokenWithBlock, DisputedRootBundle, ExecutedRootBundle, TokenInfo, Log, LpToken, PendingRootBundle, ProposedRootBundle, RealizedLpFee, TokenRunningBalance, L1TokenInfo } from "../interfaces";
|
|
4
4
|
import { EVMBlockFinder } from "../arch/evm";
|
|
5
|
-
import { BigNumber, EventSearchConfig, MakeOptional } from "../utils";
|
|
5
|
+
import { BigNumber, EventSearchConfig, MakeOptional, EvmAddress, Address } from "../utils";
|
|
6
6
|
import { AcrossConfigStoreClient as ConfigStoreClient } from "./AcrossConfigStoreClient/AcrossConfigStoreClient";
|
|
7
7
|
import { BaseAbstractClient, UpdateFailureReason } from "./BaseAbstractClient";
|
|
8
8
|
type HubPoolUpdateSuccess = {
|
|
@@ -38,7 +38,7 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
38
38
|
timeToCache?: number;
|
|
39
39
|
};
|
|
40
40
|
protected l1TokensToDestinationTokens: L1TokensToDestinationTokens;
|
|
41
|
-
protected l1Tokens:
|
|
41
|
+
protected l1Tokens: L1TokenInfo[];
|
|
42
42
|
protected lpTokens: {
|
|
43
43
|
[token: string]: LpToken;
|
|
44
44
|
};
|
|
@@ -69,21 +69,22 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
69
69
|
getCancelledRootBundles(): CancelledRootBundle[];
|
|
70
70
|
getDisputedRootBundles(): DisputedRootBundle[];
|
|
71
71
|
getExecutedRootBundles(): ExecutedRootBundle[];
|
|
72
|
-
getSpokePoolForBlock(chain: number, block?: number):
|
|
73
|
-
getSpokePoolActivationBlock(chain: number, spokePool:
|
|
74
|
-
getL2TokenForL1TokenAtBlock(l1Token:
|
|
75
|
-
getL1TokenForL2TokenAtBlock(l2Token:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
getSpokePoolForBlock(chain: number, block?: number): Address;
|
|
73
|
+
getSpokePoolActivationBlock(chain: number, spokePool: Address): number | undefined;
|
|
74
|
+
getL2TokenForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, latestHubBlock?: number): Address;
|
|
75
|
+
getL1TokenForL2TokenAtBlock(l2Token: Address, // ! TODO: assuming that for Svm token, we'll have a proper full SvmAddress in this var
|
|
76
|
+
destinationChainId: number, latestHubBlock?: number): EvmAddress;
|
|
77
|
+
protected getL1TokenForDeposit(deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">): EvmAddress;
|
|
78
|
+
l2TokenEnabledForL1Token(l1Token: EvmAddress, destinationChainId: number): boolean;
|
|
79
|
+
l2TokenEnabledForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, hubBlockNumber: number): boolean;
|
|
80
|
+
l2TokenHasPoolRebalanceRoute(l2Token: Address, l2ChainId: number, hubPoolBlock?: number): boolean;
|
|
80
81
|
/**
|
|
81
82
|
* @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
|
|
82
83
|
* @param tokenAddress Token address on `chain`
|
|
83
|
-
* @param
|
|
84
|
+
* @param chainId Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
|
|
84
85
|
* @returns Token info for the given token address on the L2 chain including symbol and decimal.
|
|
85
86
|
*/
|
|
86
|
-
getTokenInfoForAddress(tokenAddress: string,
|
|
87
|
+
getTokenInfoForAddress(tokenAddress: string, chainId: number): TokenInfo;
|
|
87
88
|
/**
|
|
88
89
|
* Resolve a given timestamp to a block number on the HubPool chain.
|
|
89
90
|
* @param timestamp A single timestamp to be resolved to a block number on the HubPool chain.
|
|
@@ -100,7 +101,7 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
100
101
|
getBlockNumbers(timestamps: number[]): Promise<{
|
|
101
102
|
[quoteTimestamp: number]: number;
|
|
102
103
|
}>;
|
|
103
|
-
getCurrentPoolUtilization(l1Token:
|
|
104
|
+
getCurrentPoolUtilization(l1Token: EvmAddress): Promise<BigNumber>;
|
|
104
105
|
/**
|
|
105
106
|
* For a HubPool token at a specific block number, compute the relevant utilization.
|
|
106
107
|
* @param hubPoolToken HubPool token to query utilization for.
|
|
@@ -110,13 +111,13 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
110
111
|
* @param timeToCache Age at which the response is able to be cached.
|
|
111
112
|
* @returns HubPool utilization at `blockNumber` after optional `amount` increase in utilization.
|
|
112
113
|
*/
|
|
113
|
-
protected getUtilization(hubPoolToken:
|
|
114
|
+
protected getUtilization(hubPoolToken: EvmAddress, blockNumber: number, depositAmount: BigNumber, timestamp: number, timeToCache: number): Promise<BigNumber>;
|
|
114
115
|
computeRealizedLpFeePct(deposit: LpFeeRequest): Promise<RealizedLpFee>;
|
|
115
116
|
batchComputeRealizedLpFeePct(deposits: LpFeeRequest[]): Promise<RealizedLpFee[]>;
|
|
116
|
-
getL1Tokens():
|
|
117
|
-
getTokenInfoForL1Token(l1Token:
|
|
118
|
-
getLpTokenInfoForL1Token(l1Token:
|
|
119
|
-
areTokensEquivalent(tokenA:
|
|
117
|
+
getL1Tokens(): L1TokenInfo[];
|
|
118
|
+
getTokenInfoForL1Token(l1Token: EvmAddress): L1TokenInfo | undefined;
|
|
119
|
+
getLpTokenInfoForL1Token(l1Token: EvmAddress): LpToken | undefined;
|
|
120
|
+
areTokensEquivalent(tokenA: Address, chainIdA: number, tokenB: Address, chainIdB: number, hubPoolBlock?: number): boolean;
|
|
120
121
|
getSpokeActivationBlockForChain(chainId: number): number;
|
|
121
122
|
isRootBundleValid(rootBundle: ProposedRootBundle, latestMainnetBlock: number): boolean;
|
|
122
123
|
getRootBundleEvalBlockNumberContainingBlock(latestMainnetBlock: number, block: number, chain: number, chainIdListOverride?: number[]): number | undefined;
|
|
@@ -142,9 +143,9 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
142
143
|
getNthFullyExecutedRootBundle(n: number, startBlock?: number): ProposedRootBundle | undefined;
|
|
143
144
|
getLatestBundleEndBlockForChain(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
|
|
144
145
|
getNextBundleStartBlockNumber(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
|
|
145
|
-
getLatestExecutedRootBundleContainingL1Token(block: number, chain: number, l1Token:
|
|
146
|
-
getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token:
|
|
147
|
-
getRunningBalanceForToken(l1Token:
|
|
146
|
+
getLatestExecutedRootBundleContainingL1Token(block: number, chain: number, l1Token: EvmAddress): ExecutedRootBundle | undefined;
|
|
147
|
+
getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: EvmAddress): TokenRunningBalance;
|
|
148
|
+
getRunningBalanceForToken(l1Token: EvmAddress, executedRootBundle: ExecutedRootBundle | undefined): TokenRunningBalance;
|
|
148
149
|
_update(eventNames: HubPoolEvent[]): Promise<HubPoolUpdate>;
|
|
149
150
|
update(eventsToQuery?: HubPoolEvent[]): Promise<void>;
|
|
150
151
|
protected getBundleEndBlockForChain(proposeRootBundleEvent: ProposedRootBundle, chainId: number, chainIdList: number[]): number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __assign, __awaiter, __extends, __generator, __spreadArray } from "tslib";
|
|
2
2
|
import assert from "assert";
|
|
3
3
|
import _ from "lodash";
|
|
4
|
-
import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, TOKEN_SYMBOLS_MAP
|
|
4
|
+
import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, TOKEN_SYMBOLS_MAP } from "../constants";
|
|
5
5
|
import * as lpFeeCalculator from "../lpFeeCalculator";
|
|
6
6
|
import { EVMBlockFinder } from "../arch/evm";
|
|
7
|
-
import { BigNumber, bnZero, dedupArray, assign, fetchTokenInfo, getCachedBlockForTimestamp, getCurrentTime, getNetworkName, isDefined, mapAsync, paginatedEventQuery, shouldCache, sortEventsDescending, spreadEventWithBlockNumber, toBN, getTokenInfo, getUsdcSymbol,
|
|
7
|
+
import { BigNumber, bnZero, dedupArray, assign, fetchTokenInfo, getCachedBlockForTimestamp, getCurrentTime, getNetworkName, isDefined, mapAsync, paginatedEventQuery, shouldCache, sortEventsDescending, spreadEventWithBlockNumber, toBN, getTokenInfo, getUsdcSymbol, chainIsSvm, getDeployedAddress, SvmAddress, EvmAddress, toAddressType, } from "../utils";
|
|
8
8
|
import { BaseAbstractClient, isUpdateFailureReason, UpdateFailureReason } from "./BaseAbstractClient";
|
|
9
9
|
var HubPoolClient = /** @class */ (function (_super) {
|
|
10
10
|
__extends(HubPoolClient, _super);
|
|
@@ -26,6 +26,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
26
26
|
// L1Token -> destinationChainId -> destinationToken
|
|
27
27
|
_this.l1TokensToDestinationTokens = {};
|
|
28
28
|
_this.l1Tokens = []; // L1Tokens and their associated info.
|
|
29
|
+
// @dev `token` here is a 20-byte hex sting
|
|
29
30
|
_this.lpTokens = {};
|
|
30
31
|
_this.proposedRootBundles = [];
|
|
31
32
|
_this.canceledRootBundles = [];
|
|
@@ -84,42 +85,52 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
84
85
|
HubPoolClient.prototype.getSpokePoolActivationBlock = function (chain, spokePool) {
|
|
85
86
|
// Return first time that this spoke pool was registered in the HubPool as a cross chain contract. We can use
|
|
86
87
|
// this block as the oldest block that we should query for SpokePoolClient purposes.
|
|
87
|
-
var mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find(function (crossChainContract) {
|
|
88
|
+
var mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find(function (crossChainContract) {
|
|
89
|
+
return crossChainContract.spokePool.eq(spokePool);
|
|
90
|
+
});
|
|
88
91
|
return mostRecentSpokePoolUpdateBeforeBlock === null || mostRecentSpokePoolUpdateBeforeBlock === void 0 ? void 0 : mostRecentSpokePoolUpdateBeforeBlock.blockNumber;
|
|
89
92
|
};
|
|
90
93
|
// Returns the latest L2 token to use for an L1 token as of the input hub block.
|
|
91
94
|
HubPoolClient.prototype.getL2TokenForL1TokenAtBlock = function (l1Token, destinationChainId, latestHubBlock) {
|
|
92
95
|
var _a, _b, _c, _d;
|
|
93
96
|
if (latestHubBlock === void 0) { latestHubBlock = Number.MAX_SAFE_INTEGER; }
|
|
94
|
-
if (!((_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId])) {
|
|
97
|
+
if (!((_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId])) {
|
|
95
98
|
var chain = getNetworkName(destinationChainId);
|
|
96
99
|
var symbol = ((_c = this.l1Tokens.find(function (_a) {
|
|
97
100
|
var address = _a.address;
|
|
98
|
-
return address
|
|
99
|
-
})) !== null && _c !== void 0 ? _c : { symbol: l1Token }).symbol;
|
|
101
|
+
return address.eq(l1Token);
|
|
102
|
+
})) !== null && _c !== void 0 ? _c : { symbol: l1Token.toString() }).symbol;
|
|
100
103
|
throw new Error("Could not find SpokePool mapping for ".concat(symbol, " on ").concat(chain, " and L1 token ").concat(l1Token));
|
|
101
104
|
}
|
|
102
105
|
// Find the last mapping published before the target block.
|
|
103
|
-
var l2Token = sortEventsDescending(this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId]).find(function (mapping) { return mapping.blockNumber <= latestHubBlock; });
|
|
106
|
+
var l2Token = sortEventsDescending(this.l1TokensToDestinationTokensWithBlock[l1Token.toEvmAddress()][destinationChainId]).find(function (mapping) { return mapping.blockNumber <= latestHubBlock; });
|
|
104
107
|
if (!l2Token) {
|
|
105
108
|
var chain = getNetworkName(destinationChainId);
|
|
106
109
|
var symbol = ((_d = this.l1Tokens.find(function (_a) {
|
|
107
110
|
var address = _a.address;
|
|
108
|
-
return address
|
|
109
|
-
})) !== null && _d !== void 0 ? _d : { symbol: l1Token }).symbol;
|
|
111
|
+
return address.eq(l1Token);
|
|
112
|
+
})) !== null && _d !== void 0 ? _d : { symbol: l1Token.toString() }).symbol;
|
|
110
113
|
throw new Error("Could not find SpokePool mapping for ".concat(symbol, " on ").concat(chain, " at or before HubPool block ").concat(latestHubBlock, "!"));
|
|
111
114
|
}
|
|
112
115
|
return l2Token.l2Token;
|
|
113
116
|
};
|
|
117
|
+
// TODO: this might have to deal with truncated Solana addresses? Depends on what input is given actually
|
|
118
|
+
// TODO: might craete `getL1TokenForL2EVMTokenAtBlock` and some other fn
|
|
114
119
|
// Returns the latest L1 token to use for an L2 token as of the input hub block.
|
|
115
|
-
HubPoolClient.prototype.getL1TokenForL2TokenAtBlock = function (l2Token,
|
|
120
|
+
HubPoolClient.prototype.getL1TokenForL2TokenAtBlock = function (l2Token, // ! TODO: assuming that for Svm token, we'll have a proper full SvmAddress in this var
|
|
121
|
+
destinationChainId, latestHubBlock) {
|
|
116
122
|
var _this = this;
|
|
117
123
|
if (latestHubBlock === void 0) { latestHubBlock = Number.MAX_SAFE_INTEGER; }
|
|
118
124
|
var l2Tokens = Object.keys(this.l1TokensToDestinationTokensWithBlock)
|
|
119
|
-
.filter(function (l1Token) { return _this.l2TokenEnabledForL1Token(l1Token, destinationChainId); })
|
|
125
|
+
.filter(function (l1Token) { return _this.l2TokenEnabledForL1Token(EvmAddress.from(l1Token), destinationChainId); })
|
|
120
126
|
.map(function (l1Token) {
|
|
121
127
|
// Return all matching L2 token mappings that are equal to or earlier than the target block.
|
|
122
|
-
return _this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(
|
|
128
|
+
return _this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(
|
|
129
|
+
// ! TODO: Okay. Here, in `l1TokensToDestinationTokensWithBlock`, we might be saving truncated solana addresses (as `l1TokensToDestinationTokensWithBlock` is probably generated from events)
|
|
130
|
+
// ! TODO: Considering this, this filtering should be a bit different. If .isSvmAddress => check not for equality, but for *truncated equality*. If .isEvmAddress, check for equality
|
|
131
|
+
function (dstTokenWithBlock) {
|
|
132
|
+
return dstTokenWithBlock.l2Token.eq(l2Token) && dstTokenWithBlock.blockNumber <= latestHubBlock;
|
|
133
|
+
});
|
|
123
134
|
})
|
|
124
135
|
.flat();
|
|
125
136
|
if (l2Tokens.length === 0) {
|
|
@@ -137,12 +148,12 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
137
148
|
};
|
|
138
149
|
HubPoolClient.prototype.l2TokenEnabledForL1Token = function (l1Token, destinationChainId) {
|
|
139
150
|
var _a, _b;
|
|
140
|
-
return ((_b = (_a = this.l1TokensToDestinationTokens) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) != undefined;
|
|
151
|
+
return ((_b = (_a = this.l1TokensToDestinationTokens) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) != undefined;
|
|
141
152
|
};
|
|
142
153
|
HubPoolClient.prototype.l2TokenEnabledForL1TokenAtBlock = function (l1Token, destinationChainId, hubBlockNumber) {
|
|
143
154
|
var _a, _b, _c;
|
|
144
155
|
// Find the last mapping published before the target block.
|
|
145
|
-
var l2Token = sortEventsDescending((_c = (_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) !== null && _c !== void 0 ? _c : []).find(function (mapping) { return mapping.blockNumber <= hubBlockNumber; });
|
|
156
|
+
var l2Token = sortEventsDescending((_c = (_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) !== null && _c !== void 0 ? _c : []).find(function (mapping) { return mapping.blockNumber <= hubBlockNumber; });
|
|
146
157
|
return l2Token !== undefined;
|
|
147
158
|
};
|
|
148
159
|
HubPoolClient.prototype.l2TokenHasPoolRebalanceRoute = function (l2Token, l2ChainId, hubPoolBlock) {
|
|
@@ -152,7 +163,8 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
152
163
|
var _l2ChainId = _a[0], setPoolRebalanceRouteEvents = _a[1];
|
|
153
164
|
return setPoolRebalanceRouteEvents.some(function (e) {
|
|
154
165
|
return (e.blockNumber <= hubPoolBlock &&
|
|
155
|
-
|
|
166
|
+
// TODO: compare the last 20 bytes of l2Token only. Solana workaround, is this correct?
|
|
167
|
+
e.l2Token.eq(l2Token) &&
|
|
156
168
|
Number(_l2ChainId) === l2ChainId);
|
|
157
169
|
});
|
|
158
170
|
});
|
|
@@ -161,16 +173,17 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
161
173
|
/**
|
|
162
174
|
* @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
|
|
163
175
|
* @param tokenAddress Token address on `chain`
|
|
164
|
-
* @param
|
|
176
|
+
* @param chainId Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
|
|
165
177
|
* @returns Token info for the given token address on the L2 chain including symbol and decimal.
|
|
166
178
|
*/
|
|
167
|
-
|
|
179
|
+
// TODO: didn't change `tokenAddress` here to Address because of downstream getTokenInfo impl
|
|
180
|
+
HubPoolClient.prototype.getTokenInfoForAddress = function (tokenAddress, chainId) {
|
|
168
181
|
var _a;
|
|
169
|
-
var tokenInfo = getTokenInfo(tokenAddress,
|
|
182
|
+
var tokenInfo = getTokenInfo(tokenAddress, chainId);
|
|
170
183
|
// @dev Temporarily handle case where an L2 token for chain ID can map to more than one TOKEN_SYMBOLS_MAP
|
|
171
184
|
// entry. For example, L2 Bridged USDC maps to both the USDC and USDC.e/USDbC entries in TOKEN_SYMBOLS_MAP.
|
|
172
|
-
if (tokenInfo.symbol.toLowerCase() === "usdc" &&
|
|
173
|
-
tokenInfo.symbol = (_a = getUsdcSymbol(tokenAddress,
|
|
185
|
+
if (tokenInfo.symbol.toLowerCase() === "usdc" && chainId !== this.chainId) {
|
|
186
|
+
tokenInfo.symbol = (_a = getUsdcSymbol(tokenAddress, chainId)) !== null && _a !== void 0 ? _a : "UNKNOWN";
|
|
174
187
|
}
|
|
175
188
|
return tokenInfo;
|
|
176
189
|
};
|
|
@@ -262,11 +275,11 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
262
275
|
case 0:
|
|
263
276
|
overrides = { blockTag: blockNumber };
|
|
264
277
|
if (!depositAmount.eq(0)) return [3 /*break*/, 2];
|
|
265
|
-
return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken, overrides)];
|
|
278
|
+
return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken.toEvmAddress(), overrides)];
|
|
266
279
|
case 1:
|
|
267
280
|
// For zero amount, just get the utilisation at `blockNumber`.
|
|
268
281
|
return [2 /*return*/, _a.sent()];
|
|
269
|
-
case 2: return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationPostRelay(hubPoolToken, depositAmount, overrides)];
|
|
282
|
+
case 2: return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationPostRelay(hubPoolToken.toEvmAddress(), depositAmount, overrides)];
|
|
270
283
|
case 3: return [2 /*return*/, _a.sent()];
|
|
271
284
|
}
|
|
272
285
|
});
|
|
@@ -277,8 +290,8 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
277
290
|
return [2 /*return*/, resolver()];
|
|
278
291
|
}
|
|
279
292
|
key = depositAmount.eq(0)
|
|
280
|
-
? "utilization_".concat(hubPoolToken, "_").concat(blockNumber)
|
|
281
|
-
: "utilization_".concat(hubPoolToken, "_").concat(blockNumber, "_").concat(depositAmount.toString(), "_");
|
|
293
|
+
? "utilization_".concat(hubPoolToken.toEvmAddress(), "_").concat(blockNumber)
|
|
294
|
+
: "utilization_".concat(hubPoolToken.toEvmAddress(), "_").concat(blockNumber, "_").concat(depositAmount.toString(), "_");
|
|
282
295
|
return [4 /*yield*/, cache.get(key)];
|
|
283
296
|
case 1:
|
|
284
297
|
result = _a.sent();
|
|
@@ -341,6 +354,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
341
354
|
getHubPoolTokens = function () { return dedupArray(Object.values(hubPoolTokens).filter(isDefined)); };
|
|
342
355
|
resolveUniqueQuoteTimestamps = function (deposit) {
|
|
343
356
|
var _a;
|
|
357
|
+
var _b;
|
|
344
358
|
var quoteTimestamp = deposit.quoteTimestamp;
|
|
345
359
|
// Resolve the HubPool token address for this origin chainId/token pair, if it isn't already known.
|
|
346
360
|
var quoteBlockNumber = quoteBlocks[quoteTimestamp];
|
|
@@ -349,9 +363,9 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
349
363
|
return;
|
|
350
364
|
}
|
|
351
365
|
// Append the quoteTimestamp for this HubPool token, if it isn't already enqueued.
|
|
352
|
-
(_a = utilizationTimestamps[hubPoolToken]) !== null && _a !== void 0 ? _a : (utilizationTimestamps[
|
|
353
|
-
if (!utilizationTimestamps[hubPoolToken].includes(quoteTimestamp)) {
|
|
354
|
-
utilizationTimestamps[hubPoolToken].push(quoteTimestamp);
|
|
366
|
+
(_a = utilizationTimestamps[_b = hubPoolToken.toEvmAddress()]) !== null && _a !== void 0 ? _a : (utilizationTimestamps[_b] = []);
|
|
367
|
+
if (!utilizationTimestamps[hubPoolToken.toEvmAddress()].includes(quoteTimestamp)) {
|
|
368
|
+
utilizationTimestamps[hubPoolToken.toEvmAddress()].push(quoteTimestamp);
|
|
355
369
|
}
|
|
356
370
|
};
|
|
357
371
|
resolveUtilization = function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -361,7 +375,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
361
375
|
switch (_c.label) {
|
|
362
376
|
case 0:
|
|
363
377
|
_b = (_a = Object).fromEntries;
|
|
364
|
-
return [4 /*yield*/, mapAsync(utilizationTimestamps[hubPoolToken], function (quoteTimestamp) { return __awaiter(_this, void 0, void 0, function () {
|
|
378
|
+
return [4 /*yield*/, mapAsync(utilizationTimestamps[hubPoolToken.toEvmAddress()], function (quoteTimestamp) { return __awaiter(_this, void 0, void 0, function () {
|
|
365
379
|
var blockNumber, utilization;
|
|
366
380
|
return __generator(this, function (_a) {
|
|
367
381
|
switch (_a.label) {
|
|
@@ -394,7 +408,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
394
408
|
throw new Error("Cannot computeRealizedLpFeePct for deposit with no pool rebalance route for input token ".concat(deposit.inputToken, " on ").concat(originChainId));
|
|
395
409
|
}
|
|
396
410
|
rateModel = this.configStoreClient.getRateModelForBlockNumber(hubPoolToken, originChainId, paymentChainId, quoteBlock);
|
|
397
|
-
preUtilization = utilization[hubPoolToken][quoteBlock];
|
|
411
|
+
preUtilization = utilization[hubPoolToken.toEvmAddress()][quoteBlock];
|
|
398
412
|
return [4 /*yield*/, this.getUtilization(hubPoolToken, quoteBlock, inputAmount, quoteTimestamp, timeToCache)];
|
|
399
413
|
case 1:
|
|
400
414
|
postUtilization = _a.sent();
|
|
@@ -414,14 +428,19 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
414
428
|
// Identify the unique hubPoolToken & quoteTimestamp mappings. This is used to optimise subsequent HubPool queries.
|
|
415
429
|
deposits.forEach(function (deposit) { return resolveUniqueQuoteTimestamps(deposit); });
|
|
416
430
|
_c = (_b = Object).fromEntries;
|
|
417
|
-
return [4 /*yield*/, mapAsync(getHubPoolTokens(), function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
431
|
+
return [4 /*yield*/, mapAsync(getHubPoolTokens(), function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () {
|
|
432
|
+
var _a;
|
|
433
|
+
return __generator(this, function (_b) {
|
|
434
|
+
switch (_b.label) {
|
|
435
|
+
case 0:
|
|
436
|
+
_a = [hubPoolToken.toEvmAddress()];
|
|
437
|
+
return [4 /*yield*/, resolveUtilization(hubPoolToken)];
|
|
438
|
+
case 1: return [2 /*return*/, _a.concat([
|
|
439
|
+
_b.sent()
|
|
440
|
+
])];
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}); })];
|
|
425
444
|
case 2:
|
|
426
445
|
// For each token / quoteBlock pair, resolve the utilisation for each quoted block.
|
|
427
446
|
// This can be reused for each deposit with the same HubPool token and quoteTimestamp pair.
|
|
@@ -454,10 +473,10 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
454
473
|
return this.l1Tokens;
|
|
455
474
|
};
|
|
456
475
|
HubPoolClient.prototype.getTokenInfoForL1Token = function (l1Token) {
|
|
457
|
-
return this.l1Tokens.find(function (token) { return token.address
|
|
476
|
+
return this.l1Tokens.find(function (token) { return token.address.eq(l1Token); });
|
|
458
477
|
};
|
|
459
478
|
HubPoolClient.prototype.getLpTokenInfoForL1Token = function (l1Token) {
|
|
460
|
-
return this.lpTokens[l1Token];
|
|
479
|
+
return this.lpTokens[l1Token.toEvmAddress()];
|
|
461
480
|
};
|
|
462
481
|
HubPoolClient.prototype.areTokensEquivalent = function (tokenA, chainIdA, tokenB, chainIdB, hubPoolBlock) {
|
|
463
482
|
if (hubPoolBlock === void 0) { hubPoolBlock = this.latestHeightSearched; }
|
|
@@ -468,13 +487,13 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
468
487
|
// Resolve both SpokePool tokens back to their respective HubPool tokens and verify that they match.
|
|
469
488
|
var l1TokenA = this.getL1TokenForL2TokenAtBlock(tokenA, chainIdA, hubPoolBlock);
|
|
470
489
|
var l1TokenB = this.getL1TokenForL2TokenAtBlock(tokenB, chainIdB, hubPoolBlock);
|
|
471
|
-
if (l1TokenA
|
|
490
|
+
if (!l1TokenA.eq(l1TokenB)) {
|
|
472
491
|
return false;
|
|
473
492
|
}
|
|
474
493
|
// Resolve both HubPool tokens back to a current SpokePool token and verify that they match.
|
|
475
494
|
var _tokenA = this.getL2TokenForL1TokenAtBlock(l1TokenA, chainIdA, hubPoolBlock);
|
|
476
495
|
var _tokenB = this.getL2TokenForL1TokenAtBlock(l1TokenB, chainIdB, hubPoolBlock);
|
|
477
|
-
return tokenA
|
|
496
|
+
return tokenA.eq(_tokenA) && tokenB.eq(_tokenB);
|
|
478
497
|
};
|
|
479
498
|
HubPoolClient.prototype.getSpokeActivationBlockForChain = function (chainId) {
|
|
480
499
|
var _a;
|
|
@@ -661,7 +680,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
661
680
|
return sortEventsDescending(this.executedRootBundles).find(function (executedLeaf) {
|
|
662
681
|
return (executedLeaf.blockNumber <= block &&
|
|
663
682
|
executedLeaf.chainId === chain &&
|
|
664
|
-
executedLeaf.l1Tokens.some(function (token) { return token.
|
|
683
|
+
executedLeaf.l1Tokens.some(function (token) { return token.eq(l1Token); }));
|
|
665
684
|
});
|
|
666
685
|
};
|
|
667
686
|
HubPoolClient.prototype.getRunningBalanceBeforeBlockForChain = function (block, chain, l1Token) {
|
|
@@ -671,10 +690,11 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
671
690
|
HubPoolClient.prototype.getRunningBalanceForToken = function (l1Token, executedRootBundle) {
|
|
672
691
|
var runningBalance = toBN(0);
|
|
673
692
|
if (executedRootBundle) {
|
|
674
|
-
var indexOfL1Token = executedRootBundle.l1Tokens
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
693
|
+
var indexOfL1Token = executedRootBundle.l1Tokens.findIndex(function (tokenInBundle) { return tokenInBundle.eq(l1Token); });
|
|
694
|
+
// TODO: not sure this if is required. Wasn't here before. Probably `getRunningBalanceForToken` is used on checked tokens only
|
|
695
|
+
if (indexOfL1Token !== -1) {
|
|
696
|
+
runningBalance = executedRootBundle.runningBalances[indexOfL1Token];
|
|
697
|
+
}
|
|
678
698
|
}
|
|
679
699
|
return { runningBalance: runningBalance };
|
|
680
700
|
};
|
|
@@ -738,7 +758,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
738
758
|
return [2 /*return*/, {
|
|
739
759
|
success: true,
|
|
740
760
|
currentTime: currentTime,
|
|
741
|
-
pendingRootBundleProposal: pendingRootBundleProposal,
|
|
761
|
+
pendingRootBundleProposal: __assign(__assign({}, pendingRootBundleProposal), { proposer: toAddressType(pendingRootBundleProposal.proposer, this.chainId) }),
|
|
742
762
|
searchEndBlock: searchConfig.to,
|
|
743
763
|
events: _events,
|
|
744
764
|
}];
|
|
@@ -749,7 +769,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
749
769
|
HubPoolClient.prototype.update = function (eventsToQuery) {
|
|
750
770
|
if (eventsToQuery === void 0) { eventsToQuery = Object.keys(this.hubPoolEventFilters()); }
|
|
751
771
|
return __awaiter(this, void 0, void 0, function () {
|
|
752
|
-
var update, events, currentTime, pendingRootBundleProposal, searchEndBlock, _i, _a, event_1, args, dataToAdd, solanaSpokePool, truncatedAddress, _b, _c, event_2, args, destinationToken, usdcTokenSol,
|
|
772
|
+
var update, events, currentTime, pendingRootBundleProposal, searchEndBlock, _i, _a, event_1, args, dataToAdd, solanaSpokePool, svmSpoke, truncatedAddress, _b, _c, event_2, args, destinationToken, usdcTokenSol, svmUsdc, uniqueL1Tokens, _d, tokenInfo, lpTokenInfo_1, _loop_1, this_1, _e, tokenInfo_1, info, _f, _g, event_3, executedRootBundle, l1Tokens, runningBalances, nTokens, executedRootBundleWithL1Tokens, mostRecentProposedRootBundle;
|
|
753
773
|
var _h, _j, _k;
|
|
754
774
|
var _this = this;
|
|
755
775
|
return __generator(this, function (_l) {
|
|
@@ -774,7 +794,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
774
794
|
event_1 = _a[_i];
|
|
775
795
|
args = spreadEventWithBlockNumber(event_1);
|
|
776
796
|
dataToAdd = {
|
|
777
|
-
spokePool: args.spokePool,
|
|
797
|
+
spokePool: toAddressType(args.spokePool, this.chainId),
|
|
778
798
|
blockNumber: args.blockNumber,
|
|
779
799
|
txnRef: args.txnRef,
|
|
780
800
|
logIndex: args.logIndex,
|
|
@@ -790,14 +810,14 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
790
810
|
if (!solanaSpokePool) {
|
|
791
811
|
throw new Error("SVM spoke pool not found for chain ".concat(args.l2ChainId));
|
|
792
812
|
}
|
|
793
|
-
|
|
813
|
+
svmSpoke = SvmAddress.from(solanaSpokePool);
|
|
814
|
+
truncatedAddress = svmSpoke.truncateToBytes20();
|
|
794
815
|
// Verify the event address matches our expected truncated address
|
|
795
816
|
if (args.spokePool.toLowerCase() !== truncatedAddress.toLowerCase()) {
|
|
796
817
|
throw new Error("SVM spoke pool address mismatch for chain ".concat(args.l2ChainId, ". ") +
|
|
797
818
|
"Expected ".concat(truncatedAddress, ", got ").concat(args.spokePool));
|
|
798
819
|
}
|
|
799
|
-
|
|
800
|
-
dataToAdd.spokePool = SvmAddress.from(solanaSpokePool).toBytes32();
|
|
820
|
+
dataToAdd.spokePool = svmSpoke;
|
|
801
821
|
}
|
|
802
822
|
assign(this.crossChainContracts, [args.l2ChainId], [dataToAdd]);
|
|
803
823
|
}
|
|
@@ -806,23 +826,23 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
806
826
|
for (_b = 0, _c = events["SetPoolRebalanceRoute"]; _b < _c.length; _b++) {
|
|
807
827
|
event_2 = _c[_b];
|
|
808
828
|
args = spreadEventWithBlockNumber(event_2);
|
|
809
|
-
destinationToken = args.destinationToken;
|
|
829
|
+
destinationToken = toAddressType(args.destinationToken, this.chainId);
|
|
810
830
|
if (chainIsSvm(args.destinationChainId)) {
|
|
811
831
|
usdcTokenSol = TOKEN_SYMBOLS_MAP.USDC.addresses[args.destinationChainId];
|
|
812
|
-
|
|
813
|
-
if (destinationToken.
|
|
832
|
+
svmUsdc = SvmAddress.from(usdcTokenSol);
|
|
833
|
+
if (destinationToken.truncateToBytes20() !== svmUsdc.truncateToBytes20()) {
|
|
814
834
|
throw new Error("SVM USDC address mismatch for chain ".concat(args.destinationChainId, ". ") +
|
|
815
|
-
"Expected ".concat(
|
|
835
|
+
"Expected ".concat(svmUsdc.truncateToBytes20(), ", got ").concat(destinationToken));
|
|
816
836
|
}
|
|
817
|
-
destinationToken =
|
|
837
|
+
destinationToken = svmUsdc;
|
|
818
838
|
}
|
|
819
839
|
// If the destination token is set to the zero address in an event, then this means Across should no longer
|
|
820
840
|
// rebalance to this chain.
|
|
821
|
-
if (destinationToken
|
|
841
|
+
if (!destinationToken.isZeroAddress()) {
|
|
822
842
|
assign(this.l1TokensToDestinationTokens, [args.l1Token, args.destinationChainId], destinationToken);
|
|
823
843
|
assign(this.l1TokensToDestinationTokensWithBlock, [args.l1Token, args.destinationChainId], [
|
|
824
844
|
{
|
|
825
|
-
l1Token: args.l1Token,
|
|
845
|
+
l1Token: toAddressType(args.l1Token, this.chainId),
|
|
826
846
|
l2Token: destinationToken,
|
|
827
847
|
blockNumber: args.blockNumber,
|
|
828
848
|
txnIndex: args.txnIndex,
|
|
@@ -836,7 +856,17 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
836
856
|
if (!eventsToQuery.includes("L1TokenEnabledForLiquidityProvision")) return [3 /*break*/, 3];
|
|
837
857
|
uniqueL1Tokens = dedupArray(events["L1TokenEnabledForLiquidityProvision"].map(function (event) { return String(event.args["l1Token"]); }));
|
|
838
858
|
return [4 /*yield*/, Promise.all([
|
|
839
|
-
Promise.all(uniqueL1Tokens.map(function (l1Token) { return
|
|
859
|
+
Promise.all(uniqueL1Tokens.map(function (l1Token) { return __awaiter(_this, void 0, void 0, function () {
|
|
860
|
+
var tokenInfo;
|
|
861
|
+
return __generator(this, function (_a) {
|
|
862
|
+
switch (_a.label) {
|
|
863
|
+
case 0: return [4 /*yield*/, fetchTokenInfo(l1Token, this.hubPool.provider)];
|
|
864
|
+
case 1:
|
|
865
|
+
tokenInfo = _a.sent();
|
|
866
|
+
return [2 /*return*/, __assign(__assign({}, tokenInfo), { address: EvmAddress.from(l1Token) })];
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
}); })),
|
|
840
870
|
Promise.all(uniqueL1Tokens.map(function (l1Token) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
841
871
|
switch (_a.label) {
|
|
842
872
|
case 0: return [4 /*yield*/, this.hubPool.pooledTokens(l1Token, { blockTag: update.searchEndBlock })];
|
|
@@ -847,7 +877,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
847
877
|
case 2:
|
|
848
878
|
_d = _l.sent(), tokenInfo = _d[0], lpTokenInfo_1 = _d[1];
|
|
849
879
|
_loop_1 = function (info) {
|
|
850
|
-
if (!this_1.l1Tokens.find(function (token) { return
|
|
880
|
+
if (!this_1.l1Tokens.find(function (token) { return token.address.eq(info.address); })) {
|
|
851
881
|
if (info.decimals > 0 && info.decimals <= 18) {
|
|
852
882
|
this_1.l1Tokens.push(info);
|
|
853
883
|
}
|
|
@@ -872,7 +902,10 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
872
902
|
if (eventsToQuery.includes("ProposeRootBundle")) {
|
|
873
903
|
(_h = this.proposedRootBundles).push.apply(_h, events["ProposeRootBundle"]
|
|
874
904
|
.filter(function (event) { return !_this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber); })
|
|
875
|
-
.map(function (
|
|
905
|
+
.map(function (_event) {
|
|
906
|
+
var args = spreadEventWithBlockNumber(_event);
|
|
907
|
+
return __assign(__assign({}, args), { proposer: toAddressType(args.proposer, _this.chainId) });
|
|
908
|
+
}));
|
|
876
909
|
}
|
|
877
910
|
if (eventsToQuery.includes("RootBundleCanceled")) {
|
|
878
911
|
(_j = this.canceledRootBundles).push.apply(_j, events["RootBundleCanceled"].map(function (event) { return spreadEventWithBlockNumber(event); }));
|
|
@@ -895,7 +928,8 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
895
928
|
" Expected ".concat(nTokens, " or ").concat(nTokens * 2, " for chain ").concat(this.chainId, " transaction ").concat(event_3.transactionHash));
|
|
896
929
|
}
|
|
897
930
|
executedRootBundle.runningBalances = runningBalances.slice(0, nTokens);
|
|
898
|
-
|
|
931
|
+
executedRootBundleWithL1Tokens = __assign(__assign({}, executedRootBundle), { l1Tokens: executedRootBundle.l1Tokens.map(toAddressType, this.chainId) });
|
|
932
|
+
this.executedRootBundles.push(executedRootBundleWithL1Tokens);
|
|
899
933
|
}
|
|
900
934
|
}
|
|
901
935
|
// If the contract's current rootBundleProposal() value has an unclaimedPoolRebalanceLeafCount > 0, then
|