@gearbox-protocol/sdk 16.3.0-next.4 → 17.0.0-next.1
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/model/errors/operation-errors.js +1 -1
- package/dist/cjs/model/index.js +2 -2
- package/dist/cjs/model/rwa.js +4 -4
- package/dist/cjs/model/rwa.schema.js +4 -4
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +3 -1
- package/dist/cjs/onchain/accounts/intents/guards.js +4 -4
- package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/cjs/onchain/market/credit/CreditSuite.js +12 -26
- package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +5 -45
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +12 -56
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +37 -0
- package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +2 -8
- package/dist/cjs/onchain/opportunities/OpportunitiesService.js +4 -16
- package/dist/cjs/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +2 -3
- package/dist/cjs/onchain/validation/bundles/checkDraw.js +3 -3
- package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
- package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +5 -6
- package/dist/cjs/onchain/validation/checkSimulation.js +4 -11
- package/dist/cjs/onchain/validation/checks/checkDebtLimits.js +2 -3
- package/dist/cjs/sdk/execute/ExecuteApi.js +2 -2
- package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +3 -9
- 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/model/errors/operation-errors.js +1 -1
- package/dist/esm/model/index.js +3 -3
- package/dist/esm/model/rwa.js +4 -4
- package/dist/esm/model/rwa.schema.js +5 -5
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +5 -3
- package/dist/esm/onchain/accounts/intents/guards.js +4 -4
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +2 -2
- 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/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/credit/CreditSuite.js +12 -26
- 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/midas/MidasDegenNFT.js +5 -45
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +10 -55
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +37 -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/opportunities/MultichainOpportunitiesService.js +2 -8
- package/dist/esm/onchain/opportunities/OpportunitiesService.js +4 -16
- package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
- package/dist/esm/onchain/preview/preview/previewPoolPositionOperation.js +2 -2
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +2 -3
- package/dist/esm/onchain/validation/bundles/checkDraw.js +3 -3
- package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
- package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +5 -6
- package/dist/esm/onchain/validation/checkSimulation.js +4 -11
- package/dist/esm/onchain/validation/checks/checkDebtLimits.js +2 -3
- package/dist/esm/sdk/execute/ExecuteApi.js +2 -2
- package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +3 -9
- package/dist/types/model/errors/operation-errors.d.ts +4 -10
- package/dist/types/model/index.d.ts +3 -3
- package/dist/types/model/opportunities.d.ts +5 -4
- package/dist/types/model/rwa.d.ts +27 -47
- package/dist/types/model/rwa.schema.d.ts +3 -3
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +2 -1
- package/dist/types/offchain/opportunities/types.d.ts +4 -1
- package/dist/types/onchain/accounts/types.d.ts +2 -4
- package/dist/types/onchain/index.d.ts +2 -2
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +3 -8
- package/dist/types/onchain/market/credit/types.d.ts +2 -2
- package/dist/types/onchain/market/index.d.ts +2 -2
- package/dist/types/onchain/market/rwa/index.d.ts +2 -2
- package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +4 -19
- package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +4 -24
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +14 -2
- package/dist/types/onchain/market/rwa/types.d.ts +37 -39
- package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +1 -5
- package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +3 -10
- package/dist/types/onchain/opportunities/types.d.ts +1 -6
- package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +3 -3
- package/dist/types/onchain/validation/checkSimulation.d.ts +3 -6
- package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +0 -4
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -5
- package/dist/types/sdk/opportunities/types.d.ts +3 -9
- package/package.json +1 -1
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import { AddressSet } from "../../../utils/AddressSet.js";
|
|
2
|
-
import "../../../utils/index.js";
|
|
3
1
|
import { BaseContract } from "../../../base/BaseContract.js";
|
|
4
2
|
import "../../../base/index.js";
|
|
5
|
-
import { KYC_REGISTRATION_LINKS } from "../../../../model/rwa.js";
|
|
6
|
-
import "../../../../model/index.js";
|
|
7
3
|
import { DEGEN_NFT_SECURITIZE } from "./constants.js";
|
|
8
4
|
import { iSecuritizeDegenNFTAbi } from "../../../../abi/rwa/iSecuritizeDegenNFT.js";
|
|
5
|
+
import { isAddressEqual } from "viem";
|
|
9
6
|
//#region src/onchain/market/rwa/securitize/SecuritizeDegenNFT.ts
|
|
10
7
|
const abi = iSecuritizeDegenNFTAbi;
|
|
11
|
-
/**
|
|
12
|
-
* Securitize always has a factory, which deploys this NFT. DS-token data,
|
|
13
|
-
* registrars and cached signatures live here; the factory only builds txs
|
|
14
|
-
* and looks up investor/wallet addresses.
|
|
15
|
-
*/
|
|
16
8
|
var SecuritizeDegenNFT = class extends BaseContract {
|
|
17
9
|
protocol = "securitize";
|
|
18
|
-
registrationLink = KYC_REGISTRATION_LINKS.securitize;
|
|
19
10
|
factory;
|
|
20
|
-
#sdk;
|
|
21
11
|
constructor(sdk, address, factory) {
|
|
22
12
|
super(sdk, {
|
|
23
13
|
addr: address,
|
|
@@ -26,54 +16,19 @@ var SecuritizeDegenNFT = class extends BaseContract {
|
|
|
26
16
|
name: "SecuritizeDegenNFT",
|
|
27
17
|
abi
|
|
28
18
|
});
|
|
29
|
-
this.#sdk = sdk;
|
|
30
19
|
this.factory = factory;
|
|
31
20
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
async getOpenAccountRequirements(wallet, props) {
|
|
40
|
-
const tokensToRegister = new AddressSet(this.factory.getTokens()).has(props.tokenOutAddress) ? new AddressSet([props.tokenOutAddress]) : new AddressSet();
|
|
41
|
-
if (tokensToRegister.size === 0) return {
|
|
42
|
-
protocol: "securitize",
|
|
43
|
-
factory: this.factory.address,
|
|
44
|
-
securitizeTokensToRegister: [],
|
|
45
|
-
tokensToRegister: [],
|
|
46
|
-
requiredSignatures: []
|
|
47
|
-
};
|
|
48
|
-
const [investorData] = await this.#sdk.rwa.getInvestorData(wallet, [this.factory.address]);
|
|
49
|
-
const registredTokens = new AddressSet(investorData.registeredTokens);
|
|
50
|
-
const signedTokens = new AddressSet(investorData.cachedSignatures.map((s) => s.token));
|
|
51
|
-
const unsignedTokens = tokensToRegister.difference(signedTokens);
|
|
52
|
-
const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
|
|
53
|
-
const requiredSignatures = investorData.registerVaultMessages.filter((m) => unsignedTokens.has(m.message.token));
|
|
54
|
-
return {
|
|
55
|
-
protocol: "securitize",
|
|
56
|
-
factory: this.factory.address,
|
|
57
|
-
securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
|
|
58
|
-
tokensToRegister: Array.from(tokensToRegister),
|
|
59
|
-
requiredSignatures
|
|
21
|
+
/** Registration on Securitize is the only KYC step; pending EIP-712 signatures are not. */
|
|
22
|
+
async checkKyc(wallet, targetCollateral) {
|
|
23
|
+
const { factory } = this;
|
|
24
|
+
if (!factory.getTokens().some((t) => isAddressEqual(t, targetCollateral))) return {
|
|
25
|
+
eligible: true,
|
|
26
|
+
token: targetCollateral
|
|
60
27
|
};
|
|
61
|
-
|
|
62
|
-
isRegistered(requirements) {
|
|
63
|
-
return requirements.securitizeTokensToRegister.length === 0;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* A required signature is omitted when `providedArgs.signaturesToCache`
|
|
67
|
-
* already carries a signature for the same token: the transaction caches it
|
|
68
|
-
* on-chain as part of the operation.
|
|
69
|
-
*/
|
|
70
|
-
getMissingRequirements(requirements, providedArgs) {
|
|
71
|
-
const providedTokens = new AddressSet((providedArgs?.signaturesToCache ?? []).map((s) => s.token));
|
|
72
|
-
const requiredSignatures = requirements.requiredSignatures.filter((message) => !providedTokens.has(message.message.token));
|
|
73
|
-
if (requiredSignatures.length === 0) return;
|
|
28
|
+
const req = await factory.getOpenAccountRequirements(wallet, { tokenOutAddress: targetCollateral });
|
|
74
29
|
return {
|
|
75
|
-
|
|
76
|
-
|
|
30
|
+
eligible: !req || req.securitizeTokensToRegister.length === 0,
|
|
31
|
+
token: req?.securitizeTokensToRegister[0] ?? targetCollateral
|
|
77
32
|
};
|
|
78
33
|
}
|
|
79
34
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AddressMap } from "../../../utils/AddressMap.js";
|
|
2
|
+
import { AddressSet } from "../../../utils/AddressSet.js";
|
|
2
3
|
import "../../../utils/index.js";
|
|
3
4
|
import { BaseContract } from "../../../base/BaseContract.js";
|
|
4
5
|
import "../../../base/index.js";
|
|
@@ -10,6 +11,7 @@ import { decodeAbiParameters } from "viem";
|
|
|
10
11
|
//#region src/onchain/market/rwa/securitize/SecuritizeRWAFactory.ts
|
|
11
12
|
const abi = iSecuritizeRWAFactoryAbi;
|
|
12
13
|
var SecuritizeRWAFactory = class extends BaseContract {
|
|
14
|
+
#sdk;
|
|
13
15
|
#investorCache = new AddressMap();
|
|
14
16
|
degenNFT;
|
|
15
17
|
owner;
|
|
@@ -21,6 +23,7 @@ var SecuritizeRWAFactory = class extends BaseContract {
|
|
|
21
23
|
name: "SecuritizeRWAFactory",
|
|
22
24
|
abi
|
|
23
25
|
});
|
|
26
|
+
this.#sdk = sdk;
|
|
24
27
|
const decoded = decodeAbiParameters([
|
|
25
28
|
{
|
|
26
29
|
name: "owner",
|
|
@@ -181,6 +184,40 @@ var SecuritizeRWAFactory = class extends BaseContract {
|
|
|
181
184
|
});
|
|
182
185
|
}
|
|
183
186
|
/**
|
|
187
|
+
* {@inheritDoc IRWAFactory.getOpenAccountRequirements}
|
|
188
|
+
*/
|
|
189
|
+
async getOpenAccountRequirements(investor, props) {
|
|
190
|
+
const [investorData] = await this.#sdk.rwa.getInvestorData(investor, [this.address]);
|
|
191
|
+
const tokensToRegister = new AddressSet([props.tokenOutAddress]);
|
|
192
|
+
const registredTokens = new AddressSet(investorData.registeredTokens);
|
|
193
|
+
const signedTokens = new AddressSet(investorData.cachedSignatures.map((s) => s.token));
|
|
194
|
+
const unsignedTokens = tokensToRegister.difference(signedTokens);
|
|
195
|
+
const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
|
|
196
|
+
const requiredSignatures = investorData.registerVaultMessages.filter((m) => unsignedTokens.has(m.message.token));
|
|
197
|
+
return {
|
|
198
|
+
type: RWA_FACTORY_SECURITIZE,
|
|
199
|
+
securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
|
|
200
|
+
tokensToRegister: Array.from(tokensToRegister),
|
|
201
|
+
requiredSignatures
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* {@inheritDoc IRWAFactory.getMissingRequirements}
|
|
206
|
+
*
|
|
207
|
+
* A required signature is omitted when `providedArgs.signaturesToCache`
|
|
208
|
+
* already carries a signature for the same token: the transaction caches it
|
|
209
|
+
* on-chain as part of the operation.
|
|
210
|
+
*/
|
|
211
|
+
getMissingRequirements(requirements, providedArgs) {
|
|
212
|
+
const providedTokens = new AddressSet((providedArgs?.signaturesToCache ?? []).map((s) => s.token));
|
|
213
|
+
const requiredSignatures = requirements.requiredSignatures.filter((message) => !providedTokens.has(message.message.token));
|
|
214
|
+
if (requiredSignatures.length === 0) return;
|
|
215
|
+
return {
|
|
216
|
+
type: RWA_FACTORY_SECURITIZE,
|
|
217
|
+
requiredSignatures
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
184
221
|
* {@inheritDoc IRWAFactory.openCreditAccount}
|
|
185
222
|
*/
|
|
186
223
|
openCreditAccount(creditManager, calls, args) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
1
|
import { ZapperContract } from "./ZapperContract.js";
|
|
2
|
+
import { iethZapperAbi } from "../../../abi/iETHZapper.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";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
4
3
|
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
5
4
|
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.
|
|
@@ -37,18 +37,12 @@ var MultichainOpportunitiesService = class extends MultichainConstruct {
|
|
|
37
37
|
*
|
|
38
38
|
* See {@link MultichainOpportunitiesService.getPool}.
|
|
39
39
|
**/
|
|
40
|
-
async getStrategy(key) {
|
|
40
|
+
async getStrategy(key, wallet) {
|
|
41
41
|
return this.queryChain({
|
|
42
42
|
network: key.chainId,
|
|
43
|
-
run: (sdk) => sdk.opportunities.getStrategy(key)
|
|
43
|
+
run: (sdk) => sdk.opportunities.getStrategy(key, wallet)
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
* {@inheritDoc OpportunitiesService.isEligibleForStrategy}
|
|
48
|
-
**/
|
|
49
|
-
async isEligibleForStrategy(key, wallet) {
|
|
50
|
-
return this.sdk.chain(key.chainId).opportunities.isEligibleForStrategy(key, wallet);
|
|
51
|
-
}
|
|
52
46
|
};
|
|
53
47
|
//#endregion
|
|
54
48
|
export { MultichainOpportunitiesService };
|
|
@@ -36,34 +36,22 @@ var OpportunitiesService = class extends SDKConstruct {
|
|
|
36
36
|
* A single strategy opportunity plus the rate curve of the pool it borrows
|
|
37
37
|
* from and the price feeds its liquidation price depends on.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
39
|
+
* @param wallet - When given, `kyc` says whether this wallet must register
|
|
40
|
+
* with the strategy's KYC provider first; `null` otherwise.
|
|
40
41
|
*
|
|
41
42
|
* @throws If the credit manager is unknown, or does not currently offer a
|
|
42
43
|
* strategy.
|
|
43
44
|
**/
|
|
44
|
-
async getStrategy(key) {
|
|
45
|
+
async getStrategy(key, wallet) {
|
|
45
46
|
const suite = this.sdk.marketRegister.findCreditManager(key.creditManager);
|
|
46
47
|
const detail = suite.strategyOpportunityDetail();
|
|
47
48
|
if (!detail) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
|
|
48
|
-
const kyc = await suite.kycRequirement(detail.targetCollateral.address);
|
|
49
|
+
const kyc = wallet ? await suite.kycRequirement(wallet, detail.targetCollateral.address) : null;
|
|
49
50
|
return {
|
|
50
51
|
...detail,
|
|
51
52
|
kyc
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Whether `wallet` may open this strategy today: `true` when it is not
|
|
56
|
-
* KYC-gated or the wallet already passed the gate.
|
|
57
|
-
*
|
|
58
|
-
* @throws If the credit manager is unknown, or does not currently offer a
|
|
59
|
-
* strategy.
|
|
60
|
-
**/
|
|
61
|
-
async isEligibleForStrategy(key, wallet) {
|
|
62
|
-
const suite = this.sdk.marketRegister.findCreditManager(key.creditManager);
|
|
63
|
-
const opportunity = suite.strategyOpportunity();
|
|
64
|
-
if (!opportunity) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
|
|
65
|
-
return suite.isEligibleForStrategy(wallet, opportunity.targetCollateral.address);
|
|
66
|
-
}
|
|
67
55
|
};
|
|
68
56
|
//#endregion
|
|
69
57
|
export { OpportunitiesService };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hexEq } from "../../utils/hex.js";
|
|
2
2
|
import { AbstractAdapterContract } from "../../market/adapters/contracts/AbstractAdapter.js";
|
|
3
3
|
import { CreditFacadeV310Contract } from "../../market/credit/CreditFacadeV310Contract.js";
|
|
4
|
-
import "../../../model/rwa.js";
|
|
4
|
+
import { RWA_FACTORY_SECURITIZE } from "../../../model/rwa.js";
|
|
5
5
|
import "../../../model/index.js";
|
|
6
6
|
import { isRWAFactory } from "../../market/rwa/types.js";
|
|
7
7
|
import { classifyInnerOperations } from "./classifyInnerOperations.js";
|
|
@@ -32,7 +32,7 @@ function parseSecuritizeOperationCalldata(sdk, factory, calldata) {
|
|
|
32
32
|
const { rawArgs } = parsed;
|
|
33
33
|
const innerCalls = rawArgs.calls ?? [];
|
|
34
34
|
const args = {
|
|
35
|
-
|
|
35
|
+
type: RWA_FACTORY_SECURITIZE,
|
|
36
36
|
tokensToRegister: [...rawArgs.tokensToRegister ?? []],
|
|
37
37
|
signaturesToCache: [...rawArgs.signaturesToCache ?? []]
|
|
38
38
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ierc20Abi } from "../../../abi/iERC20.js";
|
|
2
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
3
1
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
2
|
+
import { ierc20Abi } from "../../../abi/iERC20.js";
|
|
4
3
|
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
5
4
|
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 { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
3
2
|
import { generateCastTraceCall } from "./cast.js";
|
|
3
|
+
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.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";
|
|
@@ -32,8 +32,7 @@ async function checkCreditOperation(args) {
|
|
|
32
32
|
minDebt: suite.creditFacade.minDebt,
|
|
33
33
|
maxDebt: suite.creditFacade.maxDebt,
|
|
34
34
|
underlying,
|
|
35
|
-
allowZero: !isOpening
|
|
36
|
-
maxBorrowAmount: suite.maxBorrowAmount()
|
|
35
|
+
allowZero: !isOpening
|
|
37
36
|
}),
|
|
38
37
|
...checkDraw(suite, preview, underlying),
|
|
39
38
|
...checkObtained(suite, preview),
|
|
@@ -50,7 +49,7 @@ async function checkCreditOperation(args) {
|
|
|
50
49
|
preview,
|
|
51
50
|
sender,
|
|
52
51
|
blockNumber
|
|
53
|
-
}), preview.operation === "
|
|
52
|
+
}), preview.operation === "RWAOpenCreditAccount" ? checkRWAOpening({
|
|
54
53
|
sdk,
|
|
55
54
|
preview,
|
|
56
55
|
sender
|
|
@@ -15,11 +15,11 @@ import "../checks/index.js";
|
|
|
15
15
|
function checkDraw(suite, preview, underlying) {
|
|
16
16
|
const drawn = preview.operation === "AdjustCreditAccount" ? preview.totalDebtChange.value : preview.totalDebt.value;
|
|
17
17
|
if (drawn <= 0n) return [];
|
|
18
|
-
const
|
|
18
|
+
const { value, limit } = suite.maxBorrowAmount();
|
|
19
19
|
return checkBorrowLimit({
|
|
20
20
|
requested: drawn,
|
|
21
|
-
available:
|
|
22
|
-
limit
|
|
21
|
+
available: value,
|
|
22
|
+
limit,
|
|
23
23
|
underlying
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -5,24 +5,24 @@ import { toToken } from "../helpers/token.js";
|
|
|
5
5
|
import "../helpers/index.js";
|
|
6
6
|
//#region src/onchain/validation/bundles/checkRWAOpenRequirements.ts
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The RWA factory is satisfied that `wallet` may open on `token` with the
|
|
9
9
|
* registration args already on the transaction.
|
|
10
10
|
*/
|
|
11
11
|
async function checkRWAOpenRequirements(input) {
|
|
12
12
|
const { sdk, wallet, creditManager, token, providedArgs } = input;
|
|
13
13
|
try {
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const requirements = await sdk.accounts.getOpenAccountRequirements(wallet, creditManager, { tokenOutAddress: token });
|
|
15
|
+
if (!requirements) return [];
|
|
16
|
+
const { rwaFactory } = sdk.marketRegister.findByCreditManager(creditManager);
|
|
17
|
+
if (!rwaFactory) throw new Error(`no RWA factory for credit manager ${creditManager}`);
|
|
18
|
+
const missing = rwaFactory.getMissingRequirements(requirements, providedArgs);
|
|
19
|
+
if (!missing && requirements.securitizeTokensToRegister.length === 0) return [];
|
|
19
20
|
return [rwaOpenRequirementsNotMet({
|
|
20
21
|
token: toToken(sdk, token),
|
|
21
22
|
creditManager,
|
|
22
|
-
|
|
23
|
-
registrationLink: nft.registrationLink,
|
|
23
|
+
factory: rwaFactory.address,
|
|
24
24
|
requirements,
|
|
25
|
-
missing
|
|
25
|
+
...missing === void 0 ? {} : { missing }
|
|
26
26
|
})];
|
|
27
27
|
} catch (cause) {
|
|
28
28
|
return [unexpectedFailure(cause, "read the RWA opening requirements")];
|
|
@@ -2,22 +2,21 @@ import { AddressSet } from "../../utils/AddressSet.js";
|
|
|
2
2
|
import { checkRWAOpenRequirements } from "./checkRWAOpenRequirements.js";
|
|
3
3
|
//#region src/onchain/validation/bundles/checkRWAOpening.ts
|
|
4
4
|
/**
|
|
5
|
-
* Per
|
|
5
|
+
* Per factory-gated token among `collateralAdded ∪ quotas`, whether the
|
|
6
6
|
* borrower still has to register or sign before this opening can land.
|
|
7
7
|
*/
|
|
8
8
|
async function checkRWAOpening(input) {
|
|
9
9
|
const { sdk, preview, sender } = input;
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
12
|
-
const gated = new AddressSet(
|
|
10
|
+
const { rwaFactory } = sdk.marketRegister.findByCreditManager(preview.creditManager);
|
|
11
|
+
if (!rwaFactory) return [];
|
|
12
|
+
const gated = new AddressSet(rwaFactory.getTokens());
|
|
13
13
|
const candidates = new AddressSet([...preview.collateralAdded.map((a) => a.token.address), ...preview.quotas.map((q) => q.token.address)]);
|
|
14
|
-
const providedArgs = preview.operation === "RWAOpenCreditAccount" ? preview.rwaArgs : void 0;
|
|
15
14
|
return (await Promise.all([...candidates].filter((token) => gated.has(token)).map((token) => checkRWAOpenRequirements({
|
|
16
15
|
sdk,
|
|
17
16
|
wallet: sender,
|
|
18
17
|
creditManager: preview.creditManager,
|
|
19
18
|
token,
|
|
20
|
-
providedArgs
|
|
19
|
+
providedArgs: preview.rwaArgs
|
|
21
20
|
})))).flat();
|
|
22
21
|
}
|
|
23
22
|
//#endregion
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { toToken } from "./helpers/token.js";
|
|
2
2
|
import "./helpers/index.js";
|
|
3
3
|
import { checkDebtLimits } from "./checks/checkDebtLimits.js";
|
|
4
|
-
import { checkQuotaCount } from "./checks/checkQuotaCount.js";
|
|
5
4
|
import "./checks/index.js";
|
|
6
5
|
import { checkAccountQuotas } from "./bundles/checkAccountQuotas.js";
|
|
7
6
|
import { checkHealthFactors } from "./bundles/checkHealthFactors.js";
|
|
@@ -27,10 +26,8 @@ import { checkMarket } from "./bundles/checkMarket.js";
|
|
|
27
26
|
* touched. The engine performed all three during the walk, so a simulation that
|
|
28
27
|
* came back `ok` has already passed them.
|
|
29
28
|
*
|
|
30
|
-
* A credit account only
|
|
31
|
-
*
|
|
32
|
-
* before it answers. An opening names its quotas `averageQuota` — the branch
|
|
33
|
-
* the planner already weighed it as.
|
|
29
|
+
* A credit account only: a pool operation has no account to weigh, and the
|
|
30
|
+
* three things its own state decides are read by `prepare` before it answers.
|
|
34
31
|
*/
|
|
35
32
|
function checkSimulation(sdk, input, options = {}) {
|
|
36
33
|
const { state } = input;
|
|
@@ -42,13 +39,9 @@ function checkSimulation(sdk, input, options = {}) {
|
|
|
42
39
|
minDebt: suite.creditFacade.minDebt,
|
|
43
40
|
maxDebt: suite.creditFacade.maxDebt,
|
|
44
41
|
underlying: toToken(sdk, suite.market.pool.underlying),
|
|
45
|
-
allowZero: true
|
|
46
|
-
maxBorrowAmount: suite.maxBorrowAmount()
|
|
42
|
+
allowZero: true
|
|
47
43
|
}),
|
|
48
|
-
...
|
|
49
|
-
count: state.averageQuota.filter((q) => q.balance > 0n).length,
|
|
50
|
-
max: suite.creditManager.maxEnabledTokens
|
|
51
|
-
}) : checkAccountQuotas(suite, state),
|
|
44
|
+
...checkAccountQuotas(suite, state),
|
|
52
45
|
...checkHealthFactors(state, options)
|
|
53
46
|
];
|
|
54
47
|
}
|
|
@@ -5,13 +5,12 @@ import "../helpers/index.js";
|
|
|
5
5
|
//#region src/onchain/validation/checks/checkDebtLimits.ts
|
|
6
6
|
/** A debt the facade would revert on. */
|
|
7
7
|
function checkDebtLimits(args) {
|
|
8
|
-
const { debt, minDebt, maxDebt, underlying, allowZero
|
|
8
|
+
const { debt, minDebt, maxDebt, underlying, allowZero } = args;
|
|
9
9
|
if (!(debt > maxDebt || debt < minDebt && !(allowZero && debt === 0n))) return [];
|
|
10
10
|
return [debtOutOfRange({
|
|
11
11
|
requested: amountOf(underlying, debt),
|
|
12
12
|
minDebt: amountOf(underlying, minDebt),
|
|
13
|
-
maxDebt: amountOf(underlying, maxDebt)
|
|
14
|
-
maxBorrowAmount
|
|
13
|
+
maxDebt: amountOf(underlying, maxDebt)
|
|
15
14
|
})];
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
@@ -73,9 +73,9 @@ async function openTx(sdk, request) {
|
|
|
73
73
|
async function openRwaOptions(sdk, request) {
|
|
74
74
|
if (!request.targetToken) return;
|
|
75
75
|
const requirements = await sdk.accounts.getOpenAccountRequirements(request.wallet, request.creditManager, { tokenOutAddress: request.targetToken });
|
|
76
|
-
if (requirements
|
|
76
|
+
if (!requirements) return;
|
|
77
77
|
return {
|
|
78
|
-
|
|
78
|
+
type: requirements.type,
|
|
79
79
|
tokensToRegister: requirements.tokensToRegister,
|
|
80
80
|
signaturesToCache: request.signaturesToCache ?? []
|
|
81
81
|
};
|
|
@@ -70,21 +70,15 @@ var OpportunitiesNamespace = class extends AbstractNamespace {
|
|
|
70
70
|
/**
|
|
71
71
|
* {@inheritDoc IOpportunitiesBase.getStrategy}
|
|
72
72
|
**/
|
|
73
|
-
async getStrategy(key) {
|
|
73
|
+
async getStrategy(key, wallet) {
|
|
74
74
|
return this.merged("get strategy opportunity", {
|
|
75
75
|
chainIds: [key.chainId],
|
|
76
|
-
fromChain: (source) => source.getStrategy(key),
|
|
77
|
-
fromBackend: (source) => source.getStrategy(key),
|
|
76
|
+
fromChain: (source) => source.getStrategy(key, wallet),
|
|
77
|
+
fromBackend: (source) => source.getStrategy(key, wallet),
|
|
78
78
|
merge: this.merge.strategy
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* {@inheritDoc IOpportunitiesOnchainOnly.isEligibleForStrategy}
|
|
83
|
-
**/
|
|
84
|
-
async isEligibleForStrategy(key, wallet) {
|
|
85
|
-
return this.onchain.isEligibleForStrategy(key, wallet);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
82
|
* {@inheritDoc IOpportunitiesBase.filter}
|
|
89
83
|
**/
|
|
90
84
|
filter(response, filter) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Bps, Token, TokenAmount } from "../primitives.js";
|
|
2
2
|
import { IGearboxError } from "./base.js";
|
|
3
|
-
import { RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements
|
|
4
|
-
import { MaxBorrowAmount } from "../../onchain/market/credit/types.js";
|
|
5
|
-
import "../../onchain/index.js";
|
|
3
|
+
import { RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements } from "../rwa.js";
|
|
6
4
|
import { Address } from "viem";
|
|
7
5
|
//#region src/model/errors/operation-errors.d.ts
|
|
8
6
|
/**
|
|
@@ -84,8 +82,6 @@ interface DebtOutOfRangeError extends IGearboxError {
|
|
|
84
82
|
requested: TokenAmount;
|
|
85
83
|
minDebt: TokenAmount;
|
|
86
84
|
maxDebt: TokenAmount;
|
|
87
|
-
/** What the market will really lend; absent where the raiser only throws. */
|
|
88
|
-
maxBorrowAmount?: MaxBorrowAmount;
|
|
89
85
|
}
|
|
90
86
|
/** {@inheritDoc DebtOutOfRangeError} */
|
|
91
87
|
declare function debtOutOfRange(args: Omit<DebtOutOfRangeError, "code" | "message">): DebtOutOfRangeError;
|
|
@@ -201,19 +197,17 @@ interface InsufficientAllowanceError extends IGearboxError {
|
|
|
201
197
|
/** {@inheritDoc InsufficientAllowanceError} */
|
|
202
198
|
declare function insufficientAllowance(args: Omit<InsufficientAllowanceError, "code" | "message">): InsufficientAllowanceError;
|
|
203
199
|
/**
|
|
204
|
-
* The RWA
|
|
200
|
+
* The RWA factory still wants something from the borrower before this token
|
|
205
201
|
* can be opened on.
|
|
206
202
|
**/
|
|
207
203
|
interface RWAOpenRequirementsError extends IGearboxError {
|
|
208
204
|
code: "rwaOpenRequirementsNotMet";
|
|
209
205
|
token: Token;
|
|
210
206
|
creditManager: Address;
|
|
211
|
-
|
|
212
|
-
/** Where the wallet completes registration with {@link protocol}. */
|
|
213
|
-
registrationLink: string;
|
|
207
|
+
factory: Address;
|
|
214
208
|
/** Always present on the error. */
|
|
215
209
|
requirements: RWAOpenAccountRequirements;
|
|
216
|
-
/** Absent when only issuer-side registration is pending
|
|
210
|
+
/** Absent when only issuer-side registration is pending. */
|
|
217
211
|
missing?: RWAMissingOpenAccountRequirements;
|
|
218
212
|
}
|
|
219
213
|
/** {@inheritDoc RWAOpenRequirementsError} */
|
|
@@ -5,7 +5,7 @@ import { Curator, CuratorName } from "./curators.js";
|
|
|
5
5
|
import { DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedWithdrawCollateralIntent } from "./delayed-intents.js";
|
|
6
6
|
import { IGearboxError } from "./errors/base.js";
|
|
7
7
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./errors/liquidation-errors.js";
|
|
8
|
-
import { KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement,
|
|
8
|
+
import { KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./rwa.js";
|
|
9
9
|
import { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
10
10
|
import { UnpriceableTokenError, unpriceableTokenError } from "./errors/oracle-errors.js";
|
|
11
11
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
|
|
@@ -30,7 +30,7 @@ import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema
|
|
|
30
30
|
import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
|
|
31
31
|
import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
|
|
32
32
|
import { SDKError, SDKResult, SDKReturn, SafeValue, safeValue, sdkErr, sdkOk } from "./result.js";
|
|
33
|
-
import {
|
|
33
|
+
import { kycProtocolSchema, kycRequirementSchema } from "./rwa.schema.js";
|
|
34
34
|
import { PositionClaimableWithdrawal, PositionPendingWithdrawal, PositionWithdrawals, WithdrawalOutputAmount } from "./withdrawals.js";
|
|
35
35
|
import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
|
|
36
|
-
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError,
|
|
36
|
+
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, Notice, NoticeKind, NoticeSubject, OpenNonRWAStrategyPositionPreview, OpenRWAStrategyPositionPreview, OpenStrategyPositionPreview, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAsset, QuotaCountExceededError, QuotaLimitReachedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ResponseMetadata, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycProtocolSchema, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|
|
@@ -591,10 +591,11 @@ interface StrategyOpportunityDetail extends StrategyOpportunity {
|
|
|
591
591
|
**/
|
|
592
592
|
priceFeeds: PriceFeedSummary;
|
|
593
593
|
/**
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
594
|
+
* Registration the wallet passed to `getStrategy` still needs before it may
|
|
595
|
+
* open this strategy. `null` when the strategy is not KYC-gated, when no
|
|
596
|
+
* wallet was given, or when the wallet is already eligible. `undefined`
|
|
597
|
+
* only in `offchain` mode, where the backend does not evaluate it. In
|
|
598
|
+
* `both` mode `kyc` is taken from the chain whenever that leg succeeded.
|
|
598
599
|
**/
|
|
599
600
|
kyc?: KycRequirement | null;
|
|
600
601
|
}
|