@gearbox-protocol/sdk 14.12.0-next.54 → 14.12.0-next.55
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/abi/rwa/iMidasLiquidatorV311.js +96 -0
- package/dist/cjs/abi/rwa/iSecuritizeLiquidatorV311.js +111 -0
- package/dist/cjs/sdk/base/BaseContract.js +26 -0
- package/dist/cjs/sdk/base/ChainContractsRegister.js +24 -0
- package/dist/cjs/sdk/index.js +12 -1
- package/dist/cjs/sdk/market/credit/CreditFacadeV310BaseContract.js +3 -3
- package/dist/cjs/sdk/market/index.js +7 -0
- package/dist/cjs/sdk/market/rwa/index.js +8 -0
- package/dist/cjs/sdk/market/rwa/midas/MidasLiquidator.js +43 -0
- package/dist/cjs/sdk/market/rwa/midas/constants.js +5 -0
- package/dist/cjs/sdk/market/rwa/midas/index.js +5 -0
- package/dist/cjs/sdk/market/rwa/securitize/SecuritizeLiquidator.js +31 -0
- package/dist/cjs/sdk/market/rwa/securitize/constants.js +2 -0
- package/dist/cjs/sdk/market/rwa/securitize/index.js +3 -0
- package/dist/cjs/sdk/utils/viem/cast.js +20 -15
- package/dist/cjs/sdk/utils/viem/index.js +4 -0
- package/dist/cjs/sdk/utils/viem/simulateCall.js +82 -0
- package/dist/esm/abi/rwa/iMidasLiquidatorV311.js +95 -0
- package/dist/esm/abi/rwa/iSecuritizeLiquidatorV311.js +110 -0
- package/dist/esm/permissionless/bindings/factory/credit-factory.js +1 -1
- package/dist/esm/preview/index.js +5 -5
- package/dist/esm/sdk/base/BaseContract.js +26 -0
- package/dist/esm/sdk/base/ChainContractsRegister.js +24 -0
- package/dist/esm/sdk/index.js +7 -3
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +3 -3
- package/dist/esm/sdk/market/index.js +5 -2
- package/dist/esm/sdk/market/rwa/index.js +6 -2
- package/dist/esm/sdk/market/rwa/midas/MidasLiquidator.js +43 -0
- package/dist/esm/sdk/market/rwa/midas/constants.js +4 -0
- package/dist/esm/sdk/market/rwa/midas/index.js +3 -0
- package/dist/esm/sdk/market/rwa/securitize/SecuritizeLiquidator.js +31 -0
- package/dist/esm/sdk/market/rwa/securitize/constants.js +2 -1
- package/dist/esm/sdk/market/rwa/securitize/index.js +3 -2
- package/dist/esm/sdk/utils/viem/cast.js +20 -16
- package/dist/esm/sdk/utils/viem/index.js +3 -2
- package/dist/esm/sdk/utils/viem/simulateCall.js +80 -0
- package/dist/types/abi/rwa/iMidasLiquidatorV311.d.ts +83 -0
- package/dist/types/abi/rwa/iSecuritizeLiquidatorV311.d.ts +95 -0
- package/dist/types/sdk/base/BaseContract.d.ts +13 -0
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +15 -0
- package/dist/types/sdk/index.d.ts +7 -3
- package/dist/types/sdk/market/index.d.ts +5 -2
- package/dist/types/sdk/market/rwa/index.d.ts +6 -2
- package/dist/types/sdk/market/rwa/midas/MidasLiquidator.d.ts +93 -0
- package/dist/types/sdk/market/rwa/midas/constants.d.ts +4 -0
- package/dist/types/sdk/market/rwa/midas/index.d.ts +3 -0
- package/dist/types/sdk/market/rwa/securitize/SecuritizeLiquidator.d.ts +104 -0
- package/dist/types/sdk/market/rwa/securitize/constants.d.ts +2 -1
- package/dist/types/sdk/market/rwa/securitize/index.d.ts +3 -2
- package/dist/types/sdk/utils/viem/cast.d.ts +6 -1
- package/dist/types/sdk/utils/viem/index.d.ts +3 -2
- package/dist/types/sdk/utils/viem/simulateCall.d.ts +57 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_viem_cast = require("./cast.js");
|
|
3
|
+
let viem = require("viem");
|
|
4
|
+
let viem_utils = require("viem/utils");
|
|
5
|
+
let viem_actions = require("viem/actions");
|
|
6
|
+
//#region src/sdk/utils/viem/simulateCall.ts
|
|
7
|
+
/**
|
|
8
|
+
* Simulates raw calldata with `eth_call`, without encoding or decoding anything on success.
|
|
9
|
+
*
|
|
10
|
+
* Use it when calldata already exists (for example a {@link RawTx} built by the SDK): the happy
|
|
11
|
+
* path is a pure passthrough, and the calldata is only decoded when the call reverts, to build a
|
|
12
|
+
* viem {@link ContractFunctionExecutionError} out of the revert data.
|
|
13
|
+
*
|
|
14
|
+
* @param client - viem client to call with.
|
|
15
|
+
* @param parameters - viem call parameters, plus the ABIs used for error decoding.
|
|
16
|
+
* @throws {@link SimulationError} when the call reverts or the request fails.
|
|
17
|
+
*/
|
|
18
|
+
async function simulateCall(client, parameters) {
|
|
19
|
+
const { abis = [], account: account_, ...rest } = parameters;
|
|
20
|
+
const request = {
|
|
21
|
+
...rest,
|
|
22
|
+
account: account_ ? (0, viem_utils.parseAccount)(account_) : client.account
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
const { data } = await (0, viem_utils.getAction)(client, viem_actions.call, "call")(request);
|
|
26
|
+
return { data: data ?? "0x" };
|
|
27
|
+
} catch (e) {
|
|
28
|
+
throw new SimulationError(e, request, abis.flat());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Thrown by {@link simulateCall} when a simulation fails.
|
|
33
|
+
*
|
|
34
|
+
* The viem {@link ContractFunctionExecutionError} built from the revert data is kept as `cause`,
|
|
35
|
+
* so `walk()` still finds `ContractFunctionRevertedError` and its decoded (or raw) revert data.
|
|
36
|
+
*/
|
|
37
|
+
var SimulationError = class extends viem.BaseError {
|
|
38
|
+
/**
|
|
39
|
+
* The call that failed, kept verbatim so that it can be replayed or traced.
|
|
40
|
+
*/
|
|
41
|
+
request;
|
|
42
|
+
constructor(cause, request, abi) {
|
|
43
|
+
const callData = request.data ?? "0x";
|
|
44
|
+
let functionName = callData.slice(0, 10);
|
|
45
|
+
let args = [];
|
|
46
|
+
try {
|
|
47
|
+
const decoded = (0, viem.decodeFunctionData)({
|
|
48
|
+
abi,
|
|
49
|
+
data: callData
|
|
50
|
+
});
|
|
51
|
+
functionName = decoded.functionName;
|
|
52
|
+
args = decoded.args ?? [];
|
|
53
|
+
} catch {}
|
|
54
|
+
const account = request.account;
|
|
55
|
+
super(`simulation of ${functionName} at ${request.to} failed`, {
|
|
56
|
+
cause: (0, viem.getContractError)(cause, {
|
|
57
|
+
abi,
|
|
58
|
+
address: request.to ?? void 0,
|
|
59
|
+
args,
|
|
60
|
+
functionName,
|
|
61
|
+
sender: typeof account === "string" ? account : account?.address ?? void 0
|
|
62
|
+
}),
|
|
63
|
+
name: "SimulationError"
|
|
64
|
+
});
|
|
65
|
+
this.request = request;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Arguments of a `cast call --trace` command replaying this call, for spawning `cast` directly.
|
|
69
|
+
*/
|
|
70
|
+
getCastTraceArgs(rpcUrl) {
|
|
71
|
+
return require_sdk_utils_viem_cast.getCastTraceArgs(this.request, rpcUrl);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Full `cast call --trace` command replaying this call.
|
|
75
|
+
*/
|
|
76
|
+
getCastTraceCall(rpcUrl) {
|
|
77
|
+
return require_sdk_utils_viem_cast.generateCastTraceCall(this.request, rpcUrl);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
exports.SimulationError = SimulationError;
|
|
82
|
+
exports.simulateCall = simulateCall;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//#region src/abi/rwa/iMidasLiquidatorV311.ts
|
|
2
|
+
const iMidasLiquidatorV311Abi = [
|
|
3
|
+
{
|
|
4
|
+
type: "function",
|
|
5
|
+
name: "contractType",
|
|
6
|
+
inputs: [],
|
|
7
|
+
outputs: [{
|
|
8
|
+
name: "",
|
|
9
|
+
type: "bytes32",
|
|
10
|
+
internalType: "bytes32"
|
|
11
|
+
}],
|
|
12
|
+
stateMutability: "view"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "function",
|
|
16
|
+
name: "isTransferAllowed",
|
|
17
|
+
inputs: [{
|
|
18
|
+
name: "redeemerOwner",
|
|
19
|
+
type: "address",
|
|
20
|
+
internalType: "address"
|
|
21
|
+
}],
|
|
22
|
+
outputs: [{
|
|
23
|
+
name: "",
|
|
24
|
+
type: "bool",
|
|
25
|
+
internalType: "bool"
|
|
26
|
+
}],
|
|
27
|
+
stateMutability: "view"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "function",
|
|
31
|
+
name: "liquidateWithRedeemerTransfers",
|
|
32
|
+
inputs: [
|
|
33
|
+
{
|
|
34
|
+
name: "creditAccount",
|
|
35
|
+
type: "address",
|
|
36
|
+
internalType: "address"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "gateway",
|
|
40
|
+
type: "address",
|
|
41
|
+
internalType: "address"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "calls",
|
|
45
|
+
type: "tuple[]",
|
|
46
|
+
internalType: "struct MultiCall[]",
|
|
47
|
+
components: [{
|
|
48
|
+
name: "target",
|
|
49
|
+
type: "address",
|
|
50
|
+
internalType: "address"
|
|
51
|
+
}, {
|
|
52
|
+
name: "callData",
|
|
53
|
+
type: "bytes",
|
|
54
|
+
internalType: "bytes"
|
|
55
|
+
}]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "lossPolicyData",
|
|
59
|
+
type: "bytes",
|
|
60
|
+
internalType: "bytes"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
outputs: [],
|
|
64
|
+
stateMutability: "nonpayable"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: "function",
|
|
68
|
+
name: "transferableRedeemerOwner",
|
|
69
|
+
inputs: [],
|
|
70
|
+
outputs: [{
|
|
71
|
+
name: "",
|
|
72
|
+
type: "address",
|
|
73
|
+
internalType: "address"
|
|
74
|
+
}],
|
|
75
|
+
stateMutability: "view"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: "function",
|
|
79
|
+
name: "version",
|
|
80
|
+
inputs: [],
|
|
81
|
+
outputs: [{
|
|
82
|
+
name: "",
|
|
83
|
+
type: "uint256",
|
|
84
|
+
internalType: "uint256"
|
|
85
|
+
}],
|
|
86
|
+
stateMutability: "view"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "error",
|
|
90
|
+
name: "NotValidGatewayException",
|
|
91
|
+
inputs: []
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
//#endregion
|
|
95
|
+
export { iMidasLiquidatorV311Abi };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//#region src/abi/rwa/iSecuritizeLiquidatorV311.ts
|
|
2
|
+
const iSecuritizeLiquidatorV311Abi = [
|
|
3
|
+
{
|
|
4
|
+
type: "function",
|
|
5
|
+
name: "contractType",
|
|
6
|
+
inputs: [],
|
|
7
|
+
outputs: [{
|
|
8
|
+
name: "",
|
|
9
|
+
type: "bytes32",
|
|
10
|
+
internalType: "bytes32"
|
|
11
|
+
}],
|
|
12
|
+
stateMutability: "view"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "function",
|
|
16
|
+
name: "isTransferAllowed",
|
|
17
|
+
inputs: [{
|
|
18
|
+
name: "redeemerOwner",
|
|
19
|
+
type: "address",
|
|
20
|
+
internalType: "address"
|
|
21
|
+
}],
|
|
22
|
+
outputs: [{
|
|
23
|
+
name: "",
|
|
24
|
+
type: "bool",
|
|
25
|
+
internalType: "bool"
|
|
26
|
+
}],
|
|
27
|
+
stateMutability: "view"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "function",
|
|
31
|
+
name: "liquidatePendingRedemption",
|
|
32
|
+
inputs: [
|
|
33
|
+
{
|
|
34
|
+
name: "creditAccount",
|
|
35
|
+
type: "address",
|
|
36
|
+
internalType: "address"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "redemptionGateway",
|
|
40
|
+
type: "address",
|
|
41
|
+
internalType: "address"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "priceUpdates",
|
|
45
|
+
type: "tuple[]",
|
|
46
|
+
internalType: "struct PriceUpdate[]",
|
|
47
|
+
components: [{
|
|
48
|
+
name: "priceFeed",
|
|
49
|
+
type: "address",
|
|
50
|
+
internalType: "address"
|
|
51
|
+
}, {
|
|
52
|
+
name: "data",
|
|
53
|
+
type: "bytes",
|
|
54
|
+
internalType: "bytes"
|
|
55
|
+
}]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "lossPolicyData",
|
|
59
|
+
type: "bytes",
|
|
60
|
+
internalType: "bytes"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
outputs: [],
|
|
64
|
+
stateMutability: "nonpayable"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: "function",
|
|
68
|
+
name: "transferableRedeemerOwner",
|
|
69
|
+
inputs: [],
|
|
70
|
+
outputs: [{
|
|
71
|
+
name: "",
|
|
72
|
+
type: "address",
|
|
73
|
+
internalType: "address"
|
|
74
|
+
}],
|
|
75
|
+
stateMutability: "view"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: "function",
|
|
79
|
+
name: "version",
|
|
80
|
+
inputs: [],
|
|
81
|
+
outputs: [{
|
|
82
|
+
name: "",
|
|
83
|
+
type: "uint256",
|
|
84
|
+
internalType: "uint256"
|
|
85
|
+
}],
|
|
86
|
+
stateMutability: "view"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "error",
|
|
90
|
+
name: "AccountHasSufficientLiquidityException",
|
|
91
|
+
inputs: []
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: "error",
|
|
95
|
+
name: "NotValidGatewayException",
|
|
96
|
+
inputs: []
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "error",
|
|
100
|
+
name: "StableCoinIsNotConvertibleException",
|
|
101
|
+
inputs: []
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "error",
|
|
105
|
+
name: "UnknownCreditAccountException",
|
|
106
|
+
inputs: []
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
//#endregion
|
|
110
|
+
export { iSecuritizeLiquidatorV311Abi };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iCreditConfigureActionsAbi } from "../../../abi/310/configure/iCreditConfigureActions.js";
|
|
2
1
|
import { adapterConstructorAbi } from "../../../plugins/adapters/abi/conctructorAbi.js";
|
|
3
2
|
import { parseAdapterAction, parseAdapterDeployParams } from "../../../plugins/adapters/abi/utils.js";
|
|
4
3
|
import "../../../plugins/adapters/index.js";
|
|
4
|
+
import { iCreditConfigureActionsAbi } from "../../../abi/310/configure/iCreditConfigureActions.js";
|
|
5
5
|
import { AbstractFactory } from "./abstract-factory.js";
|
|
6
6
|
import { decodeFunctionData, hexToString } from "viem";
|
|
7
7
|
//#region src/permissionless/bindings/factory/credit-factory.ts
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { UnsupportedZapperFunctionError } from "../sdk/market/zapper/errors.js";
|
|
2
|
+
import { TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, WithdrawCollateralAlignmentError } from "./trace/errors.js";
|
|
3
|
+
import { extractAdapterCallTraces } from "./trace/extractAdapterCallTraces.js";
|
|
4
|
+
import { extractTransfers } from "./trace/extractTransfers.js";
|
|
5
|
+
import { findFacadeCalls } from "./trace/findFacadeCalls.js";
|
|
6
|
+
import "./trace/index.js";
|
|
2
7
|
import { classifyInnerOperations } from "./parse/classifyInnerOperations.js";
|
|
3
8
|
import { UnsupportedPoolFunctionError, UnsupportedTargetError } from "./parse/errors.js";
|
|
4
9
|
import { parseFacadeOperationCalldata } from "./parse/parseFacadeOperationCalldata.js";
|
|
@@ -26,10 +31,5 @@ import { previewAdjustCreditAccount } from "./preview/previewAdjustCreditAccount
|
|
|
26
31
|
import { previewCloseOrRepayCreditAccount } from "./preview/previewCloseOrRepayCreditAccount.js";
|
|
27
32
|
import { previewOperation } from "./preview/previewOperation.js";
|
|
28
33
|
import "./preview/index.js";
|
|
29
|
-
import { TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, WithdrawCollateralAlignmentError } from "./trace/errors.js";
|
|
30
|
-
import { extractAdapterCallTraces } from "./trace/extractAdapterCallTraces.js";
|
|
31
|
-
import { extractTransfers } from "./trace/extractTransfers.js";
|
|
32
|
-
import { findFacadeCalls } from "./trace/findFacadeCalls.js";
|
|
33
|
-
import "./trace/index.js";
|
|
34
34
|
import "./types.js";
|
|
35
35
|
export { AllowancePrerequisite, BalancePrerequisite, CreditAccountState, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, PREVIEW_DUST, Prerequisite, RWAOpenRequirementsPrerequisite, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, WithdrawCollateralAlignmentError, buildDelayedPreview, checkPrerequisites, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustCreditAccount, previewCloseOrRepayCreditAccount, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
|
|
@@ -4,6 +4,7 @@ import { functionArgsToMap, functionArgsToRecord, getFunctionSignature } from ".
|
|
|
4
4
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
5
5
|
import { createRawTx } from "../utils/createRawTx.js";
|
|
6
6
|
import "../utils/index.js";
|
|
7
|
+
import { simulateCall } from "../utils/viem/simulateCall.js";
|
|
7
8
|
import { Construct } from "./Construct.js";
|
|
8
9
|
import { BaseError, decodeFunctionData, getAbiItem, getAddress, getContract, isHex } from "viem";
|
|
9
10
|
//#region src/sdk/base/BaseContract.ts
|
|
@@ -261,6 +262,31 @@ var BaseContract = class extends Construct {
|
|
|
261
262
|
return tx;
|
|
262
263
|
}
|
|
263
264
|
/**
|
|
265
|
+
* Simulates calldata against this contract with `eth_call`, returning the raw response.
|
|
266
|
+
*
|
|
267
|
+
* Nothing is encoded or decoded on success: pass calldata that already exists (e.g. from
|
|
268
|
+
* {@link createRawTx}) instead of decoding it into a function name and arguments first.
|
|
269
|
+
* On revert, this contract's abi and the shared exception abis are used to decode the error.
|
|
270
|
+
*
|
|
271
|
+
* @param callData - Encoded calldata, passed to the node as-is.
|
|
272
|
+
* @param options - Call options, plus any extra `abis` needed to decode custom errors.
|
|
273
|
+
* @throws {@link SimulationError} when the call reverts or the request fails.
|
|
274
|
+
*/
|
|
275
|
+
async simulateCall(callData, options = {}) {
|
|
276
|
+
const { abis = [], ...rest } = options;
|
|
277
|
+
const { data } = await simulateCall(this.client, {
|
|
278
|
+
...rest,
|
|
279
|
+
to: this.address,
|
|
280
|
+
data: callData,
|
|
281
|
+
abis: [
|
|
282
|
+
this.abi,
|
|
283
|
+
errorAbis,
|
|
284
|
+
...abis
|
|
285
|
+
]
|
|
286
|
+
});
|
|
287
|
+
return data;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
264
290
|
* Get events in safe manner, by bisecting block range if needed
|
|
265
291
|
*
|
|
266
292
|
* @deprecated TODO: this should be moved to viem transport
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
2
2
|
import "../constants/addresses.js";
|
|
3
|
+
import { simulateCall } from "../utils/viem/simulateCall.js";
|
|
3
4
|
import { TokensMeta } from "./TokensMeta.js";
|
|
4
5
|
//#region src/sdk/base/ChainContractsRegister.ts
|
|
5
6
|
/**
|
|
@@ -103,6 +104,29 @@ var ChainContractsRegister = class {
|
|
|
103
104
|
return contract ? contract.stringifyFunctionData(calldata) : `unknown: ${address}.${calldata.slice(0, 10)}`;
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
107
|
+
* Simulates a transaction with `eth_call`, without encoding or decoding anything on success.
|
|
108
|
+
*
|
|
109
|
+
* When the target is a known contract, its abi and the shared exception abis are used to decode
|
|
110
|
+
* a revert. For an unknown target only `options.abis` are used, so pass the exception abis you
|
|
111
|
+
* care about when simulating contracts the SDK does not know.
|
|
112
|
+
*
|
|
113
|
+
* @param target - Target address.
|
|
114
|
+
* @param callData - Calldata to simulate.
|
|
115
|
+
* @param options - Call options, plus any extra `abis` needed to decode custom errors.
|
|
116
|
+
* @returns Raw bytes returned by the call, `0x` when the function returns nothing.
|
|
117
|
+
* @throws {@link SimulationError} when the call reverts or the request fails.
|
|
118
|
+
*/
|
|
119
|
+
async simulateCall(target, callData, options = {}) {
|
|
120
|
+
const contract = this.contracts.get(target);
|
|
121
|
+
if (contract) return contract.simulateCall(callData, options);
|
|
122
|
+
const { data } = await simulateCall(this.client, {
|
|
123
|
+
...options,
|
|
124
|
+
to: target,
|
|
125
|
+
data: callData
|
|
126
|
+
});
|
|
127
|
+
return data;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
106
130
|
* Converts multicalls into some human-friendly strings
|
|
107
131
|
* This method is safe and should not throw
|
|
108
132
|
* @param address
|
package/dist/esm/sdk/index.js
CHANGED
|
@@ -27,6 +27,8 @@ import { retry } from "./utils/retry.js";
|
|
|
27
27
|
import { toAddress } from "./utils/toAddress.js";
|
|
28
28
|
import { ZodAddress } from "./utils/zod.js";
|
|
29
29
|
import "./utils/index.js";
|
|
30
|
+
import { generateCastTraceCall, getCastTraceArgs } from "./utils/viem/cast.js";
|
|
31
|
+
import { SimulationError, simulateCall } from "./utils/viem/simulateCall.js";
|
|
30
32
|
import { TokensMeta } from "./base/TokensMeta.js";
|
|
31
33
|
import { ChainContractsRegister } from "./base/ChainContractsRegister.js";
|
|
32
34
|
import { Construct } from "./base/Construct.js";
|
|
@@ -44,7 +46,6 @@ import { CreditFacadeV310BaseContract, creditFacadeV310Abi as abi } from "./mark
|
|
|
44
46
|
import { CreditFacadeV310Contract } from "./market/credit/CreditFacadeV310Contract.js";
|
|
45
47
|
import { CreditManagerV310Contract } from "./market/credit/CreditManagerV310Contract.js";
|
|
46
48
|
import { CreditSuite } from "./market/credit/CreditSuite.js";
|
|
47
|
-
import { generateCastTraceCall } from "./utils/viem/cast.js";
|
|
48
49
|
import { simulateMulticall } from "./utils/viem/simulateMulticall.js";
|
|
49
50
|
import { SimulateWithPriceUpdatesError, getSimulateWithPriceUpdatesError, simulateWithPriceUpdates } from "./utils/viem/simulateWithPriceUpdates.js";
|
|
50
51
|
import { executeDelegatedMulticalls } from "./utils/viem/executeDelegatedMulticalls.js";
|
|
@@ -88,7 +89,10 @@ import { IERC20ZapperContract } from "./market/zapper/IERC20ZapperContract.js";
|
|
|
88
89
|
import { IETHZapperContract } from "./market/zapper/IETHZapperContract.js";
|
|
89
90
|
import { createZapper } from "./market/zapper/createZapper.js";
|
|
90
91
|
import { MarketRegister } from "./market/MarketRegister.js";
|
|
91
|
-
import {
|
|
92
|
+
import { RWA_LIQUIDATOR_MIDAS } from "./market/rwa/midas/constants.js";
|
|
93
|
+
import { MidasLiquidator } from "./market/rwa/midas/MidasLiquidator.js";
|
|
94
|
+
import { RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE } from "./market/rwa/securitize/constants.js";
|
|
95
|
+
import { SecuritizeLiquidator } from "./market/rwa/securitize/SecuritizeLiquidator.js";
|
|
92
96
|
import { SECURITIZE_REGISTER_VAULT_TYPES } from "./market/rwa/securitize/types.js";
|
|
93
97
|
import { SecuritizeRWAFactory } from "./market/rwa/securitize/SecuritizeRWAFactory.js";
|
|
94
98
|
import { RWARegistry } from "./market/rwa/RWARegistry.js";
|
|
@@ -127,4 +131,4 @@ import { OnchainSDK, STATE_VERSION } from "./OnchainSDK.js";
|
|
|
127
131
|
import { MultichainSDK } from "./MultichainSDK.js";
|
|
128
132
|
import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
129
133
|
import "./types/index.js";
|
|
130
|
-
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, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BotPermissions, BoundedPriceFeedContract, ChainContractsRegister, CompositePriceFeedContract, Construct, ContractParseError, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InvalidDelayedIntentError, LEVERAGE_DECIMALS, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MissingSerializedParamsError, MultichainLiquidationsService, MultichainSDK, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PlaceholderContract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, 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, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeRWAFactory, SimulateWithPriceUpdatesError, TokensMeta, TypedObjectUtils, UnsupportedZapperFunctionError, VERSION_RANGE_310, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, decodeDelayedIntent, detectNetwork, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, numberWithCommas, onchainSDKOptionsSchema, percentFmt, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, watchBlocksAsync };
|
|
134
|
+
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, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BotPermissions, BoundedPriceFeedContract, ChainContractsRegister, CompositePriceFeedContract, Construct, ContractParseError, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InvalidDelayedIntentError, LEVERAGE_DECIMALS, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidator, MissingSerializedParamsError, MultichainLiquidationsService, MultichainSDK, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PlaceholderContract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, 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, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidator, SecuritizeRWAFactory, SimulateWithPriceUpdatesError, SimulationError, TokensMeta, TypedObjectUtils, UnsupportedZapperFunctionError, VERSION_RANGE_310, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, decodeDelayedIntent, detectNetwork, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, numberWithCommas, onchainSDKOptionsSchema, percentFmt, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, watchBlocksAsync };
|
|
@@ -60,20 +60,20 @@ var CreditFacadeV310BaseContract = class extends BaseContract {
|
|
|
60
60
|
const [onBehalfOf, calls, referralCode] = params.args;
|
|
61
61
|
return [
|
|
62
62
|
this.labelAddress(onBehalfOf),
|
|
63
|
-
this.register.
|
|
63
|
+
this.register.stringifyMultiCall([...calls]).join(", "),
|
|
64
64
|
`${referralCode}`
|
|
65
65
|
];
|
|
66
66
|
}
|
|
67
67
|
case "closeCreditAccount": {
|
|
68
68
|
const [creditAccount, calls] = params.args;
|
|
69
|
-
return [this.labelAddress(creditAccount), this.register.
|
|
69
|
+
return [this.labelAddress(creditAccount), this.register.stringifyMultiCall([...calls]).join(", ")];
|
|
70
70
|
}
|
|
71
71
|
case "liquidateCreditAccount": {
|
|
72
72
|
const [creditAccount, to, calls] = params.args;
|
|
73
73
|
return [
|
|
74
74
|
this.labelAddress(creditAccount),
|
|
75
75
|
this.labelAddress(to),
|
|
76
|
-
this.register.
|
|
76
|
+
this.register.stringifyMultiCall([...calls]).join(", ")
|
|
77
77
|
];
|
|
78
78
|
}
|
|
79
79
|
default: return super.stringifyFunctionParams(params);
|
|
@@ -48,11 +48,14 @@ import { IETHZapperContract } from "./zapper/IETHZapperContract.js";
|
|
|
48
48
|
import { createZapper } from "./zapper/createZapper.js";
|
|
49
49
|
import "./zapper/index.js";
|
|
50
50
|
import { MarketRegister } from "./MarketRegister.js";
|
|
51
|
-
import {
|
|
51
|
+
import { RWA_LIQUIDATOR_MIDAS } from "./rwa/midas/constants.js";
|
|
52
|
+
import { MidasLiquidator } from "./rwa/midas/MidasLiquidator.js";
|
|
53
|
+
import { RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE } from "./rwa/securitize/constants.js";
|
|
54
|
+
import { SecuritizeLiquidator } from "./rwa/securitize/SecuritizeLiquidator.js";
|
|
52
55
|
import { SECURITIZE_REGISTER_VAULT_TYPES } from "./rwa/securitize/types.js";
|
|
53
56
|
import { SecuritizeRWAFactory } from "./rwa/securitize/SecuritizeRWAFactory.js";
|
|
54
57
|
import { RWARegistry } from "./rwa/RWARegistry.js";
|
|
55
58
|
import { RWA_FACTORY_TYPES, isRWAFactory } from "./rwa/types.js";
|
|
56
59
|
import "./rwa/index.js";
|
|
57
60
|
import "./types.js";
|
|
58
|
-
export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, LinearInterestRateModelContract, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeRWAFactory, UnsupportedZapperFunctionError, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, fetchPythPayloads, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isRWAFactory, isUpdatablePriceFeed };
|
|
61
|
+
export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, LinearInterestRateModelContract, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidator, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidator, SecuritizeRWAFactory, UnsupportedZapperFunctionError, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, fetchPythPayloads, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isRWAFactory, isUpdatablePriceFeed };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RWA_LIQUIDATOR_MIDAS } from "./midas/constants.js";
|
|
2
|
+
import { MidasLiquidator } from "./midas/MidasLiquidator.js";
|
|
3
|
+
import "./midas/index.js";
|
|
4
|
+
import { RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE } from "./securitize/constants.js";
|
|
5
|
+
import { SecuritizeLiquidator } from "./securitize/SecuritizeLiquidator.js";
|
|
2
6
|
import { SECURITIZE_REGISTER_VAULT_TYPES } from "./securitize/types.js";
|
|
3
7
|
import { SecuritizeRWAFactory } from "./securitize/SecuritizeRWAFactory.js";
|
|
4
8
|
import "./securitize/index.js";
|
|
5
9
|
import { RWARegistry } from "./RWARegistry.js";
|
|
6
10
|
import { RWA_FACTORY_TYPES, isRWAFactory } from "./types.js";
|
|
7
|
-
export { RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeRWAFactory, isRWAFactory };
|
|
11
|
+
export { MidasLiquidator, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidator, SecuritizeRWAFactory, isRWAFactory };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseContract } from "../../../base/BaseContract.js";
|
|
2
|
+
import "../../../base/index.js";
|
|
3
|
+
import { RWA_LIQUIDATOR_MIDAS } from "./constants.js";
|
|
4
|
+
import { iMidasLiquidatorV311Abi } from "../../../../abi/rwa/iMidasLiquidatorV311.js";
|
|
5
|
+
//#region src/sdk/market/rwa/midas/MidasLiquidator.ts
|
|
6
|
+
const abi = iMidasLiquidatorV311Abi;
|
|
7
|
+
var MidasLiquidator = class extends BaseContract {
|
|
8
|
+
constructor(options, address) {
|
|
9
|
+
super(options, {
|
|
10
|
+
addr: address,
|
|
11
|
+
contractType: RWA_LIQUIDATOR_MIDAS,
|
|
12
|
+
version: 311,
|
|
13
|
+
name: "MidasLiquidator",
|
|
14
|
+
abi
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
stringifyFunctionParams(params) {
|
|
18
|
+
if (params.functionName === "liquidateWithRedeemerTransfers") {
|
|
19
|
+
const [creditAccount, gateway, calls, lossPolicyData] = params.args;
|
|
20
|
+
return [
|
|
21
|
+
this.labelAddress(creditAccount),
|
|
22
|
+
this.labelAddress(gateway),
|
|
23
|
+
`[${this.register.stringifyMultiCall([...calls]).join(", ")}]`,
|
|
24
|
+
lossPolicyData === "0x" ? "none" : lossPolicyData
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
return super.stringifyFunctionParams(params);
|
|
28
|
+
}
|
|
29
|
+
parseFunctionParamsV2(params, strict) {
|
|
30
|
+
if (params.functionName === "liquidateWithRedeemerTransfers") {
|
|
31
|
+
const [creditAccount, gateway, calls, lossPolicyData] = params.args;
|
|
32
|
+
return {
|
|
33
|
+
creditAccount,
|
|
34
|
+
gateway,
|
|
35
|
+
calls: this.register.parseMultiCallV2([...calls], strict),
|
|
36
|
+
lossPolicyData
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return super.parseFunctionParamsV2(params, strict);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { MidasLiquidator };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseContract } from "../../../base/BaseContract.js";
|
|
2
|
+
import "../../../base/index.js";
|
|
3
|
+
import { RWA_LIQUIDATOR_SECURITIZE } from "./constants.js";
|
|
4
|
+
import { iSecuritizeLiquidatorV311Abi } from "../../../../abi/rwa/iSecuritizeLiquidatorV311.js";
|
|
5
|
+
//#region src/sdk/market/rwa/securitize/SecuritizeLiquidator.ts
|
|
6
|
+
const abi = iSecuritizeLiquidatorV311Abi;
|
|
7
|
+
var SecuritizeLiquidator = class extends BaseContract {
|
|
8
|
+
constructor(options, address) {
|
|
9
|
+
super(options, {
|
|
10
|
+
addr: address,
|
|
11
|
+
contractType: RWA_LIQUIDATOR_SECURITIZE,
|
|
12
|
+
version: 311,
|
|
13
|
+
name: "SecuritizeLiquidator",
|
|
14
|
+
abi
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
stringifyFunctionParams(params) {
|
|
18
|
+
if (params.functionName === "liquidatePendingRedemption") {
|
|
19
|
+
const [creditAccount, redemptionGateway, priceUpdates, lossPolicyData] = params.args;
|
|
20
|
+
return [
|
|
21
|
+
this.labelAddress(creditAccount),
|
|
22
|
+
this.labelAddress(redemptionGateway),
|
|
23
|
+
`${priceUpdates.length} price updates`,
|
|
24
|
+
lossPolicyData === "0x" ? "none" : lossPolicyData
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
return super.stringifyFunctionParams(params);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { SecuritizeLiquidator };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region src/sdk/market/rwa/securitize/constants.ts
|
|
2
2
|
const RWA_FACTORY_SECURITIZE = "RWA_FACTORY::SECURITIZE";
|
|
3
|
+
const RWA_LIQUIDATOR_SECURITIZE = "RWA_LIQUIDATOR::SECURITIZE";
|
|
3
4
|
//#endregion
|
|
4
|
-
export { RWA_FACTORY_SECURITIZE };
|
|
5
|
+
export { RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { RWA_FACTORY_SECURITIZE } from "./constants.js";
|
|
1
|
+
import { RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE } from "./constants.js";
|
|
2
|
+
import { SecuritizeLiquidator } from "./SecuritizeLiquidator.js";
|
|
2
3
|
import { SECURITIZE_REGISTER_VAULT_TYPES } from "./types.js";
|
|
3
4
|
import { SecuritizeRWAFactory } from "./SecuritizeRWAFactory.js";
|
|
4
|
-
export { RWA_FACTORY_SECURITIZE, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeRWAFactory };
|
|
5
|
+
export { RWA_FACTORY_SECURITIZE, RWA_LIQUIDATOR_SECURITIZE, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidator, SecuritizeRWAFactory };
|