@gearbox-protocol/sdk 18.4.1-aave.4 → 18.4.1-aave.6
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/iSecuritizeRWAFactory.js +15 -0
- package/dist/cjs/onchain/accounts/intents/plan.js +8 -2
- package/dist/cjs/onchain/accounts/intents/realize.js +9 -4
- package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +10 -3
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +1 -0
- package/dist/esm/abi/rwa/iSecuritizeRWAFactory.js +15 -0
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/history/trace/extractTransfers.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/intents/plan.js +8 -2
- package/dist/esm/onchain/accounts/intents/realize.js +9 -4
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +10 -3
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/onchain/market/rwa/createDegenNFT.js +1 -1
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/preview/preview/previewPoolPositionOperation.js +2 -2
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/sdk/prepare/PrepareApi.js +1 -0
- package/dist/types/abi/rwa/iSecuritizeRWAFactory.d.ts +14 -0
- package/dist/types/onchain/accounts/intents/plan.d.ts +8 -4
- package/dist/types/onchain/accounts/intents/types.d.ts +5 -1
- package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +5 -1
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +20 -0
- package/dist/types/onchain/market/rwa/types.d.ts +6 -0
- package/dist/types/sdk/prepare/types.d.ts +13 -3
- package/package.json +1 -1
|
@@ -79,6 +79,21 @@ const iSecuritizeRWAFactoryAbi = [
|
|
|
79
79
|
}],
|
|
80
80
|
stateMutability: "view"
|
|
81
81
|
},
|
|
82
|
+
{
|
|
83
|
+
type: "function",
|
|
84
|
+
name: "isAllowedBot",
|
|
85
|
+
inputs: [{
|
|
86
|
+
name: "bot",
|
|
87
|
+
type: "address",
|
|
88
|
+
internalType: "address"
|
|
89
|
+
}],
|
|
90
|
+
outputs: [{
|
|
91
|
+
name: "",
|
|
92
|
+
type: "bool",
|
|
93
|
+
internalType: "bool"
|
|
94
|
+
}],
|
|
95
|
+
stateMutability: "view"
|
|
96
|
+
},
|
|
82
97
|
{
|
|
83
98
|
type: "function",
|
|
84
99
|
name: "isCreditAccount",
|
|
@@ -112,7 +112,7 @@ function planRepay(intent, view) {
|
|
|
112
112
|
*
|
|
113
113
|
* Aave lends the debt plus the {@link SETTLE_MARGIN} headroom, since the facade
|
|
114
114
|
* is told to repay everything outstanding by the time the transaction lands;
|
|
115
|
-
* what it does not take
|
|
115
|
+
* what it does not take goes to `to`.
|
|
116
116
|
*/
|
|
117
117
|
function planMoveToAave(intent, view) {
|
|
118
118
|
const { claimable } = intent;
|
|
@@ -137,8 +137,14 @@ function planMoveToAave(intent, view) {
|
|
|
137
137
|
token: intent.token,
|
|
138
138
|
borrow: withMargin(view.debt)
|
|
139
139
|
},
|
|
140
|
+
...view.rwaAsset ? [convert(view.rwaAsset, view.underlying, RAISED)] : [],
|
|
140
141
|
clearQuotas(),
|
|
141
|
-
repay(view.debt)
|
|
142
|
+
repay(view.debt),
|
|
143
|
+
{
|
|
144
|
+
kind: "sweep",
|
|
145
|
+
to: intent.to,
|
|
146
|
+
token: view.underlying
|
|
147
|
+
}
|
|
142
148
|
];
|
|
143
149
|
}
|
|
144
150
|
/**
|
|
@@ -330,8 +330,9 @@ async function realize(steps, props) {
|
|
|
330
330
|
break;
|
|
331
331
|
case "sweep": {
|
|
332
332
|
withdrawsCollateral = true;
|
|
333
|
+
const swept = (token) => !step.token || require_onchain_accounts_intents_utils_common.eq(token, step.token) || rwaAsset !== void 0 && require_onchain_accounts_intents_utils_common.eq(step.token, underlying) && require_onchain_accounts_intents_utils_common.eq(token, rwaAsset);
|
|
333
334
|
const wrapped = ledger.balanceOf(underlying);
|
|
334
|
-
if (rwaAsset && wrapped > 0n) push(await require_onchain_accounts_intents_operations.buildUnwrapRwaCollateralOperation({
|
|
335
|
+
if (rwaAsset && wrapped > 0n && swept(underlying)) push(await require_onchain_accounts_intents_operations.buildUnwrapRwaCollateralOperation({
|
|
335
336
|
tokenIn: underlying,
|
|
336
337
|
all: true,
|
|
337
338
|
amountIn: wrapped,
|
|
@@ -341,6 +342,7 @@ async function realize(steps, props) {
|
|
|
341
342
|
sdk
|
|
342
343
|
}));
|
|
343
344
|
for (const { token, balance } of ledger.snapshot().assets) {
|
|
345
|
+
if (!swept(token)) continue;
|
|
344
346
|
const withdrawal = require_onchain_accounts_intents_operations.buildWithdrawCollateralOperation({
|
|
345
347
|
token,
|
|
346
348
|
amount: balance,
|
|
@@ -371,16 +373,19 @@ async function realize(steps, props) {
|
|
|
371
373
|
const aToken = await aavePoolAdapter(sdk, suite, step.token).aToken(step.token);
|
|
372
374
|
const aTokenAmount = ledger.balanceOf(aToken);
|
|
373
375
|
assertHolds(aToken, aTokenAmount, "aaveOpenPosition");
|
|
376
|
+
const debtToken = rwaAsset ?? underlying;
|
|
377
|
+
const borrowAmount = require_onchain_accounts_intents_utils_common.toTargetDecimals(step.borrow, underlying, debtToken, sdk);
|
|
374
378
|
push(require_onchain_accounts_intents_operations.buildAaveOpenPositionOperation({
|
|
375
379
|
adapter: aaveBridgeAdapter(sdk, suite, step.token, {
|
|
376
380
|
aToken,
|
|
377
|
-
debtToken
|
|
381
|
+
debtToken
|
|
378
382
|
}),
|
|
379
383
|
aToken,
|
|
380
384
|
aTokenAmount,
|
|
381
|
-
debtToken
|
|
382
|
-
borrowAmount
|
|
385
|
+
debtToken,
|
|
386
|
+
borrowAmount
|
|
383
387
|
}));
|
|
388
|
+
raised = borrowAmount;
|
|
384
389
|
break;
|
|
385
390
|
}
|
|
386
391
|
}
|
|
@@ -13,6 +13,7 @@ let viem = require("viem");
|
|
|
13
13
|
const abi = require_onchain_market_adapters_abi_adapters_iAaveHorizonBridgeAdapter.iAaveHorizonBridgeAdapterAbi;
|
|
14
14
|
const protocolAbi = require_onchain_market_adapters_abi_aave_iAaveHorizonBridge.iAaveHorizonBridgeAbi;
|
|
15
15
|
const FINALIZER_BOT_TYPE = (0, viem.stringToHex)("BOT::AAVE_HORIZON_FINALIZER", { size: 32 });
|
|
16
|
+
const SECURITIZE_FINALIZER_BOT_TYPE = (0, viem.stringToHex)("BOT::AAVE_HORIZON_SECURITIZE", { size: 32 });
|
|
16
17
|
/**
|
|
17
18
|
* The bridge a finalizer bot serves, from its `serialize()`:
|
|
18
19
|
* `abi.encode(pool, bridge)`. `undefined` where the bot did not serialize.
|
|
@@ -123,17 +124,23 @@ var AaveHorizonBridgeAdapterContract = class extends require_onchain_market_adap
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
/**
|
|
126
|
-
* Every account on this credit manager is finished by
|
|
127
|
+
* Every account on this credit manager is finished by a Horizon finalizer
|
|
127
128
|
* bot a block after its own transaction, so opening one grants the bot its
|
|
128
129
|
* permissions. The bot is the one the market configurator lists among its
|
|
129
130
|
* periphery contracts for this adapter's bridge, the latest version where
|
|
130
131
|
* there are several; nothing where it lists none.
|
|
132
|
+
*
|
|
133
|
+
* An account opened through an RWA factory belongs to the factory's wallet,
|
|
134
|
+
* which needs the Securitize finalizer and grants only the bots the factory
|
|
135
|
+
* allows; nothing where it does not allow that bot.
|
|
131
136
|
*/
|
|
132
137
|
async openingCalls() {
|
|
133
138
|
const { configurator } = this.sdk.marketRegister.findByCreditManager(this.creditManager);
|
|
134
|
-
const
|
|
139
|
+
const { creditFacade, rwaFactory } = this.sdk.marketRegister.findCreditManager(this.creditManager);
|
|
140
|
+
const botType = rwaFactory ? SECURITIZE_FINALIZER_BOT_TYPE : FINALIZER_BOT_TYPE;
|
|
141
|
+
const [bot] = (await this.sdk.accounts.bots.getMarketBots(configurator.address)).filter(({ baseParams }) => require_onchain_utils_hex.hexEq(baseParams.contractType, botType) && require_onchain_utils_hex.hexEq(finalizerBridge(baseParams.serializedParams), this.bridge)).sort((a, b) => Number(b.baseParams.version - a.baseParams.version));
|
|
135
142
|
if (!bot) return [];
|
|
136
|
-
|
|
143
|
+
if (rwaFactory && !await rwaFactory.isAllowedBot(bot.baseParams.addr)) return [];
|
|
137
144
|
return [creditFacade.prepareSetBotPermissions(bot.baseParams.addr, bot.requiredPermissions)];
|
|
138
145
|
}
|
|
139
146
|
stateHuman(raw) {
|
|
@@ -167,6 +167,15 @@ var SecuritizeRWAFactory = class extends require_onchain_base_BaseContract.BaseC
|
|
|
167
167
|
return this.contract.read.getWallet([creditAccount]);
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
|
+
* {@inheritDoc IRWAFactory.isAllowedBot}
|
|
171
|
+
*
|
|
172
|
+
* Factories below 3.12 keep no allowlist, and their wallets reject every bot.
|
|
173
|
+
*/
|
|
174
|
+
async isAllowedBot(bot) {
|
|
175
|
+
if (this.version < 312) return false;
|
|
176
|
+
return this.contract.read.isAllowedBot([bot]);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
170
179
|
* {@inheritDoc IRWAFactory.multicall}
|
|
171
180
|
*/
|
|
172
181
|
multicall(creditAccount, calls, args) {
|
|
@@ -398,6 +398,7 @@ var PrepareApi = class extends require_onchain_base_MultichainConstruct.Multicha
|
|
|
398
398
|
return this.#startIntent(position, {}, {
|
|
399
399
|
type: "MOVE_TO_AAVE",
|
|
400
400
|
token: params.token,
|
|
401
|
+
to: params.to,
|
|
401
402
|
claimable: params.claimable && toClaimableWithdrawal(params.claimable)
|
|
402
403
|
});
|
|
403
404
|
}
|
|
@@ -78,6 +78,21 @@ const iSecuritizeRWAFactoryAbi = [
|
|
|
78
78
|
}],
|
|
79
79
|
stateMutability: "view"
|
|
80
80
|
},
|
|
81
|
+
{
|
|
82
|
+
type: "function",
|
|
83
|
+
name: "isAllowedBot",
|
|
84
|
+
inputs: [{
|
|
85
|
+
name: "bot",
|
|
86
|
+
type: "address",
|
|
87
|
+
internalType: "address"
|
|
88
|
+
}],
|
|
89
|
+
outputs: [{
|
|
90
|
+
name: "",
|
|
91
|
+
type: "bool",
|
|
92
|
+
internalType: "bool"
|
|
93
|
+
}],
|
|
94
|
+
stateMutability: "view"
|
|
95
|
+
},
|
|
81
96
|
{
|
|
82
97
|
type: "function",
|
|
83
98
|
name: "isCreditAccount",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
|
|
2
1
|
import { ierc20Abi } from "../abi/iERC20.js";
|
|
2
|
+
import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
|
|
3
3
|
import { AddressMap } from "../onchain/utils/AddressMap.js";
|
|
4
4
|
import { AddressSet } from "../onchain/utils/AddressSet.js";
|
|
5
5
|
import { AssetsMap } from "../onchain/utils/AssetsMap.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
1
2
|
import { getNetworkType } from "../onchain/chain/chains.js";
|
|
2
3
|
import { getWithdrawalCompressorAddress } from "../onchain/accounts/withdrawal-compressor/addresses.js";
|
|
3
|
-
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import "../onchain/index.js";
|
|
5
5
|
import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
|
|
6
6
|
import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
|
|
2
1
|
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
|
+
import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
|
|
3
3
|
import { AddressMap } from "../../onchain/utils/AddressMap.js";
|
|
4
4
|
import "../../onchain/index.js";
|
|
5
5
|
import { UnexpectedFacadeEventOrderError } from "./errors.js";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
2
|
+
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
1
3
|
import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
|
|
2
4
|
import { ADDRESS_0X0 } from "../constants/addresses.js";
|
|
3
5
|
import { MAX_UINT256 } from "../constants/math.js";
|
|
@@ -8,8 +10,6 @@ import "../base/index.js";
|
|
|
8
10
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
9
11
|
import "./bots/index.js";
|
|
10
12
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
11
|
-
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
12
|
-
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
13
13
|
import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
|
|
14
14
|
import "../market/index.js";
|
|
15
15
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
@@ -111,7 +111,7 @@ function planRepay(intent, view) {
|
|
|
111
111
|
*
|
|
112
112
|
* Aave lends the debt plus the {@link SETTLE_MARGIN} headroom, since the facade
|
|
113
113
|
* is told to repay everything outstanding by the time the transaction lands;
|
|
114
|
-
* what it does not take
|
|
114
|
+
* what it does not take goes to `to`.
|
|
115
115
|
*/
|
|
116
116
|
function planMoveToAave(intent, view) {
|
|
117
117
|
const { claimable } = intent;
|
|
@@ -136,8 +136,14 @@ function planMoveToAave(intent, view) {
|
|
|
136
136
|
token: intent.token,
|
|
137
137
|
borrow: withMargin(view.debt)
|
|
138
138
|
},
|
|
139
|
+
...view.rwaAsset ? [convert(view.rwaAsset, view.underlying, RAISED)] : [],
|
|
139
140
|
clearQuotas(),
|
|
140
|
-
repay(view.debt)
|
|
141
|
+
repay(view.debt),
|
|
142
|
+
{
|
|
143
|
+
kind: "sweep",
|
|
144
|
+
to: intent.to,
|
|
145
|
+
token: view.underlying
|
|
146
|
+
}
|
|
141
147
|
];
|
|
142
148
|
}
|
|
143
149
|
/**
|
|
@@ -329,8 +329,9 @@ async function realize(steps, props) {
|
|
|
329
329
|
break;
|
|
330
330
|
case "sweep": {
|
|
331
331
|
withdrawsCollateral = true;
|
|
332
|
+
const swept = (token) => !step.token || eq(token, step.token) || rwaAsset !== void 0 && eq(step.token, underlying) && eq(token, rwaAsset);
|
|
332
333
|
const wrapped = ledger.balanceOf(underlying);
|
|
333
|
-
if (rwaAsset && wrapped > 0n) push(await buildUnwrapRwaCollateralOperation({
|
|
334
|
+
if (rwaAsset && wrapped > 0n && swept(underlying)) push(await buildUnwrapRwaCollateralOperation({
|
|
334
335
|
tokenIn: underlying,
|
|
335
336
|
all: true,
|
|
336
337
|
amountIn: wrapped,
|
|
@@ -340,6 +341,7 @@ async function realize(steps, props) {
|
|
|
340
341
|
sdk
|
|
341
342
|
}));
|
|
342
343
|
for (const { token, balance } of ledger.snapshot().assets) {
|
|
344
|
+
if (!swept(token)) continue;
|
|
343
345
|
const withdrawal = buildWithdrawCollateralOperation({
|
|
344
346
|
token,
|
|
345
347
|
amount: balance,
|
|
@@ -370,16 +372,19 @@ async function realize(steps, props) {
|
|
|
370
372
|
const aToken = await aavePoolAdapter(sdk, suite, step.token).aToken(step.token);
|
|
371
373
|
const aTokenAmount = ledger.balanceOf(aToken);
|
|
372
374
|
assertHolds(aToken, aTokenAmount, "aaveOpenPosition");
|
|
375
|
+
const debtToken = rwaAsset ?? underlying;
|
|
376
|
+
const borrowAmount = toTargetDecimals(step.borrow, underlying, debtToken, sdk);
|
|
373
377
|
push(buildAaveOpenPositionOperation({
|
|
374
378
|
adapter: aaveBridgeAdapter(sdk, suite, step.token, {
|
|
375
379
|
aToken,
|
|
376
|
-
debtToken
|
|
380
|
+
debtToken
|
|
377
381
|
}),
|
|
378
382
|
aToken,
|
|
379
383
|
aTokenAmount,
|
|
380
|
-
debtToken
|
|
381
|
-
borrowAmount
|
|
384
|
+
debtToken,
|
|
385
|
+
borrowAmount
|
|
382
386
|
}));
|
|
387
|
+
raised = borrowAmount;
|
|
383
388
|
break;
|
|
384
389
|
}
|
|
385
390
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
1
2
|
import { AddressSet } from "../../utils/AddressSet.js";
|
|
2
3
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
3
4
|
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
@@ -19,7 +20,6 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
|
|
|
19
20
|
import "../../market/rwa/securitize/index.js";
|
|
20
21
|
import "../../market/index.js";
|
|
21
22
|
import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
22
|
-
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
23
23
|
import { optimalPartialLiquidation, partialLiquidationParams } from "./partialLiquidation.js";
|
|
24
24
|
import { skipLiquidatableAccount } from "./skipLiquidatableAccount.js";
|
|
25
25
|
import { isAddressEqual } from "viem";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
1
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
2
3
|
import "../../base/index.js";
|
|
3
4
|
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
4
5
|
import "../../../model/index.js";
|
|
5
6
|
import { decodeDelayedIntent } from "./intent-codec.js";
|
|
6
|
-
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
7
7
|
//#region src/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
|
|
8
8
|
const abi = iRedemptionLoggerV310Abi;
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
1
|
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
2
|
+
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
3
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV310Abi;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
1
|
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
2
|
+
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
3
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV311Abi;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
1
2
|
import { encodeDelayedIntent } from "./intent-codec.js";
|
|
2
3
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
|
-
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import { toWithdrawalStatus } from "./types.js";
|
|
5
5
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
|
|
6
6
|
const abi = iWithdrawalCompressorV313Abi;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
2
|
+
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
3
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
1
4
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
2
5
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
3
6
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
4
7
|
import { getAssetType } from "../chain/chains.js";
|
|
5
8
|
import { formatBN } from "../utils/formatter.js";
|
|
6
9
|
import "../utils/index.js";
|
|
7
|
-
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
8
|
-
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
9
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
10
10
|
import { SdkRWADataNotLoadedError } from "../core/errors.js";
|
|
11
11
|
import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
|
|
12
12
|
import { decodeAbiParameters } from "viem";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
1
2
|
import "../constants/address-provider.js";
|
|
2
3
|
import { isV310 } from "../constants/versions.js";
|
|
3
4
|
import "../constants/index.js";
|
|
4
5
|
import { hexEq } from "../utils/hex.js";
|
|
5
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
6
6
|
import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
|
|
7
7
|
//#region src/onchain/core/createAddressProvider.ts
|
|
8
8
|
const OVERRIDE_ADDRESSES = {};
|
|
@@ -12,6 +12,7 @@ import { decodeAbiParameters, decodeFunctionData, encodeFunctionData, stringToHe
|
|
|
12
12
|
const abi = iAaveHorizonBridgeAdapterAbi;
|
|
13
13
|
const protocolAbi = iAaveHorizonBridgeAbi;
|
|
14
14
|
const FINALIZER_BOT_TYPE = stringToHex("BOT::AAVE_HORIZON_FINALIZER", { size: 32 });
|
|
15
|
+
const SECURITIZE_FINALIZER_BOT_TYPE = stringToHex("BOT::AAVE_HORIZON_SECURITIZE", { size: 32 });
|
|
15
16
|
/**
|
|
16
17
|
* The bridge a finalizer bot serves, from its `serialize()`:
|
|
17
18
|
* `abi.encode(pool, bridge)`. `undefined` where the bot did not serialize.
|
|
@@ -122,17 +123,23 @@ var AaveHorizonBridgeAdapterContract = class extends AbstractAdapterContract {
|
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
/**
|
|
125
|
-
* Every account on this credit manager is finished by
|
|
126
|
+
* Every account on this credit manager is finished by a Horizon finalizer
|
|
126
127
|
* bot a block after its own transaction, so opening one grants the bot its
|
|
127
128
|
* permissions. The bot is the one the market configurator lists among its
|
|
128
129
|
* periphery contracts for this adapter's bridge, the latest version where
|
|
129
130
|
* there are several; nothing where it lists none.
|
|
131
|
+
*
|
|
132
|
+
* An account opened through an RWA factory belongs to the factory's wallet,
|
|
133
|
+
* which needs the Securitize finalizer and grants only the bots the factory
|
|
134
|
+
* allows; nothing where it does not allow that bot.
|
|
130
135
|
*/
|
|
131
136
|
async openingCalls() {
|
|
132
137
|
const { configurator } = this.sdk.marketRegister.findByCreditManager(this.creditManager);
|
|
133
|
-
const
|
|
138
|
+
const { creditFacade, rwaFactory } = this.sdk.marketRegister.findCreditManager(this.creditManager);
|
|
139
|
+
const botType = rwaFactory ? SECURITIZE_FINALIZER_BOT_TYPE : FINALIZER_BOT_TYPE;
|
|
140
|
+
const [bot] = (await this.sdk.accounts.bots.getMarketBots(configurator.address)).filter(({ baseParams }) => hexEq(baseParams.contractType, botType) && hexEq(finalizerBridge(baseParams.serializedParams), this.bridge)).sort((a, b) => Number(b.baseParams.version - a.baseParams.version));
|
|
134
141
|
if (!bot) return [];
|
|
135
|
-
|
|
142
|
+
if (rwaFactory && !await rwaFactory.isAllowedBot(bot.baseParams.addr)) return [];
|
|
136
143
|
return [creditFacade.prepareSetBotPermissions(bot.baseParams.addr, bot.requiredPermissions)];
|
|
137
144
|
}
|
|
138
145
|
stateHuman(raw) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
2
1
|
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
2
|
+
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
3
3
|
//#region src/onchain/market/adapters/contracts/AccountMigratorAdapterContract.ts
|
|
4
4
|
const abi = accountMigratorAbi;
|
|
5
5
|
const protocolAbi = accountMigratorAbi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
1
2
|
import { MissingSerializedParamsError } from "../../../base/errors.js";
|
|
2
3
|
import "../../../base/index.js";
|
|
3
|
-
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
4
4
|
import { iERC4626Abi } from "../abi/targetContractAbi.js";
|
|
5
5
|
import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
|
|
6
6
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
1
2
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
2
3
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
4
|
import "../../base/index.js";
|
|
4
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
5
5
|
//#region src/onchain/market/credit/CreditFacadeV310BaseContract.ts
|
|
6
6
|
const abi = [
|
|
7
7
|
...iCreditFacadeV310Abi,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
1
2
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
2
3
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
3
4
|
import { RAY } from "../../constants/math.js";
|
|
@@ -7,7 +8,6 @@ import "../../utils/index.js";
|
|
|
7
8
|
import { SdkRWADataNotLoadedError } from "../../core/errors.js";
|
|
8
9
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
9
10
|
import "../../base/index.js";
|
|
10
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
11
11
|
//#region src/onchain/market/pool/PoolV310Contract.ts
|
|
12
12
|
const abi = [...iPoolV310Abi, ...iPausableAbi];
|
|
13
13
|
var PoolV310Contract = class extends BaseContract {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { iVersionAbi } from "../../../abi/iVersion.js";
|
|
1
2
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
2
3
|
import "../../utils/index.js";
|
|
3
|
-
import { iVersionAbi } from "../../../abi/iVersion.js";
|
|
4
4
|
import { iMidasDegenNFTAbi } from "../../../abi/rwa/iMidasDegenNFT.js";
|
|
5
5
|
import { DEGEN_NFT_MIDAS } from "./midas/constants.js";
|
|
6
6
|
import { MidasDegenNFT } from "./midas/MidasDegenNFT.js";
|
|
@@ -166,6 +166,15 @@ var SecuritizeRWAFactory = class extends BaseContract {
|
|
|
166
166
|
return this.contract.read.getWallet([creditAccount]);
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
|
+
* {@inheritDoc IRWAFactory.isAllowedBot}
|
|
170
|
+
*
|
|
171
|
+
* Factories below 3.12 keep no allowlist, and their wallets reject every bot.
|
|
172
|
+
*/
|
|
173
|
+
async isAllowedBot(bot) {
|
|
174
|
+
if (this.version < 312) return false;
|
|
175
|
+
return this.contract.read.isAllowedBot([bot]);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
169
178
|
* {@inheritDoc IRWAFactory.multicall}
|
|
170
179
|
*/
|
|
171
180
|
multicall(creditAccount, calls, args) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ZapperContract } from "./ZapperContract.js";
|
|
2
1
|
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
|
+
import { ZapperContract } from "./ZapperContract.js";
|
|
3
3
|
//#region src/onchain/market/zapper/IETHZapperContract.ts
|
|
4
4
|
const abi = iethZapperAbi;
|
|
5
5
|
var IETHZapperContract = class extends ZapperContract {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
1
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
2
3
|
import "../../base/index.js";
|
|
3
4
|
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
4
5
|
import "../../../model/index.js";
|
|
5
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
6
6
|
//#region src/onchain/market/zapper/ZapperContract.ts
|
|
7
7
|
/**
|
|
8
8
|
* Base contract for every Gearbox zapper. Specialized zappers (e.g.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
2
1
|
import { ierc20Abi } from "../../../abi/iERC20.js";
|
|
2
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
3
|
+
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
3
4
|
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
4
5
|
import "../../../model/index.js";
|
|
5
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
6
6
|
//#region src/onchain/preview/preview/previewPoolPositionOperation.ts
|
|
7
7
|
function previewRead(operation) {
|
|
8
8
|
switch (operation.operation) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { errorAbis } from "../../../abi/errors.js";
|
|
2
|
-
import { generateCastTraceCall } from "./cast.js";
|
|
3
2
|
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
3
|
+
import { generateCastTraceCall } from "./cast.js";
|
|
4
4
|
import { simulateMulticall } from "./simulateMulticall.js";
|
|
5
5
|
import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
|
|
6
6
|
import { getAction, parseAccount } from "viem/utils";
|
|
@@ -397,6 +397,7 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
397
397
|
return this.#startIntent(position, {}, {
|
|
398
398
|
type: "MOVE_TO_AAVE",
|
|
399
399
|
token: params.token,
|
|
400
|
+
to: params.to,
|
|
400
401
|
claimable: params.claimable && toClaimableWithdrawal(params.claimable)
|
|
401
402
|
});
|
|
402
403
|
}
|
|
@@ -71,6 +71,20 @@ export declare const iSecuritizeRWAFactoryAbi: readonly [{
|
|
|
71
71
|
readonly internalType: "address";
|
|
72
72
|
}];
|
|
73
73
|
readonly stateMutability: "view";
|
|
74
|
+
}, {
|
|
75
|
+
readonly type: "function";
|
|
76
|
+
readonly name: "isAllowedBot";
|
|
77
|
+
readonly inputs: readonly [{
|
|
78
|
+
readonly name: "bot";
|
|
79
|
+
readonly type: "address";
|
|
80
|
+
readonly internalType: "address";
|
|
81
|
+
}];
|
|
82
|
+
readonly outputs: readonly [{
|
|
83
|
+
readonly name: "";
|
|
84
|
+
readonly type: "bool";
|
|
85
|
+
readonly internalType: "bool";
|
|
86
|
+
}];
|
|
87
|
+
readonly stateMutability: "view";
|
|
74
88
|
}, {
|
|
75
89
|
readonly type: "function";
|
|
76
90
|
readonly name: "isCreditAccount";
|
|
@@ -83,12 +83,15 @@ export type Step = {
|
|
|
83
83
|
} |
|
|
84
84
|
/**
|
|
85
85
|
* Hands whatever is left on the account to `to`, each balance in the token it
|
|
86
|
-
* stands in. Only
|
|
87
|
-
* before it happen to leave, which no planner can name in
|
|
86
|
+
* stands in. Only a plan that leaves no debt asks for this: the amounts are
|
|
87
|
+
* whatever the legs before it happen to leave, which no planner can name in
|
|
88
|
+
* advance. `token` limits it to that balance, the underlying of an RWA
|
|
89
|
+
* market leaving as the asset it wraps.
|
|
88
90
|
*/
|
|
89
91
|
{
|
|
90
92
|
kind: "sweep";
|
|
91
93
|
to: Address;
|
|
94
|
+
token?: Address;
|
|
92
95
|
} |
|
|
93
96
|
/**
|
|
94
97
|
* Drops every quota the account holds, in the same transaction and before
|
|
@@ -117,7 +120,8 @@ export type Step = {
|
|
|
117
120
|
} |
|
|
118
121
|
/**
|
|
119
122
|
* Hands every aToken of `token` the account holds to its owner through the
|
|
120
|
-
* Horizon bridge, which borrows `borrow
|
|
123
|
+
* Horizon bridge, which borrows `borrow`, in underlying units, into the
|
|
124
|
+
* account: of the underlying, or of the asset an RWA underlying wraps.
|
|
121
125
|
*/
|
|
122
126
|
{
|
|
123
127
|
kind: "aaveOpenPosition";
|
|
@@ -172,7 +176,7 @@ export declare function planRepay(intent: Omit<RepayStrategyIntent, "type">, vie
|
|
|
172
176
|
*
|
|
173
177
|
* Aave lends the debt plus the {@link SETTLE_MARGIN} headroom, since the facade
|
|
174
178
|
* is told to repay everything outstanding by the time the transaction lands;
|
|
175
|
-
* what it does not take
|
|
179
|
+
* what it does not take goes to `to`.
|
|
176
180
|
*/
|
|
177
181
|
export declare function planMoveToAave(intent: Omit<MoveToAaveIntent, "type">, view: AccountView): Step[];
|
|
178
182
|
/**
|
|
@@ -450,7 +450,9 @@ export interface RepayStrategyIntent {
|
|
|
450
450
|
* borrows the underlying on the owner's behalf into the account, and the loan
|
|
451
451
|
* is repaid in full with its quotas. The bridge borrows the debt plus a 10bps
|
|
452
452
|
* margin for the interest of the blocks still to come; whatever the facade
|
|
453
|
-
* does not take
|
|
453
|
+
* does not take goes to `to`. On an RWA market Aave lends the asset the
|
|
454
|
+
* underlying wraps, which is wrapped before the repayment and the remainder
|
|
455
|
+
* unwrapped again on its way out.
|
|
454
456
|
*
|
|
455
457
|
* The bridge borrows as the owner, so the owner must have delegated credit on
|
|
456
458
|
* the Aave variable debt token to the bridge beforehand.
|
|
@@ -459,6 +461,8 @@ export interface MoveToAaveIntent {
|
|
|
459
461
|
type: "MOVE_TO_AAVE";
|
|
460
462
|
/** RWA collateral on the account, as the Aave pool lists it. */
|
|
461
463
|
token: Address;
|
|
464
|
+
/** Wallet the margin the repayment leaves goes to. */
|
|
465
|
+
to: Address;
|
|
462
466
|
/**
|
|
463
467
|
* Matured mint of `token`, claimed ahead of the supply; what it brings
|
|
464
468
|
* moves along with the balance already on the account.
|
|
@@ -317,11 +317,15 @@ export declare class AaveHorizonBridgeAdapterContract extends AbstractAdapterCon
|
|
|
317
317
|
amount: bigint;
|
|
318
318
|
} | undefined;
|
|
319
319
|
/**
|
|
320
|
-
* Every account on this credit manager is finished by
|
|
320
|
+
* Every account on this credit manager is finished by a Horizon finalizer
|
|
321
321
|
* bot a block after its own transaction, so opening one grants the bot its
|
|
322
322
|
* permissions. The bot is the one the market configurator lists among its
|
|
323
323
|
* periphery contracts for this adapter's bridge, the latest version where
|
|
324
324
|
* there are several; nothing where it lists none.
|
|
325
|
+
*
|
|
326
|
+
* An account opened through an RWA factory belongs to the factory's wallet,
|
|
327
|
+
* which needs the Securitize finalizer and grants only the bots the factory
|
|
328
|
+
* allows; nothing where it does not allow that bot.
|
|
325
329
|
*/
|
|
326
330
|
openingCalls(): Promise<MultiCall[]>;
|
|
327
331
|
stateHuman(raw?: boolean): {
|
|
@@ -82,6 +82,20 @@ declare const abi: readonly [{
|
|
|
82
82
|
readonly internalType: "address";
|
|
83
83
|
}];
|
|
84
84
|
readonly stateMutability: "view";
|
|
85
|
+
}, {
|
|
86
|
+
readonly type: "function";
|
|
87
|
+
readonly name: "isAllowedBot";
|
|
88
|
+
readonly inputs: readonly [{
|
|
89
|
+
readonly name: "bot";
|
|
90
|
+
readonly type: "address";
|
|
91
|
+
readonly internalType: "address";
|
|
92
|
+
}];
|
|
93
|
+
readonly outputs: readonly [{
|
|
94
|
+
readonly name: "";
|
|
95
|
+
readonly type: "bool";
|
|
96
|
+
readonly internalType: "bool";
|
|
97
|
+
}];
|
|
98
|
+
readonly stateMutability: "view";
|
|
85
99
|
}, {
|
|
86
100
|
readonly type: "function";
|
|
87
101
|
readonly name: "isCreditAccount";
|
|
@@ -493,6 +507,12 @@ export declare class SecuritizeRWAFactory extends BaseContract<abi> implements I
|
|
|
493
507
|
* {@inheritDoc IRWAFactory.getWallet}
|
|
494
508
|
*/
|
|
495
509
|
getWallet(creditAccount: Address): Promise<Address>;
|
|
510
|
+
/**
|
|
511
|
+
* {@inheritDoc IRWAFactory.isAllowedBot}
|
|
512
|
+
*
|
|
513
|
+
* Factories below 3.12 keep no allowlist, and their wallets reject every bot.
|
|
514
|
+
*/
|
|
515
|
+
isAllowedBot(bot: Address): Promise<boolean>;
|
|
496
516
|
/**
|
|
497
517
|
* {@inheritDoc IRWAFactory.multicall}
|
|
498
518
|
*/
|
|
@@ -147,6 +147,12 @@ export interface IRWAFactory<T extends RWAFactoryType = RWAFactoryType> extends
|
|
|
147
147
|
* @param creditAccount - credit account address
|
|
148
148
|
**/
|
|
149
149
|
getWallet(creditAccount: Address): Promise<Address>;
|
|
150
|
+
/**
|
|
151
|
+
* Whether the factory's wallets let a multicall grant `bot` permissions;
|
|
152
|
+
* they reject every other `setBotPermissions`.
|
|
153
|
+
* @param bot - bot address
|
|
154
|
+
**/
|
|
155
|
+
isAllowedBot(bot: Address): Promise<boolean>;
|
|
150
156
|
/**
|
|
151
157
|
* Creates a raw transaction to perform operations on a credit account.
|
|
152
158
|
* Similar to {@link CreditFacadeV310Contract.multicall}.
|
|
@@ -397,6 +397,11 @@ export interface RepayStrategyParams extends PrepareOptions {
|
|
|
397
397
|
export interface MoveToAaveParams {
|
|
398
398
|
/** RWA collateral on the account; its whole balance moves to Aave. */
|
|
399
399
|
token: Address;
|
|
400
|
+
/**
|
|
401
|
+
* Wallet the margin the repayment leaves goes to, as the asset on an RWA
|
|
402
|
+
* market.
|
|
403
|
+
**/
|
|
404
|
+
to: Address;
|
|
400
405
|
/**
|
|
401
406
|
* The matured mint of `token`, from `sdk.positions.getCurrentWithdrawals()`:
|
|
402
407
|
* claimed in the same transaction ahead of the supply, so what it brings
|
|
@@ -684,7 +689,10 @@ export interface IOpportunitiesPrepare {
|
|
|
684
689
|
* every credit manager with a Horizon bridge adapter, whichever of the two
|
|
685
690
|
* methods prepared it; the bot is the one the market configurator lists
|
|
686
691
|
* among its periphery contracts for that bridge, and with none listed the
|
|
687
|
-
* opening grants nothing and the move is left to {@link moveToAave}.
|
|
692
|
+
* opening grants nothing and the move is left to {@link moveToAave}. An
|
|
693
|
+
* account opened through an RWA factory gets the Securitize finalizer
|
|
694
|
+
* instead, and only where the factory allows it: its wallet rejects any
|
|
695
|
+
* other bot.
|
|
688
696
|
*
|
|
689
697
|
* The bot borrows the whole Gearbox debt on Aave or reverts, so an opening
|
|
690
698
|
* whose debt is above what Aave lends against the collateral at its LTV is
|
|
@@ -827,8 +835,10 @@ export interface IOpportunitiesPrepare {
|
|
|
827
835
|
* which borrows the underlying on the owner's behalf into the account, and
|
|
828
836
|
* the Gearbox loan is repaid in full with its quotas. Aave lends the debt
|
|
829
837
|
* plus a 10bps margin for the interest still to come; whatever the facade
|
|
830
|
-
* does not take
|
|
831
|
-
*
|
|
838
|
+
* does not take goes to `to`. On an RWA market Aave lends the asset the
|
|
839
|
+
* underlying wraps, which is wrapped before the repayment and unwrapped
|
|
840
|
+
* again on its way to `to`. The state answered is the credit account's:
|
|
841
|
+
* owing nothing, and holding none of the underlying.
|
|
832
842
|
*
|
|
833
843
|
* The bridge borrows as the owner, so the transaction reverts unless the
|
|
834
844
|
* owner has delegated credit on Aave's variable debt token to the bridge;
|