@gearbox-protocol/sdk 14.12.0-next.17 → 14.12.0-next.18
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/{IWithdrawalCompressorV312.js → IWithdrawalCompressorV313.js} +49 -6
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.js +45 -1
- package/dist/cjs/abi/compressors/withdrawalCompressor.js +45 -1
- package/dist/cjs/dev/index.js +3 -1
- package/dist/cjs/dev/withdrawalAbi.js +2105 -0
- package/dist/cjs/dev/withdrawalUtils.js +271 -0
- package/dist/cjs/permissionless/bindings/factory/rate-keeper-factory.js +35 -0
- package/dist/cjs/permissionless/bindings/market-configurator.js +11 -0
- package/dist/cjs/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +1015 -0
- package/dist/cjs/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.js → iMidasIssuanceVaultAdapterV310.js} +6 -6
- package/dist/cjs/plugins/adapters/abi/adapters/{iMidasRedemptionVault.js → iMidasRedemptionVaultAdapterV310.js} +9 -9
- package/dist/cjs/plugins/adapters/abi/adapters/index.js +6 -4
- package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +3 -0
- package/dist/cjs/plugins/adapters/abi/targetContractAbi.js +3 -3
- package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +121 -0
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +2 -2
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +2 -2
- package/dist/cjs/plugins/adapters/contracts/index.js +2 -0
- package/dist/cjs/plugins/adapters/createAdapter.js +2 -0
- package/dist/cjs/plugins/adapters/types.js +1 -0
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +20 -37
- package/dist/cjs/sdk/OnchainSDK.js +11 -0
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +9 -55
- package/dist/cjs/sdk/accounts/index.js +3 -1
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +229 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +40 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/addresses.js +52 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +53 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/index.js +36 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/intent.js +172 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/types.js +16 -0
- package/dist/esm/abi/{IWithdrawalCompressorV312.js → IWithdrawalCompressorV313.js} +45 -2
- package/dist/esm/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.js +45 -1
- package/dist/esm/abi/compressors/withdrawalCompressor.js +45 -1
- package/dist/esm/dev/index.js +1 -0
- package/dist/esm/dev/withdrawalAbi.js +2074 -0
- package/dist/esm/dev/withdrawalUtils.js +259 -0
- package/dist/esm/permissionless/bindings/factory/rate-keeper-factory.js +11 -0
- package/dist/esm/permissionless/bindings/market-configurator.js +11 -0
- package/dist/esm/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +990 -0
- package/dist/esm/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.js → iMidasIssuanceVaultAdapterV310.js} +2 -2
- package/dist/esm/plugins/adapters/abi/adapters/{iMidasRedemptionVault.js → iMidasRedemptionVaultAdapterV310.js} +4 -4
- package/dist/esm/plugins/adapters/abi/adapters/index.js +3 -2
- package/dist/esm/plugins/adapters/abi/conctructorAbi.js +3 -0
- package/dist/esm/plugins/adapters/abi/targetContractAbi.js +2 -2
- package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +104 -0
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +4 -4
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +4 -4
- package/dist/esm/plugins/adapters/contracts/index.js +1 -0
- package/dist/esm/plugins/adapters/createAdapter.js +3 -0
- package/dist/esm/plugins/adapters/types.js +1 -0
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +21 -39
- package/dist/esm/sdk/OnchainSDK.js +13 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +8 -53
- package/dist/esm/sdk/accounts/index.js +1 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +205 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +16 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/addresses.js +28 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +29 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/index.js +8 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/intent.js +137 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/types.js +0 -0
- package/dist/types/abi/{IWithdrawalCompressorV312.d.ts → IWithdrawalCompressorV313.d.ts} +74 -1
- package/dist/types/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.d.ts +77 -0
- package/dist/types/abi/compressors/withdrawalCompressor.d.ts +77 -0
- package/dist/types/dev/index.d.ts +1 -0
- package/dist/types/dev/withdrawalAbi.d.ts +1584 -0
- package/dist/types/dev/withdrawalUtils.d.ts +19 -0
- package/dist/types/permissionless/bindings/compressors/withdrawal-compressor.d.ts +77 -0
- package/dist/types/permissionless/bindings/factory/rate-keeper-factory.d.ts +179 -0
- package/dist/types/permissionless/bindings/market-configurator.d.ts +2 -0
- package/dist/types/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.d.ts +754 -0
- package/dist/types/plugins/adapters/abi/adapters/{iMidasIssuanceVaultAdapter.d.ts → iMidasIssuanceVaultAdapterV310.d.ts} +1 -1
- package/dist/types/plugins/adapters/abi/adapters/{iMidasRedemptionVault.d.ts → iMidasRedemptionVaultAdapterV310.d.ts} +2 -2
- package/dist/types/plugins/adapters/abi/adapters/index.d.ts +3 -2
- package/dist/types/plugins/adapters/abi/targetContractAbi.d.ts +1 -1
- package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +790 -0
- package/dist/types/plugins/adapters/contracts/index.d.ts +1 -0
- package/dist/types/plugins/adapters/types.d.ts +2 -1
- package/dist/types/plugins/delayed-withdrawal/types.d.ts +4 -17
- package/dist/types/sdk/OnchainSDK.d.ts +10 -1
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +3 -11
- package/dist/types/sdk/accounts/index.d.ts +1 -0
- package/dist/types/sdk/accounts/types.d.ts +4 -18
- package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +35 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.d.ts +334 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.d.ts +338 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +300 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/addresses.d.ts +21 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.d.ts +11 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/index.d.ts +8 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/intent.d.ts +106 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +122 -0
- package/package.json +1 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
|
|
2
|
+
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
3
|
+
import {
|
|
4
|
+
getNetworkType,
|
|
5
|
+
getWithdrawalCompressorAddress
|
|
6
|
+
} from "../sdk/index.js";
|
|
7
|
+
import {
|
|
8
|
+
iMidasDataFeedAbi,
|
|
9
|
+
iMidasRedemptionVaultAbi,
|
|
10
|
+
midasGatewayAbi,
|
|
11
|
+
midasRedeemerAbi,
|
|
12
|
+
midasRedemptionVaultPhantomTokenAbi,
|
|
13
|
+
securitizeRedeemerAbi,
|
|
14
|
+
securitizeRedemptionGatewayAbi,
|
|
15
|
+
securitizeRedemptionPhantomTokenAbi
|
|
16
|
+
} from "./withdrawalAbi.js";
|
|
17
|
+
const MIDAS_VAULT_ADMIN = "0x2ACB4BdCbEf02f81BF713b696Ac26390d7f79A12";
|
|
18
|
+
const iVersionAbi = parseAbi([
|
|
19
|
+
"function contractType() external view returns (bytes32)"
|
|
20
|
+
]);
|
|
21
|
+
const iMidasRedemptionVaultExtAbi = parseAbi([
|
|
22
|
+
"function requestRedeemer() external view returns (address)",
|
|
23
|
+
"function safeApproveRequest(uint256 requestId, uint256 newMTokenRate) external"
|
|
24
|
+
]);
|
|
25
|
+
async function makePendingWithdrawalsClaimable(anvil, creditAccount, options) {
|
|
26
|
+
const { logger, timeWarp = false } = options || {};
|
|
27
|
+
const compressor = getWithdrawalCompressorAddress(
|
|
28
|
+
getNetworkType(anvil.chain.id)
|
|
29
|
+
);
|
|
30
|
+
if (!compressor) {
|
|
31
|
+
throw new Error(`no withdrawal compressor for chain ${anvil.chain.id}`);
|
|
32
|
+
}
|
|
33
|
+
if (compressor.version !== 313) {
|
|
34
|
+
logger?.warn(
|
|
35
|
+
`withdrawal compressor version is ${compressor.version}, this helper assumes 313`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const [, pending] = await anvil.readContract({
|
|
39
|
+
address: compressor.address,
|
|
40
|
+
abi: iWithdrawalCompressorV313Abi,
|
|
41
|
+
functionName: "getCurrentWithdrawals",
|
|
42
|
+
args: [creditAccount]
|
|
43
|
+
});
|
|
44
|
+
logger?.debug(
|
|
45
|
+
`found ${pending.length} pending withdrawals for credit account ${creditAccount}`
|
|
46
|
+
);
|
|
47
|
+
if (pending.length === 0) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (timeWarp) {
|
|
51
|
+
const maxClaimableAt = pending.reduce(
|
|
52
|
+
(max, p) => p.claimableAt > max ? p.claimableAt : max,
|
|
53
|
+
0n
|
|
54
|
+
);
|
|
55
|
+
if (maxClaimableAt > 0n) {
|
|
56
|
+
logger?.debug(`warping time to ${maxClaimableAt + 1n}`);
|
|
57
|
+
await anvil.evmMineDetailed(maxClaimableAt + 1n);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const w of pending) {
|
|
61
|
+
const cType = hexToString(
|
|
62
|
+
await anvil.readContract({
|
|
63
|
+
address: w.withdrawalPhantomToken,
|
|
64
|
+
abi: iVersionAbi,
|
|
65
|
+
functionName: "contractType"
|
|
66
|
+
}),
|
|
67
|
+
{ size: 32 }
|
|
68
|
+
);
|
|
69
|
+
logger?.debug(
|
|
70
|
+
`fulfilling withdrawal in phantom token ${w.withdrawalPhantomToken} with contract type ${cType}`
|
|
71
|
+
);
|
|
72
|
+
switch (cType) {
|
|
73
|
+
case "PHANTOM_TOKEN::MIDAS_REDEMPTION":
|
|
74
|
+
await fulfillMidasWithdrawal(
|
|
75
|
+
anvil,
|
|
76
|
+
creditAccount,
|
|
77
|
+
w.withdrawalPhantomToken,
|
|
78
|
+
logger
|
|
79
|
+
);
|
|
80
|
+
break;
|
|
81
|
+
case "PHANTOM_TOKEN::SECURITIZE_RD":
|
|
82
|
+
await fulfillSecuritizeWithdrawal(
|
|
83
|
+
anvil,
|
|
84
|
+
creditAccount,
|
|
85
|
+
w.withdrawalPhantomToken,
|
|
86
|
+
logger
|
|
87
|
+
);
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
logger?.warn(
|
|
91
|
+
`unsupported withdrawal phantom token type ${cType}, only time warp was applied`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const [claimableAfter, pendingAfter] = await anvil.readContract({
|
|
96
|
+
address: compressor.address,
|
|
97
|
+
abi: iWithdrawalCompressorV313Abi,
|
|
98
|
+
functionName: "getCurrentWithdrawals",
|
|
99
|
+
args: [creditAccount]
|
|
100
|
+
});
|
|
101
|
+
logger?.debug(
|
|
102
|
+
`after fulfillment: ${claimableAfter.length} claimable, ${pendingAfter.length} still pending withdrawals`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
async function fulfillMidasWithdrawal(anvil, creditAccount, withdrawalPhantomToken, logger) {
|
|
106
|
+
const [gateway, tokenOut] = await anvil.multicall({
|
|
107
|
+
allowFailure: false,
|
|
108
|
+
contracts: [
|
|
109
|
+
{
|
|
110
|
+
address: withdrawalPhantomToken,
|
|
111
|
+
abi: midasRedemptionVaultPhantomTokenAbi,
|
|
112
|
+
functionName: "gateway"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
address: withdrawalPhantomToken,
|
|
116
|
+
abi: midasRedemptionVaultPhantomTokenAbi,
|
|
117
|
+
functionName: "tokenOut"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
const midasRedemptionVault = await anvil.readContract({
|
|
122
|
+
address: gateway,
|
|
123
|
+
abi: midasGatewayAbi,
|
|
124
|
+
functionName: "midasRedemptionVault"
|
|
125
|
+
});
|
|
126
|
+
const [mTokenDataFeed, requestRedeemer, tokenOutDecimals, redeemers] = await anvil.multicall({
|
|
127
|
+
allowFailure: false,
|
|
128
|
+
contracts: [
|
|
129
|
+
{
|
|
130
|
+
address: midasRedemptionVault,
|
|
131
|
+
abi: iMidasRedemptionVaultAbi,
|
|
132
|
+
functionName: "mTokenDataFeed"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
address: midasRedemptionVault,
|
|
136
|
+
abi: iMidasRedemptionVaultExtAbi,
|
|
137
|
+
functionName: "requestRedeemer"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
address: tokenOut,
|
|
141
|
+
abi: erc20Abi,
|
|
142
|
+
functionName: "decimals"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
address: gateway,
|
|
146
|
+
abi: midasGatewayAbi,
|
|
147
|
+
functionName: "pendingRedeemers",
|
|
148
|
+
args: [creditAccount]
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
const mTokenRate = await anvil.readContract({
|
|
153
|
+
address: mTokenDataFeed,
|
|
154
|
+
abi: iMidasDataFeedAbi,
|
|
155
|
+
functionName: "getDataInBase18"
|
|
156
|
+
});
|
|
157
|
+
logger?.debug(
|
|
158
|
+
`midas: gateway ${gateway}, vault ${midasRedemptionVault}, tokenOut ${tokenOut}, mToken rate ${mTokenRate}, ${redeemers.length} pending redeemers`
|
|
159
|
+
);
|
|
160
|
+
for (const redeemer of redeemers) {
|
|
161
|
+
const topUp = 1000000n * 10n ** BigInt(tokenOutDecimals);
|
|
162
|
+
const requestRedeemerBalance = await anvil.readContract({
|
|
163
|
+
address: tokenOut,
|
|
164
|
+
abi: erc20Abi,
|
|
165
|
+
functionName: "balanceOf",
|
|
166
|
+
args: [requestRedeemer]
|
|
167
|
+
});
|
|
168
|
+
logger?.debug(
|
|
169
|
+
`midas: dealing ${topUp} of tokenOut ${tokenOut} to request redeemer ${requestRedeemer}`
|
|
170
|
+
);
|
|
171
|
+
await anvil.deal({
|
|
172
|
+
erc20: tokenOut,
|
|
173
|
+
account: requestRedeemer,
|
|
174
|
+
amount: requestRedeemerBalance + topUp
|
|
175
|
+
});
|
|
176
|
+
const requestId = await anvil.readContract({
|
|
177
|
+
address: redeemer,
|
|
178
|
+
abi: midasRedeemerAbi,
|
|
179
|
+
functionName: "requestId"
|
|
180
|
+
});
|
|
181
|
+
logger?.debug(
|
|
182
|
+
`midas: approving request ${requestId} of redeemer ${redeemer} as vault admin ${MIDAS_VAULT_ADMIN}`
|
|
183
|
+
);
|
|
184
|
+
await anvil.impersonateAccount({ address: MIDAS_VAULT_ADMIN });
|
|
185
|
+
await anvil.setBalance({
|
|
186
|
+
address: MIDAS_VAULT_ADMIN,
|
|
187
|
+
value: parseEther("100")
|
|
188
|
+
});
|
|
189
|
+
await anvil.writeContract({
|
|
190
|
+
chain: anvil.chain,
|
|
191
|
+
address: midasRedemptionVault,
|
|
192
|
+
account: MIDAS_VAULT_ADMIN,
|
|
193
|
+
abi: iMidasRedemptionVaultExtAbi,
|
|
194
|
+
functionName: "safeApproveRequest",
|
|
195
|
+
args: [requestId, mTokenRate]
|
|
196
|
+
});
|
|
197
|
+
await anvil.stopImpersonatingAccount({ address: MIDAS_VAULT_ADMIN });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async function fulfillSecuritizeWithdrawal(anvil, creditAccount, withdrawalPhantomToken, logger) {
|
|
201
|
+
const [redemptionGateway, stableCoinToken] = await anvil.multicall({
|
|
202
|
+
allowFailure: false,
|
|
203
|
+
contracts: [
|
|
204
|
+
{
|
|
205
|
+
address: withdrawalPhantomToken,
|
|
206
|
+
abi: securitizeRedemptionPhantomTokenAbi,
|
|
207
|
+
functionName: "redemptionGateway"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
address: withdrawalPhantomToken,
|
|
211
|
+
abi: securitizeRedemptionPhantomTokenAbi,
|
|
212
|
+
functionName: "stableCoinToken"
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
const redeemers = await anvil.readContract({
|
|
217
|
+
address: redemptionGateway,
|
|
218
|
+
abi: securitizeRedemptionGatewayAbi,
|
|
219
|
+
functionName: "getRedeemers",
|
|
220
|
+
args: [creditAccount]
|
|
221
|
+
});
|
|
222
|
+
logger?.debug(
|
|
223
|
+
`securitize: gateway ${redemptionGateway}, stablecoin ${stableCoinToken}, ${redeemers.length} redeemers`
|
|
224
|
+
);
|
|
225
|
+
if (redeemers.length === 0) {
|
|
226
|
+
logger?.warn(
|
|
227
|
+
`securitize: no redeemers found for credit account ${creditAccount}`
|
|
228
|
+
);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const redeemer = redeemers[0];
|
|
232
|
+
const [redemptionValue, redeemerBalance] = await anvil.multicall({
|
|
233
|
+
allowFailure: false,
|
|
234
|
+
contracts: [
|
|
235
|
+
{
|
|
236
|
+
address: redeemer,
|
|
237
|
+
abi: securitizeRedeemerAbi,
|
|
238
|
+
functionName: "getCurrentRedemptionValue"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
address: stableCoinToken,
|
|
242
|
+
abi: erc20Abi,
|
|
243
|
+
functionName: "balanceOf",
|
|
244
|
+
args: [redeemer]
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
});
|
|
248
|
+
logger?.debug(
|
|
249
|
+
`securitize: dealing ${redemptionValue} of stablecoin ${stableCoinToken} to redeemer ${redeemer}`
|
|
250
|
+
);
|
|
251
|
+
await anvil.deal({
|
|
252
|
+
erc20: stableCoinToken,
|
|
253
|
+
account: redeemer,
|
|
254
|
+
amount: redeemerBalance + redemptionValue
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
export {
|
|
258
|
+
makePendingWithdrawalsClaimable
|
|
259
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { iTumblerV310Abi } from "../../../abi/310/generated.js";
|
|
2
|
+
import { AbstractFactory } from "./abstract-factory.js";
|
|
3
|
+
const abi = iTumblerV310Abi;
|
|
4
|
+
class RateKeeperFactory extends AbstractFactory {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(abi);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
RateKeeperFactory
|
|
11
|
+
};
|
|
@@ -27,6 +27,7 @@ import { CreditFactory } from "./factory/credit-factory.js";
|
|
|
27
27
|
import { LossPolicyFactory } from "./factory/loss-policy-factory.js";
|
|
28
28
|
import { PoolFactory } from "./factory/pool-factory.js";
|
|
29
29
|
import { PriceOracleFactory } from "./factory/price-oracle-factory.js";
|
|
30
|
+
import { RateKeeperFactory } from "./factory/rate-keeper-factory.js";
|
|
30
31
|
import { AddressProviderContract } from "./index.js";
|
|
31
32
|
const PERIPHERY_DOMAINS = ["ZAPPER", "DEGEN_NFT"];
|
|
32
33
|
const abi = iMarketConfiguratorV310Abi;
|
|
@@ -35,12 +36,14 @@ class MarketConfiguratorContract extends BaseContract {
|
|
|
35
36
|
poolFactory;
|
|
36
37
|
priceOracleFactory;
|
|
37
38
|
lossPolicyFactory;
|
|
39
|
+
rateKeeperFactory;
|
|
38
40
|
constructor(addr, client) {
|
|
39
41
|
super({ client }, { abi, addr, name: "MarketConfigurator" });
|
|
40
42
|
this.creditFactory = new CreditFactory();
|
|
41
43
|
this.poolFactory = new PoolFactory();
|
|
42
44
|
this.priceOracleFactory = new PriceOracleFactory();
|
|
43
45
|
this.lossPolicyFactory = new LossPolicyFactory();
|
|
46
|
+
this.rateKeeperFactory = new RateKeeperFactory();
|
|
44
47
|
}
|
|
45
48
|
async getAddressProvider() {
|
|
46
49
|
const addressProvider = await this.contract.read.addressProvider();
|
|
@@ -698,6 +701,14 @@ class MarketConfiguratorContract extends BaseContract {
|
|
|
698
701
|
data: json_stringify(decoded)
|
|
699
702
|
};
|
|
700
703
|
}
|
|
704
|
+
case "configureRateKeeper": {
|
|
705
|
+
const [pool, calldata] = args;
|
|
706
|
+
const decoded = this.rateKeeperFactory.decodeConfig(calldata);
|
|
707
|
+
return {
|
|
708
|
+
pool,
|
|
709
|
+
data: json_stringify(decoded)
|
|
710
|
+
};
|
|
711
|
+
}
|
|
701
712
|
case "updateInterestRateModel": {
|
|
702
713
|
const [pool, deployParams] = args;
|
|
703
714
|
return {
|