@gearbox-protocol/sdk 14.0.0-next.9 → 14.1.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/abi/kyc/iDSRegistryService.js +149 -0
- package/dist/cjs/abi/kyc/iDSToken.js +71 -0
- package/dist/cjs/abi/kyc/iKYCCompressor.js +196 -0
- package/dist/cjs/abi/kyc/iKYCFactory.js +122 -0
- package/dist/cjs/abi/kyc/iKYCUnderlying.js +401 -0
- package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +326 -0
- package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +319 -0
- package/dist/cjs/dev/AccountOpener.js +45 -5
- package/dist/cjs/rewards/rewards/extra-apy.js +1 -1
- package/dist/cjs/sdk/MultichainSDK.js +5 -0
- package/dist/cjs/sdk/OnchainSDK.js +55 -6
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +335 -21
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +7 -1
- package/dist/cjs/sdk/base/TokensMeta.js +22 -42
- package/dist/cjs/sdk/base/token-types.js +9 -0
- package/dist/cjs/sdk/chain/chains.js +18 -1
- package/dist/cjs/sdk/constants/address-provider.js +3 -0
- package/dist/cjs/sdk/market/MarketRegister.js +70 -116
- package/dist/cjs/sdk/market/MarketSuite.js +3 -0
- package/dist/cjs/sdk/market/index.js +2 -0
- package/dist/cjs/sdk/market/kyc/KYCRegistry.js +269 -0
- package/dist/cjs/sdk/market/kyc/index.js +26 -0
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +242 -0
- package/dist/cjs/sdk/market/kyc/securitize/constants.js +28 -0
- package/dist/cjs/sdk/market/kyc/securitize/index.js +26 -0
- package/dist/cjs/sdk/market/kyc/securitize/types.js +16 -0
- package/dist/cjs/sdk/{accounts/utils.js → market/kyc/types.js} +11 -15
- package/dist/cjs/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +11 -2
- package/dist/cjs/sdk/market/pool/index.js +2 -0
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
- package/dist/cjs/sdk/options.js +6 -0
- package/dist/cjs/sdk/pools/PoolService.js +104 -12
- package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +38 -0
- package/dist/cjs/sdk/utils/viem/index.js +2 -4
- package/dist/esm/abi/kyc/iDSRegistryService.js +125 -0
- package/dist/esm/abi/kyc/iDSToken.js +47 -0
- package/dist/esm/abi/kyc/iKYCCompressor.js +172 -0
- package/dist/esm/abi/kyc/iKYCFactory.js +98 -0
- package/dist/esm/abi/kyc/iKYCUnderlying.js +377 -0
- package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +302 -0
- package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +295 -0
- package/dist/esm/dev/AccountOpener.js +47 -6
- package/dist/esm/rewards/rewards/extra-apy.js +1 -1
- package/dist/esm/sdk/MultichainSDK.js +5 -0
- package/dist/esm/sdk/OnchainSDK.js +58 -7
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +336 -22
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +7 -1
- package/dist/esm/sdk/base/TokensMeta.js +22 -44
- package/dist/esm/sdk/base/token-types.js +6 -0
- package/dist/esm/sdk/chain/chains.js +18 -1
- package/dist/esm/sdk/constants/address-provider.js +2 -0
- package/dist/esm/sdk/market/MarketRegister.js +74 -118
- package/dist/esm/sdk/market/MarketSuite.js +3 -0
- package/dist/esm/sdk/market/index.js +1 -0
- package/dist/esm/sdk/market/kyc/KYCRegistry.js +253 -0
- package/dist/esm/sdk/market/kyc/index.js +3 -0
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +218 -0
- package/dist/esm/sdk/market/kyc/securitize/constants.js +4 -0
- package/dist/esm/sdk/market/kyc/securitize/index.js +3 -0
- package/dist/esm/sdk/market/kyc/securitize/types.js +0 -0
- package/dist/esm/sdk/market/kyc/types.js +9 -0
- package/dist/esm/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +11 -2
- package/dist/esm/sdk/market/pool/index.js +1 -0
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
- package/dist/esm/sdk/options.js +6 -0
- package/dist/esm/sdk/pools/PoolService.js +109 -13
- package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +14 -0
- package/dist/esm/sdk/utils/viem/index.js +1 -2
- package/dist/types/abi/kyc/iDSRegistryService.d.ts +191 -0
- package/dist/types/abi/kyc/iDSToken.d.ts +67 -0
- package/dist/types/abi/kyc/iKYCCompressor.d.ts +228 -0
- package/dist/types/abi/kyc/iKYCFactory.d.ts +139 -0
- package/dist/types/abi/kyc/iKYCUnderlying.d.ts +548 -0
- package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +404 -0
- package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +376 -0
- package/dist/types/sdk/OnchainSDK.d.ts +19 -1
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +59 -6
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +114 -14
- package/dist/types/sdk/base/TokensMeta.d.ts +14 -3
- package/dist/types/sdk/base/token-types.d.ts +44 -4
- package/dist/types/sdk/base/types.d.ts +116 -2
- package/dist/types/sdk/chain/chains.d.ts +5 -1
- package/dist/types/sdk/constants/address-provider.d.ts +1 -0
- package/dist/types/sdk/market/MarketRegister.d.ts +6 -9
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -0
- package/dist/types/sdk/market/index.d.ts +1 -0
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +52 -0
- package/dist/types/sdk/market/kyc/index.d.ts +3 -0
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +429 -0
- package/dist/types/sdk/market/kyc/securitize/constants.d.ts +1 -0
- package/dist/types/sdk/market/kyc/securitize/index.d.ts +3 -0
- package/dist/types/sdk/market/kyc/securitize/types.d.ts +136 -0
- package/dist/types/sdk/market/kyc/types.d.ts +171 -0
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +3 -2
- package/dist/types/sdk/market/oracle/types.d.ts +3 -10
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -0
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +6 -2
- package/dist/types/sdk/market/pool/index.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +1 -1
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +1 -0
- package/dist/types/sdk/pools/PoolService.d.ts +8 -8
- package/dist/types/sdk/pools/types.d.ts +1 -1
- package/dist/types/sdk/types/state-human.d.ts +2 -0
- package/dist/types/sdk/types/state.d.ts +5 -0
- package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +28 -0
- package/dist/types/sdk/utils/viem/index.d.ts +1 -2
- package/package.json +4 -4
- package/dist/cjs/sdk/utils/viem/getLogsPaginated.js +0 -62
- package/dist/cjs/sdk/utils/viem/getLogsSafe.js +0 -87
- package/dist/esm/sdk/accounts/utils.js +0 -14
- package/dist/esm/sdk/utils/viem/getLogsPaginated.js +0 -38
- package/dist/esm/sdk/utils/viem/getLogsSafe.js +0 -65
- package/dist/types/sdk/accounts/utils.d.ts +0 -2
- package/dist/types/sdk/utils/viem/getLogsPaginated.d.ts +0 -12
- package/dist/types/sdk/utils/viem/getLogsSafe.d.ts +0 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var kyc_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(kyc_exports);
|
|
18
|
+
__reExport(kyc_exports, require("./KYCRegistry.js"), module.exports);
|
|
19
|
+
__reExport(kyc_exports, require("./securitize/index.js"), module.exports);
|
|
20
|
+
__reExport(kyc_exports, require("./types.js"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./KYCRegistry.js"),
|
|
24
|
+
...require("./securitize/index.js"),
|
|
25
|
+
...require("./types.js")
|
|
26
|
+
});
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var SecuritizeKYCFactory_exports = {};
|
|
20
|
+
__export(SecuritizeKYCFactory_exports, {
|
|
21
|
+
SecuritizeKYCFactory: () => SecuritizeKYCFactory
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(SecuritizeKYCFactory_exports);
|
|
24
|
+
var import_viem = require("viem");
|
|
25
|
+
var import_iSecuritizeKYCFactory = require("../../../../abi/kyc/iSecuritizeKYCFactory.js");
|
|
26
|
+
var import_base = require("../../../base/index.js");
|
|
27
|
+
var import_utils = require("../../../utils/index.js");
|
|
28
|
+
var import_constants = require("./constants.js");
|
|
29
|
+
const abi = import_iSecuritizeKYCFactory.iSecuritizeKYCFactoryAbi;
|
|
30
|
+
class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
31
|
+
#sdk;
|
|
32
|
+
#investorCache = new import_utils.AddressMap();
|
|
33
|
+
degenNFT;
|
|
34
|
+
owner;
|
|
35
|
+
dsTokens;
|
|
36
|
+
contractType = import_constants.KYC_FACTORY_SECURITIZE;
|
|
37
|
+
constructor(sdk, data) {
|
|
38
|
+
super(sdk, {
|
|
39
|
+
...data.baseParams,
|
|
40
|
+
name: "SecuritizeKYCFactory",
|
|
41
|
+
abi
|
|
42
|
+
});
|
|
43
|
+
this.#sdk = sdk;
|
|
44
|
+
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
45
|
+
[
|
|
46
|
+
{ name: "owner", type: "address" },
|
|
47
|
+
{ name: "degenNFT", type: "address" },
|
|
48
|
+
{
|
|
49
|
+
name: "dsTokensData",
|
|
50
|
+
type: "tuple[]",
|
|
51
|
+
components: [
|
|
52
|
+
{ name: "token", type: "address" },
|
|
53
|
+
{ name: "registrar", type: "address" },
|
|
54
|
+
{ name: "operators", type: "address[]" }
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
data.baseParams.serializedParams
|
|
59
|
+
);
|
|
60
|
+
this.owner = decoded[0];
|
|
61
|
+
this.degenNFT = decoded[1];
|
|
62
|
+
for (const t of data.tokens) {
|
|
63
|
+
this.tokensMeta.upsert(t.addr, t);
|
|
64
|
+
}
|
|
65
|
+
this.dsTokens = decoded[2].map((t) => ({
|
|
66
|
+
address: t.token,
|
|
67
|
+
registrar: t.registrar,
|
|
68
|
+
operators: [...t.operators]
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* {@inheritDoc IKYCFactory.decodeInvestorData}
|
|
73
|
+
*/
|
|
74
|
+
decodeInvestorData(data) {
|
|
75
|
+
const { creditAccounts, extraDetails } = data;
|
|
76
|
+
const [registeredTokens, cachedSignatures, registerVaultMessages] = (0, import_viem.decodeAbiParameters)(
|
|
77
|
+
[
|
|
78
|
+
{ name: "registeredTokens", type: "address[]" },
|
|
79
|
+
{
|
|
80
|
+
name: "cachedSignatures",
|
|
81
|
+
type: "tuple[]",
|
|
82
|
+
components: [...registerMessageTuple]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "registerVaultMessages",
|
|
86
|
+
type: "tuple[]",
|
|
87
|
+
components: [...registerVaultMessageTuple]
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
extraDetails
|
|
91
|
+
);
|
|
92
|
+
return {
|
|
93
|
+
type: import_constants.KYC_FACTORY_SECURITIZE,
|
|
94
|
+
factory: this.address,
|
|
95
|
+
cachedSignatures: [...cachedSignatures],
|
|
96
|
+
registerVaultMessages: [...registerVaultMessages],
|
|
97
|
+
registeredTokens: [...registeredTokens],
|
|
98
|
+
creditAccounts: creditAccounts.map((ca) => {
|
|
99
|
+
const [registeredTokens2] = (0, import_viem.decodeAbiParameters)(
|
|
100
|
+
[{ name: "registeredTokens", type: "address[]" }],
|
|
101
|
+
ca.extraDetails
|
|
102
|
+
);
|
|
103
|
+
return {
|
|
104
|
+
...ca,
|
|
105
|
+
registeredTokens: [...registeredTokens2]
|
|
106
|
+
};
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* {@inheritDoc IKYCFactory.getInvestor}
|
|
112
|
+
*/
|
|
113
|
+
async getInvestor(creditAccount, fromCache) {
|
|
114
|
+
if (fromCache && this.#investorCache.has(creditAccount)) {
|
|
115
|
+
return this.#investorCache.mustGet(creditAccount);
|
|
116
|
+
}
|
|
117
|
+
const investor = await this.contract.read.getInvestor([creditAccount]);
|
|
118
|
+
if (fromCache) {
|
|
119
|
+
this.#investorCache.upsert(creditAccount, investor);
|
|
120
|
+
}
|
|
121
|
+
return investor;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* {@inheritDoc IKYCFactory.getApprovalAddress}
|
|
125
|
+
*/
|
|
126
|
+
async getApprovalAddress(options) {
|
|
127
|
+
if ("creditAccount" in options) {
|
|
128
|
+
return this.getWallet(options.creditAccount);
|
|
129
|
+
}
|
|
130
|
+
return this.#precomputeWalletAddress(
|
|
131
|
+
options.creditManager,
|
|
132
|
+
options.borrower
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* {@inheritDoc IKYCFactory.getWallet}
|
|
137
|
+
*/
|
|
138
|
+
async getWallet(creditAccount) {
|
|
139
|
+
return this.contract.read.getWallet([creditAccount]);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* {@inheritDoc IKYCFactory.multicall}
|
|
143
|
+
*/
|
|
144
|
+
multicall(creditAccount, calls, options) {
|
|
145
|
+
const { tokensToRegister = [], signaturesToCache = [] } = options ?? {};
|
|
146
|
+
return this.createRawTx({
|
|
147
|
+
functionName: "multicall",
|
|
148
|
+
args: [creditAccount, calls, tokensToRegister, signaturesToCache]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* {@inheritDoc IKYCFactory.getOpenAccountRequirements}
|
|
153
|
+
*/
|
|
154
|
+
async getOpenAccountRequirements(investor, props) {
|
|
155
|
+
const [investorData] = await this.#sdk.kyc.getInvestorData(investor, [
|
|
156
|
+
this.address
|
|
157
|
+
]);
|
|
158
|
+
const tokensToRegister = new import_utils.AddressSet([props.tokenOutAddress]);
|
|
159
|
+
const registredTokens = new import_utils.AddressSet(investorData.registeredTokens);
|
|
160
|
+
const signedTokens = new import_utils.AddressSet(
|
|
161
|
+
investorData.cachedSignatures.map((s) => s.token)
|
|
162
|
+
);
|
|
163
|
+
const unsignedTokens = tokensToRegister.difference(signedTokens);
|
|
164
|
+
const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
|
|
165
|
+
const requiredSignatures = investorData.registerVaultMessages.filter(
|
|
166
|
+
(m) => unsignedTokens.has(m.token)
|
|
167
|
+
);
|
|
168
|
+
return {
|
|
169
|
+
type: import_constants.KYC_FACTORY_SECURITIZE,
|
|
170
|
+
securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
|
|
171
|
+
tokensToRegister: Array.from(tokensToRegister),
|
|
172
|
+
requiredSignatures
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* {@inheritDoc IKYCFactory.openCreditAccount}
|
|
177
|
+
*/
|
|
178
|
+
openCreditAccount(creditManager, calls, options) {
|
|
179
|
+
const { tokensToRegister = [], signaturesToCache = [] } = options ?? {};
|
|
180
|
+
return this.createRawTx({
|
|
181
|
+
functionName: "openCreditAccount",
|
|
182
|
+
args: [creditManager, calls, tokensToRegister, signaturesToCache]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
stateHuman(_raw) {
|
|
186
|
+
return {
|
|
187
|
+
...super.stateHuman(_raw),
|
|
188
|
+
owner: this.labelAddress(this.owner),
|
|
189
|
+
degenNFT: this.labelAddress(this.degenNFT),
|
|
190
|
+
dsTokens: this.dsTokens.map((t) => ({
|
|
191
|
+
...this.tokensMeta.mustGet(t.address),
|
|
192
|
+
registrar: this.labelAddress(t.registrar),
|
|
193
|
+
operators: t.operators.map((o) => this.labelAddress(o))
|
|
194
|
+
}))
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Precomputes the wallet address that will own a new credit account
|
|
199
|
+
* for the given investor in the given credit manager.
|
|
200
|
+
*
|
|
201
|
+
* @param creditManager - credit manager address
|
|
202
|
+
* @param investor - investor address
|
|
203
|
+
**/
|
|
204
|
+
async #precomputeWalletAddress(creditManager, investor) {
|
|
205
|
+
return this.contract.read.precomputeWalletAddress([
|
|
206
|
+
creditManager,
|
|
207
|
+
investor
|
|
208
|
+
]);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const registerMessageTuple = [
|
|
212
|
+
{ name: "token", type: "address" },
|
|
213
|
+
{
|
|
214
|
+
name: "signature",
|
|
215
|
+
type: "tuple",
|
|
216
|
+
components: [
|
|
217
|
+
{ name: "deadline", type: "uint256" },
|
|
218
|
+
{ name: "signature", type: "bytes" }
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
];
|
|
222
|
+
const registerVaultMessageTuple = [
|
|
223
|
+
{
|
|
224
|
+
name: "domain",
|
|
225
|
+
type: "tuple",
|
|
226
|
+
components: [
|
|
227
|
+
{ name: "name", type: "string" },
|
|
228
|
+
{ name: "version", type: "string" },
|
|
229
|
+
{ name: "chainId", type: "uint256" },
|
|
230
|
+
{ name: "verifyingContract", type: "address" }
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
{ name: "investor", type: "address" },
|
|
234
|
+
{ name: "operator", type: "address" },
|
|
235
|
+
{ name: "token", type: "address" },
|
|
236
|
+
{ name: "nonce", type: "uint256" },
|
|
237
|
+
{ name: "deadline", type: "uint256" }
|
|
238
|
+
];
|
|
239
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
240
|
+
0 && (module.exports = {
|
|
241
|
+
SecuritizeKYCFactory
|
|
242
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var constants_exports = {};
|
|
20
|
+
__export(constants_exports, {
|
|
21
|
+
KYC_FACTORY_SECURITIZE: () => KYC_FACTORY_SECURITIZE
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(constants_exports);
|
|
24
|
+
const KYC_FACTORY_SECURITIZE = "KYC_FACTORY::SECURITIZE";
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
KYC_FACTORY_SECURITIZE
|
|
28
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var securitize_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(securitize_exports);
|
|
18
|
+
__reExport(securitize_exports, require("./constants.js"), module.exports);
|
|
19
|
+
__reExport(securitize_exports, require("./SecuritizeKYCFactory.js"), module.exports);
|
|
20
|
+
__reExport(securitize_exports, require("./types.js"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./constants.js"),
|
|
24
|
+
...require("./SecuritizeKYCFactory.js"),
|
|
25
|
+
...require("./types.js")
|
|
26
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -16,23 +16,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
KYC_FACTORY_TYPES: () => KYC_FACTORY_TYPES,
|
|
22
|
+
isKYCFactory: () => isKYCFactory
|
|
22
23
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function replacer(_key, value) {
|
|
29
|
-
if (typeof value === "bigint") {
|
|
30
|
-
return value.toString();
|
|
31
|
-
} else {
|
|
32
|
-
return value;
|
|
33
|
-
}
|
|
24
|
+
module.exports = __toCommonJS(types_exports);
|
|
25
|
+
var import_securitize = require("./securitize/index.js");
|
|
26
|
+
const KYC_FACTORY_TYPES = [import_securitize.KYC_FACTORY_SECURITIZE];
|
|
27
|
+
function isKYCFactory(factory, type) {
|
|
28
|
+
return factory.contractType === type;
|
|
34
29
|
}
|
|
35
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
31
|
0 && (module.exports = {
|
|
37
|
-
|
|
32
|
+
KYC_FACTORY_TYPES,
|
|
33
|
+
isKYCFactory
|
|
38
34
|
});
|
|
@@ -88,6 +88,9 @@ class PoolSuite extends import_base.SDKConstruct {
|
|
|
88
88
|
get underlying() {
|
|
89
89
|
return this.pool.underlying;
|
|
90
90
|
}
|
|
91
|
+
get kycFactory() {
|
|
92
|
+
return this.pool.kycFactory;
|
|
93
|
+
}
|
|
91
94
|
get dirty() {
|
|
92
95
|
return this.pool.dirty || this.rateKeeper.dirty || this.pqk.dirty || this.interestRateModel.dirty;
|
|
93
96
|
}
|
|
@@ -28,13 +28,15 @@ var import_utils = require("../../utils/index.js");
|
|
|
28
28
|
const abi = [...import_generated.iPoolV310Abi, ...import_iPausable.iPausableAbi];
|
|
29
29
|
class PoolV310Contract extends import_base.BaseContract {
|
|
30
30
|
creditManagerDebtParams;
|
|
31
|
-
|
|
31
|
+
#sdk;
|
|
32
|
+
constructor(sdk, data) {
|
|
32
33
|
const { baseParams, creditManagerDebtParams, ...rest } = data;
|
|
33
|
-
super(
|
|
34
|
+
super(sdk, {
|
|
34
35
|
...data.baseParams,
|
|
35
36
|
name: `PoolV3(${data.name})`,
|
|
36
37
|
abi
|
|
37
38
|
});
|
|
39
|
+
this.#sdk = sdk;
|
|
38
40
|
Object.assign(this, rest);
|
|
39
41
|
this.creditManagerDebtParams = new import_utils.AddressMap(
|
|
40
42
|
creditManagerDebtParams.map((p) => [p.creditManager, p])
|
|
@@ -46,6 +48,13 @@ class PoolV310Contract extends import_base.BaseContract {
|
|
|
46
48
|
symbol: data.symbol
|
|
47
49
|
});
|
|
48
50
|
}
|
|
51
|
+
get kycFactory() {
|
|
52
|
+
const meta = this.#sdk.tokensMeta.mustGet(this.underlying);
|
|
53
|
+
if (this.#sdk.tokensMeta.isKYCUnderlying(meta)) {
|
|
54
|
+
return this.#sdk.mustGetContract(meta.kycFactory);
|
|
55
|
+
}
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
49
58
|
stateHuman(raw = true) {
|
|
50
59
|
return {
|
|
51
60
|
...super.stateHuman(raw),
|
|
@@ -18,11 +18,13 @@ module.exports = __toCommonJS(pool_exports);
|
|
|
18
18
|
__reExport(pool_exports, require("./GaugeContract.js"), module.exports);
|
|
19
19
|
__reExport(pool_exports, require("./LinearInterestRateModelContract.js"), module.exports);
|
|
20
20
|
__reExport(pool_exports, require("./PoolSuite.js"), module.exports);
|
|
21
|
+
__reExport(pool_exports, require("./PoolV310Contract.js"), module.exports);
|
|
21
22
|
__reExport(pool_exports, require("./types.js"), module.exports);
|
|
22
23
|
// Annotate the CommonJS export names for ESM import in node:
|
|
23
24
|
0 && (module.exports = {
|
|
24
25
|
...require("./GaugeContract.js"),
|
|
25
26
|
...require("./LinearInterestRateModelContract.js"),
|
|
26
27
|
...require("./PoolSuite.js"),
|
|
28
|
+
...require("./PoolV310Contract.js"),
|
|
27
29
|
...require("./types.js")
|
|
28
30
|
});
|
|
@@ -237,13 +237,13 @@ class PriceFeedRegister extends import_base.SDKConstruct {
|
|
|
237
237
|
* Loads PARTIAL information about all updatable price feeds from MarketCompressor
|
|
238
238
|
* Discovered price feeds are not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
|
|
239
239
|
*/
|
|
240
|
-
async getPartialUpdatablePriceFeeds(configurators
|
|
240
|
+
async getPartialUpdatablePriceFeeds(configurators) {
|
|
241
241
|
const [priceFeedCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
|
|
242
242
|
import_constants.AP_PRICE_FEED_COMPRESSOR,
|
|
243
243
|
import_constants.VERSION_RANGE_310
|
|
244
244
|
);
|
|
245
245
|
this.logger?.debug(
|
|
246
|
-
{ configurators
|
|
246
|
+
{ configurators },
|
|
247
247
|
`calling getUpdatablePriceFeeds in block ${this.sdk.currentBlock}`
|
|
248
248
|
);
|
|
249
249
|
const result = await this.client.readContract({
|
|
@@ -253,7 +253,7 @@ class PriceFeedRegister extends import_base.SDKConstruct {
|
|
|
253
253
|
args: [
|
|
254
254
|
{
|
|
255
255
|
configurators,
|
|
256
|
-
pools:
|
|
256
|
+
pools: [],
|
|
257
257
|
underlying: import_constants.ADDRESS_0X0
|
|
258
258
|
}
|
|
259
259
|
],
|
package/dist/cjs/sdk/options.js
CHANGED
|
@@ -44,6 +44,12 @@ const AttachOptionsSchema = import_v4.z.object({
|
|
|
44
44
|
addressProvider: (0, import_utils.ZodAddress)().optional(),
|
|
45
45
|
/** Addresses of market configurator contracts to load. */
|
|
46
46
|
marketConfigurators: import_v4.z.array((0, import_utils.ZodAddress)()).optional(),
|
|
47
|
+
/**
|
|
48
|
+
* Addresses of KYC factory contracts to load.
|
|
49
|
+
* If not set, all default KYC factories for the chain are loaded
|
|
50
|
+
* (from {@link GearboxChain.kycFactories})
|
|
51
|
+
**/
|
|
52
|
+
kycFactories: import_v4.z.array((0, import_utils.ZodAddress)()).optional(),
|
|
47
53
|
/** Pin SDK to a specific block number during attach. */
|
|
48
54
|
blockNumber: import_v4.z.union([import_v4.z.bigint().nonnegative(), import_v4.z.number().int().nonnegative()]).optional(),
|
|
49
55
|
/** Skip fetching updatable price feeds on attach and sync. */
|
|
@@ -22,6 +22,7 @@ __export(PoolService_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(PoolService_exports);
|
|
24
24
|
var import_generated = require("../../abi/310/generated.js");
|
|
25
|
+
var import_iERC20 = require("../../abi/iERC20.js");
|
|
25
26
|
var import_iERC20ZapperDeposits = require("../../abi/iERC20ZapperDeposits.js");
|
|
26
27
|
var import_iETHZapperDeposits = require("../../abi/iETHZapperDeposits.js");
|
|
27
28
|
var import_iZapper = require("../../abi/iZapper.js");
|
|
@@ -30,28 +31,73 @@ var import_constants = require("../constants/index.js");
|
|
|
30
31
|
var import_utils = require("../utils/index.js");
|
|
31
32
|
class PoolService extends import_base.SDKConstruct {
|
|
32
33
|
/**
|
|
33
|
-
* @
|
|
34
|
+
* {@inheritDoc IPoolsService.getDepositTokensIn}
|
|
34
35
|
*/
|
|
35
36
|
getDepositTokensIn(pool) {
|
|
37
|
+
const underlying = this.#describeUnderlying(pool);
|
|
38
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
39
|
+
switch (underlying.contractType) {
|
|
40
|
+
case import_base.KYC_UNDERLYING_DEFAULT:
|
|
41
|
+
return this.#depositTokensIn(pool, false);
|
|
42
|
+
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
43
|
+
return [underlying.asset];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
return this.#depositTokensIn(pool, true);
|
|
37
47
|
}
|
|
38
48
|
/**
|
|
39
|
-
* @
|
|
49
|
+
* {@inheritDoc IPoolsService.getDepositTokensOut}
|
|
40
50
|
*/
|
|
41
51
|
getDepositTokensOut(pool, tokenIn) {
|
|
52
|
+
const underlying = this.#describeUnderlying(pool);
|
|
53
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
54
|
+
switch (underlying.contractType) {
|
|
55
|
+
case import_base.KYC_UNDERLYING_DEFAULT:
|
|
56
|
+
return this.#depositTokensOut(pool, tokenIn, false);
|
|
57
|
+
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
42
61
|
return this.#depositTokensOut(pool, tokenIn, true);
|
|
43
62
|
}
|
|
44
63
|
/**
|
|
45
|
-
* @
|
|
64
|
+
* {@inheritDoc IPoolsService.getDepositMetadata}
|
|
46
65
|
*/
|
|
47
66
|
getDepositMetadata(pool, tokenIn, tokenOut) {
|
|
67
|
+
const underlying = this.#describeUnderlying(pool);
|
|
68
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
69
|
+
switch (underlying.contractType) {
|
|
70
|
+
case import_base.KYC_UNDERLYING_DEFAULT: {
|
|
71
|
+
return this.#depositMetadata(
|
|
72
|
+
"kyc-default",
|
|
73
|
+
pool,
|
|
74
|
+
tokenIn,
|
|
75
|
+
tokenOut,
|
|
76
|
+
false
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
80
|
+
return {
|
|
81
|
+
zapper: void 0,
|
|
82
|
+
approveTarget: underlying.liquidityProvider.addr,
|
|
83
|
+
permissible: false,
|
|
84
|
+
type: "kyc-on-demand"
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
48
88
|
return this.#depositMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
49
89
|
}
|
|
50
90
|
/**
|
|
51
|
-
* @
|
|
91
|
+
* {@inheritDoc IPoolsService.addLiquidity}
|
|
52
92
|
*/
|
|
53
93
|
addLiquidity(props) {
|
|
54
94
|
const { collateral, meta, permit, referralCode, pool, wallet } = props;
|
|
95
|
+
const underlying = this.#describeUnderlying(pool);
|
|
96
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
97
|
+
if (underlying.contractType === import_base.KYC_UNDERLYING_ON_DEMAND) {
|
|
98
|
+
return void 0;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
55
101
|
const { zapper } = meta;
|
|
56
102
|
if (zapper && (0, import_utils.hexEq)(zapper.tokenIn.addr, import_constants.NATIVE_ADDRESS)) {
|
|
57
103
|
return {
|
|
@@ -91,22 +137,51 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
91
137
|
}
|
|
92
138
|
}
|
|
93
139
|
/**
|
|
94
|
-
* @
|
|
140
|
+
* {@inheritDoc IPoolsService.getWithdrawalTokensIn}
|
|
95
141
|
*/
|
|
96
142
|
getWithdrawalTokensIn(pool) {
|
|
143
|
+
const underlying = this.#describeUnderlying(pool);
|
|
144
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
145
|
+
switch (underlying.contractType) {
|
|
146
|
+
case import_base.KYC_UNDERLYING_DEFAULT:
|
|
147
|
+
return this.#withdrawalTokensIn(pool, false);
|
|
148
|
+
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
97
152
|
return this.#withdrawalTokensIn(pool, true);
|
|
98
153
|
}
|
|
99
154
|
/**
|
|
100
|
-
* @
|
|
155
|
+
* {@inheritDoc IPoolsService.getWithdrawalTokensOut}
|
|
101
156
|
*/
|
|
102
157
|
getWithdrawalTokensOut(pool, tokenIn) {
|
|
158
|
+
const underlying = this.#describeUnderlying(pool);
|
|
159
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
160
|
+
switch (underlying.contractType) {
|
|
161
|
+
case import_base.KYC_UNDERLYING_DEFAULT:
|
|
162
|
+
return this.#withdrawalTokensOut(pool, tokenIn, false);
|
|
163
|
+
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
164
|
+
return [underlying.asset];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
103
167
|
return this.#withdrawalTokensOut(pool, tokenIn, true);
|
|
104
168
|
}
|
|
105
169
|
/**
|
|
106
|
-
* @
|
|
170
|
+
* {@inheritDoc IPoolsService.removeLiquidity}
|
|
107
171
|
*/
|
|
108
172
|
removeLiquidity(props) {
|
|
109
173
|
const { pool, amount, meta, wallet, permit } = props;
|
|
174
|
+
const underlying = this.#describeUnderlying(pool);
|
|
175
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
176
|
+
if (underlying.contractType === import_base.KYC_UNDERLYING_ON_DEMAND) {
|
|
177
|
+
return {
|
|
178
|
+
abi: import_iERC20.ierc20Abi,
|
|
179
|
+
functionName: "approve",
|
|
180
|
+
args: [underlying.liquidityProvider, 0n],
|
|
181
|
+
target: underlying.asset
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
110
185
|
if (meta.zapper) {
|
|
111
186
|
return permit ? {
|
|
112
187
|
target: meta.zapper.baseParams.addr,
|
|
@@ -135,9 +210,30 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
135
210
|
};
|
|
136
211
|
}
|
|
137
212
|
/**
|
|
138
|
-
* @
|
|
213
|
+
* {@inheritDoc IPoolsService.getWithdrawalMetadata}
|
|
139
214
|
*/
|
|
140
215
|
getWithdrawalMetadata(pool, tokenIn, tokenOut) {
|
|
216
|
+
const underlying = this.#describeUnderlying(pool);
|
|
217
|
+
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
218
|
+
switch (underlying.contractType) {
|
|
219
|
+
case import_base.KYC_UNDERLYING_DEFAULT: {
|
|
220
|
+
return this.#withdrawalMetadata(
|
|
221
|
+
"kyc-default",
|
|
222
|
+
pool,
|
|
223
|
+
tokenIn,
|
|
224
|
+
tokenOut,
|
|
225
|
+
false
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
229
|
+
return {
|
|
230
|
+
zapper: void 0,
|
|
231
|
+
approveTarget: void 0,
|
|
232
|
+
permissible: false,
|
|
233
|
+
type: "kyc-on-demand"
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
141
237
|
return this.#withdrawalMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
142
238
|
}
|
|
143
239
|
/**
|
|
@@ -297,8 +393,6 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
297
393
|
zapper,
|
|
298
394
|
// Approval target is zapper when routed, otherwise the pool contract.
|
|
299
395
|
approveTarget: zapper?.baseParams.addr ?? pool.pool.address,
|
|
300
|
-
// TODO: instead of permissible, return permitType depending on tokenIn
|
|
301
|
-
// "none" | "eip2612" | "dai_like";
|
|
302
396
|
permissible: !!zapper && !(0, import_utils.hexEq)(tokenIn, import_constants.NATIVE_ADDRESS),
|
|
303
397
|
type
|
|
304
398
|
};
|
|
@@ -326,8 +420,6 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
326
420
|
zapper,
|
|
327
421
|
// Approval target exists only for zapper-based withdrawals.
|
|
328
422
|
approveTarget: zapper?.baseParams.addr,
|
|
329
|
-
// TODO: instead of permissible, return permitType depending on tokenIn
|
|
330
|
-
// "none" | "eip2612" | "dai_like";
|
|
331
423
|
permissible: !!zapper,
|
|
332
424
|
type
|
|
333
425
|
};
|