@gearbox-protocol/sdk 18.2.0-next.1 → 18.2.0-next.3
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/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +179 -0
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +534 -0
- package/dist/cjs/abi/router/treehouseWorker.js +885 -0
- package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
- package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +3 -0
- package/dist/cjs/onchain/market/adapters/types.js +3 -0
- package/dist/cjs/permissionless/api/oracles/PermissionlessOracles.js +47 -0
- package/dist/cjs/permissionless/api/oracles/schemas.js +43 -1
- package/dist/esm/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +178 -0
- package/dist/esm/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +533 -0
- package/dist/esm/abi/router/treehouseWorker.js +884 -0
- package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
- package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +3 -0
- package/dist/esm/onchain/market/adapters/types.js +3 -0
- package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +48 -1
- package/dist/esm/permissionless/api/oracles/schemas.js +40 -2
- package/dist/types/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.d.ts +148 -0
- package/dist/types/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.d.ts +440 -0
- package/dist/types/abi/router/treehouseWorker.d.ts +728 -0
- package/dist/types/onchain/market/adapters/types.d.ts +4 -1
- package/dist/types/permissionless/api/index.d.ts +2 -2
- package/dist/types/permissionless/api/oracles/PermissionlessOracles.d.ts +38 -1
- package/dist/types/permissionless/api/oracles/index.d.ts +2 -2
- package/dist/types/permissionless/api/oracles/schemas.d.ts +81 -0
- package/dist/types/permissionless/api/oracles/types.d.ts +159 -0
- package/dist/types/permissionless/index.d.ts +2 -2
- package/package.json +4 -3
|
@@ -33,6 +33,7 @@ const adapterActionSignatures = {
|
|
|
33
33
|
311: "function setPairStatusBatch((address,address,address,uint8,uint8)[])"
|
|
34
34
|
},
|
|
35
35
|
["TRADERJOE_ROUTER"]: { 310: "function setPoolStatusBatch((address,address,uint256,uint8,bool)[])" },
|
|
36
|
+
["TREEHOUSE_ROUTER"]: { 310: "function setAssetStatusBatch(address[],bool[])" },
|
|
36
37
|
["UNISWAP_V2_ROUTER"]: { 310: "function setPairStatusBatch((address,address,bool)[])" },
|
|
37
38
|
["UNISWAP_V3_ROUTER"]: { 310: "function setPoolStatusBatch((address,address,uint24,bool)[])" },
|
|
38
39
|
["UNISWAP_V4_GATEWAY"]: { 310: "function setPoolKeyStatusBatch(((address,address,uint24,int24,address),bool)[])" },
|
|
@@ -36,6 +36,9 @@ const adapterConstructorAbi = {
|
|
|
36
36
|
["UNISWAP_V4_GATEWAY"]: { 310: require_onchain_market_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
|
|
37
37
|
["VELODROME_V2_ROUTER"]: { 310: require_onchain_market_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
|
|
38
38
|
["SECURITIZE_ONRAMP"]: { 310: require_onchain_market_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
|
|
39
|
+
["TREEHOUSE_FASTLANE"]: { 310: require_onchain_market_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
|
|
40
|
+
["TREEHOUSE_GATEWAY"]: { 310: require_onchain_market_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
|
|
41
|
+
["TREEHOUSE_ROUTER"]: { 310: require_onchain_market_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
|
|
39
42
|
["CURVE_V1_2ASSETS"]: { 311: require_onchain_market_adapters_abi_conctructorAbiPatterns.CURVE_V1_ADAPTER_311_ABI },
|
|
40
43
|
["CURVE_V1_3ASSETS"]: { 311: require_onchain_market_adapters_abi_conctructorAbiPatterns.CURVE_V1_ADAPTER_311_ABI },
|
|
41
44
|
["CURVE_V1_4ASSETS"]: { 311: require_onchain_market_adapters_abi_conctructorAbiPatterns.CURVE_V1_ADAPTER_311_ABI },
|
|
@@ -34,6 +34,9 @@ let AdapterType = /* @__PURE__ */ function(AdapterType) {
|
|
|
34
34
|
AdapterType["SECURITIZE_REDEMPTION"] = "SECURITIZE_REDEMPTION";
|
|
35
35
|
AdapterType["STAKING_REWARDS"] = "STAKING_REWARDS";
|
|
36
36
|
AdapterType["TRADERJOE_ROUTER"] = "TRADERJOE_ROUTER";
|
|
37
|
+
AdapterType["TREEHOUSE_FASTLANE"] = "TREEHOUSE_FASTLANE";
|
|
38
|
+
AdapterType["TREEHOUSE_GATEWAY"] = "TREEHOUSE_GATEWAY";
|
|
39
|
+
AdapterType["TREEHOUSE_ROUTER"] = "TREEHOUSE_ROUTER";
|
|
37
40
|
AdapterType["UNISWAP_V2_ROUTER"] = "UNISWAP_V2_ROUTER";
|
|
38
41
|
AdapterType["UNISWAP_V3_ROUTER"] = "UNISWAP_V3_ROUTER";
|
|
39
42
|
AdapterType["UNISWAP_V4_GATEWAY"] = "UNISWAP_V4_GATEWAY";
|
|
@@ -62,6 +62,53 @@ var PermissionlessOracles = class extends require_offchain_AbstractOffchainNames
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
+
* One asset of the store: the feeds allowed for it, and the markets that
|
|
66
|
+
* take it as collateral.
|
|
67
|
+
*
|
|
68
|
+
* The mirror of {@link feed}, and the call to reach for when the question is
|
|
69
|
+
* "what prices this token and what is it backing" rather than "where is this
|
|
70
|
+
* feed used". Both read the same market slots; which end they are indexed
|
|
71
|
+
* from is the difference.
|
|
72
|
+
*
|
|
73
|
+
* ```ts
|
|
74
|
+
* const { priceFeeds, markets, quotaUsedUsd } =
|
|
75
|
+
* await permissionless.oracles.asset({ chainId: 1, address: token });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @throws When the chain has no metadata for the address. An asset nothing
|
|
79
|
+
* was indexed for has no symbol or decimals, so there is no row to answer.
|
|
80
|
+
**/
|
|
81
|
+
async asset({ chainId, address }) {
|
|
82
|
+
return this.getData({
|
|
83
|
+
path: `/pfs/${chainId}/asset/${address}`,
|
|
84
|
+
schema: require_permissionless_api_oracles_schemas.assetDetailsSchema
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* What each of one asset's feeds prices it at, and the market cap each of
|
|
89
|
+
* them implies.
|
|
90
|
+
*
|
|
91
|
+
* The asset-side counterpart of {@link feedMarketCaps}, and priced the same
|
|
92
|
+
* way: one `totalSupply` read for the asset and one price per feed, rather
|
|
93
|
+
* than the chain-wide pass {@link prices} makes.
|
|
94
|
+
*
|
|
95
|
+
* Several feeds for one asset do not have to agree — that is the point of
|
|
96
|
+
* having a reserve feed — so this answers per feed rather than picking one.
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* const { prices, marketCaps } = await permissionless.oracles.assetPrices({
|
|
100
|
+
* chainId: 1,
|
|
101
|
+
* address: token,
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
**/
|
|
105
|
+
async assetPrices({ chainId, address }) {
|
|
106
|
+
return this.getData({
|
|
107
|
+
path: `/pfs/${chainId}/asset/${address}/prices`,
|
|
108
|
+
schema: require_permissionless_api_oracles_schemas.assetPricesSchema
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
65
112
|
* The feeds one feed reads from, recursively.
|
|
66
113
|
*
|
|
67
114
|
* Answers for any feed the chain has indexed, store member or not: a
|
|
@@ -62,7 +62,9 @@ const priceFeedMarketSchema = zod_v4.z.looseObject({
|
|
|
62
62
|
underlyingSymbol: zod_v4.z.string().nullable(),
|
|
63
63
|
reserve: zod_v4.z.boolean(),
|
|
64
64
|
isUnderlying: zod_v4.z.boolean(),
|
|
65
|
-
quotaLimit: zod_v4.z.number().nullable()
|
|
65
|
+
quotaLimit: zod_v4.z.number().nullable(),
|
|
66
|
+
quotaUsed: zod_v4.z.number().nullable(),
|
|
67
|
+
marketStalenessPeriod: zod_v4.z.number().nullable()
|
|
66
68
|
});
|
|
67
69
|
/** {@link PermissionlessPriceFeedDetails} */
|
|
68
70
|
const priceFeedDetailsSchema = zod_v4.z.looseObject({
|
|
@@ -76,7 +78,47 @@ const priceFeedMarketCapsSchema = zod_v4.z.looseObject({
|
|
|
76
78
|
marketCaps: require_permissionless_api_schemas.addressRecord(zod_v4.z.string().nullable()),
|
|
77
79
|
time: zod_v4.z.number()
|
|
78
80
|
});
|
|
81
|
+
/** {@link PermissionlessAssetMarketFeed} */
|
|
82
|
+
const assetMarketFeedSchema = zod_v4.z.looseObject({
|
|
83
|
+
address: require_permissionless_api_schemas.addressSchema,
|
|
84
|
+
name: zod_v4.z.string().nullable(),
|
|
85
|
+
inStore: zod_v4.z.boolean()
|
|
86
|
+
});
|
|
87
|
+
/** {@link PermissionlessAssetMarket} */
|
|
88
|
+
const assetMarketSchema = zod_v4.z.looseObject({
|
|
89
|
+
market: require_permissionless_api_schemas.addressSchema,
|
|
90
|
+
marketConfigurator: require_permissionless_api_schemas.addressSchema,
|
|
91
|
+
curatorName: zod_v4.z.string().nullable(),
|
|
92
|
+
marketName: zod_v4.z.string().nullable(),
|
|
93
|
+
underlyingToken: require_permissionless_api_schemas.addressSchema,
|
|
94
|
+
underlyingSymbol: zod_v4.z.string().nullable(),
|
|
95
|
+
isUnderlying: zod_v4.z.boolean(),
|
|
96
|
+
isShutdown: zod_v4.z.boolean(),
|
|
97
|
+
mainFeed: assetMarketFeedSchema.nullable(),
|
|
98
|
+
reserveFeed: assetMarketFeedSchema.nullable(),
|
|
99
|
+
quotaLimit: zod_v4.z.number().nullable(),
|
|
100
|
+
quotaUsed: zod_v4.z.number().nullable()
|
|
101
|
+
});
|
|
102
|
+
/** {@link PermissionlessAssetDetails} */
|
|
103
|
+
const assetDetailsSchema = zod_v4.z.looseObject({
|
|
104
|
+
chainId: zod_v4.z.number(),
|
|
105
|
+
asset: priceFeedAssetSchema,
|
|
106
|
+
priceFeeds: zod_v4.z.array(priceFeedSchema),
|
|
107
|
+
markets: zod_v4.z.array(assetMarketSchema),
|
|
108
|
+
quotaLimitUsd: zod_v4.z.number().nullable(),
|
|
109
|
+
quotaUsedUsd: zod_v4.z.number().nullable()
|
|
110
|
+
});
|
|
111
|
+
/** {@link PermissionlessAssetPrices} */
|
|
112
|
+
const assetPricesSchema = zod_v4.z.looseObject({
|
|
113
|
+
prices: require_permissionless_api_schemas.addressRecord(zod_v4.z.string().nullable()),
|
|
114
|
+
marketCaps: require_permissionless_api_schemas.addressRecord(zod_v4.z.string().nullable()),
|
|
115
|
+
time: zod_v4.z.number()
|
|
116
|
+
});
|
|
79
117
|
//#endregion
|
|
118
|
+
exports.assetDetailsSchema = assetDetailsSchema;
|
|
119
|
+
exports.assetMarketFeedSchema = assetMarketFeedSchema;
|
|
120
|
+
exports.assetMarketSchema = assetMarketSchema;
|
|
121
|
+
exports.assetPricesSchema = assetPricesSchema;
|
|
80
122
|
exports.assetSchema = assetSchema;
|
|
81
123
|
exports.priceFeedAssetSchema = priceFeedAssetSchema;
|
|
82
124
|
exports.priceFeedDetailsSchema = priceFeedDetailsSchema;
|
package/dist/esm/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
//#region src/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.ts
|
|
2
|
+
const treehouseLiquidationSubcompressorAbi = [
|
|
3
|
+
{
|
|
4
|
+
type: "function",
|
|
5
|
+
name: "contractType",
|
|
6
|
+
inputs: [],
|
|
7
|
+
outputs: [{
|
|
8
|
+
name: "",
|
|
9
|
+
type: "bytes32",
|
|
10
|
+
internalType: "bytes32"
|
|
11
|
+
}],
|
|
12
|
+
stateMutability: "view"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "function",
|
|
16
|
+
name: "getLiquidationData",
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
name: "liquidator",
|
|
20
|
+
type: "address",
|
|
21
|
+
internalType: "address"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "creditAccount",
|
|
25
|
+
type: "address",
|
|
26
|
+
internalType: "address"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "phantomToken",
|
|
30
|
+
type: "address",
|
|
31
|
+
internalType: "address"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "priceUpdates",
|
|
35
|
+
type: "tuple[]",
|
|
36
|
+
internalType: "struct PriceUpdate[]",
|
|
37
|
+
components: [{
|
|
38
|
+
name: "priceFeed",
|
|
39
|
+
type: "address",
|
|
40
|
+
internalType: "address"
|
|
41
|
+
}, {
|
|
42
|
+
name: "data",
|
|
43
|
+
type: "bytes",
|
|
44
|
+
internalType: "bytes"
|
|
45
|
+
}]
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
outputs: [{
|
|
49
|
+
name: "data",
|
|
50
|
+
type: "tuple",
|
|
51
|
+
internalType: "struct LiquidationData",
|
|
52
|
+
components: [
|
|
53
|
+
{
|
|
54
|
+
name: "requiredToken",
|
|
55
|
+
type: "address",
|
|
56
|
+
internalType: "address"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "requiredAmount",
|
|
60
|
+
type: "uint256",
|
|
61
|
+
internalType: "uint256"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "expectedOutputs",
|
|
65
|
+
type: "tuple[]",
|
|
66
|
+
internalType: "struct LiquidationOutput[]",
|
|
67
|
+
components: [
|
|
68
|
+
{
|
|
69
|
+
name: "token",
|
|
70
|
+
type: "address",
|
|
71
|
+
internalType: "address"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "amount",
|
|
75
|
+
type: "uint256",
|
|
76
|
+
internalType: "uint256"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "delayed",
|
|
80
|
+
type: "bool",
|
|
81
|
+
internalType: "bool"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "redeemerAddress",
|
|
85
|
+
type: "address",
|
|
86
|
+
internalType: "address"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "claimableAt",
|
|
90
|
+
type: "uint256",
|
|
91
|
+
internalType: "uint256"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "liquidationCall",
|
|
97
|
+
type: "tuple",
|
|
98
|
+
internalType: "struct MultiCall",
|
|
99
|
+
components: [{
|
|
100
|
+
name: "target",
|
|
101
|
+
type: "address",
|
|
102
|
+
internalType: "address"
|
|
103
|
+
}, {
|
|
104
|
+
name: "callData",
|
|
105
|
+
type: "bytes",
|
|
106
|
+
internalType: "bytes"
|
|
107
|
+
}]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "isLiquidatorEligible",
|
|
111
|
+
type: "bool",
|
|
112
|
+
internalType: "bool"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "isCreditAccountFrozen",
|
|
116
|
+
type: "bool",
|
|
117
|
+
internalType: "bool"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "kycProtocol",
|
|
121
|
+
type: "string",
|
|
122
|
+
internalType: "string"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "kycToken",
|
|
126
|
+
type: "address",
|
|
127
|
+
internalType: "address"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}],
|
|
131
|
+
stateMutability: "nonpayable"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: "function",
|
|
135
|
+
name: "getRWALiquidatorInfo",
|
|
136
|
+
inputs: [{
|
|
137
|
+
name: "token",
|
|
138
|
+
type: "address",
|
|
139
|
+
internalType: "address"
|
|
140
|
+
}],
|
|
141
|
+
outputs: [{
|
|
142
|
+
name: "info",
|
|
143
|
+
type: "tuple",
|
|
144
|
+
internalType: "struct RWALiquidatorInfo",
|
|
145
|
+
components: [
|
|
146
|
+
{
|
|
147
|
+
name: "gateway",
|
|
148
|
+
type: "address",
|
|
149
|
+
internalType: "address"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "liquidatorAddress",
|
|
153
|
+
type: "address",
|
|
154
|
+
internalType: "address"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "contractType",
|
|
158
|
+
type: "bytes32",
|
|
159
|
+
internalType: "bytes32"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}],
|
|
163
|
+
stateMutability: "view"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: "function",
|
|
167
|
+
name: "version",
|
|
168
|
+
inputs: [],
|
|
169
|
+
outputs: [{
|
|
170
|
+
name: "",
|
|
171
|
+
type: "uint256",
|
|
172
|
+
internalType: "uint256"
|
|
173
|
+
}],
|
|
174
|
+
stateMutability: "view"
|
|
175
|
+
}
|
|
176
|
+
];
|
|
177
|
+
//#endregion
|
|
178
|
+
export { treehouseLiquidationSubcompressorAbi };
|