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