@across-protocol/sdk 4.2.9-alpha.0 → 4.2.9-alpha.1
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 +2 -2
- package/dist/cjs/arch/evm/SpokeUtils.js +3 -18
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +16 -1
- package/dist/cjs/arch/svm/SpokeUtils.js +135 -34
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +5 -1
- package/dist/cjs/arch/svm/utils.js +26 -16
- 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 +2 -4
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +2 -2
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +53 -57
- 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 +1 -2
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.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 +8 -11
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.d.ts +20 -20
- package/dist/cjs/clients/HubPoolClient.js +57 -78
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -5
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +29 -35
- 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 +9 -15
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +13 -9
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +56 -40
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- 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 +13 -18
- package/dist/cjs/interfaces/SpokePool.d.ts +16 -14
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +7 -7
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +7 -8
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +73 -64
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +4 -7
- package/dist/cjs/utils/AddressUtils.js +8 -21
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
- package/dist/cjs/utils/SpokeUtils.js +22 -4
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +4 -4
- package/dist/cjs/utils/TokenUtils.js +3 -3
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +2 -2
- package/dist/esm/arch/evm/SpokeUtils.js +4 -19
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +46 -6
- package/dist/esm/arch/svm/SpokeUtils.js +164 -43
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +11 -1
- package/dist/esm/arch/svm/utils.js +31 -16
- 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 +2 -4
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +2 -2
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +54 -58
- 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 +1 -2
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -4
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.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 +9 -12
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +21 -22
- package/dist/esm/clients/HubPoolClient.js +61 -91
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +3 -3
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -5
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +30 -37
- 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 +10 -16
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +13 -9
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +60 -44
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- 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 +13 -18
- package/dist/esm/interfaces/SpokePool.d.ts +16 -14
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -8
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +8 -9
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +77 -66
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +4 -7
- package/dist/esm/utils/AddressUtils.js +10 -25
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +8 -3
- package/dist/esm/utils/SpokeUtils.js +26 -4
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +16 -4
- package/dist/esm/utils/TokenUtils.js +3 -3
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts +2 -2
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +46 -6
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +11 -1
- 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 +2 -2
- 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 +1 -2
- package/dist/types/clients/BundleDataClient/utils/FillUtils.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 +21 -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 +3 -5
- 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 +13 -9
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/HubPool.d.ts +13 -18
- package/dist/types/interfaces/HubPool.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +16 -14
- 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 +8 -9
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +4 -7
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +8 -3
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +16 -4
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/arch/evm/SpokeUtils.ts +8 -22
- package/src/arch/svm/SpokeUtils.ts +156 -49
- package/src/arch/svm/utils.ts +22 -3
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
- package/src/clients/BundleDataClient/BundleDataClient.ts +47 -49
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
- package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -6
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +9 -13
- package/src/clients/HubPoolClient.ts +79 -113
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +1 -7
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +37 -104
- package/src/clients/mocks/MockHubPoolClient.ts +19 -24
- package/src/clients/mocks/MockSpokePoolClient.ts +74 -53
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
- package/src/interfaces/HubPool.ts +13 -22
- package/src/interfaces/SpokePool.ts +17 -14
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +8 -10
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +92 -91
- package/src/relayFeeCalculator/relayFeeCalculator.ts +14 -16
- package/src/utils/AddressUtils.ts +14 -32
- package/src/utils/SpokeUtils.ts +33 -11
- package/src/utils/TokenUtils.ts +7 -7
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
fixedPointAdjustment,
|
|
18
18
|
count2DDictionaryValues,
|
|
19
19
|
count3DDictionaryValues,
|
|
20
|
-
toAddressType,
|
|
21
20
|
} from "../../../utils";
|
|
22
21
|
import {
|
|
23
22
|
addLastRunningBalance,
|
|
@@ -66,10 +65,10 @@ export function getRefundsFromBundle(
|
|
|
66
65
|
Object.entries(depositsForChain).forEach(([l2TokenAddress, deposits]) => {
|
|
67
66
|
deposits.forEach((deposit) => {
|
|
68
67
|
if (combinedRefunds[originChainId][l2TokenAddress] === undefined) {
|
|
69
|
-
combinedRefunds[originChainId][l2TokenAddress] = { [deposit.depositor
|
|
68
|
+
combinedRefunds[originChainId][l2TokenAddress] = { [deposit.depositor]: deposit.inputAmount };
|
|
70
69
|
} else {
|
|
71
|
-
const existingRefundAmount = combinedRefunds[originChainId][l2TokenAddress][deposit.depositor
|
|
72
|
-
combinedRefunds[originChainId][l2TokenAddress][deposit.depositor
|
|
70
|
+
const existingRefundAmount = combinedRefunds[originChainId][l2TokenAddress][deposit.depositor];
|
|
71
|
+
combinedRefunds[originChainId][l2TokenAddress][deposit.depositor] = deposit.inputAmount.add(
|
|
73
72
|
existingRefundAmount ?? bnZero
|
|
74
73
|
);
|
|
75
74
|
}
|
|
@@ -154,23 +153,19 @@ export function _buildPoolRebalanceRoot(
|
|
|
154
153
|
// If the repayment token and repayment chain ID do not map to a PoolRebalanceRoute graph, then
|
|
155
154
|
// there are no relevant L1 running balances.
|
|
156
155
|
if (
|
|
157
|
-
!clients.hubPoolClient.l2TokenHasPoolRebalanceRoute(
|
|
158
|
-
toAddressType(l2TokenAddress),
|
|
159
|
-
repaymentChainId,
|
|
160
|
-
mainnetBundleEndBlock
|
|
161
|
-
)
|
|
156
|
+
!clients.hubPoolClient.l2TokenHasPoolRebalanceRoute(l2TokenAddress, repaymentChainId, mainnetBundleEndBlock)
|
|
162
157
|
) {
|
|
163
158
|
chainWithRefundsOnly.add(repaymentChainId);
|
|
164
159
|
return;
|
|
165
160
|
}
|
|
166
161
|
const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
|
|
167
|
-
|
|
162
|
+
l2TokenAddress,
|
|
168
163
|
repaymentChainId,
|
|
169
164
|
mainnetBundleEndBlock
|
|
170
165
|
);
|
|
171
166
|
|
|
172
|
-
updateRunningBalance(runningBalances, repaymentChainId, l1TokenCounterpart
|
|
173
|
-
updateRunningBalance(realizedLpFees, repaymentChainId, l1TokenCounterpart
|
|
167
|
+
updateRunningBalance(runningBalances, repaymentChainId, l1TokenCounterpart, totalRefundAmount);
|
|
168
|
+
updateRunningBalance(realizedLpFees, repaymentChainId, l1TokenCounterpart, totalRealizedLpFee);
|
|
174
169
|
}
|
|
175
170
|
);
|
|
176
171
|
});
|
|
@@ -187,17 +182,12 @@ export function _buildPoolRebalanceRoot(
|
|
|
187
182
|
Object.entries(depositsForChain).forEach(([outputToken, deposits]) => {
|
|
188
183
|
deposits.forEach((deposit) => {
|
|
189
184
|
const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
|
|
190
|
-
|
|
185
|
+
outputToken,
|
|
191
186
|
destinationChainId,
|
|
192
187
|
mainnetBundleEndBlock
|
|
193
188
|
);
|
|
194
189
|
const lpFee = deposit.lpFeePct.mul(deposit.inputAmount).div(fixedPointAdjustment);
|
|
195
|
-
updateRunningBalance(
|
|
196
|
-
runningBalances,
|
|
197
|
-
destinationChainId,
|
|
198
|
-
l1TokenCounterpart.toEvmAddress(),
|
|
199
|
-
deposit.inputAmount.sub(lpFee)
|
|
200
|
-
);
|
|
190
|
+
updateRunningBalance(runningBalances, destinationChainId, l1TokenCounterpart, deposit.inputAmount.sub(lpFee));
|
|
201
191
|
// Slow fill LP fees are accounted for when the slow fill executes and a V3FilledRelay is emitted. i.e. when
|
|
202
192
|
// the slow fill execution is included in bundleFillsV3.
|
|
203
193
|
});
|
|
@@ -216,17 +206,12 @@ export function _buildPoolRebalanceRoot(
|
|
|
216
206
|
Object.entries(slowFilledDepositsForChain).forEach(([outputToken, slowFilledDeposits]) => {
|
|
217
207
|
slowFilledDeposits.forEach((deposit) => {
|
|
218
208
|
const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
|
|
219
|
-
|
|
209
|
+
outputToken,
|
|
220
210
|
destinationChainId,
|
|
221
211
|
mainnetBundleEndBlock
|
|
222
212
|
);
|
|
223
213
|
const lpFee = deposit.lpFeePct.mul(deposit.inputAmount).div(fixedPointAdjustment);
|
|
224
|
-
updateRunningBalance(
|
|
225
|
-
runningBalances,
|
|
226
|
-
destinationChainId,
|
|
227
|
-
l1TokenCounterpart.toEvmAddress(),
|
|
228
|
-
lpFee.sub(deposit.inputAmount)
|
|
229
|
-
);
|
|
214
|
+
updateRunningBalance(runningBalances, destinationChainId, l1TokenCounterpart, lpFee.sub(deposit.inputAmount));
|
|
230
215
|
// Slow fills don't add to lpFees, only when the slow fill is executed and a V3FilledRelay is emitted, so
|
|
231
216
|
// we don't need to subtract it here. Moreover, the HubPoole expects bundleLpFees to be > 0.
|
|
232
217
|
});
|
|
@@ -286,11 +271,11 @@ export function _buildPoolRebalanceRoot(
|
|
|
286
271
|
return;
|
|
287
272
|
}
|
|
288
273
|
const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
|
|
289
|
-
|
|
274
|
+
inputToken,
|
|
290
275
|
originChainId,
|
|
291
276
|
mainnetBundleEndBlock
|
|
292
277
|
);
|
|
293
|
-
updateRunningBalance(runningBalances, originChainId, l1TokenCounterpart
|
|
278
|
+
updateRunningBalance(runningBalances, originChainId, l1TokenCounterpart, deposit.inputAmount);
|
|
294
279
|
});
|
|
295
280
|
});
|
|
296
281
|
});
|
|
@@ -2,7 +2,7 @@ import _ from "lodash";
|
|
|
2
2
|
import assert from "assert";
|
|
3
3
|
import { providers } from "ethers";
|
|
4
4
|
import { DepositWithBlock, Fill, FillWithBlock } from "../../../interfaces";
|
|
5
|
-
import { isSlowFill, isValidEvmAddress, isDefined, chainIsEvm
|
|
5
|
+
import { isSlowFill, isValidEvmAddress, isDefined, chainIsEvm } from "../../../utils";
|
|
6
6
|
import { HubPoolClient } from "../../HubPoolClient";
|
|
7
7
|
import { SVMProvider } from "../../../arch/svm";
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@ export function getRefundInformationFromFill(
|
|
|
25
25
|
bundleEndBlockForMainnet: number
|
|
26
26
|
): {
|
|
27
27
|
chainToSendRefundTo: number;
|
|
28
|
-
repaymentToken:
|
|
28
|
+
repaymentToken: string;
|
|
29
29
|
} {
|
|
30
30
|
const chainToSendRefundTo = _getRepaymentChainId(relayData, hubPoolClient, bundleEndBlockForMainnet);
|
|
31
31
|
if (chainToSendRefundTo === relayData.originChainId) {
|
|
@@ -49,7 +49,6 @@ export function getRefundInformationFromFill(
|
|
|
49
49
|
chainToSendRefundTo,
|
|
50
50
|
bundleEndBlockForMainnet
|
|
51
51
|
);
|
|
52
|
-
|
|
53
52
|
return {
|
|
54
53
|
chainToSendRefundTo,
|
|
55
54
|
repaymentToken,
|
|
@@ -126,8 +125,7 @@ export async function verifyFillRepayment(
|
|
|
126
125
|
return undefined;
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
|
-
fill.relayer =
|
|
130
|
-
assert(fill.relayer.isValidEvmAddress(), `Cannot re-assign fill to msg.sender: ${destinationRelayer}`);
|
|
128
|
+
fill.relayer = destinationRelayer;
|
|
131
129
|
} else {
|
|
132
130
|
return undefined;
|
|
133
131
|
}
|
|
@@ -202,5 +200,5 @@ function _repaymentAddressNeedsToBeOverwritten(fill: Fill): boolean {
|
|
|
202
200
|
// - i.e. If chainIsSvm && !isValidSvmAddress(fill.relayer) then return false
|
|
203
201
|
// If chainIsEvm && !isValidEvmAddress(fill.relayer) then return false
|
|
204
202
|
// If chainIsEvm && isValidEvmAddress(fill.relayer) then return true
|
|
205
|
-
return
|
|
203
|
+
return !isValidEvmAddress(fill.relayer);
|
|
206
204
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MerkleTree } from "@across-protocol/contracts/dist/utils/MerkleTree";
|
|
2
2
|
import { RunningBalances, PoolRebalanceLeaf, Clients, SpokePoolTargetBalance } from "../../../interfaces";
|
|
3
3
|
import { SpokePoolClient } from "../../SpokePoolClient";
|
|
4
|
-
import { BigNumber, bnZero, compareAddresses
|
|
4
|
+
import { BigNumber, bnZero, compareAddresses } from "../../../utils";
|
|
5
5
|
import { HubPoolClient } from "../../HubPoolClient";
|
|
6
6
|
import { V3DepositWithBlock } from "./shims";
|
|
7
7
|
import { AcrossConfigStoreClient } from "../../AcrossConfigStoreClient";
|
|
@@ -151,7 +151,7 @@ export function addLastRunningBalance(
|
|
|
151
151
|
const { runningBalance } = hubPoolClient.getRunningBalanceBeforeBlockForChain(
|
|
152
152
|
latestMainnetBlock,
|
|
153
153
|
Number(repaymentChainId),
|
|
154
|
-
|
|
154
|
+
l1TokenAddress
|
|
155
155
|
);
|
|
156
156
|
if (!runningBalance.eq(bnZero)) {
|
|
157
157
|
updateRunningBalance(runningBalances, Number(repaymentChainId), l1TokenAddress, runningBalance);
|
|
@@ -172,7 +172,7 @@ export function updateRunningBalanceForDeposit(
|
|
|
172
172
|
deposit.originChainId,
|
|
173
173
|
mainnetBundleEndBlock
|
|
174
174
|
);
|
|
175
|
-
updateRunningBalance(runningBalances, deposit.originChainId, l1TokenCounterpart
|
|
175
|
+
updateRunningBalance(runningBalances, deposit.originChainId, l1TokenCounterpart, updateAmount);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
export function constructPoolRebalanceLeaves(
|
|
@@ -253,7 +253,7 @@ export function constructPoolRebalanceLeaves(
|
|
|
253
253
|
runningBalances: leafRunningBalances,
|
|
254
254
|
groupIndex: groupIndexForChainId++,
|
|
255
255
|
leafId: leaves.length,
|
|
256
|
-
l1Tokens: l1TokensToIncludeInThisLeaf
|
|
256
|
+
l1Tokens: l1TokensToIncludeInThisLeaf,
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
});
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
type,
|
|
16
16
|
} from "superstruct";
|
|
17
17
|
import { UNDEFINED_MESSAGE_HASH } from "../../../constants";
|
|
18
|
-
import { BigNumber
|
|
18
|
+
import { BigNumber } from "../../../utils";
|
|
19
19
|
|
|
20
20
|
const PositiveIntegerStringSS = pattern(string(), /\d+/);
|
|
21
21
|
const Web3AddressSS = pattern(string(), /^0x[a-fA-F0-9]{40}$/);
|
|
@@ -31,23 +31,19 @@ const BigNumberType = coerce(instance(BigNumber), union([string(), number()]), (
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
const AddressType = coerce(instance(Address), string(), (value) => {
|
|
35
|
-
return toAddressType(value);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
34
|
const FillTypeSS = number();
|
|
39
35
|
|
|
40
36
|
const V3RelayDataSS = {
|
|
41
|
-
inputToken:
|
|
37
|
+
inputToken: string(),
|
|
42
38
|
inputAmount: BigNumberType,
|
|
43
|
-
outputToken:
|
|
39
|
+
outputToken: string(),
|
|
44
40
|
outputAmount: BigNumberType,
|
|
45
41
|
fillDeadline: number(),
|
|
46
|
-
exclusiveRelayer:
|
|
42
|
+
exclusiveRelayer: string(),
|
|
47
43
|
exclusivityDeadline: number(),
|
|
48
44
|
originChainId: number(),
|
|
49
|
-
depositor:
|
|
50
|
-
recipient:
|
|
45
|
+
depositor: string(),
|
|
46
|
+
recipient: string(),
|
|
51
47
|
depositId: BigNumberType,
|
|
52
48
|
message: string(),
|
|
53
49
|
};
|
|
@@ -71,7 +67,7 @@ const V3DepositSS = {
|
|
|
71
67
|
quoteTimestamp: number(),
|
|
72
68
|
relayerFeePct: optional(BigNumberType),
|
|
73
69
|
speedUpSignature: optional(string()),
|
|
74
|
-
updatedRecipient: optional(
|
|
70
|
+
updatedRecipient: optional(string()),
|
|
75
71
|
updatedOutputAmount: optional(BigNumberType),
|
|
76
72
|
updatedMessage: optional(string()),
|
|
77
73
|
};
|
|
@@ -92,7 +88,7 @@ const V3DepositWithBlockLpFeeSS = object({
|
|
|
92
88
|
const V3RelayExecutionEventInfoSS = object({
|
|
93
89
|
updatedOutputAmount: BigNumberType,
|
|
94
90
|
fillType: FillTypeSS,
|
|
95
|
-
updatedRecipient:
|
|
91
|
+
updatedRecipient: string(),
|
|
96
92
|
updatedMessage: optional(string()),
|
|
97
93
|
updatedMessageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH),
|
|
98
94
|
});
|
|
@@ -102,7 +98,7 @@ const V3FillSS = {
|
|
|
102
98
|
message: optional(string()),
|
|
103
99
|
messageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH),
|
|
104
100
|
destinationChainId: number(),
|
|
105
|
-
relayer:
|
|
101
|
+
relayer: string(),
|
|
106
102
|
repaymentChainId: number(),
|
|
107
103
|
relayExecutionInfo: V3RelayExecutionEventInfoSS,
|
|
108
104
|
quoteTimestamp: number(),
|