@gearbox-protocol/sdk 18.6.0-next.1 → 18.6.0-next.2
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/signatureDegenNFT.js +14 -0
- package/dist/cjs/model/index.js +5 -2
- package/dist/cjs/model/openingApproval.js +1 -0
- package/dist/cjs/model/openingApproval.schema.js +17 -0
- package/dist/cjs/offchain/AbstractOffchainNamespace.js +6 -16
- package/dist/cjs/offchain/errors/OpeningSignerConfigurationError.js +7 -0
- package/dist/cjs/offchain/errors/OpeningSignerError.js +39 -0
- package/dist/cjs/offchain/errors/OpeningSignerQuorumError.js +12 -0
- package/dist/cjs/offchain/errors/OpeningSignerVerificationError.js +18 -0
- package/dist/cjs/offchain/errors/index.js +12 -0
- package/dist/cjs/offchain/index.js +16 -0
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +9 -0
- package/dist/cjs/offchain/opportunities/index.js +4 -0
- package/dist/cjs/offchain/opportunities/openingApproval.js +141 -0
- package/dist/cjs/offchain/opportunities/openingSignerRegistries.js +12 -0
- package/dist/cjs/offchain/transport.js +21 -0
- package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +20 -3
- package/dist/cjs/onchain/accounts/openingApproval.js +72 -0
- package/dist/cjs/onchain/index.js +3 -0
- package/dist/cjs/onchain/market/credit/CreditFacadeV310BaseContract.js +6 -2
- package/dist/cjs/onchain/market/credit/CreditFacadeV310Contract.js +14 -1
- package/dist/cjs/onchain/market/credit/CreditSuite.js +4 -2
- package/dist/cjs/onchain/market/credit/errors.js +18 -0
- package/dist/cjs/onchain/market/credit/index.js +3 -0
- package/dist/cjs/onchain/market/index.js +3 -0
- package/dist/cjs/onchain/preview/parse/parseFacadeOperationCalldata.js +1 -0
- package/dist/cjs/sdk/execute/ExecuteApi.js +20 -3
- package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +1 -1
- package/dist/esm/abi/signatureDegenNFT.js +11 -0
- package/dist/esm/dev/RevolverTransport.js +1 -1
- package/dist/esm/dev/resilientTransport.js +1 -1
- package/dist/esm/model/analytics.schema.js +1 -1
- package/dist/esm/model/index.js +6 -4
- package/dist/esm/model/openingApproval.js +1 -0
- package/dist/esm/model/openingApproval.schema.js +16 -0
- package/dist/esm/offchain/AbstractOffchainNamespace.js +6 -16
- package/dist/esm/offchain/errors/OffchainValidationError.js +1 -1
- package/dist/esm/offchain/errors/OpeningSignerConfigurationError.js +6 -0
- package/dist/esm/offchain/errors/OpeningSignerError.js +34 -0
- package/dist/esm/offchain/errors/OpeningSignerQuorumError.js +11 -0
- package/dist/esm/offchain/errors/OpeningSignerVerificationError.js +17 -0
- package/dist/esm/offchain/errors/index.js +5 -1
- package/dist/esm/offchain/index.js +7 -1
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +9 -0
- package/dist/esm/offchain/opportunities/index.js +4 -1
- package/dist/esm/offchain/opportunities/openingApproval.js +140 -0
- package/dist/esm/offchain/opportunities/openingSignerRegistries.js +11 -0
- package/dist/esm/offchain/transport.js +19 -0
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +21 -4
- package/dist/esm/onchain/accounts/openingApproval.js +71 -0
- package/dist/esm/onchain/chain/chains.js +1 -1
- package/dist/esm/onchain/index.js +3 -2
- package/dist/esm/onchain/market/MarketSuite.js +1 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +6 -2
- package/dist/esm/onchain/market/credit/CreditFacadeV310Contract.js +14 -1
- package/dist/esm/onchain/market/credit/CreditSuite.js +4 -2
- package/dist/esm/onchain/market/credit/errors.js +16 -0
- package/dist/esm/onchain/market/credit/index.js +2 -1
- package/dist/esm/onchain/market/index.js +2 -1
- package/dist/esm/onchain/market/rwa/RWARegistry.js +1 -1
- package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +1 -1
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +1 -1
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +1 -1
- package/dist/esm/onchain/positions/PositionsService.js +1 -1
- package/dist/esm/onchain/preview/parse/parseFacadeOperationCalldata.js +1 -0
- package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +1 -1
- package/dist/esm/onchain/utils/zod.js +1 -1
- package/dist/esm/permissionless/api/configurators/schemas.js +1 -1
- package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +2 -2
- package/dist/esm/permissionless/api/schemas.js +1 -1
- package/dist/esm/permissionless/curator/actions/addAssetActionData.js +1 -1
- package/dist/esm/permissionless/curator/actions/addCollateralTokenActionData.js +1 -1
- package/dist/esm/permissionless/curator/actions/addPeripheryContractActionData.js +1 -1
- package/dist/esm/permissionless/curator/actions/createCreditSuiteActionData.js +1 -1
- package/dist/esm/permissionless/curator/actions/createMarketActionData.js +1 -1
- package/dist/esm/permissionless/curator/actions/creditManagerTargets.js +1 -1
- package/dist/esm/permissionless/curator/actions/deployContractActionData.js +1 -1
- package/dist/esm/permissionless/curator/actions/setPriceFeedActionData.js +1 -1
- package/dist/esm/permissionless/curator/actions/utils/rawAmounts.js +1 -1
- package/dist/esm/permissionless/curator/configurator-actions/setDefaultSplitActionData.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/adapterPluginHelpers.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/curve-v1/getCurveV1Plugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/curve-v1-steth/curveV1StETHPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/erc4626/erc4626AdapterPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/erc4626-referral/erc4626ReferralAdapterPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/mellow-erc4626/mellowErc4626AdapterPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/mellow-wrapper/mellowWrapperAdapterPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/midas-gateway/midasGatewayAdapterPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/midas-issuance/midasIssuanceAdapterPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/midas-redemption/midasRedemptionAdapterPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/securitize-redemption/securitizeRedemptionAdapterPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/adapters/staking-rewards/stakingRewardsPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/irm/linear/linearPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/loss-policies/alias/actions/setAliasActionData.js +1 -1
- package/dist/esm/permissionless/curator/plugins/loss-policies/alias/aliasedLossPolicyPlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/rate-keepers/gauge/gaugePlugin.js +1 -1
- package/dist/esm/permissionless/curator/plugins/rate-keepers/tumbler/tumblerPlugin.js +1 -1
- package/dist/esm/permissionless/curator/rwaPeripherySetup.js +1 -1
- package/dist/esm/permissionless/curator/state/configurator/types.js +1 -1
- package/dist/esm/permissionless/curator/validationSchemas.js +1 -1
- package/dist/esm/sdk/GearboxSDK.js +2 -2
- package/dist/esm/sdk/execute/ExecuteApi.js +21 -4
- package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +1 -1
- package/dist/types/abi/signatureDegenNFT.d.ts +91 -0
- package/dist/types/model/index.d.ts +3 -1
- package/dist/types/model/openingApproval.d.ts +33 -0
- package/dist/types/model/openingApproval.schema.d.ts +11 -0
- package/dist/types/offchain/errors/OpeningSignerConfigurationError.d.ts +4 -0
- package/dist/types/offchain/errors/OpeningSignerError.d.ts +24 -0
- package/dist/types/offchain/errors/OpeningSignerQuorumError.d.ts +6 -0
- package/dist/types/offchain/errors/OpeningSignerVerificationError.d.ts +8 -0
- package/dist/types/offchain/errors/index.d.ts +5 -1
- package/dist/types/offchain/index.d.ts +8 -2
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +2 -0
- package/dist/types/offchain/opportunities/index.d.ts +3 -1
- package/dist/types/offchain/opportunities/openingApproval.d.ts +3 -0
- package/dist/types/offchain/opportunities/openingSignerRegistries.d.ts +3 -0
- package/dist/types/offchain/opportunities/types.d.ts +2 -0
- package/dist/types/offchain/transport.d.ts +2 -0
- package/dist/types/offchain/types.d.ts +12 -0
- package/dist/types/onchain/accounts/CreditAccountsServiceV310.d.ts +4 -1
- package/dist/types/onchain/accounts/liquidations/types.d.ts +3 -3
- package/dist/types/onchain/accounts/openingApproval.d.ts +4 -0
- package/dist/types/onchain/accounts/types.d.ts +4 -0
- package/dist/types/onchain/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +2 -2
- package/dist/types/onchain/index.d.ts +2 -1
- package/dist/types/onchain/market/credit/CreditFacadeV310BaseContract.d.ts +28 -0
- package/dist/types/onchain/market/credit/CreditFacadeV310Contract.d.ts +1 -1
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +2 -2
- package/dist/types/onchain/market/credit/errors.d.ts +11 -0
- package/dist/types/onchain/market/credit/index.d.ts +2 -1
- package/dist/types/onchain/market/credit/types.d.ts +1 -1
- package/dist/types/onchain/market/index.d.ts +2 -1
- package/dist/types/onchain/preview/parse/types-facades.d.ts +1 -0
- package/dist/types/sdk/execute/ExecuteApi.d.ts +2 -1
- package/dist/types/sdk/execute/types.d.ts +8 -1
- package/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { openingSignerResponseSchema } from "../../model/openingApproval.schema.js";
|
|
2
|
+
import { OffchainValidationError } from "../errors/OffchainValidationError.js";
|
|
3
|
+
import { OpeningSignerConfigurationError } from "../errors/OpeningSignerConfigurationError.js";
|
|
4
|
+
import { OpeningSignerError } from "../errors/OpeningSignerError.js";
|
|
5
|
+
import { OpeningSignerQuorumError } from "../errors/OpeningSignerQuorumError.js";
|
|
6
|
+
import { OpeningSignerVerificationError } from "../errors/OpeningSignerVerificationError.js";
|
|
7
|
+
import { readResponseBody } from "../errors/readResponseBody.js";
|
|
8
|
+
import "../errors/index.js";
|
|
9
|
+
import { fetchOffchainResponse, readOffchainJson } from "../transport.js";
|
|
10
|
+
import { defaultOpeningSignerRegistries } from "./openingSignerRegistries.js";
|
|
11
|
+
import { getAddress, hashTypedData, isAddressEqual, recoverAddress } from "viem";
|
|
12
|
+
// src/offchain/opportunities/openingApproval.ts
|
|
13
|
+
const types = { Mint: [
|
|
14
|
+
{
|
|
15
|
+
name: "creditManager",
|
|
16
|
+
type: "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "accountOwner",
|
|
20
|
+
type: "address"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "deadline",
|
|
24
|
+
type: "uint32"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "nonce",
|
|
28
|
+
type: "uint32"
|
|
29
|
+
}
|
|
30
|
+
] };
|
|
31
|
+
function wait(ms, signal) {
|
|
32
|
+
signal.throwIfAborted();
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const abort = () => {
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
reject(signal.reason);
|
|
37
|
+
};
|
|
38
|
+
const timer = setTimeout(() => {
|
|
39
|
+
signal.removeEventListener("abort", abort);
|
|
40
|
+
resolve();
|
|
41
|
+
}, ms);
|
|
42
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async function sign(url, expected, req, signal, timeout) {
|
|
46
|
+
const { chainId, creditManager, accountOwner } = req;
|
|
47
|
+
for (let attempt = 0;; attempt++) {
|
|
48
|
+
const res = await fetchOffchainResponse(url, {
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: { "Content-Type": "application/json" },
|
|
51
|
+
body: JSON.stringify({
|
|
52
|
+
chainId,
|
|
53
|
+
creditManager: getAddress(creditManager),
|
|
54
|
+
accountOwner: getAddress(accountOwner)
|
|
55
|
+
}),
|
|
56
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(timeout)])
|
|
57
|
+
});
|
|
58
|
+
if (!res.ok) {
|
|
59
|
+
const raw = res.headers.get("retry-after");
|
|
60
|
+
const seconds = raw !== null && /^\d+$/.test(raw) ? Number(raw) : void 0;
|
|
61
|
+
const error = OpeningSignerError.fromStatus(url, res.status, await readResponseBody(res), seconds);
|
|
62
|
+
const delay = seconds ?? 1;
|
|
63
|
+
if (res.status !== 503 || attempt === 1 || delay > 300) throw error;
|
|
64
|
+
await wait(delay * 1e3, signal);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const parsed = openingSignerResponseSchema.safeParse(await readOffchainJson(url, res));
|
|
68
|
+
if (!parsed.success) throw new OffchainValidationError(url, parsed.error);
|
|
69
|
+
await verifyResponse(url, parsed.data, expected, req);
|
|
70
|
+
return parsed.data;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function verifyResponse(url, response, expected, req) {
|
|
74
|
+
const { creditManager, accountOwner, chainId } = req;
|
|
75
|
+
const message = {
|
|
76
|
+
creditManager,
|
|
77
|
+
accountOwner,
|
|
78
|
+
nonce: response.nonce,
|
|
79
|
+
deadline: response.deadline
|
|
80
|
+
};
|
|
81
|
+
const digest = hashTypedData({
|
|
82
|
+
domain: {
|
|
83
|
+
name: "SignatureDegenNFT",
|
|
84
|
+
version: "3_10",
|
|
85
|
+
chainId,
|
|
86
|
+
verifyingContract: req.degenNFT
|
|
87
|
+
},
|
|
88
|
+
primaryType: "Mint",
|
|
89
|
+
types,
|
|
90
|
+
message
|
|
91
|
+
});
|
|
92
|
+
if (!isAddressEqual(response.creditManager, creditManager) || !isAddressEqual(response.accountOwner, accountOwner) || !isAddressEqual(response.degenNFT, req.degenNFT) || !isAddressEqual(response.signer, expected) || response.nonce !== req.nonce || response.deadline < Math.floor(Date.now() / 1e3) || digest !== response.digest.toLowerCase()) throw new OpeningSignerVerificationError(url, expected);
|
|
93
|
+
let recovered;
|
|
94
|
+
try {
|
|
95
|
+
recovered = await recoverAddress({
|
|
96
|
+
hash: digest,
|
|
97
|
+
signature: response.signature
|
|
98
|
+
});
|
|
99
|
+
} catch (cause) {
|
|
100
|
+
throw new OpeningSignerVerificationError(url, expected, cause instanceof Error ? cause : void 0);
|
|
101
|
+
}
|
|
102
|
+
if (!isAddressEqual(recovered, expected)) throw new OpeningSignerVerificationError(url, expected);
|
|
103
|
+
}
|
|
104
|
+
async function collectOpeningApproval(req, registries = defaultOpeningSignerRegistries, timeout = 3e4) {
|
|
105
|
+
const eligible = /* @__PURE__ */ new Map();
|
|
106
|
+
for (const registry of registries) {
|
|
107
|
+
if (registry.chainId !== req.chainId || !isAddressEqual(registry.marketConfigurator, req.marketConfigurator)) continue;
|
|
108
|
+
for (const signer of registry.signers) if (req.authorizedSigners.some((a) => isAddressEqual(a, signer.address))) eligible.set(getAddress(signer.address), signer.url);
|
|
109
|
+
}
|
|
110
|
+
if (req.minSignaturesRequired < 1 || eligible.size < req.minSignaturesRequired) throw new OpeningSignerConfigurationError("Insufficient configured authorized opening signers");
|
|
111
|
+
const controller = new AbortController();
|
|
112
|
+
const groups = /* @__PURE__ */ new Map();
|
|
113
|
+
try {
|
|
114
|
+
return await new Promise((resolve, reject) => {
|
|
115
|
+
let pending = eligible.size;
|
|
116
|
+
const failures = [];
|
|
117
|
+
for (const [expected, url] of eligible) sign(url, expected, req, controller.signal, timeout).then(({ digest, signer, degenNFT: _degenNFT, ...entry }) => {
|
|
118
|
+
const key = digest.toLowerCase();
|
|
119
|
+
const group = groups.get(key) ?? /* @__PURE__ */ new Map();
|
|
120
|
+
group.set(signer, entry);
|
|
121
|
+
groups.set(key, group);
|
|
122
|
+
if (group.size === req.minSignaturesRequired) {
|
|
123
|
+
const signatures = [...group].sort(([a], [b]) => BigInt(a) < BigInt(b) ? -1 : 1).map(([, e]) => e);
|
|
124
|
+
resolve({
|
|
125
|
+
chainId: req.chainId,
|
|
126
|
+
degenNFT: req.degenNFT,
|
|
127
|
+
signatures
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}).catch((error) => {
|
|
131
|
+
failures.push(error);
|
|
132
|
+
}).finally(() => {
|
|
133
|
+
if (--pending === 0) reject(failures.length === 1 && eligible.size === 1 ? failures[0] : new OpeningSignerQuorumError(failures, req.minSignaturesRequired));
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
} finally {
|
|
137
|
+
controller.abort();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export { collectOpeningApproval };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/offchain/opportunities/openingSignerRegistries.ts
|
|
2
|
+
/** Default endpoints for ACL-authorized opening signers, grouped by market configurator. */
|
|
3
|
+
const defaultOpeningSignerRegistries = [{
|
|
4
|
+
chainId: 1,
|
|
5
|
+
marketConfigurator: "0x1b265b97eb169fb6668e3258007c3b0242c7bdbe",
|
|
6
|
+
signers: [{
|
|
7
|
+
address: "0x25a116142fE62a9aCE9AeeF09AF1857de44DCd29",
|
|
8
|
+
url: "https://signer.gear-dev.dev/sign"
|
|
9
|
+
}]
|
|
10
|
+
}];
|
|
11
|
+
export { defaultOpeningSignerRegistries };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OffchainInvalidJsonError } from "./errors/OffchainInvalidJsonError.js";
|
|
2
|
+
import { OffchainRequestFailedError } from "./errors/OffchainRequestFailedError.js";
|
|
3
|
+
import "./errors/index.js";
|
|
4
|
+
// src/offchain/transport.ts
|
|
5
|
+
async function fetchOffchainResponse(url, init) {
|
|
6
|
+
try {
|
|
7
|
+
return await fetch(url, init);
|
|
8
|
+
} catch (cause) {
|
|
9
|
+
throw new OffchainRequestFailedError(url, cause);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
async function readOffchainJson(url, response) {
|
|
13
|
+
try {
|
|
14
|
+
return await response.json();
|
|
15
|
+
} catch (cause) {
|
|
16
|
+
throw new OffchainInvalidJsonError(url, response.status, cause);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export { fetchOffchainResponse, readOffchainJson };
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
2
2
|
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
3
|
+
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
3
4
|
import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
|
|
4
5
|
import { ADDRESS_0X0 } from "../constants/addresses.js";
|
|
5
6
|
import { MAX_UINT256 } from "../constants/math.js";
|
|
6
7
|
import { VERSION_RANGE_310 } from "../constants/versions.js";
|
|
7
|
-
import {
|
|
8
|
+
import { openingSignatureParams } from "../../abi/signatureDegenNFT.js";
|
|
8
9
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
9
10
|
import "../base/index.js";
|
|
10
11
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
11
12
|
import "../constants/index.js";
|
|
13
|
+
import { InvalidOpeningApprovalError } from "../market/credit/errors.js";
|
|
12
14
|
import "../market/index.js";
|
|
13
15
|
import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
|
|
14
16
|
import "./bots/index.js";
|
|
15
17
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
16
18
|
import "./credit-account-compressor/index.js";
|
|
17
19
|
import { extractPriceUpdates, extractQuotaTokens, mergePriceUpdates } from "./multicall-utils.js";
|
|
18
|
-
import {
|
|
20
|
+
import { openingApprovalRequirement } from "./openingApproval.js";
|
|
21
|
+
import { encodeAbiParameters, encodeFunctionData, isAddressEqual } from "viem";
|
|
19
22
|
// src/onchain/accounts/CreditAccountsServiceV310.ts
|
|
20
23
|
/**
|
|
21
24
|
* Service for querying and operating on Gearbox credit accounts.
|
|
@@ -153,11 +156,25 @@ var CreditAccountsServiceV310 = class extends SDKConstruct {
|
|
|
153
156
|
return (await this.sdk.marketRegister.findCreditManager(creditManager).degenNFT())?.getOpenAccountRequirements(borrower, props);
|
|
154
157
|
}
|
|
155
158
|
/**
|
|
156
|
-
* {@inheritDoc ICreditAccountsService.
|
|
159
|
+
* {@inheritDoc ICreditAccountsService.getOpeningApprovalRequirement}
|
|
157
160
|
**/
|
|
161
|
+
getOpeningApprovalRequirement(creditManager, accountOwner) {
|
|
162
|
+
return openingApprovalRequirement(this.sdk, creditManager, accountOwner);
|
|
163
|
+
}
|
|
164
|
+
#validateApproval(approval, cm, owner) {
|
|
165
|
+
const facade = this.sdk.marketRegister.findCreditManager(cm).creditFacade;
|
|
166
|
+
if (approval.chainId !== this.sdk.chainId || !isAddressEqual(facade.degenNFT, approval.degenNFT) || !approval.signatures.length || approval.signatures.some((s) => !isAddressEqual(s.creditManager, cm) || !isAddressEqual(s.accountOwner, owner) || s.deadline !== approval.signatures[0].deadline || s.nonce !== approval.signatures[0].nonce)) throw new InvalidOpeningApprovalError("Opening approval does not match account request");
|
|
167
|
+
}
|
|
168
|
+
/** {@inheritDoc ICreditAccountsService.openCA} */
|
|
158
169
|
async openCA(props) {
|
|
159
170
|
const { ethAmount, creditManager, reopenCreditAccount, collateral, permits, debt, withdrawToken, referralCode, to, calls: openPathCalls, callsAfter, minQuota, averageQuota, rwaOptions } = props;
|
|
160
171
|
const cmSuite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
172
|
+
let degenNFTData;
|
|
173
|
+
if (props.openingApproval) {
|
|
174
|
+
if (reopenCreditAccount) throw new InvalidOpeningApprovalError("Cannot attach an opening approval to a reopen");
|
|
175
|
+
this.#validateApproval(props.openingApproval, creditManager, to);
|
|
176
|
+
degenNFTData = encodeAbiParameters(openingSignatureParams, [props.openingApproval.signatures]);
|
|
177
|
+
}
|
|
161
178
|
const cm = cmSuite.creditManager;
|
|
162
179
|
let tokenToWithdraw;
|
|
163
180
|
if (withdrawToken === true) tokenToWithdraw = cm.underlying;
|
|
@@ -176,7 +193,7 @@ var CreditAccountsServiceV310 = class extends SDKConstruct {
|
|
|
176
193
|
];
|
|
177
194
|
calls = [...await cmSuite.openingCalls(), ...calls];
|
|
178
195
|
calls = await this.prependPriceUpdates(cm.address, calls);
|
|
179
|
-
const tx = reopenCreditAccount ? cmSuite.multicallTx(reopenCreditAccount, calls, rwaOptions) : cmSuite.openCreditAccountTx(to, calls, referralCode, rwaOptions);
|
|
196
|
+
const tx = reopenCreditAccount ? cmSuite.multicallTx(reopenCreditAccount, calls, rwaOptions) : cmSuite.openCreditAccountTx(to, calls, referralCode, rwaOptions, degenNFTData);
|
|
180
197
|
tx.value = ethAmount.toString(10);
|
|
181
198
|
return tx;
|
|
182
199
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
2
|
+
import { signatureDegenNFTAbi } from "../../abi/signatureDegenNFT.js";
|
|
3
|
+
import { UnsupportedOpeningApprovalError } from "../market/credit/errors.js";
|
|
4
|
+
import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError, isAddressEqual, parseAbi, stringToHex, zeroAddress } from "viem";
|
|
5
|
+
// src/onchain/accounts/openingApproval.ts
|
|
6
|
+
async function openingApprovalRequirement(sdk, creditManager, accountOwner) {
|
|
7
|
+
const suite = sdk.marketRegister.findCreditManager(creditManager);
|
|
8
|
+
const { degenNFT, version } = suite.creditFacade;
|
|
9
|
+
if (isAddressEqual(degenNFT, zeroAddress)) return { status: "notRequired" };
|
|
10
|
+
const blockNumber = await sdk.client.getBlockNumber({ cacheTime: 0 });
|
|
11
|
+
let contractType;
|
|
12
|
+
try {
|
|
13
|
+
contractType = await sdk.client.readContract({
|
|
14
|
+
blockNumber,
|
|
15
|
+
address: degenNFT,
|
|
16
|
+
abi: iVersionAbi,
|
|
17
|
+
functionName: "contractType"
|
|
18
|
+
});
|
|
19
|
+
} catch (cause) {
|
|
20
|
+
if (cause instanceof BaseError && cause.walk((error) => error instanceof ContractFunctionRevertedError || error instanceof ContractFunctionZeroDataError)) return { status: "notRequired" };
|
|
21
|
+
throw cause;
|
|
22
|
+
}
|
|
23
|
+
if (contractType !== stringToHex("DEGEN_NFT::SIGNATURE", { size: 32 })) return { status: "notRequired" };
|
|
24
|
+
if (version < 311 || suite.rwaFactory) throw new UnsupportedOpeningApprovalError(suite.creditFacade.address);
|
|
25
|
+
const base = {
|
|
26
|
+
address: degenNFT,
|
|
27
|
+
abi: signatureDegenNFTAbi
|
|
28
|
+
};
|
|
29
|
+
const [[, nonce], marketConfigurator, acl, minSignaturesRequired] = await sdk.client.multicall({
|
|
30
|
+
blockNumber,
|
|
31
|
+
allowFailure: false,
|
|
32
|
+
contracts: [
|
|
33
|
+
{
|
|
34
|
+
...base,
|
|
35
|
+
functionName: "openingDeadlines",
|
|
36
|
+
args: [accountOwner, creditManager]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
...base,
|
|
40
|
+
functionName: "marketConfigurator"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
...base,
|
|
44
|
+
functionName: "acl"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
...base,
|
|
48
|
+
functionName: "minSignaturesRequired"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
const authorizedSigners = await sdk.client.readContract({
|
|
53
|
+
blockNumber,
|
|
54
|
+
address: acl,
|
|
55
|
+
abi: parseAbi(["function getRoleHolders(bytes32 role) view returns (address[])"]),
|
|
56
|
+
functionName: "getRoleHolders",
|
|
57
|
+
args: [stringToHex("OPENING_SIGNER", { size: 32 })]
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
status: "signaturesRequired",
|
|
61
|
+
chainId: sdk.chainId,
|
|
62
|
+
creditManager,
|
|
63
|
+
accountOwner,
|
|
64
|
+
degenNFT,
|
|
65
|
+
marketConfigurator,
|
|
66
|
+
nonce: nonce + 1,
|
|
67
|
+
minSignaturesRequired,
|
|
68
|
+
authorizedSigners
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export { openingApprovalRequirement };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
2
2
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
3
|
-
import { z } from "zod/v4";
|
|
4
3
|
import { defineChain } from "viem";
|
|
5
4
|
import { arbitrum, avalanche, base, berachain, bsc, etherlink, hemi, mainnet, megaeth, monad, optimism, plasma, somnia, sonic, worldchain } from "viem/chains";
|
|
5
|
+
import { z } from "zod/v4";
|
|
6
6
|
// src/onchain/chain/chains.ts
|
|
7
7
|
/**
|
|
8
8
|
* Tuple of all network labels the SDK can work with.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ZodAddress, ZodBigInt, ZodHex } from "./utils/zod.js";
|
|
2
1
|
import { AddressMap } from "./utils/AddressMap.js";
|
|
3
2
|
import { AddressSet } from "./utils/AddressSet.js";
|
|
4
3
|
import { AssetsMap } from "./utils/AssetsMap.js";
|
|
@@ -28,6 +27,7 @@ import { hexEq } from "./utils/hex.js";
|
|
|
28
27
|
import { retry } from "./utils/retry.js";
|
|
29
28
|
import { toAddress } from "./utils/toAddress.js";
|
|
30
29
|
import { EXECUTE_BYTES_SELECTOR, collectTraces, findCallTo, findCallWithInput, findExecuteBytes, resolveProtocolCall } from "./utils/trace.js";
|
|
30
|
+
import { ZodAddress, ZodBigInt, ZodHex } from "./utils/zod.js";
|
|
31
31
|
import "./chain/index.js";
|
|
32
32
|
import { generateCastTraceCall, getCastTraceArgs } from "./utils/viem/cast.js";
|
|
33
33
|
import { SimulationError, simulateCall } from "./utils/viem/simulateCall.js";
|
|
@@ -45,6 +45,7 @@ import { VotingContractStatus } from "./base/types.js";
|
|
|
45
45
|
import "./constants/index.js";
|
|
46
46
|
import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
|
|
47
47
|
import { AccountBotsService } from "./accounts/bots/AccountBotsService.js";
|
|
48
|
+
import { InvalidOpeningApprovalError, UnsupportedOpeningApprovalError } from "./market/credit/errors.js";
|
|
48
49
|
import { AdapterType } from "./market/adapters/types.js";
|
|
49
50
|
import { adapterActionAbi, adapterActionSelectors, adapterActionSignatures } from "./market/adapters/abi/actionAbi.js";
|
|
50
51
|
import { erc4626ReferralAdapterAbi } from "./market/adapters/abi/adapters/erc4626ReferralAdapter.js";
|
|
@@ -322,4 +323,4 @@ import { replayMulticall } from "./preview/preview/replayMulticall.js";
|
|
|
322
323
|
import { previewOperation } from "./preview/preview/previewOperation.js";
|
|
323
324
|
import "./utils/viem/index.js";
|
|
324
325
|
import "./validation/index.js";
|
|
325
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, ConstantPriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountState, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FixedRateWindowPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MedianPriceFeedContract, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, buildDelayedStrategyPositionOperationPreview, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMaxQuota, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPartiallyLiquidatable, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, childLogger, classifyCloseOrRepay, classifyCurveOperation, classifyInnerOperations, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectDelayedClaim, detectDelayedOperation, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateClaimableAt, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getDirectTransferToken, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isCloseOrRepay, isDust, isLPPriceFeed, isPhantomToken, isPoolOperation, isPublicNetwork, isRWAFactory, isRWAOperation, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, makeReplayState, maxAmountForQuota, mellowDvvAdapterAbi, midasGreenlistsAccount, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, partialLiquidationParams, percentFmt, pickStrategyTargetCollateral, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, raise, rayToBps, rayToNumber, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, updatableDependencies, usdToNumber, watchBlocksAsync };
|
|
326
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, ConstantPriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountState, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FixedRateWindowPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InvalidOpeningApprovalError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MedianPriceFeedContract, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedOpeningApprovalError, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, buildDelayedStrategyPositionOperationPreview, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMaxQuota, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPartiallyLiquidatable, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, childLogger, classifyCloseOrRepay, classifyCurveOperation, classifyInnerOperations, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectDelayedClaim, detectDelayedOperation, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateClaimableAt, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getDirectTransferToken, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isCloseOrRepay, isDust, isLPPriceFeed, isPhantomToken, isPoolOperation, isPublicNetwork, isRWAFactory, isRWAOperation, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, makeReplayState, maxAmountForQuota, mellowDvvAdapterAbi, midasGreenlistsAccount, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, partialLiquidationParams, percentFmt, pickStrategyTargetCollateral, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, raise, rayToBps, rayToNumber, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, updatableDependencies, usdToNumber, watchBlocksAsync };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { isFilterSet } from "../../model/filters.js";
|
|
2
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
3
2
|
import "../../model/index.js";
|
|
4
3
|
import "../base/index.js";
|
|
5
4
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
6
5
|
import { isRWAToken, isSunsetPool } from "../chain/chains.js";
|
|
7
6
|
import "../utils/index.js";
|
|
7
|
+
import { isFilterSet } from "../../model/filters.js";
|
|
8
8
|
import { matchesOpportunityFilter } from "../../model/opportunities.js";
|
|
9
9
|
import "./credit/index.js";
|
|
10
10
|
import { CreditSuite } from "./credit/CreditSuite.js";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
2
2
|
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
3
|
+
import { openWithDataAbi } from "../../../abi/signatureDegenNFT.js";
|
|
3
4
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
4
5
|
import "../../base/index.js";
|
|
5
6
|
// src/onchain/market/credit/CreditFacadeV310BaseContract.ts
|
|
6
7
|
const abi = [
|
|
7
8
|
...iCreditFacadeV310Abi,
|
|
9
|
+
...openWithDataAbi,
|
|
8
10
|
...iCreditFacadeMulticallV310Abi,
|
|
9
11
|
...iPausableAbi
|
|
10
12
|
];
|
|
@@ -25,7 +27,8 @@ var CreditFacadeV310BaseContract = class extends BaseContract {
|
|
|
25
27
|
return {
|
|
26
28
|
onBehalfOf,
|
|
27
29
|
calls: this.register.parseMultiCallV2([...calls], strict),
|
|
28
|
-
referralCode
|
|
30
|
+
referralCode,
|
|
31
|
+
...params.args.length === 4 ? { degenNFTData: params.args[3] } : {}
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
34
|
case "closeCreditAccount": {
|
|
@@ -61,7 +64,8 @@ var CreditFacadeV310BaseContract = class extends BaseContract {
|
|
|
61
64
|
return [
|
|
62
65
|
this.labelAddress(onBehalfOf),
|
|
63
66
|
this.register.stringifyMultiCall([...calls]).join(", "),
|
|
64
|
-
`${referralCode}
|
|
67
|
+
`${referralCode}`,
|
|
68
|
+
...params.args.length === 4 ? [params.args[3]] : []
|
|
65
69
|
];
|
|
66
70
|
}
|
|
67
71
|
case "closeCreditAccount": {
|
|
@@ -5,6 +5,7 @@ import "../../constants/index.js";
|
|
|
5
5
|
import { fmtBinaryMask, formatBNvalue, formatTimestamp } from "../../utils/formatter.js";
|
|
6
6
|
import "../../utils/index.js";
|
|
7
7
|
import { CreditFacadeV310BaseContract } from "./CreditFacadeV310BaseContract.js";
|
|
8
|
+
import { UnsupportedOpeningApprovalError } from "./errors.js";
|
|
8
9
|
import { encodeFunctionData } from "viem";
|
|
9
10
|
// src/onchain/market/credit/CreditFacadeV310Contract.ts
|
|
10
11
|
var CreditFacadeV310Contract = class extends CreditFacadeV310BaseContract {
|
|
@@ -100,7 +101,19 @@ var CreditFacadeV310Contract = class extends CreditFacadeV310BaseContract {
|
|
|
100
101
|
args: [ca, calls]
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
|
-
openCreditAccount(to, calls, referralCode) {
|
|
104
|
+
openCreditAccount(to, calls, referralCode, degenNFTData) {
|
|
105
|
+
if (degenNFTData !== void 0) {
|
|
106
|
+
if (this.version < 311) throw new UnsupportedOpeningApprovalError(this.address);
|
|
107
|
+
return this.createRawTx({
|
|
108
|
+
functionName: "openCreditAccount",
|
|
109
|
+
args: [
|
|
110
|
+
to,
|
|
111
|
+
calls,
|
|
112
|
+
referralCode,
|
|
113
|
+
degenNFTData
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
104
117
|
return this.createRawTx({
|
|
105
118
|
functionName: "openCreditAccount",
|
|
106
119
|
args: [
|
|
@@ -14,6 +14,7 @@ import { isStrategyCollateral, pickStrategyTargetCollateral } from "./collateral
|
|
|
14
14
|
import createCreditConfigurator from "./createCreditConfigurator.js";
|
|
15
15
|
import createCreditFacade from "./createCreditFacade.js";
|
|
16
16
|
import createCreditManager from "./createCreditManager.js";
|
|
17
|
+
import { UnsupportedOpeningApprovalError } from "./errors.js";
|
|
17
18
|
import { isAddressEqual } from "viem";
|
|
18
19
|
// src/onchain/market/credit/CreditSuite.ts
|
|
19
20
|
/**
|
|
@@ -142,9 +143,10 @@ var CreditSuite = class extends SDKConstruct {
|
|
|
142
143
|
* @param referralCode - Referral code, facade path only.
|
|
143
144
|
* @param rwaOptions - Factory-specific args, ignored on non-RWA markets.
|
|
144
145
|
*/
|
|
145
|
-
openCreditAccountTx(to, calls, referralCode, rwaOptions) {
|
|
146
|
+
openCreditAccountTx(to, calls, referralCode, rwaOptions, degenNFTData) {
|
|
146
147
|
const { rwaFactory } = this;
|
|
147
|
-
|
|
148
|
+
if (degenNFTData && rwaFactory) throw new UnsupportedOpeningApprovalError(this.creditFacade.address);
|
|
149
|
+
return rwaFactory ? rwaFactory.openCreditAccount(this.creditManager.address, calls, rwaOptions) : this.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n, degenNFTData);
|
|
148
150
|
}
|
|
149
151
|
/**
|
|
150
152
|
* Calls to run first in the multicall of a freshly opened account on this
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
// src/onchain/market/credit/errors.ts
|
|
3
|
+
/** The selected opening entry point cannot forward signature data to the NFT. */
|
|
4
|
+
var UnsupportedOpeningApprovalError = class extends BaseError {
|
|
5
|
+
facade;
|
|
6
|
+
name = "UnsupportedOpeningApprovalError";
|
|
7
|
+
constructor(facade) {
|
|
8
|
+
super("Inline opening signatures require a direct v311 or newer credit facade.", { metaMessages: [`Credit facade: ${facade}`] });
|
|
9
|
+
this.facade = facade;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
/** The supplied approval does not apply to the requested account operation. */
|
|
13
|
+
var InvalidOpeningApprovalError = class extends BaseError {
|
|
14
|
+
name = "InvalidOpeningApprovalError";
|
|
15
|
+
};
|
|
16
|
+
export { InvalidOpeningApprovalError, UnsupportedOpeningApprovalError };
|
|
@@ -5,6 +5,7 @@ import { CreditManagerV310Contract } from "./CreditManagerV310Contract.js";
|
|
|
5
5
|
import { CreditSuite } from "./CreditSuite.js";
|
|
6
6
|
import { CreditSuiteStrategy } from "./CreditSuiteStrategy.js";
|
|
7
7
|
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./collateralUtils.js";
|
|
8
|
+
import { InvalidOpeningApprovalError, UnsupportedOpeningApprovalError } from "./errors.js";
|
|
8
9
|
import { expectedBalanceDeltas } from "./expectedBalanceDeltas.js";
|
|
9
10
|
import "./types.js";
|
|
10
|
-
export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, pickStrategyTargetCollateral };
|
|
11
|
+
export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, InvalidOpeningApprovalError, UnsupportedOpeningApprovalError, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, pickStrategyTargetCollateral };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InvalidOpeningApprovalError, UnsupportedOpeningApprovalError } from "./credit/errors.js";
|
|
1
2
|
import { AdapterType } from "./adapters/types.js";
|
|
2
3
|
import { adapterActionAbi, adapterActionSelectors, adapterActionSignatures } from "./adapters/abi/actionAbi.js";
|
|
3
4
|
import { erc4626ReferralAdapterAbi } from "./adapters/abi/adapters/erc4626ReferralAdapter.js";
|
|
@@ -160,4 +161,4 @@ import { RWARegistry, RWA_COMPRESSOR_ADDRESS } from "./rwa/RWARegistry.js";
|
|
|
160
161
|
import { isRWAFactory } from "./rwa/types.js";
|
|
161
162
|
import "./types.js";
|
|
162
163
|
import "./zapper/index.js";
|
|
163
|
-
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConstantPriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FixedRateWindowPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MedianPriceFeedContract, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, updatableDependencies, usdToNumber };
|
|
164
|
+
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConstantPriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FixedRateWindowPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InvalidOpeningApprovalError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MedianPriceFeedContract, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedOpeningApprovalError, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, updatableDependencies, usdToNumber };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RWA_FACTORY_SECURITIZE } from "../../../model/rwa.js";
|
|
2
1
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
3
2
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
4
3
|
import { iRWACompressorAbi } from "../../../abi/rwa/iRWACompressor.js";
|
|
5
4
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
6
5
|
import { RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND } from "../../base/token-types.js";
|
|
7
6
|
import "../../../model/index.js";
|
|
7
|
+
import { RWA_FACTORY_SECURITIZE } from "../../../model/rwa.js";
|
|
8
8
|
import "../../base/index.js";
|
|
9
9
|
import "../../utils/index.js";
|
|
10
10
|
import { SecuritizeRWAFactory } from "./securitize/SecuritizeRWAFactory.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { KYC_REGISTRATION_LINKS } from "../../../../model/rwa.js";
|
|
2
1
|
import { BaseContract } from "../../../base/BaseContract.js";
|
|
3
2
|
import { iMidasAccessControlAbi } from "../../../../abi/rwa/iMidasAccessControl.js";
|
|
4
3
|
import { iMidasGatewayV311Abi } from "../../adapters/abi/midas/iMidasGatewayV311.js";
|
|
@@ -6,6 +5,7 @@ import { iMidasDegenNFTAbi } from "../../../../abi/rwa/iMidasDegenNFT.js";
|
|
|
6
5
|
import "../../../../model/index.js";
|
|
7
6
|
import "../../../base/index.js";
|
|
8
7
|
import "../../adapters/abi/index.js";
|
|
8
|
+
import { KYC_REGISTRATION_LINKS } from "../../../../model/rwa.js";
|
|
9
9
|
import "./constants.js";
|
|
10
10
|
import { decodeAbiParameters } from "viem";
|
|
11
11
|
// src/onchain/market/rwa/midas/MidasDegenNFT.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { KYC_REGISTRATION_LINKS } from "../../../../model/rwa.js";
|
|
2
1
|
import { AddressSet } from "../../../utils/AddressSet.js";
|
|
3
2
|
import { iSecuritizeDegenNFTAbi } from "../../../../abi/rwa/iSecuritizeDegenNFT.js";
|
|
4
3
|
import { BaseContract } from "../../../base/BaseContract.js";
|
|
5
4
|
import "../../../../model/index.js";
|
|
5
|
+
import { KYC_REGISTRATION_LINKS } from "../../../../model/rwa.js";
|
|
6
6
|
import "../../../base/index.js";
|
|
7
7
|
import "../../../utils/index.js";
|
|
8
8
|
import { DEGEN_NFT_SECURITIZE } from "./constants.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RWA_FACTORY_SECURITIZE, SECURITIZE_REGISTER_VAULT_TYPES } from "../../../../model/rwa.js";
|
|
2
1
|
import { AddressMap } from "../../../utils/AddressMap.js";
|
|
3
2
|
import { iSecuritizeRWAFactoryAbi } from "../../../../abi/rwa/iSecuritizeRWAFactory.js";
|
|
4
3
|
import { BaseContract } from "../../../base/BaseContract.js";
|
|
5
4
|
import "../../../../model/index.js";
|
|
5
|
+
import { RWA_FACTORY_SECURITIZE, SECURITIZE_REGISTER_VAULT_TYPES } from "../../../../model/rwa.js";
|
|
6
6
|
import "../../../base/index.js";
|
|
7
7
|
import "../../../utils/index.js";
|
|
8
8
|
import { SecuritizeDegenNFT } from "./SecuritizeDegenNFT.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isFilterSet } from "../../model/filters.js";
|
|
2
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
3
2
|
import "../constants/math.js";
|
|
4
3
|
import "../../model/index.js";
|
|
@@ -6,6 +5,7 @@ import "../base/index.js";
|
|
|
6
5
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
7
6
|
import "../constants/index.js";
|
|
8
7
|
import { bpsToRay, calcBorrowApy, calcPositionLeverage, healthFactorBps, usdToNumber } from "../market/math.js";
|
|
8
|
+
import { isFilterSet } from "../../model/filters.js";
|
|
9
9
|
import { STRATEGY_POSITION_COLLATERAL_ERROR, matchesPositionFilter } from "../../model/positions.js";
|
|
10
10
|
import { collateralPriceInUnderlying } from "../market/oracle/collateralPriceInUnderlying.js";
|
|
11
11
|
import { borrowRateAtUtilization, utilizationAfterLiquidityChange } from "../market/pool/math.js";
|
|
@@ -49,6 +49,7 @@ function parseFacadeOperationCalldata(sdk, facade, calldata) {
|
|
|
49
49
|
creditAccount: zeroAddress,
|
|
50
50
|
onBehalfOf: rawArgs.onBehalfOf,
|
|
51
51
|
referralCode: rawArgs.referralCode,
|
|
52
|
+
...rawArgs.degenNFTData !== void 0 && { degenNFTData: rawArgs.degenNFTData },
|
|
52
53
|
multicall
|
|
53
54
|
};
|
|
54
55
|
case "closeCreditAccount": return {
|