@gearbox-protocol/sdk 14.12.0-next.54 → 14.12.0-next.56
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/iPhantomToken.js +19 -0
- package/dist/cjs/abi/rwa/iMidasLiquidatorV311.js +96 -0
- package/dist/cjs/abi/rwa/iRWAGateway.js +19 -0
- package/dist/cjs/abi/rwa/iSecuritizeLiquidatorV311.js +111 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +65 -0
- package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +10 -0
- package/dist/cjs/sdk/base/BaseContract.js +26 -0
- package/dist/cjs/sdk/base/ChainContractsRegister.js +24 -0
- package/dist/cjs/sdk/base/token-types.js +1 -0
- package/dist/cjs/sdk/index.js +14 -1
- package/dist/cjs/sdk/market/credit/CreditFacadeV310BaseContract.js +3 -3
- package/dist/cjs/sdk/market/index.js +9 -0
- package/dist/cjs/sdk/market/rwa/index.js +10 -0
- package/dist/cjs/sdk/market/rwa/midas/MidasLiquidatorContract.js +43 -0
- package/dist/cjs/sdk/market/rwa/midas/constants.js +7 -0
- package/dist/cjs/sdk/market/rwa/midas/index.js +6 -0
- package/dist/cjs/sdk/market/rwa/securitize/SecuritizeLiquidatorContract.js +31 -0
- package/dist/cjs/sdk/market/rwa/securitize/constants.js +4 -0
- package/dist/cjs/sdk/market/rwa/securitize/index.js +4 -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/iPhantomToken.js +18 -0
- package/dist/esm/abi/rwa/iMidasLiquidatorV311.js +95 -0
- package/dist/esm/abi/rwa/iRWAGateway.js +18 -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/accounts/liquidations/LiquidationsService.js +65 -0
- package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +10 -0
- package/dist/esm/sdk/base/BaseContract.js +26 -0
- package/dist/esm/sdk/base/ChainContractsRegister.js +24 -0
- package/dist/esm/sdk/base/token-types.js +1 -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/MidasLiquidatorContract.js +43 -0
- package/dist/esm/sdk/market/rwa/midas/constants.js +5 -0
- package/dist/esm/sdk/market/rwa/midas/index.js +3 -0
- package/dist/esm/sdk/market/rwa/securitize/SecuritizeLiquidatorContract.js +31 -0
- package/dist/esm/sdk/market/rwa/securitize/constants.js +3 -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/iPhantomToken.d.ts +18 -0
- package/dist/types/abi/rwa/iMidasLiquidatorV311.d.ts +83 -0
- package/dist/types/abi/rwa/iRWAGateway.d.ts +18 -0
- package/dist/types/abi/rwa/iSecuritizeLiquidatorV311.d.ts +95 -0
- package/dist/types/sdk/accounts/index.d.ts +2 -2
- package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +4 -0
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +5 -1
- package/dist/types/sdk/accounts/liquidations/index.d.ts +2 -2
- package/dist/types/sdk/accounts/liquidations/types.d.ts +13 -1
- package/dist/types/sdk/base/BaseContract.d.ts +13 -0
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +15 -0
- package/dist/types/sdk/base/token-types.d.ts +1 -1
- package/dist/types/sdk/index.d.ts +8 -4
- 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/MidasLiquidatorContract.d.ts +93 -0
- package/dist/types/sdk/market/rwa/midas/constants.d.ts +5 -0
- package/dist/types/sdk/market/rwa/midas/index.d.ts +3 -0
- package/dist/types/sdk/market/rwa/securitize/SecuritizeLiquidatorContract.d.ts +104 -0
- package/dist/types/sdk/market/rwa/securitize/constants.d.ts +3 -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,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/abi/iPhantomToken.ts
|
|
3
|
+
const iPhantomTokenAbi = [{
|
|
4
|
+
type: "function",
|
|
5
|
+
inputs: [],
|
|
6
|
+
name: "getPhantomTokenInfo",
|
|
7
|
+
outputs: [{
|
|
8
|
+
name: "target",
|
|
9
|
+
internalType: "address",
|
|
10
|
+
type: "address"
|
|
11
|
+
}, {
|
|
12
|
+
name: "depositedToken",
|
|
13
|
+
internalType: "address",
|
|
14
|
+
type: "address"
|
|
15
|
+
}],
|
|
16
|
+
stateMutability: "view"
|
|
17
|
+
}];
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.iPhantomTokenAbi = iPhantomTokenAbi;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/abi/rwa/iMidasLiquidatorV311.ts
|
|
3
|
+
const iMidasLiquidatorV311Abi = [
|
|
4
|
+
{
|
|
5
|
+
type: "function",
|
|
6
|
+
name: "contractType",
|
|
7
|
+
inputs: [],
|
|
8
|
+
outputs: [{
|
|
9
|
+
name: "",
|
|
10
|
+
type: "bytes32",
|
|
11
|
+
internalType: "bytes32"
|
|
12
|
+
}],
|
|
13
|
+
stateMutability: "view"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: "function",
|
|
17
|
+
name: "isTransferAllowed",
|
|
18
|
+
inputs: [{
|
|
19
|
+
name: "redeemerOwner",
|
|
20
|
+
type: "address",
|
|
21
|
+
internalType: "address"
|
|
22
|
+
}],
|
|
23
|
+
outputs: [{
|
|
24
|
+
name: "",
|
|
25
|
+
type: "bool",
|
|
26
|
+
internalType: "bool"
|
|
27
|
+
}],
|
|
28
|
+
stateMutability: "view"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "function",
|
|
32
|
+
name: "liquidateWithRedeemerTransfers",
|
|
33
|
+
inputs: [
|
|
34
|
+
{
|
|
35
|
+
name: "creditAccount",
|
|
36
|
+
type: "address",
|
|
37
|
+
internalType: "address"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "gateway",
|
|
41
|
+
type: "address",
|
|
42
|
+
internalType: "address"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "calls",
|
|
46
|
+
type: "tuple[]",
|
|
47
|
+
internalType: "struct MultiCall[]",
|
|
48
|
+
components: [{
|
|
49
|
+
name: "target",
|
|
50
|
+
type: "address",
|
|
51
|
+
internalType: "address"
|
|
52
|
+
}, {
|
|
53
|
+
name: "callData",
|
|
54
|
+
type: "bytes",
|
|
55
|
+
internalType: "bytes"
|
|
56
|
+
}]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "lossPolicyData",
|
|
60
|
+
type: "bytes",
|
|
61
|
+
internalType: "bytes"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
outputs: [],
|
|
65
|
+
stateMutability: "nonpayable"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "function",
|
|
69
|
+
name: "transferableRedeemerOwner",
|
|
70
|
+
inputs: [],
|
|
71
|
+
outputs: [{
|
|
72
|
+
name: "",
|
|
73
|
+
type: "address",
|
|
74
|
+
internalType: "address"
|
|
75
|
+
}],
|
|
76
|
+
stateMutability: "view"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "function",
|
|
80
|
+
name: "version",
|
|
81
|
+
inputs: [],
|
|
82
|
+
outputs: [{
|
|
83
|
+
name: "",
|
|
84
|
+
type: "uint256",
|
|
85
|
+
internalType: "uint256"
|
|
86
|
+
}],
|
|
87
|
+
stateMutability: "view"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: "error",
|
|
91
|
+
name: "NotValidGatewayException",
|
|
92
|
+
inputs: []
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
//#endregion
|
|
96
|
+
exports.iMidasLiquidatorV311Abi = iMidasLiquidatorV311Abi;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/abi/rwa/iRWAGateway.ts
|
|
3
|
+
/**
|
|
4
|
+
* Minimal ABI shared by RWA delayed-withdrawal gateways (Midas, Securitize).
|
|
5
|
+
* Only holds `transferMaster`, which is the gateway's dedicated liquidator.
|
|
6
|
+
*/
|
|
7
|
+
const iRWAGatewayAbi = [{
|
|
8
|
+
type: "function",
|
|
9
|
+
inputs: [],
|
|
10
|
+
name: "transferMaster",
|
|
11
|
+
outputs: [{
|
|
12
|
+
name: "",
|
|
13
|
+
internalType: "address",
|
|
14
|
+
type: "address"
|
|
15
|
+
}],
|
|
16
|
+
stateMutability: "view"
|
|
17
|
+
}];
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.iRWAGatewayAbi = iRWAGatewayAbi;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/abi/rwa/iSecuritizeLiquidatorV311.ts
|
|
3
|
+
const iSecuritizeLiquidatorV311Abi = [
|
|
4
|
+
{
|
|
5
|
+
type: "function",
|
|
6
|
+
name: "contractType",
|
|
7
|
+
inputs: [],
|
|
8
|
+
outputs: [{
|
|
9
|
+
name: "",
|
|
10
|
+
type: "bytes32",
|
|
11
|
+
internalType: "bytes32"
|
|
12
|
+
}],
|
|
13
|
+
stateMutability: "view"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: "function",
|
|
17
|
+
name: "isTransferAllowed",
|
|
18
|
+
inputs: [{
|
|
19
|
+
name: "redeemerOwner",
|
|
20
|
+
type: "address",
|
|
21
|
+
internalType: "address"
|
|
22
|
+
}],
|
|
23
|
+
outputs: [{
|
|
24
|
+
name: "",
|
|
25
|
+
type: "bool",
|
|
26
|
+
internalType: "bool"
|
|
27
|
+
}],
|
|
28
|
+
stateMutability: "view"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "function",
|
|
32
|
+
name: "liquidatePendingRedemption",
|
|
33
|
+
inputs: [
|
|
34
|
+
{
|
|
35
|
+
name: "creditAccount",
|
|
36
|
+
type: "address",
|
|
37
|
+
internalType: "address"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "redemptionGateway",
|
|
41
|
+
type: "address",
|
|
42
|
+
internalType: "address"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "priceUpdates",
|
|
46
|
+
type: "tuple[]",
|
|
47
|
+
internalType: "struct PriceUpdate[]",
|
|
48
|
+
components: [{
|
|
49
|
+
name: "priceFeed",
|
|
50
|
+
type: "address",
|
|
51
|
+
internalType: "address"
|
|
52
|
+
}, {
|
|
53
|
+
name: "data",
|
|
54
|
+
type: "bytes",
|
|
55
|
+
internalType: "bytes"
|
|
56
|
+
}]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "lossPolicyData",
|
|
60
|
+
type: "bytes",
|
|
61
|
+
internalType: "bytes"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
outputs: [],
|
|
65
|
+
stateMutability: "nonpayable"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "function",
|
|
69
|
+
name: "transferableRedeemerOwner",
|
|
70
|
+
inputs: [],
|
|
71
|
+
outputs: [{
|
|
72
|
+
name: "",
|
|
73
|
+
type: "address",
|
|
74
|
+
internalType: "address"
|
|
75
|
+
}],
|
|
76
|
+
stateMutability: "view"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "function",
|
|
80
|
+
name: "version",
|
|
81
|
+
inputs: [],
|
|
82
|
+
outputs: [{
|
|
83
|
+
name: "",
|
|
84
|
+
type: "uint256",
|
|
85
|
+
internalType: "uint256"
|
|
86
|
+
}],
|
|
87
|
+
stateMutability: "view"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: "error",
|
|
91
|
+
name: "AccountHasSufficientLiquidityException",
|
|
92
|
+
inputs: []
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: "error",
|
|
96
|
+
name: "NotValidGatewayException",
|
|
97
|
+
inputs: []
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: "error",
|
|
101
|
+
name: "StableCoinIsNotConvertibleException",
|
|
102
|
+
inputs: []
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: "error",
|
|
106
|
+
name: "UnknownCreditAccountException",
|
|
107
|
+
inputs: []
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
//#endregion
|
|
111
|
+
exports.iSecuritizeLiquidatorV311Abi = iSecuritizeLiquidatorV311Abi;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_abi_ILiquidationCompressorV313 = require("../../../abi/ILiquidationCompressorV313.js");
|
|
3
|
+
const require_abi_iPhantomToken = require("../../../abi/iPhantomToken.js");
|
|
3
4
|
const require_sdk_utils_AddressSet = require("../../utils/AddressSet.js");
|
|
4
5
|
const require_sdk_constants_addresses = require("../../constants/addresses.js");
|
|
5
6
|
const require_sdk_constants_math = require("../../constants/math.js");
|
|
@@ -8,7 +9,14 @@ const require_sdk_utils_hex = require("../../utils/hex.js");
|
|
|
8
9
|
require("../../utils/index.js");
|
|
9
10
|
const require_sdk_base_SDKConstruct = require("../../base/SDKConstruct.js");
|
|
10
11
|
require("../../base/index.js");
|
|
12
|
+
const require_sdk_market_rwa_midas_constants = require("../../market/rwa/midas/constants.js");
|
|
13
|
+
const require_sdk_market_rwa_midas_MidasLiquidatorContract = require("../../market/rwa/midas/MidasLiquidatorContract.js");
|
|
14
|
+
require("../../market/rwa/midas/index.js");
|
|
15
|
+
const require_sdk_market_rwa_securitize_constants = require("../../market/rwa/securitize/constants.js");
|
|
16
|
+
const require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract = require("../../market/rwa/securitize/SecuritizeLiquidatorContract.js");
|
|
17
|
+
require("../../market/rwa/securitize/index.js");
|
|
11
18
|
const require_sdk_accounts_liquidations_constants = require("./constants.js");
|
|
19
|
+
const require_abi_rwa_iRWAGateway = require("../../../abi/rwa/iRWAGateway.js");
|
|
12
20
|
const require_sdk_accounts_liquidations_helpers = require("./helpers.js");
|
|
13
21
|
//#region src/sdk/accounts/liquidations/LiquidationsService.ts
|
|
14
22
|
/**
|
|
@@ -95,6 +103,63 @@ var LiquidationsService = class extends require_sdk_base_SDKConstruct.SDKConstru
|
|
|
95
103
|
const current = await compressor.getExternalAccountCurrentWithdrawals(props.liquidator, ...phantomTokens.asArray());
|
|
96
104
|
return require_sdk_accounts_liquidations_helpers.toLiquidatorWithdrawals(current, this.sdk.networkType);
|
|
97
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* {@inheritDoc ILiquidationsService.loadRWALiquidators}
|
|
108
|
+
**/
|
|
109
|
+
async loadRWALiquidators() {
|
|
110
|
+
await this.sdk.tokensMeta.loadTokenData();
|
|
111
|
+
const phantomTokens = [];
|
|
112
|
+
for (const meta of this.sdk.tokensMeta.phantomTokens.values()) switch (meta.contractType) {
|
|
113
|
+
case require_sdk_market_rwa_securitize_constants.PHANTOM_TOKEN_SECURITIZE_REDEMPTION:
|
|
114
|
+
case require_sdk_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION: phantomTokens.push(meta);
|
|
115
|
+
}
|
|
116
|
+
if (phantomTokens.length === 0) return;
|
|
117
|
+
const ptResp = await this.client.multicall({
|
|
118
|
+
contracts: phantomTokens.map(({ addr }) => ({
|
|
119
|
+
address: addr,
|
|
120
|
+
abi: require_abi_iPhantomToken.iPhantomTokenAbi,
|
|
121
|
+
functionName: "getPhantomTokenInfo"
|
|
122
|
+
})),
|
|
123
|
+
allowFailure: false,
|
|
124
|
+
batchSize: 0
|
|
125
|
+
});
|
|
126
|
+
const gateways = phantomTokens.map(({ contractType }, i) => ({
|
|
127
|
+
gateway: ptResp[i][0],
|
|
128
|
+
contractType
|
|
129
|
+
}));
|
|
130
|
+
const gwResp = await this.client.multicall({
|
|
131
|
+
contracts: gateways.map(({ gateway }) => ({
|
|
132
|
+
address: gateway,
|
|
133
|
+
abi: require_abi_rwa_iRWAGateway.iRWAGatewayAbi,
|
|
134
|
+
functionName: "transferMaster"
|
|
135
|
+
})),
|
|
136
|
+
allowFailure: false,
|
|
137
|
+
batchSize: 0
|
|
138
|
+
});
|
|
139
|
+
const refs = gateways.map(({ contractType }, i) => ({
|
|
140
|
+
liquidator: gwResp[i],
|
|
141
|
+
contractType
|
|
142
|
+
}));
|
|
143
|
+
for (const ref of refs) this.#createRWALiquidator(ref);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Instantiates the liquidator contract, which registers it and labels its
|
|
147
|
+
* address (see `BaseContract`).
|
|
148
|
+
*
|
|
149
|
+
* @param ref - Discovered liquidator address and its phantom token type
|
|
150
|
+
**/
|
|
151
|
+
#createRWALiquidator(ref) {
|
|
152
|
+
const { liquidator, contractType } = ref;
|
|
153
|
+
if (this.sdk.getContract(liquidator)) return;
|
|
154
|
+
switch (contractType) {
|
|
155
|
+
case require_sdk_market_rwa_securitize_constants.PHANTOM_TOKEN_SECURITIZE_REDEMPTION:
|
|
156
|
+
new require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract.SecuritizeLiquidatorContract(this.sdk, liquidator);
|
|
157
|
+
return;
|
|
158
|
+
case require_sdk_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION:
|
|
159
|
+
new require_sdk_market_rwa_midas_MidasLiquidatorContract.MidasLiquidatorContract(this.sdk, liquidator);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
98
163
|
async #getCreditAccountData(creditAccount) {
|
|
99
164
|
const ca = await this.sdk.accounts.getCreditAccountData(creditAccount);
|
|
100
165
|
if (!ca) throw new Error(`credit account ${creditAccount} not found`);
|
|
@@ -53,6 +53,16 @@ var MultichainLiquidationsService = class {
|
|
|
53
53
|
});
|
|
54
54
|
return withdrawals;
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* {@inheritDoc ILiquidationsService.loadRWALiquidators}
|
|
58
|
+
**/
|
|
59
|
+
async loadRWALiquidators(props) {
|
|
60
|
+
const chains = [...this.#sdk.chains.entries()].filter(([network]) => !props?.networks || props.networks.includes(network));
|
|
61
|
+
(await Promise.allSettled(chains.map(([, chainSdk]) => chainSdk.liquidations.loadRWALiquidators()))).forEach((result, i) => {
|
|
62
|
+
const [network, chainSdk] = chains[i];
|
|
63
|
+
if (result.status === "rejected") chainSdk.logger?.warn(result.reason, `failed to load RWA liquidators on ${network}`);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
56
66
|
};
|
|
57
67
|
//#endregion
|
|
58
68
|
exports.MultichainLiquidationsService = MultichainLiquidationsService;
|
|
@@ -5,6 +5,7 @@ const require_sdk_utils_abi_decode = require("../utils/abi-decode.js");
|
|
|
5
5
|
const require_sdk_utils_bytes32ToString = require("../utils/bytes32ToString.js");
|
|
6
6
|
const require_sdk_utils_createRawTx = require("../utils/createRawTx.js");
|
|
7
7
|
require("../utils/index.js");
|
|
8
|
+
const require_sdk_utils_viem_simulateCall = require("../utils/viem/simulateCall.js");
|
|
8
9
|
const require_sdk_base_Construct = require("./Construct.js");
|
|
9
10
|
let viem = require("viem");
|
|
10
11
|
//#region src/sdk/base/BaseContract.ts
|
|
@@ -262,6 +263,31 @@ var BaseContract = class extends require_sdk_base_Construct.Construct {
|
|
|
262
263
|
return tx;
|
|
263
264
|
}
|
|
264
265
|
/**
|
|
266
|
+
* Simulates calldata against this contract with `eth_call`, returning the raw response.
|
|
267
|
+
*
|
|
268
|
+
* Nothing is encoded or decoded on success: pass calldata that already exists (e.g. from
|
|
269
|
+
* {@link createRawTx}) instead of decoding it into a function name and arguments first.
|
|
270
|
+
* On revert, this contract's abi and the shared exception abis are used to decode the error.
|
|
271
|
+
*
|
|
272
|
+
* @param callData - Encoded calldata, passed to the node as-is.
|
|
273
|
+
* @param options - Call options, plus any extra `abis` needed to decode custom errors.
|
|
274
|
+
* @throws {@link SimulationError} when the call reverts or the request fails.
|
|
275
|
+
*/
|
|
276
|
+
async simulateCall(callData, options = {}) {
|
|
277
|
+
const { abis = [], ...rest } = options;
|
|
278
|
+
const { data } = await require_sdk_utils_viem_simulateCall.simulateCall(this.client, {
|
|
279
|
+
...rest,
|
|
280
|
+
to: this.address,
|
|
281
|
+
data: callData,
|
|
282
|
+
abis: [
|
|
283
|
+
this.abi,
|
|
284
|
+
require_abi_errors.errorAbis,
|
|
285
|
+
...abis
|
|
286
|
+
]
|
|
287
|
+
});
|
|
288
|
+
return data;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
265
291
|
* Get events in safe manner, by bisecting block range if needed
|
|
266
292
|
*
|
|
267
293
|
* @deprecated TODO: this should be moved to viem transport
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_sdk_utils_AddressMap = require("../utils/AddressMap.js");
|
|
3
3
|
require("../constants/addresses.js");
|
|
4
|
+
const require_sdk_utils_viem_simulateCall = require("../utils/viem/simulateCall.js");
|
|
4
5
|
const require_sdk_base_TokensMeta = require("./TokensMeta.js");
|
|
5
6
|
//#region src/sdk/base/ChainContractsRegister.ts
|
|
6
7
|
/**
|
|
@@ -104,6 +105,29 @@ var ChainContractsRegister = class {
|
|
|
104
105
|
return contract ? contract.stringifyFunctionData(calldata) : `unknown: ${address}.${calldata.slice(0, 10)}`;
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
108
|
+
* Simulates a transaction with `eth_call`, without encoding or decoding anything on success.
|
|
109
|
+
*
|
|
110
|
+
* When the target is a known contract, its abi and the shared exception abis are used to decode
|
|
111
|
+
* a revert. For an unknown target only `options.abis` are used, so pass the exception abis you
|
|
112
|
+
* care about when simulating contracts the SDK does not know.
|
|
113
|
+
*
|
|
114
|
+
* @param target - Target address.
|
|
115
|
+
* @param callData - Calldata to simulate.
|
|
116
|
+
* @param options - Call options, plus any extra `abis` needed to decode custom errors.
|
|
117
|
+
* @returns Raw bytes returned by the call, `0x` when the function returns nothing.
|
|
118
|
+
* @throws {@link SimulationError} when the call reverts or the request fails.
|
|
119
|
+
*/
|
|
120
|
+
async simulateCall(target, callData, options = {}) {
|
|
121
|
+
const contract = this.contracts.get(target);
|
|
122
|
+
if (contract) return contract.simulateCall(callData, options);
|
|
123
|
+
const { data } = await require_sdk_utils_viem_simulateCall.simulateCall(this.client, {
|
|
124
|
+
...options,
|
|
125
|
+
to: target,
|
|
126
|
+
data: callData
|
|
127
|
+
});
|
|
128
|
+
return data;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
107
131
|
* Converts multicalls into some human-friendly strings
|
|
108
132
|
* This method is safe and should not throw
|
|
109
133
|
* @param address
|
package/dist/cjs/sdk/index.js
CHANGED
|
@@ -28,6 +28,8 @@ const require_sdk_utils_retry = require("./utils/retry.js");
|
|
|
28
28
|
const require_sdk_utils_toAddress = require("./utils/toAddress.js");
|
|
29
29
|
const require_sdk_utils_zod = require("./utils/zod.js");
|
|
30
30
|
require("./utils/index.js");
|
|
31
|
+
const require_sdk_utils_viem_cast = require("./utils/viem/cast.js");
|
|
32
|
+
const require_sdk_utils_viem_simulateCall = require("./utils/viem/simulateCall.js");
|
|
31
33
|
const require_sdk_base_TokensMeta = require("./base/TokensMeta.js");
|
|
32
34
|
const require_sdk_base_ChainContractsRegister = require("./base/ChainContractsRegister.js");
|
|
33
35
|
const require_sdk_base_Construct = require("./base/Construct.js");
|
|
@@ -45,7 +47,6 @@ const require_sdk_market_credit_CreditFacadeV310BaseContract = require("./market
|
|
|
45
47
|
const require_sdk_market_credit_CreditFacadeV310Contract = require("./market/credit/CreditFacadeV310Contract.js");
|
|
46
48
|
const require_sdk_market_credit_CreditManagerV310Contract = require("./market/credit/CreditManagerV310Contract.js");
|
|
47
49
|
const require_sdk_market_credit_CreditSuite = require("./market/credit/CreditSuite.js");
|
|
48
|
-
const require_sdk_utils_viem_cast = require("./utils/viem/cast.js");
|
|
49
50
|
const require_sdk_utils_viem_simulateMulticall = require("./utils/viem/simulateMulticall.js");
|
|
50
51
|
const require_sdk_utils_viem_simulateWithPriceUpdates = require("./utils/viem/simulateWithPriceUpdates.js");
|
|
51
52
|
const require_sdk_utils_viem_executeDelegatedMulticalls = require("./utils/viem/executeDelegatedMulticalls.js");
|
|
@@ -89,7 +90,10 @@ const require_sdk_market_zapper_IERC20ZapperContract = require("./market/zapper/
|
|
|
89
90
|
const require_sdk_market_zapper_IETHZapperContract = require("./market/zapper/IETHZapperContract.js");
|
|
90
91
|
const require_sdk_market_zapper_createZapper = require("./market/zapper/createZapper.js");
|
|
91
92
|
const require_sdk_market_MarketRegister = require("./market/MarketRegister.js");
|
|
93
|
+
const require_sdk_market_rwa_midas_constants = require("./market/rwa/midas/constants.js");
|
|
94
|
+
const require_sdk_market_rwa_midas_MidasLiquidatorContract = require("./market/rwa/midas/MidasLiquidatorContract.js");
|
|
92
95
|
const require_sdk_market_rwa_securitize_constants = require("./market/rwa/securitize/constants.js");
|
|
96
|
+
const require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract = require("./market/rwa/securitize/SecuritizeLiquidatorContract.js");
|
|
93
97
|
const require_sdk_market_rwa_securitize_types = require("./market/rwa/securitize/types.js");
|
|
94
98
|
const require_sdk_market_rwa_securitize_SecuritizeRWAFactory = require("./market/rwa/securitize/SecuritizeRWAFactory.js");
|
|
95
99
|
const require_sdk_market_rwa_RWARegistry = require("./market/rwa/RWARegistry.js");
|
|
@@ -211,6 +215,7 @@ exports.MULTICALL_ADDRESS = require_sdk_constants_addresses.MULTICALL_ADDRESS;
|
|
|
211
215
|
exports.MarketRegister = require_sdk_market_MarketRegister.MarketRegister;
|
|
212
216
|
exports.MarketSuite = require_sdk_market_MarketSuite.MarketSuite;
|
|
213
217
|
exports.MellowLRTPriceFeedContract = require_sdk_market_pricefeeds_MellowLRTPriceFeed.MellowLRTPriceFeedContract;
|
|
218
|
+
exports.MidasLiquidatorContract = require_sdk_market_rwa_midas_MidasLiquidatorContract.MidasLiquidatorContract;
|
|
214
219
|
exports.MissingSerializedParamsError = require_sdk_base_errors.MissingSerializedParamsError;
|
|
215
220
|
exports.MultichainLiquidationsService = require_sdk_accounts_liquidations_MultichainLiquidationsService.MultichainLiquidationsService;
|
|
216
221
|
exports.MultichainSDK = require_sdk_MultichainSDK.MultichainSDK;
|
|
@@ -224,6 +229,8 @@ exports.PERCENTAGE_FACTOR = require_sdk_constants_math.PERCENTAGE_FACTOR;
|
|
|
224
229
|
exports.PERCENTAGE_FACTOR_1KK = require_sdk_constants_math.PERCENTAGE_FACTOR_1KK;
|
|
225
230
|
exports.PERIPHERY_CONTRACTS = require_sdk_constants_periphery.PERIPHERY_CONTRACTS;
|
|
226
231
|
exports.PHANTOM_TOKEN_CONTRACT_TYPES = require_sdk_base_token_types.PHANTOM_TOKEN_CONTRACT_TYPES;
|
|
232
|
+
exports.PHANTOM_TOKEN_MIDAS_REDEMPTION = require_sdk_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION;
|
|
233
|
+
exports.PHANTOM_TOKEN_SECURITIZE_REDEMPTION = require_sdk_market_rwa_securitize_constants.PHANTOM_TOKEN_SECURITIZE_REDEMPTION;
|
|
227
234
|
exports.PRICE_DECIMALS = require_sdk_constants_math.PRICE_DECIMALS;
|
|
228
235
|
exports.PRICE_DECIMALS_POW = require_sdk_constants_math.PRICE_DECIMALS_POW;
|
|
229
236
|
exports.PartialPriceFeedInitError = require_sdk_market_pricefeeds_AbstractPriceFeed.PartialPriceFeedInitError;
|
|
@@ -244,6 +251,8 @@ exports.RAY_DECIMALS_POW = require_sdk_constants_math.RAY_DECIMALS_POW;
|
|
|
244
251
|
exports.RWARegistry = require_sdk_market_rwa_RWARegistry.RWARegistry;
|
|
245
252
|
exports.RWA_FACTORY_SECURITIZE = require_sdk_market_rwa_securitize_constants.RWA_FACTORY_SECURITIZE;
|
|
246
253
|
exports.RWA_FACTORY_TYPES = require_sdk_market_rwa_types.RWA_FACTORY_TYPES;
|
|
254
|
+
exports.RWA_LIQUIDATOR_MIDAS = require_sdk_market_rwa_midas_constants.RWA_LIQUIDATOR_MIDAS;
|
|
255
|
+
exports.RWA_LIQUIDATOR_SECURITIZE = require_sdk_market_rwa_securitize_constants.RWA_LIQUIDATOR_SECURITIZE;
|
|
247
256
|
exports.RWA_ON_DEMAND_LP_MONOPOLIZED = require_sdk_base_token_types.RWA_ON_DEMAND_LP_MONOPOLIZED;
|
|
248
257
|
exports.RWA_UNDERLYING_DEFAULT = require_sdk_base_token_types.RWA_UNDERLYING_DEFAULT;
|
|
249
258
|
exports.RWA_UNDERLYING_ON_DEMAND = require_sdk_base_token_types.RWA_UNDERLYING_ON_DEMAND;
|
|
@@ -262,8 +271,10 @@ exports.SdkMissingChainStateError = require_sdk_core_errors.SdkMissingChainState
|
|
|
262
271
|
exports.SdkNotAttachedError = require_sdk_core_errors.SdkNotAttachedError;
|
|
263
272
|
exports.SdkStateVersionMismatchError = require_sdk_core_errors.SdkStateVersionMismatchError;
|
|
264
273
|
exports.SdkSyncFailedError = require_sdk_core_errors.SdkSyncFailedError;
|
|
274
|
+
exports.SecuritizeLiquidatorContract = require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract.SecuritizeLiquidatorContract;
|
|
265
275
|
exports.SecuritizeRWAFactory = require_sdk_market_rwa_securitize_SecuritizeRWAFactory.SecuritizeRWAFactory;
|
|
266
276
|
exports.SimulateWithPriceUpdatesError = require_sdk_utils_viem_simulateWithPriceUpdates.SimulateWithPriceUpdatesError;
|
|
277
|
+
exports.SimulationError = require_sdk_utils_viem_simulateCall.SimulationError;
|
|
267
278
|
exports.TokensMeta = require_sdk_base_TokensMeta.TokensMeta;
|
|
268
279
|
exports.TypedObjectUtils = require_sdk_utils_mappers.TypedObjectUtils;
|
|
269
280
|
exports.UnsupportedZapperFunctionError = require_sdk_market_zapper_errors.UnsupportedZapperFunctionError;
|
|
@@ -317,6 +328,7 @@ exports.formatTimestamp = require_sdk_utils_formatter.formatTimestamp;
|
|
|
317
328
|
exports.functionArgsToMap = require_sdk_utils_abi_decode.functionArgsToMap;
|
|
318
329
|
exports.functionArgsToRecord = require_sdk_utils_abi_decode.functionArgsToRecord;
|
|
319
330
|
exports.generateCastTraceCall = require_sdk_utils_viem_cast.generateCastTraceCall;
|
|
331
|
+
exports.getCastTraceArgs = require_sdk_utils_viem_cast.getCastTraceArgs;
|
|
320
332
|
exports.getChain = require_sdk_chain_chains.getChain;
|
|
321
333
|
exports.getCuratorName = require_sdk_chain_chains.getCuratorName;
|
|
322
334
|
exports.getFunctionSignature = require_sdk_utils_abi_decode.getFunctionSignature;
|
|
@@ -346,6 +358,7 @@ exports.retry = require_sdk_utils_retry.retry;
|
|
|
346
358
|
exports.sendRawTx = require_sdk_utils_viem_sendRawTx.sendRawTx;
|
|
347
359
|
exports.shortAddress = require_sdk_utils_formatter.shortAddress;
|
|
348
360
|
exports.shortHash = require_sdk_utils_formatter.shortHash;
|
|
361
|
+
exports.simulateCall = require_sdk_utils_viem_simulateCall.simulateCall;
|
|
349
362
|
exports.simulateMulticall = require_sdk_utils_viem_simulateMulticall.simulateMulticall;
|
|
350
363
|
exports.simulateWithPriceUpdates = require_sdk_utils_viem_simulateWithPriceUpdates.simulateWithPriceUpdates;
|
|
351
364
|
exports.toAddress = require_sdk_utils_toAddress.toAddress;
|
|
@@ -61,20 +61,20 @@ var CreditFacadeV310BaseContract = class extends require_sdk_base_BaseContract.B
|
|
|
61
61
|
const [onBehalfOf, calls, referralCode] = params.args;
|
|
62
62
|
return [
|
|
63
63
|
this.labelAddress(onBehalfOf),
|
|
64
|
-
this.register.
|
|
64
|
+
this.register.stringifyMultiCall([...calls]).join(", "),
|
|
65
65
|
`${referralCode}`
|
|
66
66
|
];
|
|
67
67
|
}
|
|
68
68
|
case "closeCreditAccount": {
|
|
69
69
|
const [creditAccount, calls] = params.args;
|
|
70
|
-
return [this.labelAddress(creditAccount), this.register.
|
|
70
|
+
return [this.labelAddress(creditAccount), this.register.stringifyMultiCall([...calls]).join(", ")];
|
|
71
71
|
}
|
|
72
72
|
case "liquidateCreditAccount": {
|
|
73
73
|
const [creditAccount, to, calls] = params.args;
|
|
74
74
|
return [
|
|
75
75
|
this.labelAddress(creditAccount),
|
|
76
76
|
this.labelAddress(to),
|
|
77
|
-
this.register.
|
|
77
|
+
this.register.stringifyMultiCall([...calls]).join(", ")
|
|
78
78
|
];
|
|
79
79
|
}
|
|
80
80
|
default: return super.stringifyFunctionParams(params);
|
|
@@ -49,7 +49,10 @@ const require_sdk_market_zapper_IETHZapperContract = require("./zapper/IETHZappe
|
|
|
49
49
|
const require_sdk_market_zapper_createZapper = require("./zapper/createZapper.js");
|
|
50
50
|
require("./zapper/index.js");
|
|
51
51
|
const require_sdk_market_MarketRegister = require("./MarketRegister.js");
|
|
52
|
+
const require_sdk_market_rwa_midas_constants = require("./rwa/midas/constants.js");
|
|
53
|
+
const require_sdk_market_rwa_midas_MidasLiquidatorContract = require("./rwa/midas/MidasLiquidatorContract.js");
|
|
52
54
|
const require_sdk_market_rwa_securitize_constants = require("./rwa/securitize/constants.js");
|
|
55
|
+
const require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract = require("./rwa/securitize/SecuritizeLiquidatorContract.js");
|
|
53
56
|
const require_sdk_market_rwa_securitize_types = require("./rwa/securitize/types.js");
|
|
54
57
|
const require_sdk_market_rwa_securitize_SecuritizeRWAFactory = require("./rwa/securitize/SecuritizeRWAFactory.js");
|
|
55
58
|
const require_sdk_market_rwa_RWARegistry = require("./rwa/RWARegistry.js");
|
|
@@ -79,6 +82,9 @@ exports.LinearInterestRateModelContract = require_sdk_market_pool_LinearInterest
|
|
|
79
82
|
exports.MarketRegister = require_sdk_market_MarketRegister.MarketRegister;
|
|
80
83
|
exports.MarketSuite = require_sdk_market_MarketSuite.MarketSuite;
|
|
81
84
|
exports.MellowLRTPriceFeedContract = require_sdk_market_pricefeeds_MellowLRTPriceFeed.MellowLRTPriceFeedContract;
|
|
85
|
+
exports.MidasLiquidatorContract = require_sdk_market_rwa_midas_MidasLiquidatorContract.MidasLiquidatorContract;
|
|
86
|
+
exports.PHANTOM_TOKEN_MIDAS_REDEMPTION = require_sdk_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION;
|
|
87
|
+
exports.PHANTOM_TOKEN_SECURITIZE_REDEMPTION = require_sdk_market_rwa_securitize_constants.PHANTOM_TOKEN_SECURITIZE_REDEMPTION;
|
|
82
88
|
exports.PartialPriceFeedInitError = require_sdk_market_pricefeeds_AbstractPriceFeed.PartialPriceFeedInitError;
|
|
83
89
|
exports.PendleTWAPPTPriceFeed = require_sdk_market_pricefeeds_PendleTWAPPTPriceFeed.PendleTWAPPTPriceFeed;
|
|
84
90
|
exports.PlaceholderAdapterContract = require_sdk_market_adapters_PlaceholderAdapterContracts.PlaceholderAdapterContract;
|
|
@@ -91,8 +97,11 @@ exports.PythPriceFeed = require_sdk_market_pricefeeds_PythPriceFeed.PythPriceFee
|
|
|
91
97
|
exports.RWARegistry = require_sdk_market_rwa_RWARegistry.RWARegistry;
|
|
92
98
|
exports.RWA_FACTORY_SECURITIZE = require_sdk_market_rwa_securitize_constants.RWA_FACTORY_SECURITIZE;
|
|
93
99
|
exports.RWA_FACTORY_TYPES = require_sdk_market_rwa_types.RWA_FACTORY_TYPES;
|
|
100
|
+
exports.RWA_LIQUIDATOR_MIDAS = require_sdk_market_rwa_midas_constants.RWA_LIQUIDATOR_MIDAS;
|
|
101
|
+
exports.RWA_LIQUIDATOR_SECURITIZE = require_sdk_market_rwa_securitize_constants.RWA_LIQUIDATOR_SECURITIZE;
|
|
94
102
|
exports.RedstonePriceFeedContract = require_sdk_market_pricefeeds_RedstonePriceFeed.RedstonePriceFeedContract;
|
|
95
103
|
exports.SECURITIZE_REGISTER_VAULT_TYPES = require_sdk_market_rwa_securitize_types.SECURITIZE_REGISTER_VAULT_TYPES;
|
|
104
|
+
exports.SecuritizeLiquidatorContract = require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract.SecuritizeLiquidatorContract;
|
|
96
105
|
exports.SecuritizeRWAFactory = require_sdk_market_rwa_securitize_SecuritizeRWAFactory.SecuritizeRWAFactory;
|
|
97
106
|
exports.UnsupportedZapperFunctionError = require_sdk_market_zapper_errors.UnsupportedZapperFunctionError;
|
|
98
107
|
exports.WstETHPriceFeedContract = require_sdk_market_pricefeeds_WstETHPriceFeed.WstETHPriceFeedContract;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_market_rwa_midas_constants = require("./midas/constants.js");
|
|
3
|
+
const require_sdk_market_rwa_midas_MidasLiquidatorContract = require("./midas/MidasLiquidatorContract.js");
|
|
4
|
+
require("./midas/index.js");
|
|
2
5
|
const require_sdk_market_rwa_securitize_constants = require("./securitize/constants.js");
|
|
6
|
+
const require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract = require("./securitize/SecuritizeLiquidatorContract.js");
|
|
3
7
|
const require_sdk_market_rwa_securitize_types = require("./securitize/types.js");
|
|
4
8
|
const require_sdk_market_rwa_securitize_SecuritizeRWAFactory = require("./securitize/SecuritizeRWAFactory.js");
|
|
5
9
|
require("./securitize/index.js");
|
|
6
10
|
const require_sdk_market_rwa_RWARegistry = require("./RWARegistry.js");
|
|
7
11
|
const require_sdk_market_rwa_types = require("./types.js");
|
|
12
|
+
exports.MidasLiquidatorContract = require_sdk_market_rwa_midas_MidasLiquidatorContract.MidasLiquidatorContract;
|
|
13
|
+
exports.PHANTOM_TOKEN_MIDAS_REDEMPTION = require_sdk_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION;
|
|
14
|
+
exports.PHANTOM_TOKEN_SECURITIZE_REDEMPTION = require_sdk_market_rwa_securitize_constants.PHANTOM_TOKEN_SECURITIZE_REDEMPTION;
|
|
8
15
|
exports.RWARegistry = require_sdk_market_rwa_RWARegistry.RWARegistry;
|
|
9
16
|
exports.RWA_FACTORY_SECURITIZE = require_sdk_market_rwa_securitize_constants.RWA_FACTORY_SECURITIZE;
|
|
10
17
|
exports.RWA_FACTORY_TYPES = require_sdk_market_rwa_types.RWA_FACTORY_TYPES;
|
|
18
|
+
exports.RWA_LIQUIDATOR_MIDAS = require_sdk_market_rwa_midas_constants.RWA_LIQUIDATOR_MIDAS;
|
|
19
|
+
exports.RWA_LIQUIDATOR_SECURITIZE = require_sdk_market_rwa_securitize_constants.RWA_LIQUIDATOR_SECURITIZE;
|
|
11
20
|
exports.SECURITIZE_REGISTER_VAULT_TYPES = require_sdk_market_rwa_securitize_types.SECURITIZE_REGISTER_VAULT_TYPES;
|
|
21
|
+
exports.SecuritizeLiquidatorContract = require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract.SecuritizeLiquidatorContract;
|
|
12
22
|
exports.SecuritizeRWAFactory = require_sdk_market_rwa_securitize_SecuritizeRWAFactory.SecuritizeRWAFactory;
|
|
13
23
|
exports.isRWAFactory = require_sdk_market_rwa_types.isRWAFactory;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_base_BaseContract = require("../../../base/BaseContract.js");
|
|
3
|
+
require("../../../base/index.js");
|
|
4
|
+
const require_sdk_market_rwa_midas_constants = require("./constants.js");
|
|
5
|
+
//#region src/sdk/market/rwa/midas/MidasLiquidatorContract.ts
|
|
6
|
+
const abi = require("../../../../abi/rwa/iMidasLiquidatorV311.js").iMidasLiquidatorV311Abi;
|
|
7
|
+
var MidasLiquidatorContract = class extends require_sdk_base_BaseContract.BaseContract {
|
|
8
|
+
constructor(options, address) {
|
|
9
|
+
super(options, {
|
|
10
|
+
addr: address,
|
|
11
|
+
contractType: require_sdk_market_rwa_midas_constants.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
|
+
exports.MidasLiquidatorContract = MidasLiquidatorContract;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/sdk/market/rwa/midas/constants.ts
|
|
3
|
+
const RWA_LIQUIDATOR_MIDAS = "RWA_LIQUIDATOR::MIDAS";
|
|
4
|
+
const PHANTOM_TOKEN_MIDAS_REDEMPTION = "PHANTOM_TOKEN::MIDAS_REDEMPTION";
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.PHANTOM_TOKEN_MIDAS_REDEMPTION = PHANTOM_TOKEN_MIDAS_REDEMPTION;
|
|
7
|
+
exports.RWA_LIQUIDATOR_MIDAS = RWA_LIQUIDATOR_MIDAS;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_market_rwa_midas_constants = require("./constants.js");
|
|
3
|
+
const require_sdk_market_rwa_midas_MidasLiquidatorContract = require("./MidasLiquidatorContract.js");
|
|
4
|
+
exports.MidasLiquidatorContract = require_sdk_market_rwa_midas_MidasLiquidatorContract.MidasLiquidatorContract;
|
|
5
|
+
exports.PHANTOM_TOKEN_MIDAS_REDEMPTION = require_sdk_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION;
|
|
6
|
+
exports.RWA_LIQUIDATOR_MIDAS = require_sdk_market_rwa_midas_constants.RWA_LIQUIDATOR_MIDAS;
|