@gearbox-protocol/sdk 14.7.0 → 14.8.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/compressors/{kycCompressor.js → rwaCompressor.js} +13 -13
- package/dist/cjs/abi/compressors/subcompressors/{kyc/onDemandKYCUnderlyingSubcompressor.js → rwa/onDemandRWAUnderlyingSubcompressor.js} +6 -6
- package/dist/cjs/abi/compressors/subcompressors/{kyc/securitizeKYCFactorySubcompressor.js → rwa/securitizeRWAFactorySubcompressor.js} +6 -6
- package/dist/cjs/abi/{kyc/iKYCCompressor.js → rwa/iRWACompressor.js} +13 -13
- package/dist/cjs/abi/{kyc/iKYCFactory.js → rwa/iRWAFactory.js} +6 -6
- package/dist/cjs/abi/{kyc/iKYCUnderlying.js → rwa/iRWAUnderlying.js} +7 -7
- package/dist/cjs/abi/{kyc/iSecuritizeKYCFactory.js → rwa/iSecuritizeRWAFactory.js} +7 -7
- package/dist/cjs/dev/claimDSToken.js +4 -4
- package/dist/cjs/plugins/adapters/abi/index.js +2 -0
- package/dist/cjs/plugins/adapters/abi/securitize/index.js +30 -0
- package/dist/cjs/sdk/OnchainSDK.js +12 -12
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +59 -59
- package/dist/cjs/sdk/base/TokensMeta.js +6 -6
- package/dist/cjs/sdk/base/token-types.js +11 -11
- package/dist/cjs/sdk/chain/chains.js +16 -16
- package/dist/cjs/sdk/constants/address-provider.js +3 -3
- package/dist/cjs/sdk/market/MarketSuite.js +2 -2
- package/dist/cjs/sdk/market/index.js +2 -2
- package/dist/cjs/sdk/market/pool/PoolSuite.js +2 -2
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +3 -3
- package/dist/cjs/sdk/market/{kyc/KYCRegistry.js → rwa/RWARegistry.js} +48 -48
- package/dist/cjs/sdk/market/{kyc → rwa}/index.js +6 -6
- package/dist/cjs/sdk/market/{kyc → rwa}/securitize/SecuritizeDegenNFT.js +1 -1
- package/dist/cjs/sdk/market/{kyc/securitize/SecuritizeKYCFactory.js → rwa/securitize/SecuritizeRWAFactory.js} +20 -20
- package/dist/cjs/sdk/market/{kyc → rwa}/securitize/constants.js +3 -3
- package/dist/cjs/sdk/market/{kyc → rwa}/securitize/index.js +2 -2
- package/dist/cjs/sdk/market/{kyc → rwa}/types.js +6 -6
- package/dist/cjs/sdk/options.js +4 -4
- package/dist/cjs/sdk/pools/PoolService.js +26 -26
- package/dist/esm/abi/compressors/{kycCompressor.js → rwaCompressor.js} +9 -9
- package/dist/esm/abi/compressors/subcompressors/{kyc/onDemandKYCUnderlyingSubcompressor.js → rwa/onDemandRWAUnderlyingSubcompressor.js} +2 -2
- package/dist/esm/abi/compressors/subcompressors/{kyc/securitizeKYCFactorySubcompressor.js → rwa/securitizeRWAFactorySubcompressor.js} +2 -2
- package/dist/esm/abi/{kyc/iKYCCompressor.js → rwa/iRWACompressor.js} +9 -9
- package/dist/esm/abi/{kyc/iKYCFactory.js → rwa/iRWAFactory.js} +2 -2
- package/dist/esm/abi/{kyc/iKYCUnderlying.js → rwa/iRWAUnderlying.js} +3 -3
- package/dist/esm/abi/{kyc/iSecuritizeKYCFactory.js → rwa/iSecuritizeRWAFactory.js} +3 -3
- package/dist/esm/dev/claimDSToken.js +4 -4
- package/dist/esm/plugins/adapters/abi/index.js +1 -0
- package/dist/esm/plugins/adapters/abi/securitize/index.js +5 -0
- package/dist/esm/sdk/OnchainSDK.js +13 -13
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +59 -59
- package/dist/esm/sdk/base/TokensMeta.js +6 -6
- package/dist/esm/sdk/base/token-types.js +7 -7
- package/dist/esm/sdk/chain/chains.js +16 -16
- package/dist/esm/sdk/constants/address-provider.js +2 -2
- package/dist/esm/sdk/market/MarketSuite.js +2 -2
- package/dist/esm/sdk/market/index.js +1 -1
- package/dist/esm/sdk/market/pool/PoolSuite.js +2 -2
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +3 -3
- package/dist/esm/sdk/market/{kyc/KYCRegistry.js → rwa/RWARegistry.js} +50 -50
- package/dist/esm/sdk/market/{kyc → rwa}/index.js +1 -1
- package/dist/esm/sdk/market/{kyc → rwa}/securitize/SecuritizeDegenNFT.js +1 -1
- package/dist/esm/sdk/market/{kyc/securitize/SecuritizeKYCFactory.js → rwa/securitize/SecuritizeRWAFactory.js} +17 -17
- package/dist/esm/sdk/market/rwa/securitize/constants.js +4 -0
- package/dist/esm/sdk/market/{kyc → rwa}/securitize/index.js +1 -1
- package/dist/esm/sdk/market/rwa/types.js +9 -0
- package/dist/esm/sdk/options.js +4 -4
- package/dist/esm/sdk/pools/PoolService.js +28 -28
- package/dist/types/abi/compressors/{kycCompressor.d.ts → rwaCompressor.d.ts} +8 -8
- package/dist/types/abi/compressors/subcompressors/{kyc/onDemandKYCUnderlyingSubcompressor.d.ts → rwa/onDemandRWAUnderlyingSubcompressor.d.ts} +1 -1
- package/dist/types/abi/compressors/subcompressors/{kyc/securitizeKYCFactorySubcompressor.d.ts → rwa/securitizeRWAFactorySubcompressor.d.ts} +1 -1
- package/dist/types/abi/{kyc/iKYCCompressor.d.ts → rwa/iRWACompressor.d.ts} +8 -8
- package/dist/types/abi/{kyc/iKYCFactory.d.ts → rwa/iRWAFactory.d.ts} +1 -1
- package/dist/types/abi/{kyc/iKYCUnderlying.d.ts → rwa/iRWAUnderlying.d.ts} +2 -2
- package/dist/types/abi/{kyc/iSecuritizeKYCFactory.d.ts → rwa/iSecuritizeRWAFactory.d.ts} +2 -2
- package/dist/types/dev/claimDSToken.d.ts +1 -1
- package/dist/types/plugins/adapters/abi/index.d.ts +1 -0
- package/dist/types/plugins/adapters/abi/securitize/index.d.ts +5 -0
- package/dist/types/sdk/OnchainSDK.d.ts +5 -5
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +19 -19
- package/dist/types/sdk/accounts/types.d.ts +26 -26
- package/dist/types/sdk/base/TokensMeta.d.ts +5 -5
- package/dist/types/sdk/base/token-types.d.ts +17 -17
- package/dist/types/sdk/base/types.d.ts +2 -2
- package/dist/types/sdk/chain/chains.d.ts +2 -2
- package/dist/types/sdk/constants/address-provider.d.ts +1 -1
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -2
- package/dist/types/sdk/market/index.d.ts +1 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -2
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -2
- package/dist/types/sdk/market/rwa/RWARegistry.d.ts +52 -0
- package/dist/types/sdk/market/{kyc → rwa}/index.d.ts +1 -1
- package/dist/types/sdk/market/{kyc/securitize/SecuritizeKYCFactory.d.ts → rwa/securitize/SecuritizeRWAFactory.d.ts} +16 -16
- package/dist/types/sdk/market/rwa/securitize/constants.d.ts +1 -0
- package/dist/types/sdk/market/{kyc → rwa}/securitize/index.d.ts +1 -1
- package/dist/types/sdk/market/{kyc → rwa}/securitize/types.d.ts +12 -12
- package/dist/types/sdk/market/{kyc → rwa}/types.d.ts +48 -48
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +1 -1
- package/dist/types/sdk/pools/types.d.ts +4 -4
- package/dist/types/sdk/types/state-human.d.ts +2 -2
- package/dist/types/sdk/types/state.d.ts +3 -3
- package/package.json +1 -1
- package/dist/esm/sdk/market/kyc/securitize/constants.js +0 -4
- package/dist/esm/sdk/market/kyc/types.js +0 -9
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +0 -52
- package/dist/types/sdk/market/kyc/securitize/constants.d.ts +0 -1
- /package/dist/cjs/abi/{kyc → rwa}/iDSRegistryService.js +0 -0
- /package/dist/cjs/abi/{kyc → rwa}/iDSToken.js +0 -0
- /package/dist/cjs/abi/{kyc → rwa}/iSecuritizeDegenNFT.js +0 -0
- /package/dist/cjs/sdk/market/{kyc → rwa}/securitize/types.js +0 -0
- /package/dist/esm/abi/{kyc → rwa}/iDSRegistryService.js +0 -0
- /package/dist/esm/abi/{kyc → rwa}/iDSToken.js +0 -0
- /package/dist/esm/abi/{kyc → rwa}/iSecuritizeDegenNFT.js +0 -0
- /package/dist/esm/sdk/market/{kyc → rwa}/securitize/types.js +0 -0
- /package/dist/types/abi/{kyc → rwa}/iDSRegistryService.d.ts +0 -0
- /package/dist/types/abi/{kyc → rwa}/iDSToken.d.ts +0 -0
- /package/dist/types/abi/{kyc → rwa}/iSecuritizeDegenNFT.d.ts +0 -0
- /package/dist/types/sdk/market/{kyc → rwa}/securitize/SecuritizeDegenNFT.d.ts +0 -0
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { decodeAbiParameters } from "viem";
|
|
2
|
-
import {
|
|
2
|
+
import { iRWACompressorAbi } from "../../../abi/rwa/iRWACompressor.js";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
RWA_ON_DEMAND_LP_MONOPOLIZED,
|
|
5
|
+
RWA_UNDERLYING_DEFAULT,
|
|
6
|
+
RWA_UNDERLYING_ON_DEMAND,
|
|
7
7
|
SDKConstruct
|
|
8
8
|
} from "../../base/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import { AP_RWA_COMPRESSOR, VERSION_RANGE_310 } from "../../constants/index.js";
|
|
10
10
|
import { AddressMap, bytes32ToString } from "../../utils/index.js";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
RWA_FACTORY_SECURITIZE,
|
|
13
|
+
SecuritizeRWAFactory
|
|
14
14
|
} from "./securitize/index.js";
|
|
15
|
-
class
|
|
15
|
+
class RWARegistry extends SDKConstruct {
|
|
16
16
|
#state;
|
|
17
17
|
#factories = new AddressMap();
|
|
18
18
|
/**
|
|
19
19
|
* @internal
|
|
20
20
|
*
|
|
21
|
-
* Returns delegated multicalls for loading all
|
|
21
|
+
* Returns delegated multicalls for loading all RWA underlying tokens from the on-chain RWA compressor.
|
|
22
22
|
* Used by the SDK to compose batched RPC calls.
|
|
23
23
|
*
|
|
24
24
|
* @param configurators - Market configurators to query.
|
|
25
|
-
* @param
|
|
25
|
+
* @param rwaFactories - RWA factory contracts to query.
|
|
26
26
|
*/
|
|
27
|
-
getLoadMulticalls(configurators,
|
|
28
|
-
if (!
|
|
27
|
+
getLoadMulticalls(configurators, rwaFactories = []) {
|
|
28
|
+
if (!rwaFactories.length) {
|
|
29
29
|
return [];
|
|
30
30
|
}
|
|
31
|
-
const [
|
|
32
|
-
|
|
31
|
+
const [rwaCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
|
|
32
|
+
AP_RWA_COMPRESSOR,
|
|
33
33
|
VERSION_RANGE_310
|
|
34
34
|
);
|
|
35
35
|
return [
|
|
36
36
|
{
|
|
37
37
|
call: {
|
|
38
|
-
abi:
|
|
39
|
-
address:
|
|
40
|
-
functionName: "
|
|
41
|
-
args: [configurators,
|
|
38
|
+
abi: iRWACompressorAbi,
|
|
39
|
+
address: rwaCompressorAddress,
|
|
40
|
+
functionName: "getRWAMarketsData",
|
|
41
|
+
args: [configurators, rwaFactories]
|
|
42
42
|
},
|
|
43
43
|
onResult: (resp) => this.setState(resp)
|
|
44
44
|
}
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Fetches decoded investor data from the on-chain
|
|
48
|
+
* Fetches decoded investor data from the on-chain RWA compressor.
|
|
49
49
|
*
|
|
50
50
|
* Each factory produces its own investor data (e.g. registered tokens,
|
|
51
51
|
* cached signatures, EIP-712 messages to sign).
|
|
@@ -62,14 +62,14 @@ class KYCRegistry extends SDKConstruct {
|
|
|
62
62
|
if (!factories.length) {
|
|
63
63
|
return [];
|
|
64
64
|
}
|
|
65
|
-
const [
|
|
66
|
-
|
|
65
|
+
const [rwaCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
|
|
66
|
+
AP_RWA_COMPRESSOR,
|
|
67
67
|
VERSION_RANGE_310
|
|
68
68
|
);
|
|
69
69
|
const resp = await this.client.readContract({
|
|
70
|
-
abi:
|
|
71
|
-
address:
|
|
72
|
-
functionName: "
|
|
70
|
+
abi: iRWACompressorAbi,
|
|
71
|
+
address: rwaCompressorAddress,
|
|
72
|
+
functionName: "getRWAInvestorData",
|
|
73
73
|
args: [investor, factories.map((f) => f.address)]
|
|
74
74
|
});
|
|
75
75
|
const result = [];
|
|
@@ -81,16 +81,16 @@ class KYCRegistry extends SDKConstruct {
|
|
|
81
81
|
}
|
|
82
82
|
return result;
|
|
83
83
|
}
|
|
84
|
-
/** All loaded
|
|
84
|
+
/** All loaded RWA factory instances. */
|
|
85
85
|
get factories() {
|
|
86
86
|
return this.#factories.values();
|
|
87
87
|
}
|
|
88
|
-
/** Raw
|
|
88
|
+
/** Raw RWA compressor response, or `undefined` before attach/hydrate. */
|
|
89
89
|
get state() {
|
|
90
90
|
return this.#state;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
* Returns a human-readable snapshot of the
|
|
93
|
+
* Returns a human-readable snapshot of the RWA state.
|
|
94
94
|
*/
|
|
95
95
|
stateHuman(raw) {
|
|
96
96
|
return {
|
|
@@ -100,8 +100,8 @@ class KYCRegistry extends SDKConstruct {
|
|
|
100
100
|
/**
|
|
101
101
|
* @internal
|
|
102
102
|
*
|
|
103
|
-
* Replaces the internal state with a new
|
|
104
|
-
* Rebuilds token metadata for
|
|
103
|
+
* Replaces the internal state with a new RWA compressor response.
|
|
104
|
+
* Rebuilds token metadata for RWA underlyings and re-instantiates factory
|
|
105
105
|
* wrappers.
|
|
106
106
|
*/
|
|
107
107
|
setState(resp) {
|
|
@@ -111,7 +111,7 @@ class KYCRegistry extends SDKConstruct {
|
|
|
111
111
|
}
|
|
112
112
|
this.#factories.clear();
|
|
113
113
|
for (const f of resp?.[1] ?? []) {
|
|
114
|
-
this.#
|
|
114
|
+
this.#loadRWAFactoryData(f);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
#loadUnderlyingTokenData(u) {
|
|
@@ -119,24 +119,24 @@ class KYCRegistry extends SDKConstruct {
|
|
|
119
119
|
const meta = this.tokensMeta.get(u.baseParams.addr);
|
|
120
120
|
if (!meta) {
|
|
121
121
|
throw new Error(
|
|
122
|
-
`
|
|
122
|
+
`RWA underlying token ${contractType} (${u.baseParams.addr}) not found in tokensMeta`
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
switch (contractType) {
|
|
126
|
-
case
|
|
127
|
-
this.#
|
|
126
|
+
case RWA_UNDERLYING_DEFAULT:
|
|
127
|
+
this.#loadRWAUnderlyingDefault(meta, u);
|
|
128
128
|
break;
|
|
129
|
-
case
|
|
130
|
-
this.#
|
|
129
|
+
case RWA_UNDERLYING_ON_DEMAND:
|
|
130
|
+
this.#loadRWAUnderlyingOnDemand(meta, u);
|
|
131
131
|
break;
|
|
132
132
|
default:
|
|
133
133
|
if (this.sdk.strictContractTypes) {
|
|
134
|
-
throw new Error(`Unknown
|
|
134
|
+
throw new Error(`Unknown RWA underlying type: ${contractType}`);
|
|
135
135
|
}
|
|
136
|
-
this.logger?.warn(`unknown
|
|
136
|
+
this.logger?.warn(`unknown RWA underlying type: ${contractType}`);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
#
|
|
139
|
+
#loadRWAUnderlyingDefault(meta, data) {
|
|
140
140
|
const decoded = decodeAbiParameters(
|
|
141
141
|
[
|
|
142
142
|
{ name: "factory", type: "address" },
|
|
@@ -146,12 +146,12 @@ class KYCRegistry extends SDKConstruct {
|
|
|
146
146
|
);
|
|
147
147
|
this.tokensMeta.upsert(data.baseParams.addr, {
|
|
148
148
|
...meta,
|
|
149
|
-
contractType:
|
|
150
|
-
|
|
149
|
+
contractType: RWA_UNDERLYING_DEFAULT,
|
|
150
|
+
rwaFactory: decoded[0],
|
|
151
151
|
asset: decoded[1]
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
|
-
#
|
|
154
|
+
#loadRWAUnderlyingOnDemand(meta, data) {
|
|
155
155
|
const decoded = decodeAbiParameters(
|
|
156
156
|
[
|
|
157
157
|
{ name: "factory", type: "address" },
|
|
@@ -171,8 +171,8 @@ class KYCRegistry extends SDKConstruct {
|
|
|
171
171
|
}
|
|
172
172
|
this.tokensMeta.upsert(data.baseParams.addr, {
|
|
173
173
|
...meta,
|
|
174
|
-
contractType:
|
|
175
|
-
|
|
174
|
+
contractType: RWA_UNDERLYING_ON_DEMAND,
|
|
175
|
+
rwaFactory: decoded[0],
|
|
176
176
|
asset: decoded[1],
|
|
177
177
|
pool: decoded[2],
|
|
178
178
|
marketConfigurator: decoded[4],
|
|
@@ -199,7 +199,7 @@ class KYCRegistry extends SDKConstruct {
|
|
|
199
199
|
);
|
|
200
200
|
const contractType = bytes32ToString(decoded.contractType);
|
|
201
201
|
switch (contractType) {
|
|
202
|
-
case
|
|
202
|
+
case RWA_ON_DEMAND_LP_MONOPOLIZED:
|
|
203
203
|
return this.#getOnDemandLPMonopolizedMeta(
|
|
204
204
|
decoded.addr,
|
|
205
205
|
decoded.version,
|
|
@@ -231,28 +231,28 @@ class KYCRegistry extends SDKConstruct {
|
|
|
231
231
|
return {
|
|
232
232
|
addr,
|
|
233
233
|
version,
|
|
234
|
-
contractType:
|
|
234
|
+
contractType: RWA_ON_DEMAND_LP_MONOPOLIZED,
|
|
235
235
|
marketConfigurator,
|
|
236
236
|
depositor,
|
|
237
237
|
pools: [...pools]
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
|
-
#
|
|
240
|
+
#loadRWAFactoryData(data) {
|
|
241
241
|
const contractType = bytes32ToString(data.baseParams.contractType);
|
|
242
242
|
switch (contractType) {
|
|
243
|
-
case
|
|
243
|
+
case RWA_FACTORY_SECURITIZE:
|
|
244
244
|
this.#factories.upsert(
|
|
245
245
|
data.baseParams.addr,
|
|
246
|
-
new
|
|
246
|
+
new SecuritizeRWAFactory(this.sdk, data)
|
|
247
247
|
);
|
|
248
248
|
break;
|
|
249
249
|
default:
|
|
250
250
|
throw new Error(
|
|
251
|
-
`Unknown
|
|
251
|
+
`Unknown RWA factory type: ${contractType} for ${data.baseParams.addr}`
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
export {
|
|
257
|
-
|
|
257
|
+
RWARegistry
|
|
258
258
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { iSecuritizeDegenNFTAbi } from "../../../../abi/
|
|
1
|
+
import { iSecuritizeDegenNFTAbi } from "../../../../abi/rwa/iSecuritizeDegenNFT.js";
|
|
2
2
|
import { BaseContract } from "../../../base/index.js";
|
|
3
3
|
const abi = iSecuritizeDegenNFTAbi;
|
|
4
4
|
class SecuritizeDegenNFT extends BaseContract {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { decodeAbiParameters } from "viem";
|
|
2
|
-
import {
|
|
2
|
+
import { iSecuritizeRWAFactoryAbi } from "../../../../abi/rwa/iSecuritizeRWAFactory.js";
|
|
3
3
|
import { BaseContract } from "../../../base/index.js";
|
|
4
4
|
import { AddressMap, AddressSet } from "../../../utils/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { RWA_FACTORY_SECURITIZE } from "./constants.js";
|
|
6
6
|
import { SecuritizeDegenNFT } from "./SecuritizeDegenNFT.js";
|
|
7
7
|
import {
|
|
8
8
|
SECURITIZE_REGISTER_VAULT_TYPES
|
|
9
9
|
} from "./types.js";
|
|
10
|
-
const abi =
|
|
11
|
-
class
|
|
10
|
+
const abi = iSecuritizeRWAFactoryAbi;
|
|
11
|
+
class SecuritizeRWAFactory extends BaseContract {
|
|
12
12
|
#sdk;
|
|
13
13
|
#investorCache = new AddressMap();
|
|
14
14
|
degenNFT;
|
|
15
15
|
owner;
|
|
16
16
|
dsTokens;
|
|
17
|
-
contractType =
|
|
17
|
+
contractType = RWA_FACTORY_SECURITIZE;
|
|
18
18
|
constructor(sdk, data) {
|
|
19
19
|
super(sdk, {
|
|
20
20
|
...data.baseParams,
|
|
21
|
-
name: "
|
|
21
|
+
name: "SecuritizeRWAFactory",
|
|
22
22
|
abi
|
|
23
23
|
});
|
|
24
24
|
this.#sdk = sdk;
|
|
@@ -50,7 +50,7 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* {@inheritDoc
|
|
53
|
+
* {@inheritDoc IRWAFactory.decodeInvestorData}
|
|
54
54
|
*/
|
|
55
55
|
decodeInvestorData(data) {
|
|
56
56
|
const { creditAccounts, extraDetails } = data;
|
|
@@ -71,7 +71,7 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
71
71
|
extraDetails
|
|
72
72
|
);
|
|
73
73
|
return {
|
|
74
|
-
type:
|
|
74
|
+
type: RWA_FACTORY_SECURITIZE,
|
|
75
75
|
factory: this.address,
|
|
76
76
|
cachedSignatures: [...cachedSignatures],
|
|
77
77
|
registerVaultMessages: registerVaultMessages.map((m) => ({
|
|
@@ -105,7 +105,7 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* {@inheritDoc
|
|
108
|
+
* {@inheritDoc IRWAFactory.getInvestor}
|
|
109
109
|
*/
|
|
110
110
|
async getInvestor(creditAccount, fromCache) {
|
|
111
111
|
if (fromCache && this.#investorCache.has(creditAccount)) {
|
|
@@ -118,7 +118,7 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
118
118
|
return investor;
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
|
-
* {@inheritDoc
|
|
121
|
+
* {@inheritDoc IRWAFactory.getApprovalAddress}
|
|
122
122
|
*/
|
|
123
123
|
async getApprovalAddress(options) {
|
|
124
124
|
if ("creditAccount" in options) {
|
|
@@ -130,13 +130,13 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
|
-
* {@inheritDoc
|
|
133
|
+
* {@inheritDoc IRWAFactory.getWallet}
|
|
134
134
|
*/
|
|
135
135
|
async getWallet(creditAccount) {
|
|
136
136
|
return this.contract.read.getWallet([creditAccount]);
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* {@inheritDoc
|
|
139
|
+
* {@inheritDoc IRWAFactory.multicall}
|
|
140
140
|
*/
|
|
141
141
|
multicall(creditAccount, calls, options) {
|
|
142
142
|
const { tokensToRegister = [], signaturesToCache = [] } = options ?? {};
|
|
@@ -146,10 +146,10 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
|
-
* {@inheritDoc
|
|
149
|
+
* {@inheritDoc IRWAFactory.getOpenAccountRequirements}
|
|
150
150
|
*/
|
|
151
151
|
async getOpenAccountRequirements(investor, props) {
|
|
152
|
-
const [investorData] = await this.#sdk.
|
|
152
|
+
const [investorData] = await this.#sdk.rwa.getInvestorData(investor, [
|
|
153
153
|
this.address
|
|
154
154
|
]);
|
|
155
155
|
const tokensToRegister = new AddressSet([props.tokenOutAddress]);
|
|
@@ -163,14 +163,14 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
163
163
|
(m) => unsignedTokens.has(m.message.token)
|
|
164
164
|
);
|
|
165
165
|
return {
|
|
166
|
-
type:
|
|
166
|
+
type: RWA_FACTORY_SECURITIZE,
|
|
167
167
|
securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
|
|
168
168
|
tokensToRegister: Array.from(tokensToRegister),
|
|
169
169
|
requiredSignatures
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
-
* {@inheritDoc
|
|
173
|
+
* {@inheritDoc IRWAFactory.openCreditAccount}
|
|
174
174
|
*/
|
|
175
175
|
openCreditAccount(creditManager, calls, options) {
|
|
176
176
|
const { tokensToRegister = [], signaturesToCache = [] } = options ?? {};
|
|
@@ -234,5 +234,5 @@ const registerVaultMessageTuple = [
|
|
|
234
234
|
{ name: "deadline", type: "uint256" }
|
|
235
235
|
];
|
|
236
236
|
export {
|
|
237
|
-
|
|
237
|
+
SecuritizeRWAFactory
|
|
238
238
|
};
|
package/dist/esm/sdk/options.js
CHANGED
|
@@ -24,11 +24,11 @@ const AttachOptionsSchema = z.object({
|
|
|
24
24
|
/** Addresses of market configurator contracts to load. */
|
|
25
25
|
marketConfigurators: z.array(ZodAddress()).optional(),
|
|
26
26
|
/**
|
|
27
|
-
* Addresses of
|
|
28
|
-
* If not set, all default
|
|
29
|
-
* (from {@link GearboxChain.
|
|
27
|
+
* Addresses of RWA factory contracts to load.
|
|
28
|
+
* If not set, all default RWA factories for the chain are loaded
|
|
29
|
+
* (from {@link GearboxChain.rwaFactories})
|
|
30
30
|
**/
|
|
31
|
-
|
|
31
|
+
rwaFactories: z.array(ZodAddress()).optional(),
|
|
32
32
|
/** Pin SDK to a specific block number during attach. */
|
|
33
33
|
blockNumber: z.union([z.bigint().nonnegative(), z.number().int().nonnegative()]).optional(),
|
|
34
34
|
/** Skip fetching updatable price feeds on attach and sync. */
|
|
@@ -4,8 +4,8 @@ import { ierc20ZapperDepositsAbi } from "../../abi/iERC20ZapperDeposits.js";
|
|
|
4
4
|
import { iethZapperDepositsAbi } from "../../abi/iETHZapperDeposits.js";
|
|
5
5
|
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
RWA_UNDERLYING_DEFAULT,
|
|
8
|
+
RWA_UNDERLYING_ON_DEMAND,
|
|
9
9
|
SDKConstruct
|
|
10
10
|
} from "../base/index.js";
|
|
11
11
|
import { NATIVE_ADDRESS } from "../constants/index.js";
|
|
@@ -16,11 +16,11 @@ class PoolService extends SDKConstruct {
|
|
|
16
16
|
*/
|
|
17
17
|
getDepositTokensIn(pool) {
|
|
18
18
|
const underlying = this.#describeUnderlying(pool);
|
|
19
|
-
if (this.sdk.tokensMeta.
|
|
19
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
20
20
|
switch (underlying.contractType) {
|
|
21
|
-
case
|
|
21
|
+
case RWA_UNDERLYING_DEFAULT:
|
|
22
22
|
return this.#depositTokensIn(pool, false);
|
|
23
|
-
case
|
|
23
|
+
case RWA_UNDERLYING_ON_DEMAND:
|
|
24
24
|
return [underlying.asset];
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -31,11 +31,11 @@ class PoolService extends SDKConstruct {
|
|
|
31
31
|
*/
|
|
32
32
|
getDepositTokensOut(pool, tokenIn) {
|
|
33
33
|
const underlying = this.#describeUnderlying(pool);
|
|
34
|
-
if (this.sdk.tokensMeta.
|
|
34
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
35
35
|
switch (underlying.contractType) {
|
|
36
|
-
case
|
|
36
|
+
case RWA_UNDERLYING_DEFAULT:
|
|
37
37
|
return this.#depositTokensOut(pool, tokenIn, false);
|
|
38
|
-
case
|
|
38
|
+
case RWA_UNDERLYING_ON_DEMAND:
|
|
39
39
|
return [];
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -46,23 +46,23 @@ class PoolService extends SDKConstruct {
|
|
|
46
46
|
*/
|
|
47
47
|
getDepositMetadata(pool, tokenIn, tokenOut) {
|
|
48
48
|
const underlying = this.#describeUnderlying(pool);
|
|
49
|
-
if (this.sdk.tokensMeta.
|
|
49
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
50
50
|
switch (underlying.contractType) {
|
|
51
|
-
case
|
|
51
|
+
case RWA_UNDERLYING_DEFAULT: {
|
|
52
52
|
return this.#depositMetadata(
|
|
53
|
-
"
|
|
53
|
+
"rwa-default",
|
|
54
54
|
pool,
|
|
55
55
|
tokenIn,
|
|
56
56
|
tokenOut,
|
|
57
57
|
false
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
case
|
|
60
|
+
case RWA_UNDERLYING_ON_DEMAND:
|
|
61
61
|
return {
|
|
62
62
|
zapper: void 0,
|
|
63
63
|
approveTarget: underlying.liquidityProvider.addr,
|
|
64
64
|
permissible: false,
|
|
65
|
-
type: "
|
|
65
|
+
type: "rwa-on-demand"
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -74,8 +74,8 @@ class PoolService extends SDKConstruct {
|
|
|
74
74
|
addLiquidity(props) {
|
|
75
75
|
const { collateral, meta, permit, referralCode, pool, wallet } = props;
|
|
76
76
|
const underlying = this.#describeUnderlying(pool);
|
|
77
|
-
if (this.sdk.tokensMeta.
|
|
78
|
-
if (underlying.contractType ===
|
|
77
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
78
|
+
if (underlying.contractType === RWA_UNDERLYING_ON_DEMAND) {
|
|
79
79
|
return void 0;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -122,11 +122,11 @@ class PoolService extends SDKConstruct {
|
|
|
122
122
|
*/
|
|
123
123
|
getWithdrawalTokensIn(pool) {
|
|
124
124
|
const underlying = this.#describeUnderlying(pool);
|
|
125
|
-
if (this.sdk.tokensMeta.
|
|
125
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
126
126
|
switch (underlying.contractType) {
|
|
127
|
-
case
|
|
127
|
+
case RWA_UNDERLYING_DEFAULT:
|
|
128
128
|
return this.#withdrawalTokensIn(pool, false);
|
|
129
|
-
case
|
|
129
|
+
case RWA_UNDERLYING_ON_DEMAND:
|
|
130
130
|
return [];
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -137,11 +137,11 @@ class PoolService extends SDKConstruct {
|
|
|
137
137
|
*/
|
|
138
138
|
getWithdrawalTokensOut(pool, tokenIn) {
|
|
139
139
|
const underlying = this.#describeUnderlying(pool);
|
|
140
|
-
if (this.sdk.tokensMeta.
|
|
140
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
141
141
|
switch (underlying.contractType) {
|
|
142
|
-
case
|
|
142
|
+
case RWA_UNDERLYING_DEFAULT:
|
|
143
143
|
return this.#withdrawalTokensOut(pool, tokenIn, false);
|
|
144
|
-
case
|
|
144
|
+
case RWA_UNDERLYING_ON_DEMAND:
|
|
145
145
|
return [underlying.asset];
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -153,8 +153,8 @@ class PoolService extends SDKConstruct {
|
|
|
153
153
|
removeLiquidity(props) {
|
|
154
154
|
const { pool, amount, meta, wallet, permit } = props;
|
|
155
155
|
const underlying = this.#describeUnderlying(pool);
|
|
156
|
-
if (this.sdk.tokensMeta.
|
|
157
|
-
if (underlying.contractType ===
|
|
156
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
157
|
+
if (underlying.contractType === RWA_UNDERLYING_ON_DEMAND) {
|
|
158
158
|
return {
|
|
159
159
|
abi: ierc20Abi,
|
|
160
160
|
functionName: "approve",
|
|
@@ -195,23 +195,23 @@ class PoolService extends SDKConstruct {
|
|
|
195
195
|
*/
|
|
196
196
|
getWithdrawalMetadata(pool, tokenIn, tokenOut) {
|
|
197
197
|
const underlying = this.#describeUnderlying(pool);
|
|
198
|
-
if (this.sdk.tokensMeta.
|
|
198
|
+
if (this.sdk.tokensMeta.isRWAUnderlying(underlying)) {
|
|
199
199
|
switch (underlying.contractType) {
|
|
200
|
-
case
|
|
200
|
+
case RWA_UNDERLYING_DEFAULT: {
|
|
201
201
|
return this.#withdrawalMetadata(
|
|
202
|
-
"
|
|
202
|
+
"rwa-default",
|
|
203
203
|
pool,
|
|
204
204
|
tokenIn,
|
|
205
205
|
tokenOut,
|
|
206
206
|
false
|
|
207
207
|
);
|
|
208
208
|
}
|
|
209
|
-
case
|
|
209
|
+
case RWA_UNDERLYING_ON_DEMAND:
|
|
210
210
|
return {
|
|
211
211
|
zapper: void 0,
|
|
212
212
|
approveTarget: void 0,
|
|
213
213
|
permissible: false,
|
|
214
|
-
type: "
|
|
214
|
+
type: "rwa-on-demand"
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
217
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const rwaCompressorAbi: readonly [{
|
|
2
2
|
readonly type: "constructor";
|
|
3
3
|
readonly inputs: readonly [{
|
|
4
4
|
readonly name: "addressProvider";
|
|
@@ -18,7 +18,7 @@ export declare const kycCompressorAbi: readonly [{
|
|
|
18
18
|
readonly stateMutability: "view";
|
|
19
19
|
}, {
|
|
20
20
|
readonly type: "function";
|
|
21
|
-
readonly name: "
|
|
21
|
+
readonly name: "getRWAInvestorData";
|
|
22
22
|
readonly inputs: readonly [{
|
|
23
23
|
readonly name: "investor";
|
|
24
24
|
readonly type: "address";
|
|
@@ -31,11 +31,11 @@ export declare const kycCompressorAbi: readonly [{
|
|
|
31
31
|
readonly outputs: readonly [{
|
|
32
32
|
readonly name: "investorData";
|
|
33
33
|
readonly type: "tuple[]";
|
|
34
|
-
readonly internalType: "struct
|
|
34
|
+
readonly internalType: "struct IRWACompressor.RWAInvestorData[]";
|
|
35
35
|
readonly components: readonly [{
|
|
36
36
|
readonly name: "creditAccounts";
|
|
37
37
|
readonly type: "tuple[]";
|
|
38
|
-
readonly internalType: "struct
|
|
38
|
+
readonly internalType: "struct IRWACompressor.RWACreditAccountData[]";
|
|
39
39
|
readonly components: readonly [{
|
|
40
40
|
readonly name: "creditAccount";
|
|
41
41
|
readonly type: "address";
|
|
@@ -62,7 +62,7 @@ export declare const kycCompressorAbi: readonly [{
|
|
|
62
62
|
readonly stateMutability: "view";
|
|
63
63
|
}, {
|
|
64
64
|
readonly type: "function";
|
|
65
|
-
readonly name: "
|
|
65
|
+
readonly name: "getRWAMarketsData";
|
|
66
66
|
readonly inputs: readonly [{
|
|
67
67
|
readonly name: "configurators";
|
|
68
68
|
readonly type: "address[]";
|
|
@@ -75,7 +75,7 @@ export declare const kycCompressorAbi: readonly [{
|
|
|
75
75
|
readonly outputs: readonly [{
|
|
76
76
|
readonly name: "underlyingsData";
|
|
77
77
|
readonly type: "tuple[]";
|
|
78
|
-
readonly internalType: "struct
|
|
78
|
+
readonly internalType: "struct IRWACompressor.RWAUnderlyingData[]";
|
|
79
79
|
readonly components: readonly [{
|
|
80
80
|
readonly name: "baseParams";
|
|
81
81
|
readonly type: "tuple";
|
|
@@ -113,7 +113,7 @@ export declare const kycCompressorAbi: readonly [{
|
|
|
113
113
|
}, {
|
|
114
114
|
readonly name: "factoriesData";
|
|
115
115
|
readonly type: "tuple[]";
|
|
116
|
-
readonly internalType: "struct
|
|
116
|
+
readonly internalType: "struct IRWACompressor.RWAFactoryData[]";
|
|
117
117
|
readonly components: readonly [{
|
|
118
118
|
readonly name: "baseParams";
|
|
119
119
|
readonly type: "tuple";
|
|
@@ -219,7 +219,7 @@ export declare const kycCompressorAbi: readonly [{
|
|
|
219
219
|
}];
|
|
220
220
|
}, {
|
|
221
221
|
readonly type: "error";
|
|
222
|
-
readonly name: "
|
|
222
|
+
readonly name: "InvalidRWAFactoryException";
|
|
223
223
|
readonly inputs: readonly [{
|
|
224
224
|
readonly name: "factory";
|
|
225
225
|
readonly type: "address";
|