@gearbox-protocol/sdk 14.12.0-next.6 → 14.12.0-next.8
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/plugins/adapters/abi/iConvexV1BoosterAdapter.js +143 -0
- package/dist/cjs/plugins/adapters/abi/index.js +2 -0
- package/dist/cjs/plugins/adapters/balanceChanges.js +47 -0
- package/dist/cjs/plugins/adapters/contracts/AbstractAdapter.js +35 -0
- package/dist/cjs/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +20 -0
- package/dist/cjs/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +20 -0
- package/dist/cjs/plugins/adapters/contracts/CamelotV3AdapterContract.js +16 -0
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +23 -0
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +29 -2
- package/dist/cjs/plugins/adapters/contracts/Curve2AssetsAdapterContract.js +27 -0
- package/dist/cjs/plugins/adapters/contracts/Curve3AssetsAdapterContract.js +27 -0
- package/dist/cjs/plugins/adapters/contracts/Curve4AssetsAdapterContract.js +27 -0
- package/dist/cjs/plugins/adapters/contracts/CurveV1AdapterDeposit.js +27 -0
- package/dist/cjs/plugins/adapters/contracts/CurveV1AdapterStETHContract.js +27 -0
- package/dist/cjs/plugins/adapters/contracts/CurveV1StableNGAdapterContract.js +27 -0
- package/dist/cjs/plugins/adapters/contracts/DaiUsdsAdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/ERC4626AdapterContract.js +16 -0
- package/dist/cjs/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/FluidDexAdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +22 -0
- package/dist/cjs/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +11 -0
- package/dist/cjs/plugins/adapters/contracts/LidoV1AdapterContract.js +12 -0
- package/dist/cjs/plugins/adapters/contracts/MellowDVVAdapterContract.js +16 -0
- package/dist/cjs/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +16 -0
- package/dist/cjs/plugins/adapters/contracts/MellowWrapperAdapterContract.js +12 -0
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +11 -0
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +13 -0
- package/dist/cjs/plugins/adapters/contracts/PendleRouterAdapterContract.js +53 -0
- package/dist/cjs/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +12 -0
- package/dist/cjs/plugins/adapters/contracts/SecuritizeSwapAdapterContract.js +23 -1
- package/dist/cjs/plugins/adapters/contracts/StakingRewardsAdapterContract.js +22 -0
- package/dist/cjs/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +11 -0
- package/dist/cjs/plugins/adapters/contracts/UniswapV2AdapterContract.js +11 -0
- package/dist/cjs/plugins/adapters/contracts/UniswapV3AdapterContract.js +16 -0
- package/dist/cjs/plugins/adapters/contracts/UniswapV4AdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +15 -0
- package/dist/cjs/plugins/adapters/contracts/VelodromeV2AdapterContract.js +11 -0
- package/dist/cjs/plugins/adapters/contracts/WstETHV1AdapterContract.js +16 -0
- package/dist/cjs/plugins/adapters/index.js +2 -0
- package/dist/cjs/preview/index.js +0 -2
- package/dist/cjs/preview/preview/errors.js +16 -0
- package/dist/cjs/preview/preview/extractExpectedBalanceChanges.js +33 -11
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +46 -7
- package/dist/cjs/preview/preview/unwrapNativeCollateral.js +59 -0
- package/dist/cjs/sdk/market/credit/CreditFacadeV310BaseContract.js +31 -0
- package/dist/cjs/sdk/market/rwa/securitize/SecuritizeRWAFactory.js +25 -0
- package/dist/esm/plugins/adapters/abi/iConvexV1BoosterAdapter.js +119 -0
- package/dist/esm/plugins/adapters/abi/index.js +1 -0
- package/dist/esm/plugins/adapters/balanceChanges.js +21 -0
- package/dist/esm/plugins/adapters/contracts/AbstractAdapter.js +35 -0
- package/dist/esm/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +23 -1
- package/dist/esm/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +23 -1
- package/dist/esm/plugins/adapters/contracts/CamelotV3AdapterContract.js +19 -1
- package/dist/esm/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +27 -1
- package/dist/esm/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +31 -2
- package/dist/esm/plugins/adapters/contracts/Curve2AssetsAdapterContract.js +30 -1
- package/dist/esm/plugins/adapters/contracts/Curve3AssetsAdapterContract.js +30 -1
- package/dist/esm/plugins/adapters/contracts/Curve4AssetsAdapterContract.js +30 -1
- package/dist/esm/plugins/adapters/contracts/CurveV1AdapterDeposit.js +30 -1
- package/dist/esm/plugins/adapters/contracts/CurveV1AdapterStETHContract.js +30 -1
- package/dist/esm/plugins/adapters/contracts/CurveV1StableNGAdapterContract.js +30 -1
- package/dist/esm/plugins/adapters/contracts/DaiUsdsAdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +20 -1
- package/dist/esm/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/FluidDexAdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +25 -1
- package/dist/esm/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +14 -1
- package/dist/esm/plugins/adapters/contracts/LidoV1AdapterContract.js +15 -1
- package/dist/esm/plugins/adapters/contracts/MellowDVVAdapterContract.js +19 -1
- package/dist/esm/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +19 -1
- package/dist/esm/plugins/adapters/contracts/MellowWrapperAdapterContract.js +15 -1
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +14 -1
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +16 -1
- package/dist/esm/plugins/adapters/contracts/PendleRouterAdapterContract.js +56 -1
- package/dist/esm/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.js +15 -1
- package/dist/esm/plugins/adapters/contracts/SecuritizeSwapAdapterContract.js +26 -2
- package/dist/esm/plugins/adapters/contracts/StakingRewardsAdapterContract.js +25 -1
- package/dist/esm/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +14 -1
- package/dist/esm/plugins/adapters/contracts/UniswapV2AdapterContract.js +11 -0
- package/dist/esm/plugins/adapters/contracts/UniswapV3AdapterContract.js +16 -0
- package/dist/esm/plugins/adapters/contracts/UniswapV4AdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +18 -1
- package/dist/esm/plugins/adapters/contracts/VelodromeV2AdapterContract.js +14 -1
- package/dist/esm/plugins/adapters/contracts/WstETHV1AdapterContract.js +19 -1
- package/dist/esm/plugins/adapters/index.js +1 -0
- package/dist/esm/preview/index.js +0 -1
- package/dist/esm/preview/preview/errors.js +15 -0
- package/dist/esm/preview/preview/extractExpectedBalanceChanges.js +33 -11
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +54 -8
- package/dist/esm/preview/preview/unwrapNativeCollateral.js +35 -0
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +33 -0
- package/dist/esm/sdk/market/rwa/securitize/SecuritizeRWAFactory.js +27 -1
- package/dist/types/plugins/adapters/abi/iConvexV1BoosterAdapter.d.ts +204 -0
- package/dist/types/plugins/adapters/abi/index.d.ts +1 -0
- package/dist/types/plugins/adapters/balanceChanges.d.ts +21 -0
- package/dist/types/plugins/adapters/contracts/AbstractAdapter.d.ts +22 -2
- package/dist/types/plugins/adapters/contracts/BalancerV3RouterAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/CamelotV3AdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.d.ts +7 -6
- package/dist/types/plugins/adapters/contracts/Curve2AssetsAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/Curve3AssetsAdapterContract.d.ts +3 -1
- package/dist/types/plugins/adapters/contracts/Curve4AssetsAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterDeposit.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterStETHContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/CurveV1StableNGAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/DaiUsdsAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/ERC4626AdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/ERC4626ReferralAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/FluidDexAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/InfinifiGatewayAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/LidoV1AdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/MellowDVVAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/MellowWrapperAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/PendleRouterAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/SecuritizeOnRampAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/SecuritizeSwapAdapterContract.d.ts +14 -3
- package/dist/types/plugins/adapters/contracts/StakingRewardsAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/TraderJoeRouterAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/UniswapV2AdapterContract.d.ts +2 -1
- package/dist/types/plugins/adapters/contracts/UniswapV3AdapterContract.d.ts +2 -1
- package/dist/types/plugins/adapters/contracts/UniswapV4AdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/UpshiftVaultAdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/VelodromeV2AdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/contracts/WstETHV1AdapterContract.d.ts +3 -2
- package/dist/types/plugins/adapters/index.d.ts +1 -0
- package/dist/types/preview/index.d.ts +0 -1
- package/dist/types/preview/preview/errors.d.ts +12 -0
- package/dist/types/preview/preview/extractExpectedBalanceChanges.d.ts +26 -14
- package/dist/types/preview/preview/types.d.ts +5 -1
- package/dist/types/preview/preview/unwrapNativeCollateral.d.ts +20 -0
- package/dist/types/sdk/market/credit/CreditFacadeV310BaseContract.d.ts +13 -1
- package/dist/types/sdk/market/rwa/securitize/SecuritizeRWAFactory.d.ts +13 -1
- package/package.json +1 -1
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
class InvalidTransactionValueError extends Error {
|
|
2
|
+
/** Transaction `msg.value`. */
|
|
3
|
+
value;
|
|
4
|
+
/** Amount of wrapped native token added as collateral. */
|
|
5
|
+
wethCollateral;
|
|
6
|
+
constructor(value, wethCollateral) {
|
|
7
|
+
super(
|
|
8
|
+
`transaction value ${value} exceeds WETH collateral ${wethCollateral}`
|
|
9
|
+
);
|
|
10
|
+
this.name = "InvalidTransactionValueError";
|
|
11
|
+
this.value = value;
|
|
12
|
+
this.wethCollateral = wethCollateral;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
1
15
|
class UnsupportedOperationError extends Error {
|
|
2
16
|
/** The parsed operation kind (the `operation` discriminant). */
|
|
3
17
|
operation;
|
|
@@ -8,5 +22,6 @@ class UnsupportedOperationError extends Error {
|
|
|
8
22
|
}
|
|
9
23
|
}
|
|
10
24
|
export {
|
|
25
|
+
InvalidTransactionValueError,
|
|
11
26
|
UnsupportedOperationError
|
|
12
27
|
};
|
|
@@ -1,20 +1,42 @@
|
|
|
1
1
|
function extractExpectedBalanceChanges(innerCalls) {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
)
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const storeIndices = [];
|
|
3
|
+
const compareIndices = [];
|
|
4
|
+
for (let i = 0; i < innerCalls.length; i++) {
|
|
5
|
+
const name = functionName(innerCalls[i]);
|
|
6
|
+
if (name === "storeExpectedBalances") {
|
|
7
|
+
storeIndices.push(i);
|
|
8
|
+
} else if (name === "compareBalances") {
|
|
9
|
+
compareIndices.push(i);
|
|
10
|
+
}
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
const last = calls[calls.length - 1];
|
|
10
|
-
if (functionName(first) !== "storeExpectedBalances" || functionName(last) !== "compareBalances") {
|
|
12
|
+
if (storeIndices.length === 0 && compareIndices.length === 0) {
|
|
11
13
|
return void 0;
|
|
12
14
|
}
|
|
13
|
-
|
|
15
|
+
if (storeIndices.length !== 1 || compareIndices.length !== 1) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`malformed multicall: expected exactly one storeExpectedBalances/compareBalances pair, got ${storeIndices.length} storeExpectedBalances and ${compareIndices.length} compareBalances calls`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
if (compareIndices[0] < storeIndices[0]) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
"malformed multicall: compareBalances appears before storeExpectedBalances"
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
const store = innerCalls[storeIndices[0]];
|
|
26
|
+
const balanceDeltas = store.rawArgs.balanceDeltas;
|
|
14
27
|
if (!balanceDeltas) {
|
|
15
|
-
|
|
28
|
+
throw new Error(
|
|
29
|
+
"malformed multicall: storeExpectedBalances has no balanceDeltas argument"
|
|
30
|
+
);
|
|
16
31
|
}
|
|
17
|
-
return
|
|
32
|
+
return {
|
|
33
|
+
deltas: balanceDeltas.map(({ token, amount }) => ({
|
|
34
|
+
token,
|
|
35
|
+
balance: amount
|
|
36
|
+
})),
|
|
37
|
+
startIndex: storeIndices[0],
|
|
38
|
+
endIndex: compareIndices[0]
|
|
39
|
+
};
|
|
18
40
|
}
|
|
19
41
|
function functionName(call) {
|
|
20
42
|
return call.functionName.split("(")[0];
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AbstractAdapterContract,
|
|
3
|
+
copyBalances
|
|
4
|
+
} from "../../plugins/adapters/index.js";
|
|
5
|
+
import {
|
|
6
|
+
AddressMap,
|
|
7
|
+
AP_WETH_TOKEN,
|
|
8
|
+
CreditFacadeV310BaseContract,
|
|
9
|
+
NO_VERSION,
|
|
10
|
+
SecuritizeRWAFactory
|
|
3
11
|
} from "../../sdk/index.js";
|
|
4
12
|
import { extractExpectedBalanceChanges } from "./extractExpectedBalanceChanges.js";
|
|
13
|
+
import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
|
|
5
14
|
function previewOpenCreditAccount(input, operation) {
|
|
6
|
-
const { sdk, to, calldata } = input;
|
|
15
|
+
const { sdk, to, calldata, value = 0n } = input;
|
|
7
16
|
const market = sdk.marketRegister.findByCreditManager(
|
|
8
17
|
operation.creditManager
|
|
9
18
|
);
|
|
@@ -41,21 +50,49 @@ function previewOpenCreditAccount(input, operation) {
|
|
|
41
50
|
break;
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
|
-
|
|
53
|
+
let collateral = collateralByToken.values();
|
|
45
54
|
const collateralValue = collateral.reduce(
|
|
46
55
|
(acc, { token, balance }) => acc + market.priceOracle.convert(token, market.underlying, balance),
|
|
47
56
|
0n
|
|
48
57
|
);
|
|
58
|
+
collateral = unwrapNativeCollateral(
|
|
59
|
+
collateral,
|
|
60
|
+
value,
|
|
61
|
+
sdk.addressProvider.getAddress(AP_WETH_TOKEN, NO_VERSION)
|
|
62
|
+
);
|
|
49
63
|
const parsed = sdk.parseFunctionDataV2(to, calldata);
|
|
50
64
|
const innerCalls = parsed.rawArgs.calls ?? [];
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
65
|
+
const expected = extractExpectedBalanceChanges(innerCalls);
|
|
66
|
+
let finalBalances = balances;
|
|
67
|
+
if (expected) {
|
|
68
|
+
const rawCalls = extractRawInnerCalls(sdk, to, calldata);
|
|
69
|
+
if (rawCalls.length !== innerCalls.length) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`raw and parsed inner calls of ${to} are misaligned: ${rawCalls.length} raw vs ${innerCalls.length} parsed`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const snapshot = copyBalances(balances);
|
|
75
|
+
for (let i = expected.startIndex + 1; i < expected.endIndex; i++) {
|
|
76
|
+
const call = rawCalls[i];
|
|
77
|
+
const adapter = sdk.getContract(call.target);
|
|
78
|
+
if (!(adapter instanceof AbstractAdapterContract)) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`call to ${call.target} between storeExpectedBalances and compareBalances is not an adapter call`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
finalBalances = adapter.previewBalanceChanges(
|
|
84
|
+
finalBalances,
|
|
85
|
+
call.callData
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
for (const { token, balance } of expected.deltas) {
|
|
89
|
+
finalBalances.upsert(token, (snapshot.get(token) ?? 0n) + balance);
|
|
90
|
+
}
|
|
54
91
|
}
|
|
55
|
-
const assets =
|
|
92
|
+
const assets = finalBalances.entries().filter(([, balance]) => balance > 1n).map(([token, balance]) => ({ token, balance }));
|
|
56
93
|
return {
|
|
57
94
|
operation: operation.operation,
|
|
58
|
-
target: inferTargetAsset(operation.multicall,
|
|
95
|
+
target: inferTargetAsset(operation.multicall, finalBalances),
|
|
59
96
|
collateral,
|
|
60
97
|
collateralValue,
|
|
61
98
|
debt,
|
|
@@ -63,6 +100,15 @@ function previewOpenCreditAccount(input, operation) {
|
|
|
63
100
|
assets
|
|
64
101
|
};
|
|
65
102
|
}
|
|
103
|
+
function extractRawInnerCalls(sdk, to, calldata) {
|
|
104
|
+
const entry = sdk.getContract(to);
|
|
105
|
+
if (entry instanceof CreditFacadeV310BaseContract || entry instanceof SecuritizeRWAFactory) {
|
|
106
|
+
return entry.extractRawInnerCalls(calldata);
|
|
107
|
+
}
|
|
108
|
+
throw new Error(
|
|
109
|
+
`cannot extract raw inner calls from ${to}: neither a credit facade nor a supported RWA factory`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
66
112
|
function inferTargetAsset(multicall, balances) {
|
|
67
113
|
for (const op of multicall) {
|
|
68
114
|
if (op.operation === "UpdateQuota" && op.change > 0n) {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isAddressEqual } from "viem";
|
|
2
|
+
import { NATIVE_ADDRESS } from "../../sdk/index.js";
|
|
3
|
+
import { InvalidTransactionValueError } from "./errors.js";
|
|
4
|
+
function unwrapNativeCollateral(collateral, nativeAmount, wethToken) {
|
|
5
|
+
if (nativeAmount === 0n) {
|
|
6
|
+
return collateral;
|
|
7
|
+
}
|
|
8
|
+
let unwrapped = false;
|
|
9
|
+
const result = [];
|
|
10
|
+
for (const asset of collateral) {
|
|
11
|
+
const isWeth = !unwrapped && isAddressEqual(asset.token, wethToken);
|
|
12
|
+
if (!isWeth) {
|
|
13
|
+
result.push(asset);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (asset.balance < nativeAmount) {
|
|
17
|
+
throw new InvalidTransactionValueError(nativeAmount, asset.balance);
|
|
18
|
+
}
|
|
19
|
+
result.push({ token: NATIVE_ADDRESS, balance: nativeAmount });
|
|
20
|
+
if (asset.balance > nativeAmount) {
|
|
21
|
+
result.push({
|
|
22
|
+
token: asset.token,
|
|
23
|
+
balance: asset.balance - nativeAmount
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
unwrapped = true;
|
|
27
|
+
}
|
|
28
|
+
if (!unwrapped) {
|
|
29
|
+
throw new InvalidTransactionValueError(nativeAmount, 0n);
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
unwrapNativeCollateral
|
|
35
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decodeFunctionData
|
|
3
|
+
} from "viem";
|
|
1
4
|
import {
|
|
2
5
|
iCreditFacadeMulticallV310Abi,
|
|
3
6
|
iCreditFacadeV310Abi
|
|
@@ -13,6 +16,36 @@ class CreditFacadeV310BaseContract extends BaseContract {
|
|
|
13
16
|
constructor(options, args) {
|
|
14
17
|
super(options, { ...args, abi });
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Decodes entry-point calldata with the facade ABI and returns the untouched
|
|
21
|
+
* inner multicall structs (targets with still-ABI-encoded `callData`).
|
|
22
|
+
*
|
|
23
|
+
* Unlike {@link ChainContractsRegister.parseMultiCallV2}, the inner calls are
|
|
24
|
+
* not decoded, so callers can re-decode them with a specific contract's ABI.
|
|
25
|
+
*
|
|
26
|
+
* @throws When the calldata cannot be decoded or the function has no inner
|
|
27
|
+
* multicall argument.
|
|
28
|
+
*/
|
|
29
|
+
extractRawInnerCalls(calldata) {
|
|
30
|
+
const decoded = decodeFunctionData({ abi: this.abi, data: calldata });
|
|
31
|
+
switch (decoded.functionName) {
|
|
32
|
+
case "openCreditAccount":
|
|
33
|
+
case "closeCreditAccount":
|
|
34
|
+
case "botMulticall":
|
|
35
|
+
case "multicall": {
|
|
36
|
+
const [, calls] = decoded.args;
|
|
37
|
+
return [...calls];
|
|
38
|
+
}
|
|
39
|
+
case "liquidateCreditAccount": {
|
|
40
|
+
const [, , calls] = decoded.args;
|
|
41
|
+
return [...calls];
|
|
42
|
+
}
|
|
43
|
+
default:
|
|
44
|
+
throw new Error(
|
|
45
|
+
`function ${decoded.functionName} on ${this.name} has no inner multicall`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
16
49
|
parseFunctionParamsV2(params, strict) {
|
|
17
50
|
switch (params.functionName) {
|
|
18
51
|
case "openCreditAccount": {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
decodeAbiParameters
|
|
2
|
+
decodeAbiParameters,
|
|
3
|
+
decodeFunctionData
|
|
3
4
|
} from "viem";
|
|
4
5
|
import { iSecuritizeRWAFactoryAbi } from "../../../../abi/rwa/iSecuritizeRWAFactory.js";
|
|
5
6
|
import { BaseContract } from "../../../base/index.js";
|
|
@@ -51,6 +52,31 @@ class SecuritizeRWAFactory extends BaseContract {
|
|
|
51
52
|
operators: [...t.operators]
|
|
52
53
|
}));
|
|
53
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Decodes entry-point calldata with the factory ABI and returns the
|
|
57
|
+
* untouched inner multicall structs (targets with still-ABI-encoded
|
|
58
|
+
* `callData`).
|
|
59
|
+
*
|
|
60
|
+
* Unlike {@link ChainContractsRegister.parseMultiCallV2}, the inner calls are
|
|
61
|
+
* not decoded, so callers can re-decode them with a specific contract's ABI.
|
|
62
|
+
*
|
|
63
|
+
* @throws When the calldata cannot be decoded or the function has no inner
|
|
64
|
+
* multicall argument.
|
|
65
|
+
*/
|
|
66
|
+
extractRawInnerCalls(calldata) {
|
|
67
|
+
const decoded = decodeFunctionData({ abi: this.abi, data: calldata });
|
|
68
|
+
switch (decoded.functionName) {
|
|
69
|
+
case "openCreditAccount":
|
|
70
|
+
case "multicall": {
|
|
71
|
+
const [, calls] = decoded.args;
|
|
72
|
+
return [...calls];
|
|
73
|
+
}
|
|
74
|
+
default:
|
|
75
|
+
throw new Error(
|
|
76
|
+
`function ${decoded.functionName} on ${this.name} has no inner multicall`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
54
80
|
parseFunctionParamsV2(params, strict) {
|
|
55
81
|
switch (params.functionName) {
|
|
56
82
|
case "openCreditAccount": {
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local copy of the Convex V1 Booster adapter ABI.
|
|
3
|
+
*
|
|
4
|
+
* The ABI published by `@gearbox-protocol/integrations-v3` is generated from
|
|
5
|
+
* `IConvexV1BoosterAdapter.sol`, which declares `depositDiff`/`withdrawDiff`
|
|
6
|
+
* args as `(leftoverAmount, _pid, ...)`, while the deployed implementation
|
|
7
|
+
* (`ConvexV1_Booster.sol`) — and the calldata encoded by the router — uses
|
|
8
|
+
* `(_pid, leftoverAmount, ...)`. Selectors only depend on types, so encoding
|
|
9
|
+
* works on-chain, but decoding with the interface ABI yields swapped argument
|
|
10
|
+
* names. This copy fixes the argument order to match the implementation.
|
|
11
|
+
*/
|
|
12
|
+
export declare const iConvexV1BoosterAdapterAbi: readonly [{
|
|
13
|
+
readonly type: "function";
|
|
14
|
+
readonly inputs: readonly [];
|
|
15
|
+
readonly name: "contractType";
|
|
16
|
+
readonly outputs: readonly [{
|
|
17
|
+
readonly name: "";
|
|
18
|
+
readonly internalType: "bytes32";
|
|
19
|
+
readonly type: "bytes32";
|
|
20
|
+
}];
|
|
21
|
+
readonly stateMutability: "view";
|
|
22
|
+
}, {
|
|
23
|
+
readonly type: "function";
|
|
24
|
+
readonly inputs: readonly [];
|
|
25
|
+
readonly name: "creditManager";
|
|
26
|
+
readonly outputs: readonly [{
|
|
27
|
+
readonly name: "";
|
|
28
|
+
readonly internalType: "address";
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
}];
|
|
31
|
+
readonly stateMutability: "view";
|
|
32
|
+
}, {
|
|
33
|
+
readonly type: "function";
|
|
34
|
+
readonly inputs: readonly [{
|
|
35
|
+
readonly name: "_pid";
|
|
36
|
+
readonly internalType: "uint256";
|
|
37
|
+
readonly type: "uint256";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "";
|
|
40
|
+
readonly internalType: "uint256";
|
|
41
|
+
readonly type: "uint256";
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "_stake";
|
|
44
|
+
readonly internalType: "bool";
|
|
45
|
+
readonly type: "bool";
|
|
46
|
+
}];
|
|
47
|
+
readonly name: "deposit";
|
|
48
|
+
readonly outputs: readonly [{
|
|
49
|
+
readonly name: "useSafePrices";
|
|
50
|
+
readonly internalType: "bool";
|
|
51
|
+
readonly type: "bool";
|
|
52
|
+
}];
|
|
53
|
+
readonly stateMutability: "nonpayable";
|
|
54
|
+
}, {
|
|
55
|
+
readonly type: "function";
|
|
56
|
+
readonly inputs: readonly [{
|
|
57
|
+
readonly name: "_pid";
|
|
58
|
+
readonly internalType: "uint256";
|
|
59
|
+
readonly type: "uint256";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "leftoverAmount";
|
|
62
|
+
readonly internalType: "uint256";
|
|
63
|
+
readonly type: "uint256";
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "_stake";
|
|
66
|
+
readonly internalType: "bool";
|
|
67
|
+
readonly type: "bool";
|
|
68
|
+
}];
|
|
69
|
+
readonly name: "depositDiff";
|
|
70
|
+
readonly outputs: readonly [{
|
|
71
|
+
readonly name: "useSafePrices";
|
|
72
|
+
readonly internalType: "bool";
|
|
73
|
+
readonly type: "bool";
|
|
74
|
+
}];
|
|
75
|
+
readonly stateMutability: "nonpayable";
|
|
76
|
+
}, {
|
|
77
|
+
readonly type: "function";
|
|
78
|
+
readonly inputs: readonly [{
|
|
79
|
+
readonly name: "";
|
|
80
|
+
readonly internalType: "uint256";
|
|
81
|
+
readonly type: "uint256";
|
|
82
|
+
}];
|
|
83
|
+
readonly name: "pidToConvexToken";
|
|
84
|
+
readonly outputs: readonly [{
|
|
85
|
+
readonly name: "";
|
|
86
|
+
readonly internalType: "address";
|
|
87
|
+
readonly type: "address";
|
|
88
|
+
}];
|
|
89
|
+
readonly stateMutability: "view";
|
|
90
|
+
}, {
|
|
91
|
+
readonly type: "function";
|
|
92
|
+
readonly inputs: readonly [{
|
|
93
|
+
readonly name: "";
|
|
94
|
+
readonly internalType: "uint256";
|
|
95
|
+
readonly type: "uint256";
|
|
96
|
+
}];
|
|
97
|
+
readonly name: "pidToCurveToken";
|
|
98
|
+
readonly outputs: readonly [{
|
|
99
|
+
readonly name: "";
|
|
100
|
+
readonly internalType: "address";
|
|
101
|
+
readonly type: "address";
|
|
102
|
+
}];
|
|
103
|
+
readonly stateMutability: "view";
|
|
104
|
+
}, {
|
|
105
|
+
readonly type: "function";
|
|
106
|
+
readonly inputs: readonly [{
|
|
107
|
+
readonly name: "";
|
|
108
|
+
readonly internalType: "uint256";
|
|
109
|
+
readonly type: "uint256";
|
|
110
|
+
}];
|
|
111
|
+
readonly name: "pidToPhantomToken";
|
|
112
|
+
readonly outputs: readonly [{
|
|
113
|
+
readonly name: "";
|
|
114
|
+
readonly internalType: "address";
|
|
115
|
+
readonly type: "address";
|
|
116
|
+
}];
|
|
117
|
+
readonly stateMutability: "view";
|
|
118
|
+
}, {
|
|
119
|
+
readonly type: "function";
|
|
120
|
+
readonly inputs: readonly [];
|
|
121
|
+
readonly name: "serialize";
|
|
122
|
+
readonly outputs: readonly [{
|
|
123
|
+
readonly name: "serializedData";
|
|
124
|
+
readonly internalType: "bytes";
|
|
125
|
+
readonly type: "bytes";
|
|
126
|
+
}];
|
|
127
|
+
readonly stateMutability: "view";
|
|
128
|
+
}, {
|
|
129
|
+
readonly type: "function";
|
|
130
|
+
readonly inputs: readonly [];
|
|
131
|
+
readonly name: "targetContract";
|
|
132
|
+
readonly outputs: readonly [{
|
|
133
|
+
readonly name: "";
|
|
134
|
+
readonly internalType: "address";
|
|
135
|
+
readonly type: "address";
|
|
136
|
+
}];
|
|
137
|
+
readonly stateMutability: "view";
|
|
138
|
+
}, {
|
|
139
|
+
readonly type: "function";
|
|
140
|
+
readonly inputs: readonly [];
|
|
141
|
+
readonly name: "updateSupportedPids";
|
|
142
|
+
readonly outputs: readonly [];
|
|
143
|
+
readonly stateMutability: "nonpayable";
|
|
144
|
+
}, {
|
|
145
|
+
readonly type: "function";
|
|
146
|
+
readonly inputs: readonly [];
|
|
147
|
+
readonly name: "version";
|
|
148
|
+
readonly outputs: readonly [{
|
|
149
|
+
readonly name: "";
|
|
150
|
+
readonly internalType: "uint256";
|
|
151
|
+
readonly type: "uint256";
|
|
152
|
+
}];
|
|
153
|
+
readonly stateMutability: "view";
|
|
154
|
+
}, {
|
|
155
|
+
readonly type: "function";
|
|
156
|
+
readonly inputs: readonly [{
|
|
157
|
+
readonly name: "_pid";
|
|
158
|
+
readonly internalType: "uint256";
|
|
159
|
+
readonly type: "uint256";
|
|
160
|
+
}, {
|
|
161
|
+
readonly name: "";
|
|
162
|
+
readonly internalType: "uint256";
|
|
163
|
+
readonly type: "uint256";
|
|
164
|
+
}];
|
|
165
|
+
readonly name: "withdraw";
|
|
166
|
+
readonly outputs: readonly [{
|
|
167
|
+
readonly name: "useSafePrices";
|
|
168
|
+
readonly internalType: "bool";
|
|
169
|
+
readonly type: "bool";
|
|
170
|
+
}];
|
|
171
|
+
readonly stateMutability: "nonpayable";
|
|
172
|
+
}, {
|
|
173
|
+
readonly type: "function";
|
|
174
|
+
readonly inputs: readonly [{
|
|
175
|
+
readonly name: "_pid";
|
|
176
|
+
readonly internalType: "uint256";
|
|
177
|
+
readonly type: "uint256";
|
|
178
|
+
}, {
|
|
179
|
+
readonly name: "leftoverAmount";
|
|
180
|
+
readonly internalType: "uint256";
|
|
181
|
+
readonly type: "uint256";
|
|
182
|
+
}];
|
|
183
|
+
readonly name: "withdrawDiff";
|
|
184
|
+
readonly outputs: readonly [{
|
|
185
|
+
readonly name: "useSafePrices";
|
|
186
|
+
readonly internalType: "bool";
|
|
187
|
+
readonly type: "bool";
|
|
188
|
+
}];
|
|
189
|
+
readonly stateMutability: "nonpayable";
|
|
190
|
+
}, {
|
|
191
|
+
readonly type: "event";
|
|
192
|
+
readonly anonymous: false;
|
|
193
|
+
readonly inputs: readonly [{
|
|
194
|
+
readonly name: "pid";
|
|
195
|
+
readonly internalType: "uint256";
|
|
196
|
+
readonly type: "uint256";
|
|
197
|
+
readonly indexed: true;
|
|
198
|
+
}];
|
|
199
|
+
readonly name: "AddSupportedPid";
|
|
200
|
+
}, {
|
|
201
|
+
readonly type: "error";
|
|
202
|
+
readonly inputs: readonly [];
|
|
203
|
+
readonly name: "UnsupportedPidException";
|
|
204
|
+
}];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import { AddressMap } from "../../sdk/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns a copy of the balances map, leaving the original untouched.
|
|
5
|
+
*/
|
|
6
|
+
export declare function copyBalances(balances: AddressMap<bigint>): AddressMap<bigint>;
|
|
7
|
+
/**
|
|
8
|
+
* Applies diff-call semantics to a balances map: a diff-style adapter call
|
|
9
|
+
* spends the consumed token down to the exact `leftoverAmount` encoded in its
|
|
10
|
+
* calldata, so the post-call balance of `tokenIn` is `leftoverAmount`
|
|
11
|
+
* regardless of the actual amount spent.
|
|
12
|
+
*
|
|
13
|
+
* Returns a new map; the input map is not mutated.
|
|
14
|
+
*/
|
|
15
|
+
export declare function clampToLeftover(balances: AddressMap<bigint>, tokenIn: Address, leftoverAmount: bigint): AddressMap<bigint>;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves a Curve pool coin index to its token address.
|
|
18
|
+
*
|
|
19
|
+
* @throws When the index is out of range for the pool.
|
|
20
|
+
*/
|
|
21
|
+
export declare function curveCoin(tokens: readonly Address[], i: bigint | number): Address;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Abi, type Address } from "viem";
|
|
1
|
+
import { type Abi, type Address, type DecodeFunctionDataReturnType, type Hex } from "viem";
|
|
2
2
|
import { type CallTrace } from "../../../common-utils/utils/trace.js";
|
|
3
|
-
import type { ConstructOptions, ParsedCallV2, RelaxedBaseParams } from "../../../sdk/index.js";
|
|
3
|
+
import type { AddressMap, ConstructOptions, ParsedCallV2, RelaxedBaseParams } from "../../../sdk/index.js";
|
|
4
4
|
import { BaseContract } from "../../../sdk/index.js";
|
|
5
5
|
import type { LegacyAdapterOperation, Transfers } from "../legacyAdapterOperations.js";
|
|
6
6
|
import type { AdapterContractStateHuman, AdapterContractType, AdapterProtocolOperation } from "../types.js";
|
|
@@ -36,6 +36,26 @@ export declare class AbstractAdapterContract<const abi extends Abi | readonly un
|
|
|
36
36
|
* @param strict When true, throws instead of returning `undefined`
|
|
37
37
|
*/
|
|
38
38
|
parseProtocolCall(trace: CallTrace, strict?: boolean): AdapterProtocolOperation | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Applies the balance changes implied by a router-generated diff-style
|
|
41
|
+
* adapter call to a map of credit-account token balances.
|
|
42
|
+
*
|
|
43
|
+
* @param balances - Token balances before the call. Not mutated.
|
|
44
|
+
* @param calldata - Raw ABI-encoded adapter calldata.
|
|
45
|
+
* @returns A new balances map with the call's changes applied.
|
|
46
|
+
* @throws When the calldata cannot be decoded or the adapter (or the
|
|
47
|
+
* specific function) has no balance-changes support.
|
|
48
|
+
*/
|
|
49
|
+
previewBalanceChanges(balances: AddressMap<bigint>, calldata: Hex): AddressMap<bigint>;
|
|
50
|
+
/**
|
|
51
|
+
* Typed hook for {@link previewBalanceChanges}: receives the viem-decoded
|
|
52
|
+
* adapter call, so overrides can switch on `decoded.functionName` and get
|
|
53
|
+
* fully-typed `decoded.args` without casts.
|
|
54
|
+
*
|
|
55
|
+
* @throws When the adapter (or the specific function) has no balance-changes
|
|
56
|
+
* support; protocol-specific subclasses override this method.
|
|
57
|
+
*/
|
|
58
|
+
protected previewDecodedBalanceChanges(_balances: AddressMap<bigint>, decoded: DecodeFunctionDataReturnType<abi>): AddressMap<bigint>;
|
|
39
59
|
/**
|
|
40
60
|
* Classifies an adapter call into a {@link LegacyAdapterOperation} using the
|
|
41
61
|
* parsed call and credit-account transfer deltas.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
|
-
import type { ConstructOptions } from "../../../sdk/index.js";
|
|
1
|
+
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
+
import type { AddressMap, ConstructOptions } from "../../../sdk/index.js";
|
|
3
3
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
4
4
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
5
5
|
export declare enum BalancerV3PoolStatus {
|
|
@@ -451,5 +451,6 @@ export declare class BalancerV3RouterAdapterContract extends AbstractAdapterCont
|
|
|
451
451
|
version: number;
|
|
452
452
|
contractType?: string;
|
|
453
453
|
};
|
|
454
|
+
protected previewDecodedBalanceChanges(balances: AddressMap<bigint>, decoded: DecodeFunctionDataReturnType<abi>): AddressMap<bigint>;
|
|
454
455
|
}
|
|
455
456
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
|
-
import type { ConstructOptions } from "../../../sdk/index.js";
|
|
1
|
+
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
+
import type { AddressMap, ConstructOptions } from "../../../sdk/index.js";
|
|
3
3
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
4
4
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
5
5
|
declare const abi: readonly [{
|
|
@@ -164,5 +164,6 @@ export declare class BalancerV3WrapperAdapterContract extends AbstractAdapterCon
|
|
|
164
164
|
version: number;
|
|
165
165
|
contractType?: string;
|
|
166
166
|
};
|
|
167
|
+
protected previewDecodedBalanceChanges(balances: AddressMap<bigint>, decoded: DecodeFunctionDataReturnType<abi>): AddressMap<bigint>;
|
|
167
168
|
}
|
|
168
169
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
|
-
import type { ConstructOptions } from "../../../sdk/index.js";
|
|
1
|
+
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
+
import type { AddressMap, ConstructOptions } from "../../../sdk/index.js";
|
|
3
3
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
4
4
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
5
5
|
export interface CamelotPool {
|
|
@@ -655,5 +655,6 @@ export declare class CamelotV3AdapterContract extends AbstractAdapterContract<ab
|
|
|
655
655
|
version: number;
|
|
656
656
|
contractType?: string;
|
|
657
657
|
};
|
|
658
|
+
protected previewDecodedBalanceChanges(balances: AddressMap<bigint>, decoded: DecodeFunctionDataReturnType<abi>): AddressMap<bigint>;
|
|
658
659
|
}
|
|
659
660
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
|
-
import { type ConstructOptions, type ParsedCallV2 } from "../../../sdk/index.js";
|
|
1
|
+
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
+
import { type AddressMap, type ConstructOptions, type ParsedCallV2 } from "../../../sdk/index.js";
|
|
3
3
|
import type { LegacyAdapterOperation, Transfers } from "../legacyAdapterOperations.js";
|
|
4
4
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
5
5
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
@@ -690,5 +690,6 @@ export declare class ConvexV1BaseRewardPoolAdapterContract extends AbstractAdapt
|
|
|
690
690
|
* @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type_v3.go#L76-L83
|
|
691
691
|
*/
|
|
692
692
|
classifyLegacyOperation(parsed: ParsedCallV2, transfers: Transfers): LegacyAdapterOperation;
|
|
693
|
+
protected previewDecodedBalanceChanges(balances: AddressMap<bigint>, decoded: DecodeFunctionDataReturnType<abi>): AddressMap<bigint>;
|
|
693
694
|
}
|
|
694
695
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
|
-
import { type ConstructOptions, type ParsedCallV2 } from "../../../sdk/index.js";
|
|
1
|
+
import { type Address, type DecodeFunctionDataReturnType } from "viem";
|
|
2
|
+
import { type AddressMap, type ConstructOptions, type ParsedCallV2 } from "../../../sdk/index.js";
|
|
3
3
|
import type { LegacyAdapterOperation, Transfers } from "../legacyAdapterOperations.js";
|
|
4
4
|
import type { ConcreteAdapterContractOptions } from "./AbstractAdapter.js";
|
|
5
5
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
@@ -54,11 +54,11 @@ declare const abi: readonly [{
|
|
|
54
54
|
}, {
|
|
55
55
|
readonly type: "function";
|
|
56
56
|
readonly inputs: readonly [{
|
|
57
|
-
readonly name: "
|
|
57
|
+
readonly name: "_pid";
|
|
58
58
|
readonly internalType: "uint256";
|
|
59
59
|
readonly type: "uint256";
|
|
60
60
|
}, {
|
|
61
|
-
readonly name: "
|
|
61
|
+
readonly name: "leftoverAmount";
|
|
62
62
|
readonly internalType: "uint256";
|
|
63
63
|
readonly type: "uint256";
|
|
64
64
|
}, {
|
|
@@ -172,11 +172,11 @@ declare const abi: readonly [{
|
|
|
172
172
|
}, {
|
|
173
173
|
readonly type: "function";
|
|
174
174
|
readonly inputs: readonly [{
|
|
175
|
-
readonly name: "
|
|
175
|
+
readonly name: "_pid";
|
|
176
176
|
readonly internalType: "uint256";
|
|
177
177
|
readonly type: "uint256";
|
|
178
178
|
}, {
|
|
179
|
-
readonly name: "
|
|
179
|
+
readonly name: "leftoverAmount";
|
|
180
180
|
readonly internalType: "uint256";
|
|
181
181
|
readonly type: "uint256";
|
|
182
182
|
}];
|
|
@@ -421,5 +421,6 @@ export declare class ConvexV1BoosterAdapterContract extends AbstractAdapterContr
|
|
|
421
421
|
* @see https://github.com/Gearbox-protocol/charts_server/blob/master/core/operation_type_v3.go#L84-L91
|
|
422
422
|
*/
|
|
423
423
|
classifyLegacyOperation(parsed: ParsedCallV2, transfers: Transfers): LegacyAdapterOperation;
|
|
424
|
+
protected previewDecodedBalanceChanges(balances: AddressMap<bigint>, decoded: DecodeFunctionDataReturnType<abi>): AddressMap<bigint>;
|
|
424
425
|
}
|
|
425
426
|
export {};
|