@across-protocol/sdk 3.3.26 → 3.3.28
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/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +28 -28
- package/dist/cjs/clients/SpokePoolClient.d.ts +0 -4
- package/dist/cjs/clients/SpokePoolClient.js +1 -4
- package/dist/cjs/clients/SpokePoolClient.js.map +1 -1
- package/dist/cjs/constants.d.ts +1 -0
- package/dist/cjs/constants.js +2 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.js +1 -7
- package/dist/cjs/gasPriceOracle/adapters/arbitrum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/adapters/ethereum.d.ts +2 -0
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js +30 -2
- package/dist/cjs/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/cjs/gasPriceOracle/oracle.js +27 -43
- package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/utils/BlockUtils.js +1 -0
- package/dist/cjs/utils/BlockUtils.js.map +1 -1
- package/dist/cjs/utils/Multicall.js +3 -1
- package/dist/cjs/utils/Multicall.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +1 -0
- package/dist/cjs/utils/SpokeUtils.js +6 -1
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/common.d.ts +0 -51
- package/dist/cjs/utils/common.js +31 -96
- package/dist/cjs/utils/common.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +28 -28
- package/dist/esm/clients/SpokePoolClient.d.ts +0 -19
- package/dist/esm/clients/SpokePoolClient.js +1 -19
- package/dist/esm/clients/SpokePoolClient.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -0
- package/dist/esm/constants.js +3 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/arbitrum.js +4 -12
- package/dist/esm/gasPriceOracle/adapters/arbitrum.js.map +1 -1
- package/dist/esm/gasPriceOracle/adapters/ethereum.d.ts +19 -0
- package/dist/esm/gasPriceOracle/adapters/ethereum.js +44 -1
- package/dist/esm/gasPriceOracle/adapters/ethereum.js.map +1 -1
- package/dist/esm/gasPriceOracle/oracle.js +27 -43
- package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/utils/BlockUtils.js +1 -0
- package/dist/esm/utils/BlockUtils.js.map +1 -1
- package/dist/esm/utils/Multicall.js +3 -1
- package/dist/esm/utils/Multicall.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +1 -0
- package/dist/esm/utils/SpokeUtils.js +10 -1
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/common.d.ts +0 -62
- package/dist/esm/utils/common.js +31 -105
- package/dist/esm/utils/common.js.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +28 -28
- package/dist/types/clients/SpokePoolClient.d.ts +0 -19
- package/dist/types/clients/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/arbitrum.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts +19 -0
- package/dist/types/gasPriceOracle/adapters/ethereum.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/utils/BlockUtils.d.ts.map +1 -1
- package/dist/types/utils/Multicall.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +1 -0
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/common.d.ts +0 -62
- package/dist/types/utils/common.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/clients/BundleDataClient/BundleDataClient.ts +7 -0
- package/src/clients/SpokePoolClient.ts +3 -29
- package/src/constants.ts +4 -0
- package/src/gasPriceOracle/adapters/arbitrum.ts +3 -12
- package/src/gasPriceOracle/adapters/ethereum.ts +39 -2
- package/src/gasPriceOracle/oracle.ts +7 -19
- package/src/utils/BlockUtils.ts +1 -0
- package/src/utils/Multicall.ts +3 -1
- package/src/utils/SpokeUtils.ts +11 -1
- package/src/utils/common.ts +19 -123
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpokeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/SpokeUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,QAAQ,EAAE,oBAAoB,EAAE,SAAS,EAAwB,MAAM,QAAQ,CAAC;AAEpG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAM7C,KAAK,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;AAEnC;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,gBAAgB,SAA6B,GAC5C,OAAO,CAAC,oBAAoB,CAAC,CA+B/B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,yBAAyB,CAC7C,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,eAAe,GACzB,OAAO,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAmHD;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAA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AS,EAAE,SAAS,EACpB,cAAc,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAiD7B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { L2Provider } from "@eth-optimism/sdk/dist/interfaces/l2-provider";
|
|
2
2
|
import Decimal from "decimal.js";
|
|
3
3
|
import { ethers, PopulatedTransaction, providers } from "ethers";
|
|
4
|
-
import { TypedMessage } from "../interfaces/TypedData";
|
|
5
4
|
import { BigNumber, BigNumberish, BN } from "./BigNumberUtils";
|
|
6
5
|
import { Transport } from "viem";
|
|
7
6
|
export type Decimalish = string | number | Decimal;
|
|
@@ -148,66 +147,5 @@ export declare function estimateTotalGasRequiredByUnsignedTransaction(unsignedTx
|
|
|
148
147
|
gasUnits: BigNumberish;
|
|
149
148
|
transport: Transport;
|
|
150
149
|
}>): Promise<TransactionCostEstimate>;
|
|
151
|
-
export type UpdateDepositDetailsMessageType = {
|
|
152
|
-
UpdateDepositDetails: [
|
|
153
|
-
{
|
|
154
|
-
name: "depositId";
|
|
155
|
-
type: "uint32";
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: "originChainId";
|
|
159
|
-
type: "uint256";
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: "updatedRelayerFeePct";
|
|
163
|
-
type: "int64";
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: "updatedRecipient";
|
|
167
|
-
type: "address";
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: "updatedMessage";
|
|
171
|
-
type: "bytes";
|
|
172
|
-
}
|
|
173
|
-
];
|
|
174
|
-
};
|
|
175
|
-
export type UpdateV3DepositDetailsMessageType = {
|
|
176
|
-
UpdateDepositDetails: [
|
|
177
|
-
{
|
|
178
|
-
name: "depositId";
|
|
179
|
-
type: "uint32";
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
name: "originChainId";
|
|
183
|
-
type: "uint256";
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
name: "updatedOutputAmount";
|
|
187
|
-
type: "uint256";
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: "updatedRecipient";
|
|
191
|
-
type: "address";
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
name: "updatedMessage";
|
|
195
|
-
type: "bytes";
|
|
196
|
-
}
|
|
197
|
-
];
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* Utility function to get EIP-712 compliant typed data that can be signed with the JSON-RPC method
|
|
201
|
-
* `eth_signedTypedDataV4` in MetaMask (https://docs.metamask.io/guide/signing-data.html). The resulting signature
|
|
202
|
-
* can then be used to call the method `speedUpDeposit` of a `SpokePool.sol` contract.
|
|
203
|
-
* @param depositId The deposit ID to speed up.
|
|
204
|
-
* @param originChainId The chain ID of the origin chain.
|
|
205
|
-
* @param updatedRelayerFeePct The new relayer fee percentage.
|
|
206
|
-
* @param updatedRecipient The new recipient address.
|
|
207
|
-
* @param updatedMessage The new message that should be provided to the recipient.
|
|
208
|
-
* @return EIP-712 compliant typed data.
|
|
209
|
-
*/
|
|
210
|
-
export declare function getUpdateDepositTypedData(depositId: number, originChainId: number, updatedRelayerFeePct: BigNumber, updatedRecipient: string, updatedMessage: string): TypedMessage<UpdateDepositDetailsMessageType>;
|
|
211
|
-
export declare function getUpdateV3DepositTypedData(depositId: number, originChainId: number, updatedOutputAmount: BigNumber, updatedRecipient: string, updatedMessage: string): TypedMessage<UpdateV3DepositDetailsMessageType>;
|
|
212
150
|
export declare function randomAddress(): string;
|
|
213
151
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAG3E,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO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QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,EAC7D,OAAO,GAAE,OAAO,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAM,GACN,OAAO,CAAC,uBAAuB,CAAC,CA6ClC;AAgBD,wBAAgB,aAAa,WAE5B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "3.3.
|
|
4
|
+
"version": "3.3.28",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"files": [
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@across-protocol/across-token": "^1.0.0",
|
|
102
|
-
"@across-protocol/constants": "^3.1.
|
|
103
|
-
"@across-protocol/contracts": "^3.0.
|
|
102
|
+
"@across-protocol/constants": "^3.1.24",
|
|
103
|
+
"@across-protocol/contracts": "^3.0.19",
|
|
104
104
|
"@eth-optimism/sdk": "^3.3.1",
|
|
105
105
|
"@ethersproject/bignumber": "^5.7.0",
|
|
106
106
|
"@pinata/sdk": "^2.1.0",
|
|
@@ -899,6 +899,9 @@ export class BundleDataClient {
|
|
|
899
899
|
bundleInvalidFillsV3.push(fill);
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
|
+
// If deposit is using the deterministic relay hash feature, then the following binary search-based
|
|
903
|
+
// algorithm will not work. However, it is impossible to emit an infinite fill deadline using
|
|
904
|
+
// the unsafeDepositV3 function so there is no need to catch the special case.
|
|
902
905
|
const historicalDeposit = await queryHistoricalDepositForFill(originClient, fill);
|
|
903
906
|
if (!historicalDeposit.found) {
|
|
904
907
|
bundleInvalidFillsV3.push(fill);
|
|
@@ -1003,6 +1006,10 @@ export class BundleDataClient {
|
|
|
1003
1006
|
// older deposit in case the spoke pool client's lookback isn't old enough to find the matching deposit.
|
|
1004
1007
|
// We can skip this step if the deposit's fill deadline is not infinite, because we can assume that the
|
|
1005
1008
|
// spoke pool clients have loaded deposits old enough to cover all fills with a non-infinite fill deadline.
|
|
1009
|
+
// We do not need to handle the case where the deposit ID is > uint32 (in which case we wouldn't
|
|
1010
|
+
// want to perform a binary search lookup for it because the deposit ID is "unsafe" and cannot be
|
|
1011
|
+
// found using such a method) because infinite fill deadlines cannot be produced from the unsafeDepositV3()
|
|
1012
|
+
// function.
|
|
1006
1013
|
if (
|
|
1007
1014
|
INFINITE_FILL_DEADLINE.eq(slowFillRequest.fillDeadline) &&
|
|
1008
1015
|
slowFillRequest.blockNumber >= destinationChainBlockRange[0]
|
|
@@ -400,33 +400,6 @@ export class SpokePoolClient extends BaseAbstractClient {
|
|
|
400
400
|
return `${event.depositId}-${event.originChainId}`;
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
/**
|
|
404
|
-
* Find the block range that contains the deposit ID. This is a binary search that searches for the block range
|
|
405
|
-
* that contains the deposit ID.
|
|
406
|
-
* @param targetDepositId The target deposit ID to search for.
|
|
407
|
-
* @param initLow The initial lower bound of the block range to search.
|
|
408
|
-
* @param initHigh The initial upper bound of the block range to search.
|
|
409
|
-
* @param maxSearches The maximum number of searches to perform. This is used to prevent infinite loops.
|
|
410
|
-
* @returns The block range that contains the deposit ID.
|
|
411
|
-
* @note // We want to find the block range that satisfies these conditions:
|
|
412
|
-
* // - the low block has deposit count <= targetDepositId
|
|
413
|
-
* // - the high block has a deposit count > targetDepositId.
|
|
414
|
-
* // This way the caller can search for a V3FundsDeposited event between [low, high] that will always
|
|
415
|
-
* // contain the event emitted when deposit ID was incremented to targetDepositId + 1. This is the same transaction
|
|
416
|
-
* // where the deposit with deposit ID = targetDepositId was created.
|
|
417
|
-
*/
|
|
418
|
-
public _getBlockRangeForDepositId(
|
|
419
|
-
targetDepositId: number,
|
|
420
|
-
initLow: number,
|
|
421
|
-
initHigh: number,
|
|
422
|
-
maxSearches: number
|
|
423
|
-
): Promise<{
|
|
424
|
-
low: number;
|
|
425
|
-
high: number;
|
|
426
|
-
}> {
|
|
427
|
-
return getBlockRangeForDepositId(targetDepositId, initLow, initHigh, maxSearches, this);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
403
|
/**
|
|
431
404
|
* Finds the deposit id at a specific block number.
|
|
432
405
|
* @param blockTag The block number to search for the deposit ID at.
|
|
@@ -814,11 +787,12 @@ export class SpokePoolClient extends BaseAbstractClient {
|
|
|
814
787
|
//
|
|
815
788
|
// @dev Limiting between 5-10 searches empirically performs best when there are ~300,000 deposits
|
|
816
789
|
// for a spoke pool and we're looking for a deposit <5 days older than HEAD.
|
|
817
|
-
const searchBounds = await
|
|
790
|
+
const searchBounds = await getBlockRangeForDepositId(
|
|
818
791
|
depositId,
|
|
819
792
|
this.deploymentBlock,
|
|
820
793
|
this.latestBlockSearched,
|
|
821
|
-
7
|
|
794
|
+
7,
|
|
795
|
+
this
|
|
822
796
|
);
|
|
823
797
|
|
|
824
798
|
const tStart = Date.now();
|
package/src/constants.ts
CHANGED
|
@@ -15,6 +15,10 @@ export const { AddressZero: ZERO_ADDRESS } = ethersConstants;
|
|
|
15
15
|
// 2^96 - 1 is a conservative erc20 max allowance.
|
|
16
16
|
export const MAX_SAFE_ALLOWANCE = "79228162514264337593543950335";
|
|
17
17
|
|
|
18
|
+
// The maximum depositId that can be emitted in a depositV3 method is the maximum uint32 value, so
|
|
19
|
+
// 2^32 - 1.
|
|
20
|
+
export const MAX_SAFE_DEPOSIT_ID = "4294967295";
|
|
21
|
+
|
|
18
22
|
export const SECONDS_PER_YEAR = 31557600; // 365.25 days per year.
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { providers } from "ethers";
|
|
2
|
-
import {
|
|
2
|
+
import { bnOne } from "../../utils";
|
|
3
3
|
import { GasPriceEstimate } from "../types";
|
|
4
4
|
import * as ethereum from "./ethereum";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// Arbitrum Nitro implements EIP-1559 pricing, but the priority fee is always refunded to the caller. Further,
|
|
9
|
-
// ethers typically hardcodes the priority fee to 1.5 Gwei. So, confirm that the priority fee supplied was 1.5
|
|
10
|
-
// Gwei, and then drop it to 1 Wei. Reference: https://developer.arbitrum.io/faqs/gas-faqs#q-priority
|
|
6
|
+
// Arbitrum Nitro implements EIP-1559 pricing, but the priority fee is always refunded to the caller.
|
|
7
|
+
// Reference: https://docs.arbitrum.io/how-arbitrum-works/gas-fees
|
|
11
8
|
export async function eip1559(provider: providers.Provider, chainId: number): Promise<GasPriceEstimate> {
|
|
12
|
-
DEFAULT_PRIORITY_FEE ??= parseUnits("1.5", 9);
|
|
13
9
|
const { maxFeePerGas: _maxFeePerGas, maxPriorityFeePerGas } = await ethereum.eip1559(provider, chainId);
|
|
14
10
|
|
|
15
|
-
// If this throws, ethers default behaviour has changed, or Arbitrum RPCs are returning something more sensible.
|
|
16
|
-
if (!maxPriorityFeePerGas.eq(DEFAULT_PRIORITY_FEE)) {
|
|
17
|
-
throw new Error(`Expected hardcoded 1.5 Gwei priority fee on Arbitrum, got ${maxPriorityFeePerGas}`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
11
|
// eip1559() sets maxFeePerGas = lastBaseFeePerGas + maxPriorityFeePerGas, so revert that.
|
|
21
12
|
// The caller may apply scaling as they wish afterwards.
|
|
22
13
|
const maxFeePerGas = _maxFeePerGas.sub(maxPriorityFeePerGas).add(bnOne);
|
|
@@ -1,9 +1,46 @@
|
|
|
1
|
+
import assert from "assert";
|
|
1
2
|
import { providers } from "ethers";
|
|
2
|
-
import { BigNumber, bnZero } from "../../utils";
|
|
3
|
+
import { BigNumber, bnZero, getNetworkName } from "../../utils";
|
|
3
4
|
import { GasPriceEstimate } from "../types";
|
|
4
5
|
import { gasPriceError } from "../util";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @param provider ethers RPC provider instance.
|
|
9
|
+
* @param chainId Chain ID of provider instance.
|
|
10
|
+
* @returns Promise of gas price estimate object.
|
|
11
|
+
*/
|
|
12
|
+
export function eip1559(provider: providers.Provider, chainId: number): Promise<GasPriceEstimate> {
|
|
13
|
+
const useRaw = process.env[`GAS_PRICE_EIP1559_RAW_${chainId}`] === "true";
|
|
14
|
+
return useRaw ? eip1559Raw(provider, chainId) : eip1559Bad(provider, chainId);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @note Performs direct RPC calls to retrieve the RPC-suggested priority fee for the next block.
|
|
19
|
+
* @param provider ethers RPC provider instance.
|
|
20
|
+
* @param chainId Chain ID of the provider instance.
|
|
21
|
+
* @returns Promise of gas price estimate object.
|
|
22
|
+
*/
|
|
23
|
+
export async function eip1559Raw(provider: providers.Provider, chainId: number): Promise<GasPriceEstimate> {
|
|
24
|
+
const [{ baseFeePerGas }, _maxPriorityFeePerGas] = await Promise.all([
|
|
25
|
+
provider.getBlock("pending"),
|
|
26
|
+
(provider as providers.JsonRpcProvider).send("eth_maxPriorityFeePerGas", []),
|
|
27
|
+
]);
|
|
28
|
+
const maxPriorityFeePerGas = BigNumber.from(_maxPriorityFeePerGas);
|
|
29
|
+
assert(BigNumber.isBigNumber(baseFeePerGas), `No baseFeePerGas received on ${getNetworkName(chainId)}`);
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
maxFeePerGas: maxPriorityFeePerGas.add(baseFeePerGas),
|
|
33
|
+
maxPriorityFeePerGas,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @note Resolves priority gas pricing poorly, because the priority fee is hardcoded to 1.5 Gwei in ethers v5.
|
|
39
|
+
* @param provider ethers RPC provider instance.
|
|
40
|
+
* @param chainId Chain ID of the provider instance.
|
|
41
|
+
* @returns Promise of gas price estimate object.
|
|
42
|
+
*/
|
|
43
|
+
export async function eip1559Bad(provider: providers.Provider, chainId: number): Promise<GasPriceEstimate> {
|
|
7
44
|
const feeData = await provider.getFeeData();
|
|
8
45
|
|
|
9
46
|
[feeData.lastBaseFeePerGas, feeData.maxPriorityFeePerGas].forEach((field: BigNumber | null) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import assert from "assert";
|
|
1
2
|
import { Transport } from "viem";
|
|
2
3
|
import { providers } from "ethers";
|
|
3
4
|
import { CHAIN_IDs } from "../constants";
|
|
@@ -25,9 +26,7 @@ export async function getGasPriceEstimate(
|
|
|
25
26
|
transport?: Transport,
|
|
26
27
|
legacyFallback = true
|
|
27
28
|
): Promise<GasPriceEstimate> {
|
|
28
|
-
|
|
29
|
-
({ chainId } = await provider.getNetwork());
|
|
30
|
-
}
|
|
29
|
+
chainId ?? ({ chainId } = await provider.getNetwork());
|
|
31
30
|
|
|
32
31
|
const useViem = process.env[`NEW_GAS_PRICE_ORACLE_${chainId}`] === "true";
|
|
33
32
|
return useViem
|
|
@@ -42,35 +41,24 @@ export async function getGasPriceEstimate(
|
|
|
42
41
|
* @param legacyFallback In the case of an unrecognised chain, fall back to type 0 gas estimation.
|
|
43
42
|
* @returns Am object of type GasPriceEstimate.
|
|
44
43
|
*/
|
|
45
|
-
|
|
44
|
+
function getEthersGasPriceEstimate(
|
|
46
45
|
provider: providers.Provider,
|
|
47
|
-
chainId
|
|
46
|
+
chainId: number,
|
|
48
47
|
legacyFallback = true
|
|
49
48
|
): Promise<GasPriceEstimate> {
|
|
50
|
-
if (chainId === undefined) {
|
|
51
|
-
({ chainId } = await provider.getNetwork());
|
|
52
|
-
}
|
|
53
|
-
|
|
54
49
|
const gasPriceFeeds = {
|
|
55
50
|
[CHAIN_IDs.ALEPH_ZERO]: arbitrum.eip1559,
|
|
56
51
|
[CHAIN_IDs.ARBITRUM]: arbitrum.eip1559,
|
|
57
|
-
[CHAIN_IDs.BASE]: ethereum.eip1559,
|
|
58
52
|
[CHAIN_IDs.LINEA]: linea.eip1559, // @todo: Support linea_estimateGas in adapter.
|
|
59
53
|
[CHAIN_IDs.MAINNET]: ethereum.eip1559,
|
|
60
|
-
[CHAIN_IDs.MODE]: ethereum.eip1559,
|
|
61
|
-
[CHAIN_IDs.OPTIMISM]: ethereum.eip1559,
|
|
62
54
|
[CHAIN_IDs.POLYGON]: polygon.gasStation,
|
|
63
|
-
[CHAIN_IDs.ZK_SYNC]: ethereum.legacy,
|
|
64
55
|
[CHAIN_IDs.SCROLL]: ethereum.legacy,
|
|
56
|
+
[CHAIN_IDs.ZK_SYNC]: ethereum.legacy,
|
|
65
57
|
} as const;
|
|
66
58
|
|
|
67
59
|
let gasPriceFeed = gasPriceFeeds[chainId];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
throw new Error(`No suitable gas price oracle for Chain ID ${chainId}`);
|
|
71
|
-
}
|
|
72
|
-
gasPriceFeed = chainIsOPStack(chainId) ? ethereum.eip1559 : ethereum.legacy;
|
|
73
|
-
}
|
|
60
|
+
assert(gasPriceFeed || legacyFallback, `No suitable gas price oracle for Chain ID ${chainId}`);
|
|
61
|
+
gasPriceFeed ??= chainIsOPStack(chainId) ? ethereum.eip1559 : ethereum.legacy;
|
|
74
62
|
|
|
75
63
|
return gasPriceFeed(provider, chainId);
|
|
76
64
|
}
|
package/src/utils/BlockUtils.ts
CHANGED
|
@@ -34,6 +34,7 @@ const defaultHighBlockOffset = 10;
|
|
|
34
34
|
const cacheTTL = 60 * 15;
|
|
35
35
|
const now = getCurrentTime(); // Seed the cache with initial values.
|
|
36
36
|
const blockTimes: { [chainId: number]: BlockTimeAverage } = {
|
|
37
|
+
[CHAIN_IDs.INK]: { average: 1, timestamp: now, blockRange: 1 },
|
|
37
38
|
[CHAIN_IDs.LINEA]: { average: 3, timestamp: now, blockRange: 1 },
|
|
38
39
|
[CHAIN_IDs.MAINNET]: { average: 12.5, timestamp: now, blockRange: 1 },
|
|
39
40
|
[CHAIN_IDs.OPTIMISM]: { average: 2, timestamp: now, blockRange: 1 },
|
package/src/utils/Multicall.ts
CHANGED
|
@@ -18,13 +18,14 @@ export type Call3 = {
|
|
|
18
18
|
const DETERMINISTIC_MULTICALL_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
19
19
|
|
|
20
20
|
const NON_DETERMINISTIC_MULTICALL_ADDRESSES = {
|
|
21
|
-
[CHAIN_IDs.ALEPH_ZERO]: "0x3CA11702f7c0F28e0b4e03C31F7492969862C569",
|
|
22
21
|
[CHAIN_IDs.ZK_SYNC]: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
// Multicall3 is an OP stack predeploy, so don't specify it here.
|
|
26
25
|
const DETERMINISTIC_MULTICALL_CHAINS = [
|
|
26
|
+
CHAIN_IDs.ALEPH_ZERO,
|
|
27
27
|
CHAIN_IDs.ARBITRUM,
|
|
28
|
+
CHAIN_IDs.INK,
|
|
28
29
|
CHAIN_IDs.LINEA,
|
|
29
30
|
CHAIN_IDs.MAINNET,
|
|
30
31
|
CHAIN_IDs.POLYGON,
|
|
@@ -32,6 +33,7 @@ const DETERMINISTIC_MULTICALL_CHAINS = [
|
|
|
32
33
|
// Testnet:
|
|
33
34
|
CHAIN_IDs.BASE_SEPOLIA,
|
|
34
35
|
CHAIN_IDs.BLAST_SEPOLIA,
|
|
36
|
+
CHAIN_IDs.INK_SEPOLIA,
|
|
35
37
|
CHAIN_IDs.POLYGON_AMOY,
|
|
36
38
|
CHAIN_IDs.SCROLL_SEPOLIA,
|
|
37
39
|
CHAIN_IDs.SEPOLIA,
|
package/src/utils/SpokeUtils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
2
|
import { BytesLike, Contract, PopulatedTransaction, providers, utils as ethersUtils } from "ethers";
|
|
3
|
-
import { CHAIN_IDs, ZERO_ADDRESS } from "../constants";
|
|
3
|
+
import { CHAIN_IDs, MAX_SAFE_DEPOSIT_ID, ZERO_ADDRESS } from "../constants";
|
|
4
4
|
import { Deposit, Fill, FillStatus, RelayData, SlowFillRequest } from "../interfaces";
|
|
5
5
|
import { SpokePoolClient } from "../clients";
|
|
6
6
|
import { chunk } from "./ArrayUtils";
|
|
@@ -244,6 +244,16 @@ export function getRelayHashFromEvent(e: Deposit | Fill | SlowFillRequest): stri
|
|
|
244
244
|
return getRelayDataHash(e, e.destinationChainId);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
+
export function isUnsafeDepositId(depositId: number): boolean {
|
|
248
|
+
// SpokePool.unsafeDepositV3() produces a uint256 depositId by hashing the msg.sender, depositor and input
|
|
249
|
+
// uint256 depositNonce. There is a possibility that this resultant uint256 is less than the maxSafeDepositId (i.e.
|
|
250
|
+
// the maximum uint32 value) which makes it possible that an unsafeDepositV3's depositId can collide with a safe
|
|
251
|
+
// depositV3's depositId, but the chances of a collision are 1 in 2^(256 - 32), so we'll ignore this
|
|
252
|
+
// possibility.
|
|
253
|
+
const maxSafeDepositId = BigNumber.from(MAX_SAFE_DEPOSIT_ID);
|
|
254
|
+
return maxSafeDepositId.lt(depositId);
|
|
255
|
+
}
|
|
256
|
+
|
|
247
257
|
/**
|
|
248
258
|
* Find the amount filled for a deposit at a particular block.
|
|
249
259
|
* @param spokePool SpokePool contract instance.
|
package/src/utils/common.ts
CHANGED
|
@@ -4,8 +4,7 @@ import assert from "assert";
|
|
|
4
4
|
import Decimal from "decimal.js";
|
|
5
5
|
import { ethers, PopulatedTransaction, providers, VoidSigner } from "ethers";
|
|
6
6
|
import { getGasPriceEstimate } from "../gasPriceOracle";
|
|
7
|
-
import {
|
|
8
|
-
import { BigNumber, BigNumberish, BN, formatUnits, parseUnits, toBN } from "./BigNumberUtils";
|
|
7
|
+
import { BigNumber, BigNumberish, BN, bnZero, formatUnits, parseUnits, toBN } from "./BigNumberUtils";
|
|
9
8
|
import { ConvertDecimals } from "./FormattingUtils";
|
|
10
9
|
import { chainIsOPStack } from "./NetworkUtils";
|
|
11
10
|
import { Address, Transport } from "viem";
|
|
@@ -266,8 +265,12 @@ export async function estimateTotalGasRequiredByUnsignedTransaction(
|
|
|
266
265
|
const voidSigner = new VoidSigner(senderAddress, provider);
|
|
267
266
|
|
|
268
267
|
// Estimate the Gas units required to submit this transaction.
|
|
269
|
-
const
|
|
270
|
-
|
|
268
|
+
const queries = [
|
|
269
|
+
gasUnits ? Promise.resolve(BigNumber.from(gasUnits)) : voidSigner.estimateGas(unsignedTx),
|
|
270
|
+
_gasPrice ? Promise.resolve({ maxFeePerGas: _gasPrice }) : getGasPriceEstimate(provider, chainId, transport),
|
|
271
|
+
] as const;
|
|
272
|
+
let [nativeGasCost, { maxFeePerGas: gasPrice }] = await Promise.all(queries);
|
|
273
|
+
assert(nativeGasCost.gt(bnZero), "Gas cost should not be 0");
|
|
271
274
|
let tokenGasCost: BigNumber;
|
|
272
275
|
|
|
273
276
|
// OP stack is a special case; gas cost is computed by the SDK, without having to query price.
|
|
@@ -277,28 +280,21 @@ export async function estimateTotalGasRequiredByUnsignedTransaction(
|
|
|
277
280
|
...unsignedTx,
|
|
278
281
|
gasLimit: nativeGasCost, // prevents additional gas estimation call
|
|
279
282
|
});
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const [l1GasCost, l2GasPrice] = await Promise.all([
|
|
283
|
-
provider.estimateL1GasCost(populatedTransaction),
|
|
284
|
-
_gasPrice || provider.getGasPrice(),
|
|
285
|
-
]);
|
|
286
|
-
const l2GasCost = nativeGasCost.mul(l2GasPrice);
|
|
283
|
+
const l1GasCost = await provider.estimateL1GasCost(populatedTransaction);
|
|
284
|
+
const l2GasCost = nativeGasCost.mul(gasPrice);
|
|
287
285
|
tokenGasCost = l1GasCost.add(l2GasCost);
|
|
288
|
-
} else if (chainId === CHAIN_IDs.LINEA && process.env[`NEW_GAS_PRICE_ORACLE_${chainId}`] === "true") {
|
|
289
|
-
// Permit linea_estimateGas via NEW_GAS_PRICE_ORACLE_59144=true
|
|
290
|
-
const {
|
|
291
|
-
gasLimit: nativeGasCost,
|
|
292
|
-
baseFeePerGas,
|
|
293
|
-
priorityFeePerGas,
|
|
294
|
-
} = await getLineaGasFees(chainId, transport, unsignedTx);
|
|
295
|
-
tokenGasCost = baseFeePerGas.add(priorityFeePerGas).mul(nativeGasCost);
|
|
296
286
|
} else {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
287
|
+
if (chainId === CHAIN_IDs.LINEA && process.env[`NEW_GAS_PRICE_ORACLE_${chainId}`] === "true") {
|
|
288
|
+
// Permit linea_estimateGas via NEW_GAS_PRICE_ORACLE_59144=true
|
|
289
|
+
let baseFeePerGas: BigNumber, priorityFeePerGas: BigNumber;
|
|
290
|
+
({
|
|
291
|
+
gasLimit: nativeGasCost,
|
|
292
|
+
baseFeePerGas,
|
|
293
|
+
priorityFeePerGas,
|
|
294
|
+
} = await getLineaGasFees(chainId, transport, unsignedTx));
|
|
295
|
+
gasPrice = baseFeePerGas.add(priorityFeePerGas);
|
|
301
296
|
}
|
|
297
|
+
|
|
302
298
|
tokenGasCost = nativeGasCost.mul(gasPrice);
|
|
303
299
|
}
|
|
304
300
|
|
|
@@ -323,106 +319,6 @@ async function getLineaGasFees(chainId: number, transport: Transport | undefined
|
|
|
323
319
|
};
|
|
324
320
|
}
|
|
325
321
|
|
|
326
|
-
export type UpdateDepositDetailsMessageType = {
|
|
327
|
-
UpdateDepositDetails: [
|
|
328
|
-
{
|
|
329
|
-
name: "depositId";
|
|
330
|
-
type: "uint32";
|
|
331
|
-
},
|
|
332
|
-
{ name: "originChainId"; type: "uint256" },
|
|
333
|
-
{ name: "updatedRelayerFeePct"; type: "int64" },
|
|
334
|
-
{ name: "updatedRecipient"; type: "address" },
|
|
335
|
-
{ name: "updatedMessage"; type: "bytes" },
|
|
336
|
-
];
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
export type UpdateV3DepositDetailsMessageType = {
|
|
340
|
-
UpdateDepositDetails: [
|
|
341
|
-
{ name: "depositId"; type: "uint32" },
|
|
342
|
-
{ name: "originChainId"; type: "uint256" },
|
|
343
|
-
{ name: "updatedOutputAmount"; type: "uint256" },
|
|
344
|
-
{ name: "updatedRecipient"; type: "address" },
|
|
345
|
-
{ name: "updatedMessage"; type: "bytes" },
|
|
346
|
-
];
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Utility function to get EIP-712 compliant typed data that can be signed with the JSON-RPC method
|
|
351
|
-
* `eth_signedTypedDataV4` in MetaMask (https://docs.metamask.io/guide/signing-data.html). The resulting signature
|
|
352
|
-
* can then be used to call the method `speedUpDeposit` of a `SpokePool.sol` contract.
|
|
353
|
-
* @param depositId The deposit ID to speed up.
|
|
354
|
-
* @param originChainId The chain ID of the origin chain.
|
|
355
|
-
* @param updatedRelayerFeePct The new relayer fee percentage.
|
|
356
|
-
* @param updatedRecipient The new recipient address.
|
|
357
|
-
* @param updatedMessage The new message that should be provided to the recipient.
|
|
358
|
-
* @return EIP-712 compliant typed data.
|
|
359
|
-
*/
|
|
360
|
-
export function getUpdateDepositTypedData(
|
|
361
|
-
depositId: number,
|
|
362
|
-
originChainId: number,
|
|
363
|
-
updatedRelayerFeePct: BigNumber,
|
|
364
|
-
updatedRecipient: string,
|
|
365
|
-
updatedMessage: string
|
|
366
|
-
): TypedMessage<UpdateDepositDetailsMessageType> {
|
|
367
|
-
return {
|
|
368
|
-
types: {
|
|
369
|
-
UpdateDepositDetails: [
|
|
370
|
-
{ name: "depositId", type: "uint32" },
|
|
371
|
-
{ name: "originChainId", type: "uint256" },
|
|
372
|
-
{ name: "updatedRelayerFeePct", type: "int64" },
|
|
373
|
-
{ name: "updatedRecipient", type: "address" },
|
|
374
|
-
{ name: "updatedMessage", type: "bytes" },
|
|
375
|
-
],
|
|
376
|
-
},
|
|
377
|
-
primaryType: "UpdateDepositDetails",
|
|
378
|
-
domain: {
|
|
379
|
-
name: "ACROSS-V2",
|
|
380
|
-
version: "1.0.0",
|
|
381
|
-
chainId: originChainId,
|
|
382
|
-
},
|
|
383
|
-
message: {
|
|
384
|
-
depositId,
|
|
385
|
-
originChainId,
|
|
386
|
-
updatedRelayerFeePct,
|
|
387
|
-
updatedRecipient,
|
|
388
|
-
updatedMessage,
|
|
389
|
-
},
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
export function getUpdateV3DepositTypedData(
|
|
394
|
-
depositId: number,
|
|
395
|
-
originChainId: number,
|
|
396
|
-
updatedOutputAmount: BigNumber,
|
|
397
|
-
updatedRecipient: string,
|
|
398
|
-
updatedMessage: string
|
|
399
|
-
): TypedMessage<UpdateV3DepositDetailsMessageType> {
|
|
400
|
-
return {
|
|
401
|
-
types: {
|
|
402
|
-
UpdateDepositDetails: [
|
|
403
|
-
{ name: "depositId", type: "uint32" },
|
|
404
|
-
{ name: "originChainId", type: "uint256" },
|
|
405
|
-
{ name: "updatedOutputAmount", type: "uint256" },
|
|
406
|
-
{ name: "updatedRecipient", type: "address" },
|
|
407
|
-
{ name: "updatedMessage", type: "bytes" },
|
|
408
|
-
],
|
|
409
|
-
},
|
|
410
|
-
primaryType: "UpdateDepositDetails",
|
|
411
|
-
domain: {
|
|
412
|
-
name: "ACROSS-V2",
|
|
413
|
-
version: "1.0.0",
|
|
414
|
-
chainId: originChainId,
|
|
415
|
-
},
|
|
416
|
-
message: {
|
|
417
|
-
depositId,
|
|
418
|
-
originChainId,
|
|
419
|
-
updatedOutputAmount,
|
|
420
|
-
updatedRecipient,
|
|
421
|
-
updatedMessage,
|
|
422
|
-
},
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
|
|
426
322
|
export function randomAddress() {
|
|
427
323
|
return ethers.utils.getAddress(ethers.utils.hexlify(ethers.utils.randomBytes(20)));
|
|
428
324
|
}
|