@gearbox-protocol/sdk 14.11.0-next.9 → 14.11.0
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/common-utils/utils/index.js +0 -2
- package/dist/cjs/dev/index.js +1 -3
- package/dist/cjs/dev/isOutOfSyncError.js +3 -1
- package/dist/cjs/history/assembleOperations.js +6 -6
- package/dist/cjs/history/classifyMulticallOperations.js +25 -31
- package/dist/cjs/{preview/trace → history}/errors.js +26 -0
- package/dist/cjs/history/extractProtocolCalls.js +53 -0
- package/dist/cjs/{preview/trace → history}/extractTransfers.js +23 -11
- package/dist/cjs/{preview/trace → history}/findFacadeCalls.js +3 -3
- package/dist/cjs/history/index.js +2 -0
- package/dist/cjs/{preview/parse/types-facades.js → history/inner-operations.js} +2 -2
- package/dist/cjs/{preview/parse/types-adapters.js → history/internal-types.js} +2 -2
- package/dist/cjs/history/parseCreditAccountTransaction.js +6 -5
- package/dist/cjs/history/toLegacyOperation.js +2 -6
- package/dist/cjs/{common-utils/utils/trace.js → history/trace-utils.js} +5 -62
- package/dist/cjs/permissionless/bindings/pricefeeds/curve-twap.js +2 -2
- package/dist/cjs/plugins/adapters/contracts/AbstractAdapter.js +37 -25
- package/dist/cjs/plugins/adapters/contracts/AccountMigratorAdapterContract.js +0 -9
- package/dist/esm/common-utils/utils/index.js +0 -1
- package/dist/esm/dev/index.js +0 -1
- package/dist/esm/dev/isOutOfSyncError.js +3 -1
- package/dist/esm/history/assembleOperations.js +6 -8
- package/dist/esm/history/classifyMulticallOperations.js +23 -29
- package/dist/esm/{preview/trace → history}/errors.js +24 -0
- package/dist/esm/history/extractProtocolCalls.js +32 -0
- package/dist/esm/{preview/trace → history}/extractTransfers.js +23 -11
- package/dist/esm/{preview/trace → history}/findFacadeCalls.js +2 -4
- package/dist/esm/history/index.js +1 -0
- package/dist/esm/history/parseCreditAccountTransaction.js +4 -3
- package/dist/esm/history/toLegacyOperation.js +2 -6
- package/dist/esm/history/trace-utils.js +36 -0
- package/dist/esm/permissionless/bindings/pricefeeds/curve-twap.js +2 -2
- package/dist/esm/plugins/adapters/contracts/AbstractAdapter.js +38 -28
- package/dist/esm/plugins/adapters/contracts/AccountMigratorAdapterContract.js +0 -9
- package/dist/types/common-utils/utils/index.d.ts +0 -1
- package/dist/types/dev/index.d.ts +0 -1
- package/dist/types/history/assembleOperations.d.ts +6 -11
- package/dist/types/history/classifyMulticallOperations.d.ts +9 -21
- package/dist/types/{preview/trace → history}/errors.d.ts +10 -0
- package/dist/types/history/extractProtocolCalls.d.ts +8 -0
- package/dist/types/{preview/trace → history}/extractTransfers.d.ts +7 -15
- package/dist/types/{preview/trace → history}/findFacadeCalls.d.ts +2 -3
- package/dist/types/history/index.d.ts +1 -0
- package/dist/types/history/inner-operations.d.ts +57 -0
- package/dist/types/history/internal-types.d.ts +47 -0
- package/dist/types/history/mapOperations.d.ts +9 -7
- package/dist/types/history/trace-utils.d.ts +12 -0
- package/dist/types/history/types.d.ts +71 -22
- package/dist/types/plugins/adapters/contracts/AbstractAdapter.d.ts +17 -16
- package/dist/types/plugins/adapters/contracts/AccountMigratorAdapterContract.d.ts +1 -10
- package/dist/types/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/Curve2AssetsAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/Curve3AssetsAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/Curve4AssetsAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterDeposit.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterStETHContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/CurveV1StableNGAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/DaiUsdsAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/ERC4626AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/ERC4626ReferralAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/LidoV1AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/MellowDVVAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/UniswapV2AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/UniswapV4AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/WstETHV1AdapterContract.d.ts +1 -1
- package/dist/types/plugins/adapters/transferHelpers.d.ts +1 -1
- package/dist/types/plugins/adapters/types.d.ts +46 -8
- package/package.json +1 -6
- package/dist/cjs/dev/verifyTestnet.js +0 -124
- package/dist/cjs/plugins/adapters/transfers.js +0 -16
- package/dist/cjs/preview/index.js +0 -28
- package/dist/cjs/preview/package.json +0 -1
- package/dist/cjs/preview/parse/classifyInnerOperations.js +0 -92
- package/dist/cjs/preview/parse/errors.js +0 -47
- package/dist/cjs/preview/parse/extractExpectedBalanceChanges.js +0 -48
- package/dist/cjs/preview/parse/index.js +0 -34
- package/dist/cjs/preview/parse/parseFacadeOperationCalldata.js +0 -115
- package/dist/cjs/preview/parse/parseOperationCalldata.js +0 -46
- package/dist/cjs/preview/parse/parsePoolOperationCalldata.js +0 -77
- package/dist/cjs/preview/parse/types-pools.js +0 -16
- package/dist/cjs/preview/parse/types.js +0 -37
- package/dist/cjs/preview/prerequisites/AllowancePrerequisite.js +0 -78
- package/dist/cjs/preview/prerequisites/BalancePrerequisite.js +0 -77
- package/dist/cjs/preview/prerequisites/Prerequisite.js +0 -85
- package/dist/cjs/preview/prerequisites/buildPrerequisites.js +0 -187
- package/dist/cjs/preview/prerequisites/index.js +0 -34
- package/dist/cjs/preview/prerequisites/prepareAction.js +0 -48
- package/dist/cjs/preview/prerequisites/runPrerequisites.js +0 -71
- package/dist/cjs/preview/prerequisites/types.js +0 -16
- package/dist/cjs/preview/simulate/constants.js +0 -28
- package/dist/cjs/preview/simulate/errors.js +0 -98
- package/dist/cjs/preview/simulate/extractERC20Transfers.js +0 -47
- package/dist/cjs/preview/simulate/holders.js +0 -45
- package/dist/cjs/preview/simulate/index.js +0 -40
- package/dist/cjs/preview/simulate/simulateFacadeOperation.js +0 -30
- package/dist/cjs/preview/simulate/simulateOperation.js +0 -37
- package/dist/cjs/preview/simulate/simulatePoolOpMulticall.js +0 -155
- package/dist/cjs/preview/simulate/simulatePoolOpV1.js +0 -106
- package/dist/cjs/preview/simulate/simulatePoolOperation.js +0 -62
- package/dist/cjs/preview/simulate/types.js +0 -16
- package/dist/cjs/preview/trace/extractAdapterCallTraces.js +0 -58
- package/dist/cjs/preview/trace/index.js +0 -30
- package/dist/cjs/preview/trace/types.js +0 -16
- package/dist/esm/common-utils/utils/trace.js +0 -93
- package/dist/esm/dev/verifyTestnet.js +0 -98
- package/dist/esm/preview/index.js +0 -4
- package/dist/esm/preview/package.json +0 -1
- package/dist/esm/preview/parse/classifyInnerOperations.js +0 -68
- package/dist/esm/preview/parse/errors.js +0 -22
- package/dist/esm/preview/parse/extractExpectedBalanceChanges.js +0 -24
- package/dist/esm/preview/parse/index.js +0 -7
- package/dist/esm/preview/parse/parseFacadeOperationCalldata.js +0 -91
- package/dist/esm/preview/parse/parseOperationCalldata.js +0 -25
- package/dist/esm/preview/parse/parsePoolOperationCalldata.js +0 -53
- package/dist/esm/preview/parse/types-facades.js +0 -0
- package/dist/esm/preview/parse/types-pools.js +0 -0
- package/dist/esm/preview/parse/types.js +0 -9
- package/dist/esm/preview/prerequisites/AllowancePrerequisite.js +0 -57
- package/dist/esm/preview/prerequisites/BalancePrerequisite.js +0 -56
- package/dist/esm/preview/prerequisites/Prerequisite.js +0 -63
- package/dist/esm/preview/prerequisites/buildPrerequisites.js +0 -163
- package/dist/esm/preview/prerequisites/index.js +0 -7
- package/dist/esm/preview/prerequisites/prepareAction.js +0 -23
- package/dist/esm/preview/prerequisites/runPrerequisites.js +0 -47
- package/dist/esm/preview/prerequisites/types.js +0 -0
- package/dist/esm/preview/simulate/constants.js +0 -4
- package/dist/esm/preview/simulate/errors.js +0 -75
- package/dist/esm/preview/simulate/extractERC20Transfers.js +0 -23
- package/dist/esm/preview/simulate/holders.js +0 -21
- package/dist/esm/preview/simulate/index.js +0 -12
- package/dist/esm/preview/simulate/simulateFacadeOperation.js +0 -6
- package/dist/esm/preview/simulate/simulateOperation.js +0 -13
- package/dist/esm/preview/simulate/simulatePoolOpMulticall.js +0 -130
- package/dist/esm/preview/simulate/simulatePoolOpV1.js +0 -82
- package/dist/esm/preview/simulate/simulatePoolOperation.js +0 -41
- package/dist/esm/preview/simulate/types.js +0 -0
- package/dist/esm/preview/trace/extractAdapterCallTraces.js +0 -40
- package/dist/esm/preview/trace/index.js +0 -5
- package/dist/esm/preview/trace/types.js +0 -0
- package/dist/types/common-utils/utils/trace.d.ts +0 -73
- package/dist/types/dev/verifyTestnet.d.ts +0 -82
- package/dist/types/plugins/adapters/transfers.d.ts +0 -17
- package/dist/types/preview/index.d.ts +0 -4
- package/dist/types/preview/parse/classifyInnerOperations.d.ts +0 -21
- package/dist/types/preview/parse/errors.d.ts +0 -17
- package/dist/types/preview/parse/extractExpectedBalanceChanges.d.ts +0 -22
- package/dist/types/preview/parse/index.d.ts +0 -7
- package/dist/types/preview/parse/parseFacadeOperationCalldata.d.ts +0 -19
- package/dist/types/preview/parse/parseOperationCalldata.d.ts +0 -23
- package/dist/types/preview/parse/parsePoolOperationCalldata.d.ts +0 -17
- package/dist/types/preview/parse/types-adapters.d.ts +0 -69
- package/dist/types/preview/parse/types-facades.d.ts +0 -157
- package/dist/types/preview/parse/types-pools.d.ts +0 -55
- package/dist/types/preview/parse/types.d.ts +0 -44
- package/dist/types/preview/prerequisites/AllowancePrerequisite.d.ts +0 -24
- package/dist/types/preview/prerequisites/BalancePrerequisite.d.ts +0 -23
- package/dist/types/preview/prerequisites/Prerequisite.d.ts +0 -60
- package/dist/types/preview/prerequisites/buildPrerequisites.d.ts +0 -16
- package/dist/types/preview/prerequisites/index.d.ts +0 -7
- package/dist/types/preview/prerequisites/prepareAction.d.ts +0 -52
- package/dist/types/preview/prerequisites/runPrerequisites.d.ts +0 -12
- package/dist/types/preview/prerequisites/types.d.ts +0 -78
- package/dist/types/preview/simulate/constants.d.ts +0 -6
- package/dist/types/preview/simulate/errors.d.ts +0 -51
- package/dist/types/preview/simulate/extractERC20Transfers.d.ts +0 -11
- package/dist/types/preview/simulate/holders.d.ts +0 -7
- package/dist/types/preview/simulate/index.d.ts +0 -9
- package/dist/types/preview/simulate/simulateFacadeOperation.d.ts +0 -25
- package/dist/types/preview/simulate/simulateOperation.d.ts +0 -20
- package/dist/types/preview/simulate/simulatePoolOpMulticall.d.ts +0 -28
- package/dist/types/preview/simulate/simulatePoolOpV1.d.ts +0 -14
- package/dist/types/preview/simulate/simulatePoolOperation.d.ts +0 -8
- package/dist/types/preview/simulate/types.d.ts +0 -79
- package/dist/types/preview/trace/extractAdapterCallTraces.d.ts +0 -23
- package/dist/types/preview/trace/index.d.ts +0 -5
- package/dist/types/preview/trace/types.d.ts +0 -21
- /package/dist/esm/{plugins/adapters/transfers.js → history/inner-operations.js} +0 -0
- /package/dist/esm/{preview/parse/types-adapters.js → history/internal-types.js} +0 -0
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var simulatePoolOperation_exports = {};
|
|
20
|
-
__export(simulatePoolOperation_exports, {
|
|
21
|
-
simulatePoolOperation: () => simulatePoolOperation
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(simulatePoolOperation_exports);
|
|
24
|
-
var import_constants = require("./constants.js");
|
|
25
|
-
var import_errors = require("./errors.js");
|
|
26
|
-
var import_simulatePoolOpMulticall = require("./simulatePoolOpMulticall.js");
|
|
27
|
-
var import_simulatePoolOpV1 = require("./simulatePoolOpV1.js");
|
|
28
|
-
async function simulatePoolOperation(input, options = {}) {
|
|
29
|
-
const { sdk } = input;
|
|
30
|
-
const { logger } = options;
|
|
31
|
-
const useSimulateV1 = options.useSimulateV1 ?? import_constants.ETH_SIMULATE_V1_NETWORKS.has(sdk.networkType);
|
|
32
|
-
logger?.debug(
|
|
33
|
-
{ wallet: input.wallet, to: input.to },
|
|
34
|
-
"simulating pool operation"
|
|
35
|
-
);
|
|
36
|
-
const [v1, multicall] = await Promise.allSettled([
|
|
37
|
-
useSimulateV1 ? (0, import_simulatePoolOpV1.simulatePoolOpV1)(input, options) : void 0,
|
|
38
|
-
(0, import_simulatePoolOpMulticall.simulatePoolOpMulticall)(input, options)
|
|
39
|
-
]);
|
|
40
|
-
if (v1.status === "fulfilled" && v1.value) {
|
|
41
|
-
return { status: "success", ...v1.value };
|
|
42
|
-
}
|
|
43
|
-
if (multicall.status === "fulfilled") {
|
|
44
|
-
if (v1.status === "rejected") {
|
|
45
|
-
logger?.debug(
|
|
46
|
-
(0, import_errors.asPreviewSimulationError)(v1.reason, "eth_simulateV1"),
|
|
47
|
-
"eth_simulateV1 flow failed; falling back to multicall result"
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
return { status: "success", ...multicall.value };
|
|
51
|
-
}
|
|
52
|
-
const error = (0, import_errors.combinePreviewSimulationErrors)(
|
|
53
|
-
v1.status === "rejected" ? (0, import_errors.asPreviewSimulationError)(v1.reason, "eth_simulateV1") : void 0,
|
|
54
|
-
(0, import_errors.asPreviewSimulationError)(multicall.reason, "multicall")
|
|
55
|
-
);
|
|
56
|
-
logger?.error(error, "pool operation simulation failed");
|
|
57
|
-
return { status: "failure", error };
|
|
58
|
-
}
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
simulatePoolOperation
|
|
62
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var extractAdapterCallTraces_exports = {};
|
|
20
|
-
__export(extractAdapterCallTraces_exports, {
|
|
21
|
-
extractAdapterCallTraces: () => extractAdapterCallTraces
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(extractAdapterCallTraces_exports);
|
|
24
|
-
var import_viem = require("viem");
|
|
25
|
-
var import_trace = require("../../common-utils/utils/trace.js");
|
|
26
|
-
const WITHDRAW_PHANTOM_TOKEN_SELECTOR = (0, import_viem.toFunctionSelector)(
|
|
27
|
-
"withdrawPhantomToken(address,uint256)"
|
|
28
|
-
);
|
|
29
|
-
const GET_PHANTOM_TOKEN_INFO_SELECTOR = (0, import_viem.toFunctionSelector)(
|
|
30
|
-
"getPhantomTokenInfo()"
|
|
31
|
-
);
|
|
32
|
-
function isSynthesizedPhantomWithdrawal(siblings, index) {
|
|
33
|
-
const node = siblings[index];
|
|
34
|
-
if (node.type !== "CALL" || node.input.slice(0, 10).toLowerCase() !== WITHDRAW_PHANTOM_TOKEN_SELECTOR) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
const [token] = (0, import_viem.decodeAbiParameters)(
|
|
38
|
-
[{ type: "address" }, { type: "uint256" }],
|
|
39
|
-
`0x${node.input.slice(10)}`
|
|
40
|
-
);
|
|
41
|
-
for (let i = 0; i < index; i++) {
|
|
42
|
-
const sib = siblings[i];
|
|
43
|
-
if (sib.type === "STATICCALL" && sib.input.slice(0, 10).toLowerCase() === GET_PHANTOM_TOKEN_INFO_SELECTOR && (0, import_viem.isAddressEqual)(sib.to, token)) {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
function extractAdapterCallTraces(facadeTrace) {
|
|
50
|
-
const subtraces = facadeTrace.calls ?? [];
|
|
51
|
-
return subtraces.filter(
|
|
52
|
-
(sub, index) => (0, import_trace.resolveProtocolCall)(sub) !== void 0 && !isSynthesizedPhantomWithdrawal(subtraces, index)
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
-
0 && (module.exports = {
|
|
57
|
-
extractAdapterCallTraces
|
|
58
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var trace_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(trace_exports);
|
|
18
|
-
__reExport(trace_exports, require("./errors.js"), module.exports);
|
|
19
|
-
__reExport(trace_exports, require("./extractAdapterCallTraces.js"), module.exports);
|
|
20
|
-
__reExport(trace_exports, require("./extractTransfers.js"), module.exports);
|
|
21
|
-
__reExport(trace_exports, require("./findFacadeCalls.js"), module.exports);
|
|
22
|
-
__reExport(trace_exports, require("./types.js"), module.exports);
|
|
23
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
-
0 && (module.exports = {
|
|
25
|
-
...require("./errors.js"),
|
|
26
|
-
...require("./extractAdapterCallTraces.js"),
|
|
27
|
-
...require("./extractTransfers.js"),
|
|
28
|
-
...require("./findFacadeCalls.js"),
|
|
29
|
-
...require("./types.js")
|
|
30
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
decodeAbiParameters,
|
|
3
|
-
getAddress,
|
|
4
|
-
isAddressEqual
|
|
5
|
-
} from "viem";
|
|
6
|
-
const EXECUTE_BYTES_SELECTOR = "0x09c5eabe";
|
|
7
|
-
function findExecuteBytes(node) {
|
|
8
|
-
const queue = [node];
|
|
9
|
-
while (queue.length > 0) {
|
|
10
|
-
const current = queue.shift();
|
|
11
|
-
if (current.error) {
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
if (current.input.slice(0, 10).toLowerCase() === EXECUTE_BYTES_SELECTOR) {
|
|
15
|
-
return current;
|
|
16
|
-
}
|
|
17
|
-
if (current.calls) {
|
|
18
|
-
queue.push(...current.calls);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return void 0;
|
|
22
|
-
}
|
|
23
|
-
function findCallWithInput(node, input) {
|
|
24
|
-
if (node.error) {
|
|
25
|
-
return void 0;
|
|
26
|
-
}
|
|
27
|
-
if (node.type === "CALL" && node.input.toLowerCase() === input.toLowerCase()) {
|
|
28
|
-
return node;
|
|
29
|
-
}
|
|
30
|
-
if (node.calls) {
|
|
31
|
-
for (const child of node.calls) {
|
|
32
|
-
const found = findCallWithInput(child, input);
|
|
33
|
-
if (found) {
|
|
34
|
-
return found;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return void 0;
|
|
39
|
-
}
|
|
40
|
-
function resolveProtocolCall(node) {
|
|
41
|
-
const executeNode = findExecuteBytes(node);
|
|
42
|
-
if (!executeNode) {
|
|
43
|
-
return void 0;
|
|
44
|
-
}
|
|
45
|
-
const [calldata] = decodeAbiParameters(
|
|
46
|
-
[{ type: "bytes" }],
|
|
47
|
-
`0x${executeNode.input.slice(10)}`
|
|
48
|
-
);
|
|
49
|
-
const targetCall = findCallWithInput(executeNode, calldata);
|
|
50
|
-
if (!targetCall) {
|
|
51
|
-
return void 0;
|
|
52
|
-
}
|
|
53
|
-
return { contract: getAddress(targetCall.to), calldata };
|
|
54
|
-
}
|
|
55
|
-
function findCallTo(node, target) {
|
|
56
|
-
if (node.error) {
|
|
57
|
-
return void 0;
|
|
58
|
-
}
|
|
59
|
-
if (node.type === "CALL" && isAddressEqual(node.to, target)) {
|
|
60
|
-
return node;
|
|
61
|
-
}
|
|
62
|
-
if (node.calls) {
|
|
63
|
-
for (const child of node.calls) {
|
|
64
|
-
const found = findCallTo(child, target);
|
|
65
|
-
if (found) {
|
|
66
|
-
return found;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return void 0;
|
|
71
|
-
}
|
|
72
|
-
function collectTraces(node, target) {
|
|
73
|
-
const results = [];
|
|
74
|
-
if (node.error) {
|
|
75
|
-
return results;
|
|
76
|
-
}
|
|
77
|
-
if (node.type === "CALL" && isAddressEqual(node.to, target)) {
|
|
78
|
-
results.push(node);
|
|
79
|
-
} else if (node.calls) {
|
|
80
|
-
for (const child of node.calls) {
|
|
81
|
-
results.push(...collectTraces(child, target));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return results;
|
|
85
|
-
}
|
|
86
|
-
export {
|
|
87
|
-
EXECUTE_BYTES_SELECTOR,
|
|
88
|
-
collectTraces,
|
|
89
|
-
findCallTo,
|
|
90
|
-
findCallWithInput,
|
|
91
|
-
findExecuteBytes,
|
|
92
|
-
resolveProtocolCall
|
|
93
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
const ONCHAIN_EXECUTION_ID_ADDRESS = "0x34131bc13eaa4ef5f98c2a423f93bc88d6ee01ba";
|
|
2
|
-
const iOnchainExecutionIdAbi = [
|
|
3
|
-
{
|
|
4
|
-
type: "function",
|
|
5
|
-
name: "deployer",
|
|
6
|
-
inputs: [],
|
|
7
|
-
outputs: [
|
|
8
|
-
{
|
|
9
|
-
name: "",
|
|
10
|
-
type: "string",
|
|
11
|
-
internalType: "string"
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
stateMutability: "view"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
type: "function",
|
|
18
|
-
name: "executionId",
|
|
19
|
-
inputs: [],
|
|
20
|
-
outputs: [
|
|
21
|
-
{
|
|
22
|
-
name: "",
|
|
23
|
-
type: "string",
|
|
24
|
-
internalType: "string"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
stateMutability: "view"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: "function",
|
|
31
|
-
name: "forkAlias",
|
|
32
|
-
inputs: [],
|
|
33
|
-
outputs: [
|
|
34
|
-
{
|
|
35
|
-
name: "",
|
|
36
|
-
type: "string",
|
|
37
|
-
internalType: "string"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
stateMutability: "view"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: "function",
|
|
44
|
-
name: "info",
|
|
45
|
-
inputs: [],
|
|
46
|
-
outputs: [
|
|
47
|
-
{
|
|
48
|
-
name: "",
|
|
49
|
-
type: "tuple",
|
|
50
|
-
internalType: "struct ExecutionId.Info",
|
|
51
|
-
components: [
|
|
52
|
-
{
|
|
53
|
-
name: "deployer",
|
|
54
|
-
type: "string",
|
|
55
|
-
internalType: "string"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "executionId",
|
|
59
|
-
type: "string",
|
|
60
|
-
internalType: "string"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "forkAlias",
|
|
64
|
-
type: "string",
|
|
65
|
-
internalType: "string"
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
stateMutability: "view"
|
|
71
|
-
}
|
|
72
|
-
];
|
|
73
|
-
async function verifyTestnet(client, expected) {
|
|
74
|
-
try {
|
|
75
|
-
const { deployer, executionId, forkAlias } = await client.readContract({
|
|
76
|
-
abi: iOnchainExecutionIdAbi,
|
|
77
|
-
address: ONCHAIN_EXECUTION_ID_ADDRESS,
|
|
78
|
-
functionName: "info"
|
|
79
|
-
});
|
|
80
|
-
if (deployer !== "anvil-manager") {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
if ("executionId" in expected && expected.executionId && expected.executionId !== executionId) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
if ("alias" in expected && expected.alias && expected.alias !== forkAlias) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
return true;
|
|
90
|
-
} catch {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
export {
|
|
95
|
-
ONCHAIN_EXECUTION_ID_ADDRESS,
|
|
96
|
-
iOnchainExecutionIdAbi,
|
|
97
|
-
verifyTestnet
|
|
98
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type": "module","sideEffects":false}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { AbstractAdapterContract } from "../../plugins/adapters/index.js";
|
|
2
|
-
function classifyInnerOperations(calls, props) {
|
|
3
|
-
const { sdk, underlying } = props;
|
|
4
|
-
const result = [];
|
|
5
|
-
for (const call of calls) {
|
|
6
|
-
const contract = sdk.getContract(call.target);
|
|
7
|
-
if (contract instanceof AbstractAdapterContract || contract === void 0) {
|
|
8
|
-
result.push({
|
|
9
|
-
operation: "Execute",
|
|
10
|
-
adapter: call.target,
|
|
11
|
-
adapterType: call.contractType,
|
|
12
|
-
version: call.version,
|
|
13
|
-
label: call.label,
|
|
14
|
-
adapterFunctionName: call.functionName,
|
|
15
|
-
adapterArgs: call.rawArgs
|
|
16
|
-
});
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
const op = classifyFacadeInnerCall(call, underlying);
|
|
20
|
-
if (op) {
|
|
21
|
-
result.push(op);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
function classifyFacadeInnerCall(call, underlying) {
|
|
27
|
-
const functionName = call.functionName.split("(")[0];
|
|
28
|
-
const { rawArgs } = call;
|
|
29
|
-
switch (functionName) {
|
|
30
|
-
case "increaseDebt":
|
|
31
|
-
return {
|
|
32
|
-
operation: "IncreaseBorrowedAmount",
|
|
33
|
-
token: underlying,
|
|
34
|
-
amount: rawArgs.amount
|
|
35
|
-
};
|
|
36
|
-
case "decreaseDebt":
|
|
37
|
-
return {
|
|
38
|
-
operation: "DecreaseBorrowedAmount",
|
|
39
|
-
token: underlying,
|
|
40
|
-
amount: rawArgs.amount
|
|
41
|
-
};
|
|
42
|
-
case "addCollateral":
|
|
43
|
-
case "addCollateralWithPermit":
|
|
44
|
-
return {
|
|
45
|
-
operation: "AddCollateral",
|
|
46
|
-
token: rawArgs.token,
|
|
47
|
-
amount: rawArgs.amount
|
|
48
|
-
};
|
|
49
|
-
case "withdrawCollateral":
|
|
50
|
-
return {
|
|
51
|
-
operation: "WithdrawCollateral",
|
|
52
|
-
token: rawArgs.token,
|
|
53
|
-
amount: rawArgs.amount,
|
|
54
|
-
to: rawArgs.to
|
|
55
|
-
};
|
|
56
|
-
case "updateQuota":
|
|
57
|
-
return {
|
|
58
|
-
operation: "UpdateQuota",
|
|
59
|
-
token: rawArgs.token,
|
|
60
|
-
change: rawArgs.quotaChange
|
|
61
|
-
};
|
|
62
|
-
default:
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export {
|
|
67
|
-
classifyInnerOperations
|
|
68
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
class UnsupportedTargetError extends Error {
|
|
2
|
-
target;
|
|
3
|
-
constructor(target) {
|
|
4
|
-
super(`unsupported transaction target: ${target}`);
|
|
5
|
-
this.name = "UnsupportedTargetError";
|
|
6
|
-
this.target = target;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
class UnsupportedPoolFunctionError extends Error {
|
|
10
|
-
pool;
|
|
11
|
-
functionName;
|
|
12
|
-
constructor(pool, functionName) {
|
|
13
|
-
super(`unsupported pool function "${functionName}" on ${pool}`);
|
|
14
|
-
this.name = "UnsupportedPoolFunctionError";
|
|
15
|
-
this.pool = pool;
|
|
16
|
-
this.functionName = functionName;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
UnsupportedPoolFunctionError,
|
|
21
|
-
UnsupportedTargetError
|
|
22
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
function extractExpectedBalanceChanges(innerCalls) {
|
|
2
|
-
const calls = innerCalls.filter(
|
|
3
|
-
(call) => functionName(call) !== "onDemandPriceUpdates"
|
|
4
|
-
);
|
|
5
|
-
if (calls.length === 0) {
|
|
6
|
-
return void 0;
|
|
7
|
-
}
|
|
8
|
-
const first = calls[0];
|
|
9
|
-
const last = calls[calls.length - 1];
|
|
10
|
-
if (functionName(first) !== "storeExpectedBalances" || functionName(last) !== "compareBalances") {
|
|
11
|
-
return void 0;
|
|
12
|
-
}
|
|
13
|
-
const balanceDeltas = first.rawArgs.balanceDeltas;
|
|
14
|
-
if (!balanceDeltas) {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
return balanceDeltas.map(({ token, amount }) => ({ token, delta: amount }));
|
|
18
|
-
}
|
|
19
|
-
function functionName(call) {
|
|
20
|
-
return call.functionName.split("(")[0];
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
extractExpectedBalanceChanges
|
|
24
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./classifyInnerOperations.js";
|
|
2
|
-
export * from "./errors.js";
|
|
3
|
-
export * from "./extractExpectedBalanceChanges.js";
|
|
4
|
-
export * from "./parseFacadeOperationCalldata.js";
|
|
5
|
-
export * from "./parseOperationCalldata.js";
|
|
6
|
-
export * from "./parsePoolOperationCalldata.js";
|
|
7
|
-
export * from "./types.js";
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { isAddressEqual, zeroAddress } from "viem";
|
|
2
|
-
import { classifyInnerOperations } from "./classifyInnerOperations.js";
|
|
3
|
-
import { extractExpectedBalanceChanges } from "./extractExpectedBalanceChanges.js";
|
|
4
|
-
function parseFacadeOperationCalldata(props) {
|
|
5
|
-
const { sdk, facade, calldata } = props;
|
|
6
|
-
const parsed = sdk.parseFunctionDataV2(facade.address, calldata);
|
|
7
|
-
const functionName = parsed.functionName.split("(")[0];
|
|
8
|
-
const { rawArgs } = parsed;
|
|
9
|
-
const suite = sdk.marketRegister.creditManagers.find(
|
|
10
|
-
(cm) => isAddressEqual(cm.creditFacade.address, facade.address)
|
|
11
|
-
);
|
|
12
|
-
if (!suite) {
|
|
13
|
-
throw new Error(`no credit suite found for facade ${facade.address}`);
|
|
14
|
-
}
|
|
15
|
-
const metadata = {
|
|
16
|
-
creditManager: suite.creditManager.address,
|
|
17
|
-
creditFacade: facade.address
|
|
18
|
-
};
|
|
19
|
-
const innerCalls = rawArgs.calls ?? [];
|
|
20
|
-
const multicall = classifyInnerOperations(innerCalls, {
|
|
21
|
-
sdk,
|
|
22
|
-
underlying: suite.underlying
|
|
23
|
-
});
|
|
24
|
-
const expectedBalanceChanges = extractExpectedBalanceChanges(innerCalls);
|
|
25
|
-
switch (functionName) {
|
|
26
|
-
case "multicall":
|
|
27
|
-
return {
|
|
28
|
-
...metadata,
|
|
29
|
-
operation: "MultiCall",
|
|
30
|
-
creditAccount: rawArgs.creditAccount,
|
|
31
|
-
multicall,
|
|
32
|
-
expectedBalanceChanges
|
|
33
|
-
};
|
|
34
|
-
case "botMulticall":
|
|
35
|
-
return {
|
|
36
|
-
...metadata,
|
|
37
|
-
operation: "BotMulticall",
|
|
38
|
-
creditAccount: rawArgs.creditAccount,
|
|
39
|
-
multicall,
|
|
40
|
-
expectedBalanceChanges
|
|
41
|
-
};
|
|
42
|
-
case "openCreditAccount":
|
|
43
|
-
return {
|
|
44
|
-
...metadata,
|
|
45
|
-
operation: "OpenCreditAccount",
|
|
46
|
-
creditAccount: zeroAddress,
|
|
47
|
-
onBehalfOf: rawArgs.onBehalfOf,
|
|
48
|
-
referralCode: rawArgs.referralCode,
|
|
49
|
-
multicall,
|
|
50
|
-
expectedBalanceChanges
|
|
51
|
-
};
|
|
52
|
-
case "closeCreditAccount":
|
|
53
|
-
return {
|
|
54
|
-
...metadata,
|
|
55
|
-
operation: "CloseCreditAccount",
|
|
56
|
-
creditAccount: rawArgs.creditAccount,
|
|
57
|
-
multicall,
|
|
58
|
-
expectedBalanceChanges
|
|
59
|
-
};
|
|
60
|
-
case "liquidateCreditAccount":
|
|
61
|
-
return {
|
|
62
|
-
...metadata,
|
|
63
|
-
operation: "LiquidateCreditAccount",
|
|
64
|
-
creditAccount: rawArgs.creditAccount,
|
|
65
|
-
to: rawArgs.to,
|
|
66
|
-
// `token` and `remainingFunds` are only emitted on-chain during
|
|
67
|
-
// liquidation, so they are not recoverable from raw calldata.
|
|
68
|
-
token: zeroAddress,
|
|
69
|
-
remainingFunds: 0n,
|
|
70
|
-
multicall,
|
|
71
|
-
expectedBalanceChanges
|
|
72
|
-
};
|
|
73
|
-
case "partiallyLiquidateCreditAccount":
|
|
74
|
-
return {
|
|
75
|
-
...metadata,
|
|
76
|
-
operation: "PartiallyLiquidateCreditAccount",
|
|
77
|
-
creditAccount: rawArgs.creditAccount,
|
|
78
|
-
token: rawArgs.token,
|
|
79
|
-
repaidAmount: rawArgs.repaidAmount,
|
|
80
|
-
minSeizedAmount: rawArgs.minSeizedAmount,
|
|
81
|
-
to: rawArgs.to
|
|
82
|
-
};
|
|
83
|
-
default:
|
|
84
|
-
throw new Error(
|
|
85
|
-
`unsupported credit facade function "${parsed.functionName}" on ${facade.address}`
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
export {
|
|
90
|
-
parseFacadeOperationCalldata
|
|
91
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreditFacadeV310Contract,
|
|
3
|
-
PoolV310Contract
|
|
4
|
-
} from "../../sdk/index.js";
|
|
5
|
-
import { UnsupportedTargetError } from "./errors.js";
|
|
6
|
-
import { parseFacadeOperationCalldata } from "./parseFacadeOperationCalldata.js";
|
|
7
|
-
import { parsePoolOperationCalldata } from "./parsePoolOperationCalldata.js";
|
|
8
|
-
function parseOperationCalldata(input) {
|
|
9
|
-
const { sdk, to, calldata } = input;
|
|
10
|
-
const contract = sdk.getContract(to);
|
|
11
|
-
if (contract instanceof PoolV310Contract) {
|
|
12
|
-
return parsePoolOperationCalldata({ sdk, pool: contract, calldata });
|
|
13
|
-
}
|
|
14
|
-
if (contract instanceof CreditFacadeV310Contract) {
|
|
15
|
-
return parseFacadeOperationCalldata({
|
|
16
|
-
sdk,
|
|
17
|
-
facade: contract,
|
|
18
|
-
calldata
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
throw new UnsupportedTargetError(to);
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
parseOperationCalldata
|
|
25
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { UnsupportedPoolFunctionError } from "./errors.js";
|
|
2
|
-
function parsePoolOperationCalldata(props) {
|
|
3
|
-
const { sdk, pool, calldata } = props;
|
|
4
|
-
const parsed = sdk.parseFunctionDataV2(pool.address, calldata);
|
|
5
|
-
const functionName = parsed.functionName.split("(")[0];
|
|
6
|
-
const { rawArgs } = parsed;
|
|
7
|
-
const underlying = pool.underlying;
|
|
8
|
-
switch (functionName) {
|
|
9
|
-
case "deposit":
|
|
10
|
-
case "depositWithReferral":
|
|
11
|
-
return {
|
|
12
|
-
operation: "Deposit",
|
|
13
|
-
pool: pool.address,
|
|
14
|
-
receiver: rawArgs.receiver,
|
|
15
|
-
assets: rawArgs.assets,
|
|
16
|
-
underlying,
|
|
17
|
-
referralCode: functionName === "depositWithReferral" ? rawArgs.referralCode : void 0
|
|
18
|
-
};
|
|
19
|
-
case "mint":
|
|
20
|
-
case "mintWithReferral":
|
|
21
|
-
return {
|
|
22
|
-
operation: "Mint",
|
|
23
|
-
pool: pool.address,
|
|
24
|
-
receiver: rawArgs.receiver,
|
|
25
|
-
shares: rawArgs.shares,
|
|
26
|
-
underlying,
|
|
27
|
-
referralCode: functionName === "mintWithReferral" ? rawArgs.referralCode : void 0
|
|
28
|
-
};
|
|
29
|
-
case "withdraw":
|
|
30
|
-
return {
|
|
31
|
-
operation: "Withdraw",
|
|
32
|
-
pool: pool.address,
|
|
33
|
-
receiver: rawArgs.receiver,
|
|
34
|
-
owner: rawArgs.owner,
|
|
35
|
-
assets: rawArgs.assets,
|
|
36
|
-
underlying
|
|
37
|
-
};
|
|
38
|
-
case "redeem":
|
|
39
|
-
return {
|
|
40
|
-
operation: "Redeem",
|
|
41
|
-
pool: pool.address,
|
|
42
|
-
receiver: rawArgs.receiver,
|
|
43
|
-
owner: rawArgs.owner,
|
|
44
|
-
shares: rawArgs.shares,
|
|
45
|
-
underlying
|
|
46
|
-
};
|
|
47
|
-
default:
|
|
48
|
-
throw new UnsupportedPoolFunctionError(pool.address, parsed.functionName);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
parsePoolOperationCalldata
|
|
53
|
-
};
|
|
File without changes
|
|
File without changes
|