@gearbox-protocol/sdk 16.0.0-next.43 → 16.0.0-next.45
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/onchain/accounts/index.js +0 -2
- package/dist/cjs/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +13 -7
- package/dist/cjs/onchain/accounts/withdrawal-compressor/errors.js +0 -19
- package/dist/cjs/onchain/accounts/withdrawal-compressor/index.js +1 -2
- package/dist/cjs/onchain/index.js +0 -4
- package/dist/cjs/onchain/market/adapters/contracts/BalancerV3RouterAdapterContract.js +33 -1
- package/dist/cjs/onchain/market/index.js +0 -2
- package/dist/cjs/onchain/market/zapper/ZapperContract.js +15 -8
- package/dist/cjs/onchain/market/zapper/errors.js +0 -18
- package/dist/cjs/onchain/market/zapper/index.js +1 -2
- package/dist/cjs/onchain/validation/checks.js +1 -1
- package/dist/cjs/preview/index.js +1 -10
- package/dist/cjs/preview/parse/errors.js +0 -35
- package/dist/cjs/preview/parse/index.js +1 -5
- package/dist/cjs/preview/parse/parseOperationCalldata.js +28 -17
- package/dist/cjs/preview/parse/parsePoolOperationCalldata.js +17 -11
- package/dist/cjs/preview/prerequisites/checkPrerequisites.js +5 -2
- package/dist/cjs/preview/preview/detectDelayedClaim.js +9 -7
- package/dist/cjs/preview/preview/detectDelayedOperation.js +11 -4
- package/dist/cjs/preview/preview/errors.js +0 -17
- package/dist/cjs/preview/preview/index.js +1 -2
- package/dist/cjs/preview/preview/previewOperation.js +30 -42
- package/dist/cjs/preview/preview/previewPoolPositionOperation.js +7 -3
- package/dist/cjs/preview/simulate/errors.js +13 -23
- package/dist/cjs/preview/simulate/index.js +1 -1
- package/dist/cjs/preview/simulate/simulateOperation.js +6 -4
- package/dist/cjs/preview/simulate/simulatePoolOperation.js +6 -3
- package/dist/esm/onchain/accounts/index.js +1 -2
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +13 -7
- package/dist/esm/onchain/accounts/withdrawal-compressor/errors.js +1 -19
- package/dist/esm/onchain/accounts/withdrawal-compressor/index.js +2 -2
- package/dist/esm/onchain/index.js +1 -3
- package/dist/esm/onchain/market/adapters/contracts/BalancerV3RouterAdapterContract.js +33 -1
- package/dist/esm/onchain/market/index.js +1 -2
- package/dist/esm/onchain/market/zapper/ZapperContract.js +15 -8
- package/dist/esm/onchain/market/zapper/errors.js +1 -18
- package/dist/esm/onchain/market/zapper/index.js +2 -2
- package/dist/esm/onchain/validation/checks.js +1 -1
- package/dist/esm/preview/index.js +2 -6
- package/dist/esm/preview/parse/errors.js +1 -33
- package/dist/esm/preview/parse/index.js +2 -3
- package/dist/esm/preview/parse/parseOperationCalldata.js +28 -17
- package/dist/esm/preview/parse/parsePoolOperationCalldata.js +17 -11
- package/dist/esm/preview/prerequisites/checkPrerequisites.js +5 -2
- package/dist/esm/preview/preview/detectDelayedClaim.js +9 -7
- package/dist/esm/preview/preview/detectDelayedOperation.js +11 -4
- package/dist/esm/preview/preview/errors.js +1 -17
- package/dist/esm/preview/preview/index.js +2 -2
- package/dist/esm/preview/preview/previewOperation.js +31 -43
- package/dist/esm/preview/preview/previewPoolPositionOperation.js +7 -3
- package/dist/esm/preview/simulate/errors.js +14 -23
- package/dist/esm/preview/simulate/index.js +2 -2
- package/dist/esm/preview/simulate/simulateOperation.js +6 -4
- package/dist/esm/preview/simulate/simulatePoolOperation.js +6 -3
- package/dist/types/model/errors.d.ts +1 -1
- package/dist/types/onchain/accounts/index.d.ts +1 -1
- package/dist/types/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.d.ts +6 -4
- package/dist/types/onchain/accounts/withdrawal-compressor/errors.d.ts +2 -11
- package/dist/types/onchain/accounts/withdrawal-compressor/index.d.ts +1 -1
- package/dist/types/onchain/accounts/withdrawal-compressor/types.d.ts +6 -4
- package/dist/types/onchain/index.d.ts +2 -2
- package/dist/types/onchain/market/index.d.ts +1 -1
- package/dist/types/onchain/market/zapper/ZapperContract.d.ts +7 -3
- package/dist/types/onchain/market/zapper/errors.d.ts +1 -10
- package/dist/types/onchain/market/zapper/index.d.ts +1 -1
- package/dist/types/onchain/market/zapper/types.d.ts +4 -1
- package/dist/types/onchain/validation/checks.d.ts +1 -1
- package/dist/types/preview/index.d.ts +4 -4
- package/dist/types/preview/parse/errors.d.ts +3 -21
- package/dist/types/preview/parse/index.d.ts +1 -1
- package/dist/types/preview/parse/parseOperationCalldata.d.ts +5 -1
- package/dist/types/preview/parse/parsePoolOperationCalldata.d.ts +5 -2
- package/dist/types/preview/prerequisites/checkPrerequisites.d.ts +6 -1
- package/dist/types/preview/preview/detectDelayedClaim.d.ts +7 -6
- package/dist/types/preview/preview/detectDelayedOperation.d.ts +3 -1
- package/dist/types/preview/preview/errors.d.ts +1 -10
- package/dist/types/preview/preview/index.d.ts +2 -2
- package/dist/types/preview/preview/previewOperation.d.ts +10 -10
- package/dist/types/preview/preview/previewPoolPositionOperation.d.ts +3 -1
- package/dist/types/preview/simulate/errors.d.ts +2 -11
- package/dist/types/preview/simulate/index.d.ts +2 -2
- package/dist/types/preview/simulate/simulateOperation.d.ts +4 -1
- package/dist/types/preview/simulate/simulatePoolOperation.d.ts +4 -1
- package/dist/types/sdk/prepare/errors.d.ts +1 -1
- package/dist/types/sdk/preview/PreviewNamespace.d.ts +2 -2
- package/dist/types/sdk/preview/types.d.ts +3 -3
- package/dist/types/sdk/types.d.ts +1 -3
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_market_adapters_contracts_AbstractAdapter = require("../../onchain/market/adapters/contracts/AbstractAdapter.js");
|
|
3
|
+
const require_model_result = require("../../model/result.js");
|
|
4
|
+
require("../../model/index.js");
|
|
3
5
|
const require_onchain_accounts_withdrawal_compressor_intent_codec = require("../../onchain/accounts/withdrawal-compressor/intent-codec.js");
|
|
4
|
-
const require_onchain_accounts_withdrawal_compressor_errors = require("../../onchain/accounts/withdrawal-compressor/errors.js");
|
|
5
6
|
require("../../onchain/index.js");
|
|
6
7
|
let viem = require("viem");
|
|
7
8
|
//#region src/preview/preview/detectDelayedOperation.ts
|
|
@@ -36,13 +37,19 @@ function detectDelayedOperation(sdk, multicall) {
|
|
|
36
37
|
if (request.extraData && request.extraData !== "0x") try {
|
|
37
38
|
intent = require_onchain_accounts_withdrawal_compressor_intent_codec.decodeDelayedIntent(request.extraData);
|
|
38
39
|
} catch (e) {
|
|
39
|
-
|
|
40
|
+
return require_model_result.sdkErr({
|
|
41
|
+
code: "invalidDelayedIntent",
|
|
42
|
+
message: `cannot decode delayed intent from extraData ${request.extraData}`,
|
|
43
|
+
extraData: request.extraData,
|
|
44
|
+
cause: e instanceof Error ? e : new Error(String(e))
|
|
45
|
+
});
|
|
40
46
|
}
|
|
41
|
-
return {
|
|
47
|
+
return require_model_result.sdkOk({
|
|
42
48
|
request,
|
|
43
49
|
intent
|
|
44
|
-
};
|
|
50
|
+
});
|
|
45
51
|
}
|
|
52
|
+
return require_model_result.sdkOk(void 0);
|
|
46
53
|
}
|
|
47
54
|
//#endregion
|
|
48
55
|
exports.detectDelayedOperation = detectDelayedOperation;
|
|
@@ -1,18 +1 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region src/preview/preview/errors.ts
|
|
3
|
-
function unsupportedOperation(operation) {
|
|
4
|
-
return {
|
|
5
|
-
code: "unsupportedOperation",
|
|
6
|
-
message: `operation "${operation}" is not supported by previewOperation`,
|
|
7
|
-
operation
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
Object.defineProperty(unsupportedOperation, Symbol.hasInstance, { value: (value) => typeof value === "object" && value !== null && value.code === "unsupportedOperation" });
|
|
11
|
-
/**
|
|
12
|
-
* Builds the verdict. Callable with or without `new`, so pre-declassing raise
|
|
13
|
-
* sites keep compiling; `instanceof` matches on the `code` discriminant, and
|
|
14
|
-
* the answer is never an `Error`.
|
|
15
|
-
*/
|
|
16
|
-
const UnsupportedOperationError = unsupportedOperation;
|
|
17
|
-
//#endregion
|
|
18
|
-
exports.UnsupportedOperationError = UnsupportedOperationError;
|
|
@@ -4,7 +4,7 @@ const require_preview_preview_CreditAccountState = require("./CreditAccountState
|
|
|
4
4
|
const require_preview_preview_detectCloseOrRepay = require("./detectCloseOrRepay.js");
|
|
5
5
|
const require_preview_preview_detectDelayedClaim = require("./detectDelayedClaim.js");
|
|
6
6
|
const require_preview_preview_detectDelayedOperation = require("./detectDelayedOperation.js");
|
|
7
|
-
|
|
7
|
+
require("./errors.js");
|
|
8
8
|
const require_preview_preview_estimateClaimableAt = require("./estimateClaimableAt.js");
|
|
9
9
|
const require_preview_preview_replayInnerOperations = require("./replayInnerOperations.js");
|
|
10
10
|
const require_preview_preview_replayMulticall = require("./replayMulticall.js");
|
|
@@ -12,7 +12,6 @@ const require_preview_preview_previewAdjustStrategyPosition = require("./preview
|
|
|
12
12
|
const require_preview_preview_previewExitOrRepayStrategyPosition = require("./previewExitOrRepayStrategyPosition.js");
|
|
13
13
|
const require_preview_preview_previewOperation = require("./previewOperation.js");
|
|
14
14
|
exports.CreditAccountState = require_preview_preview_CreditAccountState.CreditAccountState;
|
|
15
|
-
exports.UnsupportedOperationError = require_preview_preview_errors.UnsupportedOperationError;
|
|
16
15
|
exports.buildDelayedStrategyPositionOperationPreview = require_preview_preview_buildDelayedStrategyPositionOperationPreview.buildDelayedStrategyPositionOperationPreview;
|
|
17
16
|
exports.classifyCloseOrRepay = require_preview_preview_detectCloseOrRepay.classifyCloseOrRepay;
|
|
18
17
|
exports.detectDelayedClaim = require_preview_preview_detectDelayedClaim.detectDelayedClaim;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_model_result = require("../../model/result.js");
|
|
3
3
|
require("../../model/index.js");
|
|
4
|
-
const require_onchain_market_zapper_errors = require("../../onchain/market/zapper/errors.js");
|
|
5
|
-
const require_onchain_accounts_withdrawal_compressor_errors = require("../../onchain/accounts/withdrawal-compressor/errors.js");
|
|
6
|
-
require("../../onchain/index.js");
|
|
7
|
-
const require_preview_parse_errors = require("../parse/errors.js");
|
|
8
4
|
const require_preview_parse_parseOperationCalldata = require("../parse/parseOperationCalldata.js");
|
|
9
5
|
const require_preview_parse_types = require("../parse/types.js");
|
|
10
6
|
require("../parse/index.js");
|
|
@@ -12,55 +8,43 @@ const require_preview_preview_buildDelayedStrategyPositionOperationPreview = req
|
|
|
12
8
|
const require_preview_preview_detectCloseOrRepay = require("./detectCloseOrRepay.js");
|
|
13
9
|
const require_preview_preview_detectDelayedClaim = require("./detectDelayedClaim.js");
|
|
14
10
|
const require_preview_preview_detectDelayedOperation = require("./detectDelayedOperation.js");
|
|
15
|
-
const require_preview_preview_errors = require("./errors.js");
|
|
16
11
|
const require_preview_preview_estimateClaimableAt = require("./estimateClaimableAt.js");
|
|
17
12
|
const require_preview_preview_replayMulticall = require("./replayMulticall.js");
|
|
18
13
|
const require_preview_preview_previewAdjustStrategyPosition = require("./previewAdjustStrategyPosition.js");
|
|
19
14
|
const require_preview_preview_previewExitOrRepayStrategyPosition = require("./previewExitOrRepayStrategyPosition.js");
|
|
20
|
-
const require_preview_simulate_errors = require("../simulate/errors.js");
|
|
21
15
|
const require_preview_preview_previewOpenStrategyPosition = require("./previewOpenStrategyPosition.js");
|
|
22
16
|
const require_preview_preview_previewPoolPositionOperation = require("./previewPoolPositionOperation.js");
|
|
23
17
|
//#region src/preview/preview/previewOperation.ts
|
|
24
18
|
/**
|
|
25
|
-
* Narrows a raised value to the verdict vocabulary: a plain non-`Error`
|
|
26
|
-
* object whose `code` is one of the preview verdicts. Genuine exceptions —
|
|
27
|
-
* bugs, outages, calldata the parser cannot read at all — fail the check and
|
|
28
|
-
* keep propagating as throws.
|
|
29
|
-
*/
|
|
30
|
-
function isPreviewVerdict(raised) {
|
|
31
|
-
if (typeof raised !== "object" || raised === null || raised instanceof Error) return false;
|
|
32
|
-
return raised instanceof require_preview_parse_errors.UnsupportedTargetError || raised instanceof require_preview_parse_errors.UnsupportedPoolFunctionError || raised instanceof require_onchain_market_zapper_errors.UnsupportedZapperFunctionError || raised instanceof require_preview_preview_errors.UnsupportedOperationError || raised instanceof require_onchain_accounts_withdrawal_compressor_errors.InvalidDelayedIntentError || raised instanceof require_preview_simulate_errors.PreviewSimulationError;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
19
|
* Previews a raw operation calldata: decodes it into a typed operation and
|
|
36
20
|
* assembles an operation-specific, human-displayable preview.
|
|
37
21
|
*
|
|
38
22
|
* Answers an {@link SDKReturn} envelope: the preview behind `ok: true`, or —
|
|
39
23
|
* when the transaction is one the previewer refuses to read — a
|
|
40
|
-
* {@link
|
|
41
|
-
* means the SDK could not do its job (a read failed, the targeted
|
|
42
|
-
* account could not be resolved), not a
|
|
24
|
+
* {@link PreviewOperationError} behind `ok: false`. A thrown exception
|
|
25
|
+
* still means the SDK could not do its job (a read failed, the targeted
|
|
26
|
+
* credit account could not be resolved), not a refusal of the transaction.
|
|
43
27
|
*/
|
|
44
28
|
async function previewOperation(input, options) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return require_model_result.sdkOk(await previewMulticallOperation(input, operation, resolved));
|
|
58
|
-
}
|
|
59
|
-
return require_model_result.sdkErr(require_preview_preview_errors.UnsupportedOperationError(operation.operation));
|
|
60
|
-
} catch (raised) {
|
|
61
|
-
if (isPreviewVerdict(raised)) return require_model_result.sdkErr(raised);
|
|
62
|
-
throw raised;
|
|
29
|
+
const parsed = require_preview_parse_parseOperationCalldata.parseOperationCalldata(input);
|
|
30
|
+
if (require_model_result.isSDKError(parsed)) return parsed;
|
|
31
|
+
const operation = parsed.data;
|
|
32
|
+
if (require_preview_parse_types.isPoolOperation(operation)) return require_preview_preview_previewPoolPositionOperation.previewPoolPositionOperation(input, operation, options);
|
|
33
|
+
if (operation.operation === "OpenCreditAccount" || operation.operation === "RWAOpenCreditAccount") return require_model_result.sdkOk(await require_preview_preview_previewOpenStrategyPosition.previewOpenStrategyPosition(input, operation));
|
|
34
|
+
if (operation.operation === "CloseCreditAccount") {
|
|
35
|
+
const resolved = await resolveCreditAccount(input, operation, options);
|
|
36
|
+
const preview = require_preview_preview_previewExitOrRepayStrategyPosition.previewExitOrRepayStrategyPosition(input, operation, true, resolved);
|
|
37
|
+
const intent = await require_preview_preview_detectDelayedClaim.resolveDelayedClaimIntent(input.sdk, operation.multicall, options?.blockNumber);
|
|
38
|
+
if (require_model_result.isSDKError(intent)) return intent;
|
|
39
|
+
preview.intent = intent.data;
|
|
40
|
+
return require_model_result.sdkOk(preview);
|
|
63
41
|
}
|
|
42
|
+
if (operation.operation === "MultiCall" || operation.operation === "BotMulticall" || operation.operation === "RWAMulticall") return previewMulticallOperation(input, operation, await resolveCreditAccount(input, operation, options));
|
|
43
|
+
return require_model_result.sdkErr({
|
|
44
|
+
code: "unsupportedOperation",
|
|
45
|
+
message: `operation "${operation.operation}" is not supported by previewOperation`,
|
|
46
|
+
operation: operation.operation
|
|
47
|
+
});
|
|
64
48
|
}
|
|
65
49
|
/**
|
|
66
50
|
* Resolves the pre-state of the credit account an operation targets: uses the
|
|
@@ -86,10 +70,14 @@ async function resolveCreditAccount(input, operation, options) {
|
|
|
86
70
|
async function previewMulticallOperation(input, operation, options) {
|
|
87
71
|
const { sdk } = input;
|
|
88
72
|
const instantPreview = require_preview_preview_detectCloseOrRepay.isCloseOrRepay(operation.multicall) ? require_preview_preview_previewExitOrRepayStrategyPosition.previewExitOrRepayStrategyPosition(input, operation, false, options) : require_preview_preview_previewAdjustStrategyPosition.previewAdjustStrategyPosition(input, operation, options);
|
|
89
|
-
const
|
|
73
|
+
const detected = require_preview_preview_detectDelayedOperation.detectDelayedOperation(sdk, operation.multicall);
|
|
74
|
+
if (require_model_result.isSDKError(detected)) return detected;
|
|
75
|
+
const delayed = detected.data;
|
|
90
76
|
if (!delayed) {
|
|
91
|
-
|
|
92
|
-
return
|
|
77
|
+
const intent = await require_preview_preview_detectDelayedClaim.resolveDelayedClaimIntent(sdk, operation.multicall, options?.blockNumber);
|
|
78
|
+
if (require_model_result.isSDKError(intent)) return intent;
|
|
79
|
+
instantPreview.intent = intent.data;
|
|
80
|
+
return require_model_result.sdkOk(instantPreview);
|
|
93
81
|
}
|
|
94
82
|
const { before, after } = require_preview_preview_replayMulticall.replayMulticall(sdk, operation, options);
|
|
95
83
|
const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
|
|
@@ -97,7 +85,7 @@ async function previewMulticallOperation(input, operation, options) {
|
|
|
97
85
|
const meta = sdk.tokensMeta.get(market.underlying);
|
|
98
86
|
const receivedToken = meta && sdk.tokensMeta.isRWAUnderlying(meta) ? meta.asset : market.underlying;
|
|
99
87
|
const suite = sdk.marketRegister.findCreditManager(operation.creditManager);
|
|
100
|
-
return {
|
|
88
|
+
return require_model_result.sdkOk({
|
|
101
89
|
operation: "DelayedCreditAccountOperation",
|
|
102
90
|
creditAccount: operation.creditAccount,
|
|
103
91
|
...suite.creditOperationMarket(),
|
|
@@ -107,7 +95,7 @@ async function previewMulticallOperation(input, operation, options) {
|
|
|
107
95
|
estClaimableAt: require_preview_preview_estimateClaimableAt.estimateClaimableAt(sdk, delayed.request.phantomToken),
|
|
108
96
|
instantPreview,
|
|
109
97
|
delayedPreview: require_preview_preview_buildDelayedStrategyPositionOperationPreview.buildDelayedStrategyPositionOperationPreview(after.account, before, delayed, convert, receivedToken, sdk)
|
|
110
|
-
};
|
|
98
|
+
});
|
|
111
99
|
}
|
|
112
100
|
//#endregion
|
|
113
101
|
exports.previewOperation = previewOperation;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_result = require("../../model/result.js");
|
|
3
|
+
require("../../model/index.js");
|
|
2
4
|
const require_preview_simulate_simulatePoolOperation = require("../simulate/simulatePoolOperation.js");
|
|
3
5
|
require("../simulate/index.js");
|
|
4
6
|
//#region src/preview/preview/previewPoolPositionOperation.ts
|
|
@@ -6,13 +8,15 @@ async function previewPoolPositionOperation(input, operation, options) {
|
|
|
6
8
|
const { sdk, to, calldata } = input;
|
|
7
9
|
const { tokenIn, tokenOut } = operation;
|
|
8
10
|
const market = sdk.marketRegister.findByPool(operation.pool);
|
|
9
|
-
const
|
|
11
|
+
const answer = await require_preview_simulate_simulatePoolOperation.simulatePoolOperation({
|
|
10
12
|
sdk,
|
|
11
13
|
operation,
|
|
12
14
|
to,
|
|
13
15
|
calldata
|
|
14
16
|
}, options);
|
|
15
|
-
return
|
|
17
|
+
if (require_model_result.isSDKError(answer)) return answer;
|
|
18
|
+
const sim = answer.data;
|
|
19
|
+
return require_model_result.sdkOk({
|
|
16
20
|
operation: operation.operation,
|
|
17
21
|
pool: operation.pool,
|
|
18
22
|
name: sdk.tokensMeta.mustGetToken(operation.pool).name,
|
|
@@ -20,7 +24,7 @@ async function previewPoolPositionOperation(input, operation, options) {
|
|
|
20
24
|
shareRate: market.pool.pool.dieselRate,
|
|
21
25
|
tokenIn: market.priceOracle.toTokenAmount(tokenIn, sim.amountIn),
|
|
22
26
|
tokenOut: market.priceOracle.toTokenAmount(tokenOut, sim.amountOut)
|
|
23
|
-
};
|
|
27
|
+
});
|
|
24
28
|
}
|
|
25
29
|
//#endregion
|
|
26
30
|
exports.previewPoolPositionOperation = previewPoolPositionOperation;
|
|
@@ -2,35 +2,26 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_abi_errors = require("../../abi/errors.js");
|
|
3
3
|
let viem = require("viem");
|
|
4
4
|
//#region src/preview/simulate/errors.ts
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
const cause = failures.find((f) => f.detail.cause instanceof Error)?.detail.cause;
|
|
8
|
-
const verdict = {
|
|
9
|
-
code: "previewSimulationFailed",
|
|
10
|
-
message,
|
|
11
|
-
failures
|
|
12
|
-
};
|
|
13
|
-
if (cause) verdict.cause = cause;
|
|
14
|
-
return verdict;
|
|
5
|
+
function isPreviewSimulationError(value) {
|
|
6
|
+
return typeof value === "object" && value !== null && !(value instanceof Error) && value.code === "previewSimulationFailed";
|
|
15
7
|
}
|
|
16
|
-
Object.defineProperty(previewSimulationFailed, Symbol.hasInstance, { value: (value) => typeof value === "object" && value !== null && value.code === "previewSimulationFailed" });
|
|
17
|
-
/**
|
|
18
|
-
* Builds the verdict. Callable with or without `new`, so pre-declassing raise
|
|
19
|
-
* sites keep compiling; `instanceof` matches on the `code` discriminant, and
|
|
20
|
-
* the answer is never an `Error`.
|
|
21
|
-
*/
|
|
22
|
-
const PreviewSimulationError = previewSimulationFailed;
|
|
23
8
|
/**
|
|
24
9
|
* Normalises an unknown rejection reason into a {@link PreviewSimulationError}.
|
|
25
10
|
* Pass-through when it already is one; otherwise decodes it under `source`.
|
|
26
11
|
*/
|
|
27
12
|
function asPreviewSimulationError(reason, source) {
|
|
28
|
-
if (reason
|
|
13
|
+
if (isPreviewSimulationError(reason)) return reason;
|
|
29
14
|
const error = reason instanceof Error ? reason : new Error(String(reason));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
15
|
+
const detail = decodeSimulationError({ error });
|
|
16
|
+
return {
|
|
17
|
+
code: "previewSimulationFailed",
|
|
18
|
+
message: detail.reason,
|
|
19
|
+
failures: [{
|
|
20
|
+
source,
|
|
21
|
+
detail
|
|
22
|
+
}],
|
|
23
|
+
cause: error
|
|
24
|
+
};
|
|
34
25
|
}
|
|
35
26
|
/**
|
|
36
27
|
* Decodes a simulated call revert into a {@link SimulationError}.
|
|
@@ -78,6 +69,5 @@ function formatDecodedError(errorName, args) {
|
|
|
78
69
|
return `${errorName}(${args.map((arg) => String(arg)).join(", ")})`;
|
|
79
70
|
}
|
|
80
71
|
//#endregion
|
|
81
|
-
exports.PreviewSimulationError = PreviewSimulationError;
|
|
82
72
|
exports.asPreviewSimulationError = asPreviewSimulationError;
|
|
83
73
|
exports.decodeSimulationError = decodeSimulationError;
|
|
@@ -4,7 +4,7 @@ const require_preview_simulate_simulateFacadeOperation = require("./simulateFaca
|
|
|
4
4
|
const require_preview_simulate_simulatePoolOperation = require("./simulatePoolOperation.js");
|
|
5
5
|
const require_preview_simulate_simulateRWAOperation = require("./simulateRWAOperation.js");
|
|
6
6
|
const require_preview_simulate_simulateOperation = require("./simulateOperation.js");
|
|
7
|
-
exports.
|
|
7
|
+
exports.asPreviewSimulationError = require_preview_simulate_errors.asPreviewSimulationError;
|
|
8
8
|
exports.simulateFacadeOperation = require_preview_simulate_simulateFacadeOperation.simulateFacadeOperation;
|
|
9
9
|
exports.simulateOperation = require_preview_simulate_simulateOperation.simulateOperation;
|
|
10
10
|
exports.simulatePoolOperation = require_preview_simulate_simulatePoolOperation.simulatePoolOperation;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_result = require("../../model/result.js");
|
|
3
|
+
require("../../model/index.js");
|
|
2
4
|
const require_preview_parse_types = require("../parse/types.js");
|
|
3
5
|
require("../parse/index.js");
|
|
4
6
|
const require_preview_simulate_simulateFacadeOperation = require("./simulateFacadeOperation.js");
|
|
@@ -14,14 +16,14 @@ async function simulateOperation(input, options) {
|
|
|
14
16
|
...input,
|
|
15
17
|
operation
|
|
16
18
|
}, options);
|
|
17
|
-
if (require_preview_parse_types.isRWAOperation(operation)) return require_preview_simulate_simulateRWAOperation.simulateRWAOperation({
|
|
19
|
+
if (require_preview_parse_types.isRWAOperation(operation)) return require_model_result.sdkOk(await require_preview_simulate_simulateRWAOperation.simulateRWAOperation({
|
|
18
20
|
...input,
|
|
19
21
|
operation
|
|
20
|
-
}, options);
|
|
21
|
-
return require_preview_simulate_simulateFacadeOperation.simulateFacadeOperation({
|
|
22
|
+
}, options));
|
|
23
|
+
return require_model_result.sdkOk(await require_preview_simulate_simulateFacadeOperation.simulateFacadeOperation({
|
|
22
24
|
...input,
|
|
23
25
|
operation
|
|
24
|
-
}, options);
|
|
26
|
+
}, options));
|
|
25
27
|
}
|
|
26
28
|
//#endregion
|
|
27
29
|
exports.simulateOperation = simulateOperation;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_abi_iZapper = require("../../abi/iZapper.js");
|
|
3
3
|
const require_abi_310_generated = require("../../abi/310/generated.js");
|
|
4
|
+
const require_model_result = require("../../model/result.js");
|
|
5
|
+
require("../../model/index.js");
|
|
4
6
|
const require_preview_simulate_errors = require("./errors.js");
|
|
5
7
|
//#region src/preview/simulate/simulatePoolOperation.ts
|
|
6
8
|
function previewRead(operation) {
|
|
@@ -90,14 +92,15 @@ async function simulatePoolOperation(input, options = {}) {
|
|
|
90
92
|
const { sdk, operation } = input;
|
|
91
93
|
const { blockNumber, logger } = options;
|
|
92
94
|
try {
|
|
93
|
-
|
|
95
|
+
const previewAmount = await sdk.client.readContract({
|
|
94
96
|
blockNumber,
|
|
95
97
|
...previewContract(operation)
|
|
96
|
-
})
|
|
98
|
+
});
|
|
99
|
+
return require_model_result.sdkOk(amountsInOut(operation, previewAmount));
|
|
97
100
|
} catch (cause) {
|
|
98
101
|
const error = require_preview_simulate_errors.asPreviewSimulationError(cause, "multicall");
|
|
99
102
|
logger?.error(error, "pool operation simulation failed");
|
|
100
|
-
|
|
103
|
+
return require_model_result.sdkErr(error);
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
//#endregion
|
|
@@ -18,7 +18,6 @@ import "./types.js";
|
|
|
18
18
|
import { DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, decodeDelayedIntent, encodeDelayedIntent } from "./withdrawal-compressor/intent-codec.js";
|
|
19
19
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./withdrawal-compressor/AbstractWithdrawalCompressorContract.js";
|
|
20
20
|
import { getWithdrawalCompressorAddress } from "./withdrawal-compressor/addresses.js";
|
|
21
|
-
import { InvalidDelayedIntentError } from "./withdrawal-compressor/errors.js";
|
|
22
21
|
import { RedemptionLoggerV310Contract } from "./withdrawal-compressor/RedemptionLoggerV310Contract.js";
|
|
23
22
|
import { createRedemptionLogger } from "./withdrawal-compressor/createRedemptionLogger.js";
|
|
24
23
|
import { WithdrawalCompressorV310Contract } from "./withdrawal-compressor/WithdrawalCompressorV310Contract.js";
|
|
@@ -27,4 +26,4 @@ import { toWithdrawalStatus } from "./withdrawal-compressor/types.js";
|
|
|
27
26
|
import { WithdrawalCompressorV313Contract } from "./withdrawal-compressor/WithdrawalCompressorV313Contract.js";
|
|
28
27
|
import { createWithdrawalCompressor } from "./withdrawal-compressor/createWithdrawalCompressor.js";
|
|
29
28
|
import "./withdrawal-compressor/index.js";
|
|
30
|
-
export { AbstractWithdrawalCompressorContract, AccountBotsService, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION,
|
|
29
|
+
export { AbstractWithdrawalCompressorContract, AccountBotsService, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, MultichainLiquidationsService, PeripheryCompressorV310Contract, RedemptionLoggerV310Contract, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, borrowable, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, isPhantomToken, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
2
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
3
|
import "../../base/index.js";
|
|
4
|
+
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
5
|
+
import "../../../model/index.js";
|
|
4
6
|
import { decodeDelayedIntent } from "./intent-codec.js";
|
|
5
|
-
import { InvalidDelayedIntentError } from "./errors.js";
|
|
6
7
|
//#region src/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
|
|
7
8
|
const abi = iRedemptionLoggerV310Abi;
|
|
8
9
|
/**
|
|
@@ -32,18 +33,23 @@ var RedemptionLoggerV310Contract = class extends BaseContract {
|
|
|
32
33
|
*
|
|
33
34
|
* @param redeemer - Redeemer contract the withdrawal is claimed from.
|
|
34
35
|
* @param blockNumber - Optional block number to read the log at.
|
|
35
|
-
* @returns The decoded intent
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* @returns The decoded intent behind `ok` (`undefined` when the log
|
|
37
|
+
* carries none, including when nothing was logged for the redeemer), or
|
|
38
|
+
* the `invalidDelayedIntent` refusal when the logged `extraData` is
|
|
38
39
|
* non-empty but cannot be decoded as a `DelayedIntent`.
|
|
39
40
|
**/
|
|
40
41
|
async getDelayedIntent(redeemer, blockNumber) {
|
|
41
42
|
const log = await this.getRedemptionLog(redeemer, blockNumber);
|
|
42
|
-
if (!log.extraData || log.extraData === "0x") return;
|
|
43
|
+
if (!log.extraData || log.extraData === "0x") return sdkOk(void 0);
|
|
43
44
|
try {
|
|
44
|
-
return decodeDelayedIntent(log.extraData);
|
|
45
|
+
return sdkOk(decodeDelayedIntent(log.extraData));
|
|
45
46
|
} catch (e) {
|
|
46
|
-
|
|
47
|
+
return sdkErr({
|
|
48
|
+
code: "invalidDelayedIntent",
|
|
49
|
+
message: `cannot decode delayed intent from extraData ${log.extraData}`,
|
|
50
|
+
extraData: log.extraData,
|
|
51
|
+
cause: e instanceof Error ? e : new Error(String(e))
|
|
52
|
+
});
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
};
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
function invalidDelayedIntent(extraData, cause) {
|
|
3
|
-
const verdict = {
|
|
4
|
-
code: "invalidDelayedIntent",
|
|
5
|
-
message: `cannot decode delayed intent from extraData ${extraData}`,
|
|
6
|
-
extraData
|
|
7
|
-
};
|
|
8
|
-
if (cause !== void 0) verdict.cause = cause instanceof Error ? cause : new Error(String(cause));
|
|
9
|
-
return verdict;
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(invalidDelayedIntent, Symbol.hasInstance, { value: (value) => typeof value === "object" && value !== null && value.code === "invalidDelayedIntent" });
|
|
12
|
-
/**
|
|
13
|
-
* Builds the verdict. Callable with or without `new`, so pre-declassing raise
|
|
14
|
-
* sites keep compiling; `instanceof` matches on the `code` discriminant, and
|
|
15
|
-
* the answer is never an `Error`.
|
|
16
|
-
*/
|
|
17
|
-
const InvalidDelayedIntentError = invalidDelayedIntent;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { InvalidDelayedIntentError };
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, decodeDelayedIntent, encodeDelayedIntent } from "./intent-codec.js";
|
|
2
2
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
3
|
import { getWithdrawalCompressorAddress } from "./addresses.js";
|
|
4
|
-
import { InvalidDelayedIntentError } from "./errors.js";
|
|
5
4
|
import { RedemptionLoggerV310Contract } from "./RedemptionLoggerV310Contract.js";
|
|
6
5
|
import { createRedemptionLogger } from "./createRedemptionLogger.js";
|
|
7
6
|
import { WithdrawalCompressorV310Contract } from "./WithdrawalCompressorV310Contract.js";
|
|
@@ -9,4 +8,5 @@ import { WithdrawalCompressorV311Contract } from "./WithdrawalCompressorV311Cont
|
|
|
9
8
|
import { toWithdrawalStatus } from "./types.js";
|
|
10
9
|
import { WithdrawalCompressorV313Contract } from "./WithdrawalCompressorV313Contract.js";
|
|
11
10
|
import { createWithdrawalCompressor } from "./createWithdrawalCompressor.js";
|
|
12
|
-
|
|
11
|
+
import "./errors.js";
|
|
12
|
+
export { AbstractWithdrawalCompressorContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, RedemptionLoggerV310Contract, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
@@ -176,7 +176,6 @@ import { LinearInterestRateModelContract } from "./market/pool/LinearInterestRat
|
|
|
176
176
|
import { PoolV310Contract } from "./market/pool/PoolV310Contract.js";
|
|
177
177
|
import { PoolSuite } from "./market/pool/PoolSuite.js";
|
|
178
178
|
import { MarketSuite } from "./market/MarketSuite.js";
|
|
179
|
-
import { UnsupportedZapperFunctionError } from "./market/zapper/errors.js";
|
|
180
179
|
import { ZapperContract } from "./market/zapper/ZapperContract.js";
|
|
181
180
|
import { IERC20ZapperContract } from "./market/zapper/IERC20ZapperContract.js";
|
|
182
181
|
import { IETHZapperContract } from "./market/zapper/IETHZapperContract.js";
|
|
@@ -208,7 +207,6 @@ import { MultichainLiquidationsService } from "./accounts/liquidations/Multichai
|
|
|
208
207
|
import { DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, decodeDelayedIntent, encodeDelayedIntent } from "./accounts/withdrawal-compressor/intent-codec.js";
|
|
209
208
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js";
|
|
210
209
|
import { getWithdrawalCompressorAddress } from "./accounts/withdrawal-compressor/addresses.js";
|
|
211
|
-
import { InvalidDelayedIntentError } from "./accounts/withdrawal-compressor/errors.js";
|
|
212
210
|
import { RedemptionLoggerV310Contract } from "./accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js";
|
|
213
211
|
import { createRedemptionLogger } from "./accounts/withdrawal-compressor/createRedemptionLogger.js";
|
|
214
212
|
import { WithdrawalCompressorV310Contract } from "./accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js";
|
|
@@ -246,4 +244,4 @@ import { MultichainSDK } from "./MultichainSDK.js";
|
|
|
246
244
|
import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
247
245
|
import "./types/index.js";
|
|
248
246
|
import "./validation/index.js";
|
|
249
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, borrowable, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isMalformedPreviewError, isPhantomToken, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, raise, rayToBps, rayToNumber, refuse, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
247
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, borrowable, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isMalformedPreviewError, isPhantomToken, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, raise, rayToBps, rayToNumber, refuse, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AddressMap } from "../../../utils/AddressMap.js";
|
|
2
|
+
import "../../../utils/index.js";
|
|
1
3
|
import { MissingSerializedParamsError } from "../../../base/errors.js";
|
|
2
4
|
import "../../../base/index.js";
|
|
3
5
|
import { iBalancerV3RouterAdapterAbi } from "../abi/adapters/iBalancerV3RouterAdapter.js";
|
|
@@ -6,6 +8,30 @@ import { iBalancerV3RouterAbi } from "../abi/targetContractAbi.js";
|
|
|
6
8
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
7
9
|
import { decodeAbiParameters } from "viem";
|
|
8
10
|
//#region src/onchain/market/adapters/contracts/BalancerV3RouterAdapterContract.ts
|
|
11
|
+
const BALANCER_V3_POOL_TOKENS = {
|
|
12
|
+
Mainnet: new AddressMap([
|
|
13
|
+
["0x121edB0bADc036F5FC610D015EE14093C142313B", ["0x775F661b0bD1739349b9A2A3EF60be277c5d2D29", "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a"]],
|
|
14
|
+
["0x1ea5870f7C037930CE1d5d8d9317c670e89e13E3", ["0x0bfc9d54Fc184518A81162F8fB99c2eACa081202", "0xae78736Cd615f374D3085123A210448E74Fc6393"]],
|
|
15
|
+
["0x57c23c58B1D8C3292c15BEcF07c62C5c52457A42", ["0x0bfc9d54Fc184518A81162F8fB99c2eACa081202", "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38"]],
|
|
16
|
+
["0x6b31a94029fd7840d780191B6D63Fa0D269bd883", ["0x2411802D8BEA09be0aF8fD8D08314a63e706b29C", "0x90551c1795392094FE6D29B758EcCD233cFAa260"]],
|
|
17
|
+
["0x85B2b559bC2D21104C4DEFdd6EFcA8A20343361D", [
|
|
18
|
+
"0x7Bc3485026Ac48b6cf9BaF0A377477Fff5703Af8",
|
|
19
|
+
"0xC71Ea051a5F82c67ADcF634c36FFE6334793D24C",
|
|
20
|
+
"0xD4fa2D31b7968E448877f69A96DE69f5de8cD23E"
|
|
21
|
+
]],
|
|
22
|
+
["0x9ED5175aeCB6653C1BDaa19793c16fd74fBeEB37", ["0x775F661b0bD1739349b9A2A3EF60be277c5d2D29", "0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8"]],
|
|
23
|
+
["0xc4Ce391d82D164c166dF9c8336DDF84206b2F812", ["0x0FE906e030a44eF24CA8c7dC7B7c53A6C4F00ce9", "0x775F661b0bD1739349b9A2A3EF60be277c5d2D29"]]
|
|
24
|
+
]),
|
|
25
|
+
Plasma: new AddressMap([
|
|
26
|
+
["0x01E2C7fCde2B8D5d1413732c4e274Ba5B06B1E54", ["0x0A1a1A107E45b7Ced86833863f482BC5f4ed82EF", "0xE0126F0c4451B2B917064A93040fd4770D6774b5"]],
|
|
27
|
+
["0x694c009aa31B3F80EE18C218B02390ca2D7151e7", ["0x6eAf19b2FC24552925dB245F9Ff613157a7dbb4C", "0xE0126F0c4451B2B917064A93040fd4770D6774b5"]],
|
|
28
|
+
["0x6a74BE33B5393D8A3EbA4D69B78f9D9da947C48c", ["0xC63F1a8c0cD4493E18f6f3371182BE01Ce0BeF02", "0xE0126F0c4451B2B917064A93040fd4770D6774b5"]],
|
|
29
|
+
["0xB3Ca3ead1c59dEd552cD30a6992038284B418b65", ["0x0B2b2B2076d95dda7817e785989fE353fe955ef9", "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb"]],
|
|
30
|
+
["0xD931775d9AcA9859c9fDc53C63ae32EF21551492", ["0x9c46EE1f01d2b551048F5fF99a4659D98d04BED1", "0xC8A8DF9B210243c55D31c73090F06787aD0A1Bf6"]],
|
|
31
|
+
["0xd9c4e277c93374a9f8C877a9D06707a88092E8F0", ["0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2", "0xE0126F0c4451B2B917064A93040fd4770D6774b5"]],
|
|
32
|
+
["0xDE0cfD933D2036d99048a04acF5Bacfb45492377", ["0x76309A9a56309104518847BbA321c261B7B4a43f", "0xA29420057F3e3B9512D4786df135Da1674BD74D4"]]
|
|
33
|
+
])
|
|
34
|
+
};
|
|
9
35
|
let BalancerV3PoolStatus = /* @__PURE__ */ function(BalancerV3PoolStatus) {
|
|
10
36
|
BalancerV3PoolStatus[BalancerV3PoolStatus["NOT_ALLOWED"] = 0] = "NOT_ALLOWED";
|
|
11
37
|
BalancerV3PoolStatus[BalancerV3PoolStatus["ALLOWED"] = 1] = "ALLOWED";
|
|
@@ -98,7 +124,13 @@ var BalancerV3RouterAdapterContract = class extends AbstractAdapterContract {
|
|
|
98
124
|
this.setLeftover(balances, pool, leftoverAmount);
|
|
99
125
|
break;
|
|
100
126
|
}
|
|
101
|
-
case "addLiquidityUnbalancedDiff":
|
|
127
|
+
case "addLiquidityUnbalancedDiff": {
|
|
128
|
+
const [pool, leftoverAmounts] = decoded.args;
|
|
129
|
+
const tokens = BALANCER_V3_POOL_TOKENS[this.networkType]?.get(pool);
|
|
130
|
+
if (!tokens || tokens.length !== leftoverAmounts.length) throw new Error(`previewBalanceChanges cannot resolve pool tokens for addLiquidityUnbalancedDiff on ${this.contractType} adapter at ${this.address} (pool ${pool})`);
|
|
131
|
+
for (let i = 0; i < leftoverAmounts.length; i++) this.setLeftover(balances, tokens[i], leftoverAmounts[i]);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
102
134
|
default: super.applyBalanceChanges(balances, decoded);
|
|
103
135
|
}
|
|
104
136
|
}
|
|
@@ -128,7 +128,6 @@ import { PoolV310Contract } from "./pool/PoolV310Contract.js";
|
|
|
128
128
|
import { PoolSuite } from "./pool/PoolSuite.js";
|
|
129
129
|
import "./pool/index.js";
|
|
130
130
|
import { MarketSuite } from "./MarketSuite.js";
|
|
131
|
-
import { UnsupportedZapperFunctionError } from "./zapper/errors.js";
|
|
132
131
|
import { ZapperContract } from "./zapper/ZapperContract.js";
|
|
133
132
|
import { IERC20ZapperContract } from "./zapper/IERC20ZapperContract.js";
|
|
134
133
|
import { IETHZapperContract } from "./zapper/IETHZapperContract.js";
|
|
@@ -145,4 +144,4 @@ import { RWARegistry } from "./rwa/RWARegistry.js";
|
|
|
145
144
|
import { RWA_FACTORY_TYPES, isRWAFactory } from "./rwa/types.js";
|
|
146
145
|
import "./rwa/index.js";
|
|
147
146
|
import "./types.js";
|
|
148
|
-
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract,
|
|
147
|
+
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fetchRedstonePayloads, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, usdToNumber };
|