@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,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var withdrawalUtils_exports = {};
|
|
20
|
+
__export(withdrawalUtils_exports, {
|
|
21
|
+
makePendingWithdrawalsClaimable: () => makePendingWithdrawalsClaimable
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(withdrawalUtils_exports);
|
|
24
|
+
var import_viem = require("viem");
|
|
25
|
+
var import_IWithdrawalCompressorV313 = require("../abi/IWithdrawalCompressorV313.js");
|
|
26
|
+
var import_sdk = require("../sdk/index.js");
|
|
27
|
+
var import_withdrawalAbi = require("./withdrawalAbi.js");
|
|
28
|
+
const MIDAS_VAULT_ADMIN = "0x2ACB4BdCbEf02f81BF713b696Ac26390d7f79A12";
|
|
29
|
+
const iVersionAbi = (0, import_viem.parseAbi)([
|
|
30
|
+
"function contractType() external view returns (bytes32)"
|
|
31
|
+
]);
|
|
32
|
+
const iMidasRedemptionVaultExtAbi = (0, import_viem.parseAbi)([
|
|
33
|
+
"function requestRedeemer() external view returns (address)",
|
|
34
|
+
"function safeApproveRequest(uint256 requestId, uint256 newMTokenRate) external"
|
|
35
|
+
]);
|
|
36
|
+
async function makePendingWithdrawalsClaimable(anvil, creditAccount, options) {
|
|
37
|
+
const { logger, timeWarp = false } = options || {};
|
|
38
|
+
const compressor = (0, import_sdk.getWithdrawalCompressorAddress)(
|
|
39
|
+
(0, import_sdk.getNetworkType)(anvil.chain.id)
|
|
40
|
+
);
|
|
41
|
+
if (!compressor) {
|
|
42
|
+
throw new Error(`no withdrawal compressor for chain ${anvil.chain.id}`);
|
|
43
|
+
}
|
|
44
|
+
if (compressor.version !== 313) {
|
|
45
|
+
logger?.warn(
|
|
46
|
+
`withdrawal compressor version is ${compressor.version}, this helper assumes 313`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
const [, pending] = await anvil.readContract({
|
|
50
|
+
address: compressor.address,
|
|
51
|
+
abi: import_IWithdrawalCompressorV313.iWithdrawalCompressorV313Abi,
|
|
52
|
+
functionName: "getCurrentWithdrawals",
|
|
53
|
+
args: [creditAccount]
|
|
54
|
+
});
|
|
55
|
+
logger?.debug(
|
|
56
|
+
`found ${pending.length} pending withdrawals for credit account ${creditAccount}`
|
|
57
|
+
);
|
|
58
|
+
if (pending.length === 0) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (timeWarp) {
|
|
62
|
+
const maxClaimableAt = pending.reduce(
|
|
63
|
+
(max, p) => p.claimableAt > max ? p.claimableAt : max,
|
|
64
|
+
0n
|
|
65
|
+
);
|
|
66
|
+
if (maxClaimableAt > 0n) {
|
|
67
|
+
logger?.debug(`warping time to ${maxClaimableAt + 1n}`);
|
|
68
|
+
await anvil.evmMineDetailed(maxClaimableAt + 1n);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const w of pending) {
|
|
72
|
+
const cType = (0, import_viem.hexToString)(
|
|
73
|
+
await anvil.readContract({
|
|
74
|
+
address: w.withdrawalPhantomToken,
|
|
75
|
+
abi: iVersionAbi,
|
|
76
|
+
functionName: "contractType"
|
|
77
|
+
}),
|
|
78
|
+
{ size: 32 }
|
|
79
|
+
);
|
|
80
|
+
logger?.debug(
|
|
81
|
+
`fulfilling withdrawal in phantom token ${w.withdrawalPhantomToken} with contract type ${cType}`
|
|
82
|
+
);
|
|
83
|
+
switch (cType) {
|
|
84
|
+
case "PHANTOM_TOKEN::MIDAS_REDEMPTION":
|
|
85
|
+
await fulfillMidasWithdrawal(
|
|
86
|
+
anvil,
|
|
87
|
+
creditAccount,
|
|
88
|
+
w.withdrawalPhantomToken,
|
|
89
|
+
logger
|
|
90
|
+
);
|
|
91
|
+
break;
|
|
92
|
+
case "PHANTOM_TOKEN::SECURITIZE_RD":
|
|
93
|
+
await fulfillSecuritizeWithdrawal(
|
|
94
|
+
anvil,
|
|
95
|
+
creditAccount,
|
|
96
|
+
w.withdrawalPhantomToken,
|
|
97
|
+
logger
|
|
98
|
+
);
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
logger?.warn(
|
|
102
|
+
`unsupported withdrawal phantom token type ${cType}, only time warp was applied`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const [claimableAfter, pendingAfter] = await anvil.readContract({
|
|
107
|
+
address: compressor.address,
|
|
108
|
+
abi: import_IWithdrawalCompressorV313.iWithdrawalCompressorV313Abi,
|
|
109
|
+
functionName: "getCurrentWithdrawals",
|
|
110
|
+
args: [creditAccount]
|
|
111
|
+
});
|
|
112
|
+
logger?.debug(
|
|
113
|
+
`after fulfillment: ${claimableAfter.length} claimable, ${pendingAfter.length} still pending withdrawals`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
async function fulfillMidasWithdrawal(anvil, creditAccount, withdrawalPhantomToken, logger) {
|
|
117
|
+
const [gateway, tokenOut] = await anvil.multicall({
|
|
118
|
+
allowFailure: false,
|
|
119
|
+
contracts: [
|
|
120
|
+
{
|
|
121
|
+
address: withdrawalPhantomToken,
|
|
122
|
+
abi: import_withdrawalAbi.midasRedemptionVaultPhantomTokenAbi,
|
|
123
|
+
functionName: "gateway"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
address: withdrawalPhantomToken,
|
|
127
|
+
abi: import_withdrawalAbi.midasRedemptionVaultPhantomTokenAbi,
|
|
128
|
+
functionName: "tokenOut"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
const midasRedemptionVault = await anvil.readContract({
|
|
133
|
+
address: gateway,
|
|
134
|
+
abi: import_withdrawalAbi.midasGatewayAbi,
|
|
135
|
+
functionName: "midasRedemptionVault"
|
|
136
|
+
});
|
|
137
|
+
const [mTokenDataFeed, requestRedeemer, tokenOutDecimals, redeemers] = await anvil.multicall({
|
|
138
|
+
allowFailure: false,
|
|
139
|
+
contracts: [
|
|
140
|
+
{
|
|
141
|
+
address: midasRedemptionVault,
|
|
142
|
+
abi: import_withdrawalAbi.iMidasRedemptionVaultAbi,
|
|
143
|
+
functionName: "mTokenDataFeed"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
address: midasRedemptionVault,
|
|
147
|
+
abi: iMidasRedemptionVaultExtAbi,
|
|
148
|
+
functionName: "requestRedeemer"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
address: tokenOut,
|
|
152
|
+
abi: import_viem.erc20Abi,
|
|
153
|
+
functionName: "decimals"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
address: gateway,
|
|
157
|
+
abi: import_withdrawalAbi.midasGatewayAbi,
|
|
158
|
+
functionName: "pendingRedeemers",
|
|
159
|
+
args: [creditAccount]
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
const mTokenRate = await anvil.readContract({
|
|
164
|
+
address: mTokenDataFeed,
|
|
165
|
+
abi: import_withdrawalAbi.iMidasDataFeedAbi,
|
|
166
|
+
functionName: "getDataInBase18"
|
|
167
|
+
});
|
|
168
|
+
logger?.debug(
|
|
169
|
+
`midas: gateway ${gateway}, vault ${midasRedemptionVault}, tokenOut ${tokenOut}, mToken rate ${mTokenRate}, ${redeemers.length} pending redeemers`
|
|
170
|
+
);
|
|
171
|
+
for (const redeemer of redeemers) {
|
|
172
|
+
const topUp = 1000000n * 10n ** BigInt(tokenOutDecimals);
|
|
173
|
+
const requestRedeemerBalance = await anvil.readContract({
|
|
174
|
+
address: tokenOut,
|
|
175
|
+
abi: import_viem.erc20Abi,
|
|
176
|
+
functionName: "balanceOf",
|
|
177
|
+
args: [requestRedeemer]
|
|
178
|
+
});
|
|
179
|
+
logger?.debug(
|
|
180
|
+
`midas: dealing ${topUp} of tokenOut ${tokenOut} to request redeemer ${requestRedeemer}`
|
|
181
|
+
);
|
|
182
|
+
await anvil.deal({
|
|
183
|
+
erc20: tokenOut,
|
|
184
|
+
account: requestRedeemer,
|
|
185
|
+
amount: requestRedeemerBalance + topUp
|
|
186
|
+
});
|
|
187
|
+
const requestId = await anvil.readContract({
|
|
188
|
+
address: redeemer,
|
|
189
|
+
abi: import_withdrawalAbi.midasRedeemerAbi,
|
|
190
|
+
functionName: "requestId"
|
|
191
|
+
});
|
|
192
|
+
logger?.debug(
|
|
193
|
+
`midas: approving request ${requestId} of redeemer ${redeemer} as vault admin ${MIDAS_VAULT_ADMIN}`
|
|
194
|
+
);
|
|
195
|
+
await anvil.impersonateAccount({ address: MIDAS_VAULT_ADMIN });
|
|
196
|
+
await anvil.setBalance({
|
|
197
|
+
address: MIDAS_VAULT_ADMIN,
|
|
198
|
+
value: (0, import_viem.parseEther)("100")
|
|
199
|
+
});
|
|
200
|
+
await anvil.writeContract({
|
|
201
|
+
chain: anvil.chain,
|
|
202
|
+
address: midasRedemptionVault,
|
|
203
|
+
account: MIDAS_VAULT_ADMIN,
|
|
204
|
+
abi: iMidasRedemptionVaultExtAbi,
|
|
205
|
+
functionName: "safeApproveRequest",
|
|
206
|
+
args: [requestId, mTokenRate]
|
|
207
|
+
});
|
|
208
|
+
await anvil.stopImpersonatingAccount({ address: MIDAS_VAULT_ADMIN });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function fulfillSecuritizeWithdrawal(anvil, creditAccount, withdrawalPhantomToken, logger) {
|
|
212
|
+
const [redemptionGateway, stableCoinToken] = await anvil.multicall({
|
|
213
|
+
allowFailure: false,
|
|
214
|
+
contracts: [
|
|
215
|
+
{
|
|
216
|
+
address: withdrawalPhantomToken,
|
|
217
|
+
abi: import_withdrawalAbi.securitizeRedemptionPhantomTokenAbi,
|
|
218
|
+
functionName: "redemptionGateway"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
address: withdrawalPhantomToken,
|
|
222
|
+
abi: import_withdrawalAbi.securitizeRedemptionPhantomTokenAbi,
|
|
223
|
+
functionName: "stableCoinToken"
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
});
|
|
227
|
+
const redeemers = await anvil.readContract({
|
|
228
|
+
address: redemptionGateway,
|
|
229
|
+
abi: import_withdrawalAbi.securitizeRedemptionGatewayAbi,
|
|
230
|
+
functionName: "getRedeemers",
|
|
231
|
+
args: [creditAccount]
|
|
232
|
+
});
|
|
233
|
+
logger?.debug(
|
|
234
|
+
`securitize: gateway ${redemptionGateway}, stablecoin ${stableCoinToken}, ${redeemers.length} redeemers`
|
|
235
|
+
);
|
|
236
|
+
if (redeemers.length === 0) {
|
|
237
|
+
logger?.warn(
|
|
238
|
+
`securitize: no redeemers found for credit account ${creditAccount}`
|
|
239
|
+
);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const redeemer = redeemers[0];
|
|
243
|
+
const [redemptionValue, redeemerBalance] = await anvil.multicall({
|
|
244
|
+
allowFailure: false,
|
|
245
|
+
contracts: [
|
|
246
|
+
{
|
|
247
|
+
address: redeemer,
|
|
248
|
+
abi: import_withdrawalAbi.securitizeRedeemerAbi,
|
|
249
|
+
functionName: "getCurrentRedemptionValue"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
address: stableCoinToken,
|
|
253
|
+
abi: import_viem.erc20Abi,
|
|
254
|
+
functionName: "balanceOf",
|
|
255
|
+
args: [redeemer]
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
});
|
|
259
|
+
logger?.debug(
|
|
260
|
+
`securitize: dealing ${redemptionValue} of stablecoin ${stableCoinToken} to redeemer ${redeemer}`
|
|
261
|
+
);
|
|
262
|
+
await anvil.deal({
|
|
263
|
+
erc20: stableCoinToken,
|
|
264
|
+
account: redeemer,
|
|
265
|
+
amount: redeemerBalance + redemptionValue
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
269
|
+
0 && (module.exports = {
|
|
270
|
+
makePendingWithdrawalsClaimable
|
|
271
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var rate_keeper_factory_exports = {};
|
|
20
|
+
__export(rate_keeper_factory_exports, {
|
|
21
|
+
RateKeeperFactory: () => RateKeeperFactory
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(rate_keeper_factory_exports);
|
|
24
|
+
var import_generated = require("../../../abi/310/generated.js");
|
|
25
|
+
var import_abstract_factory = require("./abstract-factory.js");
|
|
26
|
+
const abi = import_generated.iTumblerV310Abi;
|
|
27
|
+
class RateKeeperFactory extends import_abstract_factory.AbstractFactory {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(abi);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
RateKeeperFactory
|
|
35
|
+
});
|
|
@@ -32,6 +32,7 @@ var import_credit_factory = require("./factory/credit-factory.js");
|
|
|
32
32
|
var import_loss_policy_factory = require("./factory/loss-policy-factory.js");
|
|
33
33
|
var import_pool_factory = require("./factory/pool-factory.js");
|
|
34
34
|
var import_price_oracle_factory = require("./factory/price-oracle-factory.js");
|
|
35
|
+
var import_rate_keeper_factory = require("./factory/rate-keeper-factory.js");
|
|
35
36
|
var import_index = require("./index.js");
|
|
36
37
|
const PERIPHERY_DOMAINS = ["ZAPPER", "DEGEN_NFT"];
|
|
37
38
|
const abi = import_generated.iMarketConfiguratorV310Abi;
|
|
@@ -40,12 +41,14 @@ class MarketConfiguratorContract extends import_sdk.BaseContract {
|
|
|
40
41
|
poolFactory;
|
|
41
42
|
priceOracleFactory;
|
|
42
43
|
lossPolicyFactory;
|
|
44
|
+
rateKeeperFactory;
|
|
43
45
|
constructor(addr, client) {
|
|
44
46
|
super({ client }, { abi, addr, name: "MarketConfigurator" });
|
|
45
47
|
this.creditFactory = new import_credit_factory.CreditFactory();
|
|
46
48
|
this.poolFactory = new import_pool_factory.PoolFactory();
|
|
47
49
|
this.priceOracleFactory = new import_price_oracle_factory.PriceOracleFactory();
|
|
48
50
|
this.lossPolicyFactory = new import_loss_policy_factory.LossPolicyFactory();
|
|
51
|
+
this.rateKeeperFactory = new import_rate_keeper_factory.RateKeeperFactory();
|
|
49
52
|
}
|
|
50
53
|
async getAddressProvider() {
|
|
51
54
|
const addressProvider = await this.contract.read.addressProvider();
|
|
@@ -703,6 +706,14 @@ class MarketConfiguratorContract extends import_sdk.BaseContract {
|
|
|
703
706
|
data: (0, import_sdk.json_stringify)(decoded)
|
|
704
707
|
};
|
|
705
708
|
}
|
|
709
|
+
case "configureRateKeeper": {
|
|
710
|
+
const [pool, calldata] = args;
|
|
711
|
+
const decoded = this.rateKeeperFactory.decodeConfig(calldata);
|
|
712
|
+
return {
|
|
713
|
+
pool,
|
|
714
|
+
data: (0, import_sdk.json_stringify)(decoded)
|
|
715
|
+
};
|
|
716
|
+
}
|
|
706
717
|
case "updateInterestRateModel": {
|
|
707
718
|
const [pool, deployParams] = args;
|
|
708
719
|
return {
|