@gearbox-protocol/sdk 8.10.0 → 8.11.0
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/dev/AccountOpener.js +7 -3
- package/dist/cjs/sdk/abi/oracles.js +75 -0
- package/dist/cjs/sdk/market/pricefeeds/ConstantPriceFeed.js +57 -0
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -0
- package/dist/esm/dev/AccountOpener.js +7 -3
- package/dist/esm/sdk/abi/oracles.js +74 -0
- package/dist/esm/sdk/market/pricefeeds/ConstantPriceFeed.js +33 -0
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -0
- package/dist/types/dev/AccountOpener.d.ts +1 -0
- package/dist/types/sdk/abi/oracles.d.ts +113 -0
- package/dist/types/sdk/market/pricefeeds/ConstantPriceFeed.d.ts +12 -0
- package/dist/types/sdk/market/pricefeeds/types.d.ts +1 -1
- package/dist/types/sdk/types/state-human.d.ts +4 -0
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
44
44
|
#borrower;
|
|
45
45
|
#faucet;
|
|
46
46
|
#poolDepositMultiplier;
|
|
47
|
+
#minDebtMultiplier;
|
|
47
48
|
constructor(service, options = {}) {
|
|
48
49
|
super(service.sdk);
|
|
49
50
|
this.#service = service;
|
|
@@ -59,6 +60,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
59
60
|
}
|
|
60
61
|
this.#borrower = options.borrower;
|
|
61
62
|
this.#poolDepositMultiplier = options.poolDepositMultiplier ?? 11000n;
|
|
63
|
+
this.#minDebtMultiplier = options.minDebtMultiplier ?? 10100n;
|
|
62
64
|
}
|
|
63
65
|
get borrower() {
|
|
64
66
|
if (!this.#borrower) {
|
|
@@ -196,7 +198,8 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
196
198
|
target: symbol
|
|
197
199
|
});
|
|
198
200
|
const leverage = this.#getLeverage(input);
|
|
199
|
-
const {
|
|
201
|
+
const { underlying } = cm.creditFacade;
|
|
202
|
+
const minDebt = this.#minDebtMultiplier * cm.creditFacade.minDebt / import_sdk.PERCENTAGE_FACTOR;
|
|
200
203
|
const expectedUnderlyingBalance = minDebt * leverage / import_sdk.PERCENTAGE_FACTOR;
|
|
201
204
|
const expectedBalances = [];
|
|
202
205
|
const leftoverBalances = [];
|
|
@@ -278,7 +281,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
278
281
|
for (const t of targets) {
|
|
279
282
|
const leverage = this.#getLeverage(t);
|
|
280
283
|
const cm = this.sdk.marketRegister.findCreditManager(t.creditManager);
|
|
281
|
-
const
|
|
284
|
+
const minDebt = this.#minDebtMultiplier * cm.creditFacade.minDebt / import_sdk.PERCENTAGE_FACTOR;
|
|
282
285
|
minAvailableByPool[cm.pool] = (minAvailableByPool[cm.pool] ?? 0n) + minDebt * (leverage - import_sdk.PERCENTAGE_FACTOR) / import_sdk.PERCENTAGE_FACTOR * this.#poolDepositMultiplier / import_sdk.PERCENTAGE_FACTOR;
|
|
283
286
|
}
|
|
284
287
|
let totalUSD = 0n;
|
|
@@ -378,7 +381,8 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
378
381
|
const market = this.sdk.marketRegister.findByCreditManager(
|
|
379
382
|
target.creditManager
|
|
380
383
|
);
|
|
381
|
-
const {
|
|
384
|
+
const { degenNFT } = cm.creditFacade;
|
|
385
|
+
const minDebt = this.#minDebtMultiplier * cm.creditFacade.minDebt / import_sdk.PERCENTAGE_FACTOR;
|
|
382
386
|
claimUSD += market.priceOracle.convertToUSD(cm.underlying, minDebt);
|
|
383
387
|
if ((0, import_viem.isAddress)(degenNFT) && degenNFT !== import_sdk.ADDRESS_0X0) {
|
|
384
388
|
degenNFTS[degenNFT] = (degenNFTS[degenNFT] ?? 0) + 1;
|
|
@@ -23,6 +23,7 @@ __export(oracles_exports, {
|
|
|
23
23
|
bptWeightedPriceFeedAbi: () => bptWeightedPriceFeedAbi,
|
|
24
24
|
chainlinkReadableAggregatorAbi: () => chainlinkReadableAggregatorAbi,
|
|
25
25
|
compositePriceFeedAbi: () => compositePriceFeedAbi,
|
|
26
|
+
constantPriceFeedAbi: () => constantPriceFeedAbi,
|
|
26
27
|
curveCryptoLpPriceFeedAbi: () => curveCryptoLpPriceFeedAbi,
|
|
27
28
|
curveStableLpPriceFeedAbi: () => curveStableLpPriceFeedAbi,
|
|
28
29
|
curveUsdPriceFeedAbi: () => curveUsdPriceFeedAbi,
|
|
@@ -4683,6 +4684,79 @@ const pythPriceFeedAbi = [
|
|
|
4683
4684
|
{ type: "error", name: "PriceTimestampTooFarAheadException", inputs: [] },
|
|
4684
4685
|
{ type: "error", name: "PriceTimestampTooFarBehindException", inputs: [] }
|
|
4685
4686
|
];
|
|
4687
|
+
const constantPriceFeedAbi = [
|
|
4688
|
+
{
|
|
4689
|
+
type: "constructor",
|
|
4690
|
+
inputs: [
|
|
4691
|
+
{ name: "_price", type: "int256", internalType: "int256" },
|
|
4692
|
+
{ name: "_descriptionTicker", type: "string", internalType: "string" }
|
|
4693
|
+
],
|
|
4694
|
+
stateMutability: "nonpayable"
|
|
4695
|
+
},
|
|
4696
|
+
{
|
|
4697
|
+
type: "function",
|
|
4698
|
+
name: "contractType",
|
|
4699
|
+
inputs: [],
|
|
4700
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
4701
|
+
stateMutability: "view"
|
|
4702
|
+
},
|
|
4703
|
+
{
|
|
4704
|
+
type: "function",
|
|
4705
|
+
name: "decimals",
|
|
4706
|
+
inputs: [],
|
|
4707
|
+
outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
|
|
4708
|
+
stateMutability: "view"
|
|
4709
|
+
},
|
|
4710
|
+
{
|
|
4711
|
+
type: "function",
|
|
4712
|
+
name: "description",
|
|
4713
|
+
inputs: [],
|
|
4714
|
+
outputs: [{ name: "", type: "string", internalType: "string" }],
|
|
4715
|
+
stateMutability: "view"
|
|
4716
|
+
},
|
|
4717
|
+
{
|
|
4718
|
+
type: "function",
|
|
4719
|
+
name: "latestRoundData",
|
|
4720
|
+
inputs: [],
|
|
4721
|
+
outputs: [
|
|
4722
|
+
{ name: "", type: "uint80", internalType: "uint80" },
|
|
4723
|
+
{ name: "answer", type: "int256", internalType: "int256" },
|
|
4724
|
+
{ name: "", type: "uint256", internalType: "uint256" },
|
|
4725
|
+
{ name: "", type: "uint256", internalType: "uint256" },
|
|
4726
|
+
{ name: "", type: "uint80", internalType: "uint80" }
|
|
4727
|
+
],
|
|
4728
|
+
stateMutability: "view"
|
|
4729
|
+
},
|
|
4730
|
+
{
|
|
4731
|
+
type: "function",
|
|
4732
|
+
name: "price",
|
|
4733
|
+
inputs: [],
|
|
4734
|
+
outputs: [{ name: "", type: "int256", internalType: "int256" }],
|
|
4735
|
+
stateMutability: "view"
|
|
4736
|
+
},
|
|
4737
|
+
{
|
|
4738
|
+
type: "function",
|
|
4739
|
+
name: "serialize",
|
|
4740
|
+
inputs: [],
|
|
4741
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
4742
|
+
stateMutability: "view"
|
|
4743
|
+
},
|
|
4744
|
+
{
|
|
4745
|
+
type: "function",
|
|
4746
|
+
name: "skipPriceCheck",
|
|
4747
|
+
inputs: [],
|
|
4748
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4749
|
+
stateMutability: "view"
|
|
4750
|
+
},
|
|
4751
|
+
{
|
|
4752
|
+
type: "function",
|
|
4753
|
+
name: "version",
|
|
4754
|
+
inputs: [],
|
|
4755
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
4756
|
+
stateMutability: "view"
|
|
4757
|
+
},
|
|
4758
|
+
{ type: "error", name: "IncorrectPriceException", inputs: [] }
|
|
4759
|
+
];
|
|
4686
4760
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4687
4761
|
0 && (module.exports = {
|
|
4688
4762
|
boundedPriceFeedAbi,
|
|
@@ -4690,6 +4764,7 @@ const pythPriceFeedAbi = [
|
|
|
4690
4764
|
bptWeightedPriceFeedAbi,
|
|
4691
4765
|
chainlinkReadableAggregatorAbi,
|
|
4692
4766
|
compositePriceFeedAbi,
|
|
4767
|
+
constantPriceFeedAbi,
|
|
4693
4768
|
curveCryptoLpPriceFeedAbi,
|
|
4694
4769
|
curveStableLpPriceFeedAbi,
|
|
4695
4770
|
curveUsdPriceFeedAbi,
|
|
@@ -0,0 +1,57 @@
|
|
|
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 ConstantPriceFeed_exports = {};
|
|
20
|
+
__export(ConstantPriceFeed_exports, {
|
|
21
|
+
ConstantPriceFeedContract: () => ConstantPriceFeedContract
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ConstantPriceFeed_exports);
|
|
24
|
+
var import_viem = require("viem");
|
|
25
|
+
var import_oracles = require("../../abi/oracles.js");
|
|
26
|
+
var import_AbstractPriceFeed = require("./AbstractPriceFeed.js");
|
|
27
|
+
class ConstantPriceFeedContract extends import_AbstractPriceFeed.AbstractPriceFeedContract {
|
|
28
|
+
price;
|
|
29
|
+
constructor(sdk, args) {
|
|
30
|
+
super(sdk, {
|
|
31
|
+
...args,
|
|
32
|
+
name: "ConstantPriceFeed",
|
|
33
|
+
abi: import_oracles.constantPriceFeedAbi,
|
|
34
|
+
decimals: 8
|
|
35
|
+
// always 8 for USD price feeds
|
|
36
|
+
});
|
|
37
|
+
const decoder = (0, import_viem.decodeAbiParameters)(
|
|
38
|
+
[
|
|
39
|
+
{ type: "int256" }
|
|
40
|
+
// price
|
|
41
|
+
],
|
|
42
|
+
args.baseParams.serializedParams
|
|
43
|
+
);
|
|
44
|
+
this.price = decoder[0];
|
|
45
|
+
}
|
|
46
|
+
stateHuman(raw = true) {
|
|
47
|
+
return {
|
|
48
|
+
...super.stateHuman(raw),
|
|
49
|
+
contractType: "PRICE_FEED::CONSTANT",
|
|
50
|
+
price: this.price
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
ConstantPriceFeedContract
|
|
57
|
+
});
|
|
@@ -31,6 +31,7 @@ var import_BalancerStablePriceFeed = require("./BalancerStablePriceFeed.js");
|
|
|
31
31
|
var import_BalancerWeightedPriceFeed = require("./BalancerWeightedPriceFeed.js");
|
|
32
32
|
var import_BoundedPriceFeed = require("./BoundedPriceFeed.js");
|
|
33
33
|
var import_CompositePriceFeed = require("./CompositePriceFeed.js");
|
|
34
|
+
var import_ConstantPriceFeed = require("./ConstantPriceFeed.js");
|
|
34
35
|
var import_CurveCryptoPriceFeed = require("./CurveCryptoPriceFeed.js");
|
|
35
36
|
var import_CurveStablePriceFeed = require("./CurveStablePriceFeed.js");
|
|
36
37
|
var import_CurveUSDPriceFeed = require("./CurveUSDPriceFeed.js");
|
|
@@ -187,6 +188,8 @@ class PriceFeedRegister extends import_base.SDKConstruct {
|
|
|
187
188
|
return new import_BoundedPriceFeed.BoundedPriceFeedContract(this.sdk, data);
|
|
188
189
|
case "PRICE_FEED::COMPOSITE":
|
|
189
190
|
return new import_CompositePriceFeed.CompositePriceFeedContract(this.sdk, data);
|
|
191
|
+
case "PRICE_FEED::CONSTANT":
|
|
192
|
+
return new import_ConstantPriceFeed.ConstantPriceFeedContract(this.sdk, data);
|
|
190
193
|
case "PRICE_FEED::CURVE_CRYPTO":
|
|
191
194
|
return new import_CurveCryptoPriceFeed.CurveCryptoPriceFeedContract(this.sdk, data);
|
|
192
195
|
case "PRICE_FEED::CURVE_STABLE":
|
|
@@ -36,6 +36,7 @@ class AccountOpener extends SDKConstruct {
|
|
|
36
36
|
#borrower;
|
|
37
37
|
#faucet;
|
|
38
38
|
#poolDepositMultiplier;
|
|
39
|
+
#minDebtMultiplier;
|
|
39
40
|
constructor(service, options = {}) {
|
|
40
41
|
super(service.sdk);
|
|
41
42
|
this.#service = service;
|
|
@@ -51,6 +52,7 @@ class AccountOpener extends SDKConstruct {
|
|
|
51
52
|
}
|
|
52
53
|
this.#borrower = options.borrower;
|
|
53
54
|
this.#poolDepositMultiplier = options.poolDepositMultiplier ?? 11000n;
|
|
55
|
+
this.#minDebtMultiplier = options.minDebtMultiplier ?? 10100n;
|
|
54
56
|
}
|
|
55
57
|
get borrower() {
|
|
56
58
|
if (!this.#borrower) {
|
|
@@ -188,7 +190,8 @@ class AccountOpener extends SDKConstruct {
|
|
|
188
190
|
target: symbol
|
|
189
191
|
});
|
|
190
192
|
const leverage = this.#getLeverage(input);
|
|
191
|
-
const {
|
|
193
|
+
const { underlying } = cm.creditFacade;
|
|
194
|
+
const minDebt = this.#minDebtMultiplier * cm.creditFacade.minDebt / PERCENTAGE_FACTOR;
|
|
192
195
|
const expectedUnderlyingBalance = minDebt * leverage / PERCENTAGE_FACTOR;
|
|
193
196
|
const expectedBalances = [];
|
|
194
197
|
const leftoverBalances = [];
|
|
@@ -270,7 +273,7 @@ class AccountOpener extends SDKConstruct {
|
|
|
270
273
|
for (const t of targets) {
|
|
271
274
|
const leverage = this.#getLeverage(t);
|
|
272
275
|
const cm = this.sdk.marketRegister.findCreditManager(t.creditManager);
|
|
273
|
-
const
|
|
276
|
+
const minDebt = this.#minDebtMultiplier * cm.creditFacade.minDebt / PERCENTAGE_FACTOR;
|
|
274
277
|
minAvailableByPool[cm.pool] = (minAvailableByPool[cm.pool] ?? 0n) + minDebt * (leverage - PERCENTAGE_FACTOR) / PERCENTAGE_FACTOR * this.#poolDepositMultiplier / PERCENTAGE_FACTOR;
|
|
275
278
|
}
|
|
276
279
|
let totalUSD = 0n;
|
|
@@ -370,7 +373,8 @@ class AccountOpener extends SDKConstruct {
|
|
|
370
373
|
const market = this.sdk.marketRegister.findByCreditManager(
|
|
371
374
|
target.creditManager
|
|
372
375
|
);
|
|
373
|
-
const {
|
|
376
|
+
const { degenNFT } = cm.creditFacade;
|
|
377
|
+
const minDebt = this.#minDebtMultiplier * cm.creditFacade.minDebt / PERCENTAGE_FACTOR;
|
|
374
378
|
claimUSD += market.priceOracle.convertToUSD(cm.underlying, minDebt);
|
|
375
379
|
if (isAddress(degenNFT) && degenNFT !== ADDRESS_0X0) {
|
|
376
380
|
degenNFTS[degenNFT] = (degenNFTS[degenNFT] ?? 0) + 1;
|
|
@@ -4636,12 +4636,86 @@ const pythPriceFeedAbi = [
|
|
|
4636
4636
|
{ type: "error", name: "PriceTimestampTooFarAheadException", inputs: [] },
|
|
4637
4637
|
{ type: "error", name: "PriceTimestampTooFarBehindException", inputs: [] }
|
|
4638
4638
|
];
|
|
4639
|
+
const constantPriceFeedAbi = [
|
|
4640
|
+
{
|
|
4641
|
+
type: "constructor",
|
|
4642
|
+
inputs: [
|
|
4643
|
+
{ name: "_price", type: "int256", internalType: "int256" },
|
|
4644
|
+
{ name: "_descriptionTicker", type: "string", internalType: "string" }
|
|
4645
|
+
],
|
|
4646
|
+
stateMutability: "nonpayable"
|
|
4647
|
+
},
|
|
4648
|
+
{
|
|
4649
|
+
type: "function",
|
|
4650
|
+
name: "contractType",
|
|
4651
|
+
inputs: [],
|
|
4652
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
4653
|
+
stateMutability: "view"
|
|
4654
|
+
},
|
|
4655
|
+
{
|
|
4656
|
+
type: "function",
|
|
4657
|
+
name: "decimals",
|
|
4658
|
+
inputs: [],
|
|
4659
|
+
outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
|
|
4660
|
+
stateMutability: "view"
|
|
4661
|
+
},
|
|
4662
|
+
{
|
|
4663
|
+
type: "function",
|
|
4664
|
+
name: "description",
|
|
4665
|
+
inputs: [],
|
|
4666
|
+
outputs: [{ name: "", type: "string", internalType: "string" }],
|
|
4667
|
+
stateMutability: "view"
|
|
4668
|
+
},
|
|
4669
|
+
{
|
|
4670
|
+
type: "function",
|
|
4671
|
+
name: "latestRoundData",
|
|
4672
|
+
inputs: [],
|
|
4673
|
+
outputs: [
|
|
4674
|
+
{ name: "", type: "uint80", internalType: "uint80" },
|
|
4675
|
+
{ name: "answer", type: "int256", internalType: "int256" },
|
|
4676
|
+
{ name: "", type: "uint256", internalType: "uint256" },
|
|
4677
|
+
{ name: "", type: "uint256", internalType: "uint256" },
|
|
4678
|
+
{ name: "", type: "uint80", internalType: "uint80" }
|
|
4679
|
+
],
|
|
4680
|
+
stateMutability: "view"
|
|
4681
|
+
},
|
|
4682
|
+
{
|
|
4683
|
+
type: "function",
|
|
4684
|
+
name: "price",
|
|
4685
|
+
inputs: [],
|
|
4686
|
+
outputs: [{ name: "", type: "int256", internalType: "int256" }],
|
|
4687
|
+
stateMutability: "view"
|
|
4688
|
+
},
|
|
4689
|
+
{
|
|
4690
|
+
type: "function",
|
|
4691
|
+
name: "serialize",
|
|
4692
|
+
inputs: [],
|
|
4693
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
4694
|
+
stateMutability: "view"
|
|
4695
|
+
},
|
|
4696
|
+
{
|
|
4697
|
+
type: "function",
|
|
4698
|
+
name: "skipPriceCheck",
|
|
4699
|
+
inputs: [],
|
|
4700
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
4701
|
+
stateMutability: "view"
|
|
4702
|
+
},
|
|
4703
|
+
{
|
|
4704
|
+
type: "function",
|
|
4705
|
+
name: "version",
|
|
4706
|
+
inputs: [],
|
|
4707
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
4708
|
+
stateMutability: "view"
|
|
4709
|
+
},
|
|
4710
|
+
{ type: "error", name: "IncorrectPriceException", inputs: [] }
|
|
4711
|
+
];
|
|
4639
4712
|
export {
|
|
4640
4713
|
boundedPriceFeedAbi,
|
|
4641
4714
|
bptStablePriceFeedAbi,
|
|
4642
4715
|
bptWeightedPriceFeedAbi,
|
|
4643
4716
|
chainlinkReadableAggregatorAbi,
|
|
4644
4717
|
compositePriceFeedAbi,
|
|
4718
|
+
constantPriceFeedAbi,
|
|
4645
4719
|
curveCryptoLpPriceFeedAbi,
|
|
4646
4720
|
curveStableLpPriceFeedAbi,
|
|
4647
4721
|
curveUsdPriceFeedAbi,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { decodeAbiParameters } from "viem";
|
|
2
|
+
import { constantPriceFeedAbi } from "../../abi/oracles.js";
|
|
3
|
+
import { AbstractPriceFeedContract } from "./AbstractPriceFeed.js";
|
|
4
|
+
class ConstantPriceFeedContract extends AbstractPriceFeedContract {
|
|
5
|
+
price;
|
|
6
|
+
constructor(sdk, args) {
|
|
7
|
+
super(sdk, {
|
|
8
|
+
...args,
|
|
9
|
+
name: "ConstantPriceFeed",
|
|
10
|
+
abi: constantPriceFeedAbi,
|
|
11
|
+
decimals: 8
|
|
12
|
+
// always 8 for USD price feeds
|
|
13
|
+
});
|
|
14
|
+
const decoder = decodeAbiParameters(
|
|
15
|
+
[
|
|
16
|
+
{ type: "int256" }
|
|
17
|
+
// price
|
|
18
|
+
],
|
|
19
|
+
args.baseParams.serializedParams
|
|
20
|
+
);
|
|
21
|
+
this.price = decoder[0];
|
|
22
|
+
}
|
|
23
|
+
stateHuman(raw = true) {
|
|
24
|
+
return {
|
|
25
|
+
...super.stateHuman(raw),
|
|
26
|
+
contractType: "PRICE_FEED::CONSTANT",
|
|
27
|
+
price: this.price
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
ConstantPriceFeedContract
|
|
33
|
+
};
|
|
@@ -14,6 +14,7 @@ import { BalancerStablePriceFeedContract } from "./BalancerStablePriceFeed.js";
|
|
|
14
14
|
import { BalancerWeightedPriceFeedContract } from "./BalancerWeightedPriceFeed.js";
|
|
15
15
|
import { BoundedPriceFeedContract } from "./BoundedPriceFeed.js";
|
|
16
16
|
import { CompositePriceFeedContract } from "./CompositePriceFeed.js";
|
|
17
|
+
import { ConstantPriceFeedContract } from "./ConstantPriceFeed.js";
|
|
17
18
|
import { CurveCryptoPriceFeedContract } from "./CurveCryptoPriceFeed.js";
|
|
18
19
|
import { CurveStablePriceFeedContract } from "./CurveStablePriceFeed.js";
|
|
19
20
|
import { CurveUSDPriceFeedContract } from "./CurveUSDPriceFeed.js";
|
|
@@ -170,6 +171,8 @@ class PriceFeedRegister extends SDKConstruct {
|
|
|
170
171
|
return new BoundedPriceFeedContract(this.sdk, data);
|
|
171
172
|
case "PRICE_FEED::COMPOSITE":
|
|
172
173
|
return new CompositePriceFeedContract(this.sdk, data);
|
|
174
|
+
case "PRICE_FEED::CONSTANT":
|
|
175
|
+
return new ConstantPriceFeedContract(this.sdk, data);
|
|
173
176
|
case "PRICE_FEED::CURVE_CRYPTO":
|
|
174
177
|
return new CurveCryptoPriceFeedContract(this.sdk, data);
|
|
175
178
|
case "PRICE_FEED::CURVE_STABLE":
|
|
@@ -6369,3 +6369,116 @@ export declare const pythPriceFeedAbi: readonly [{
|
|
|
6369
6369
|
readonly name: "PriceTimestampTooFarBehindException";
|
|
6370
6370
|
readonly inputs: readonly [];
|
|
6371
6371
|
}];
|
|
6372
|
+
export declare const constantPriceFeedAbi: readonly [{
|
|
6373
|
+
readonly type: "constructor";
|
|
6374
|
+
readonly inputs: readonly [{
|
|
6375
|
+
readonly name: "_price";
|
|
6376
|
+
readonly type: "int256";
|
|
6377
|
+
readonly internalType: "int256";
|
|
6378
|
+
}, {
|
|
6379
|
+
readonly name: "_descriptionTicker";
|
|
6380
|
+
readonly type: "string";
|
|
6381
|
+
readonly internalType: "string";
|
|
6382
|
+
}];
|
|
6383
|
+
readonly stateMutability: "nonpayable";
|
|
6384
|
+
}, {
|
|
6385
|
+
readonly type: "function";
|
|
6386
|
+
readonly name: "contractType";
|
|
6387
|
+
readonly inputs: readonly [];
|
|
6388
|
+
readonly outputs: readonly [{
|
|
6389
|
+
readonly name: "";
|
|
6390
|
+
readonly type: "bytes32";
|
|
6391
|
+
readonly internalType: "bytes32";
|
|
6392
|
+
}];
|
|
6393
|
+
readonly stateMutability: "view";
|
|
6394
|
+
}, {
|
|
6395
|
+
readonly type: "function";
|
|
6396
|
+
readonly name: "decimals";
|
|
6397
|
+
readonly inputs: readonly [];
|
|
6398
|
+
readonly outputs: readonly [{
|
|
6399
|
+
readonly name: "";
|
|
6400
|
+
readonly type: "uint8";
|
|
6401
|
+
readonly internalType: "uint8";
|
|
6402
|
+
}];
|
|
6403
|
+
readonly stateMutability: "view";
|
|
6404
|
+
}, {
|
|
6405
|
+
readonly type: "function";
|
|
6406
|
+
readonly name: "description";
|
|
6407
|
+
readonly inputs: readonly [];
|
|
6408
|
+
readonly outputs: readonly [{
|
|
6409
|
+
readonly name: "";
|
|
6410
|
+
readonly type: "string";
|
|
6411
|
+
readonly internalType: "string";
|
|
6412
|
+
}];
|
|
6413
|
+
readonly stateMutability: "view";
|
|
6414
|
+
}, {
|
|
6415
|
+
readonly type: "function";
|
|
6416
|
+
readonly name: "latestRoundData";
|
|
6417
|
+
readonly inputs: readonly [];
|
|
6418
|
+
readonly outputs: readonly [{
|
|
6419
|
+
readonly name: "";
|
|
6420
|
+
readonly type: "uint80";
|
|
6421
|
+
readonly internalType: "uint80";
|
|
6422
|
+
}, {
|
|
6423
|
+
readonly name: "answer";
|
|
6424
|
+
readonly type: "int256";
|
|
6425
|
+
readonly internalType: "int256";
|
|
6426
|
+
}, {
|
|
6427
|
+
readonly name: "";
|
|
6428
|
+
readonly type: "uint256";
|
|
6429
|
+
readonly internalType: "uint256";
|
|
6430
|
+
}, {
|
|
6431
|
+
readonly name: "";
|
|
6432
|
+
readonly type: "uint256";
|
|
6433
|
+
readonly internalType: "uint256";
|
|
6434
|
+
}, {
|
|
6435
|
+
readonly name: "";
|
|
6436
|
+
readonly type: "uint80";
|
|
6437
|
+
readonly internalType: "uint80";
|
|
6438
|
+
}];
|
|
6439
|
+
readonly stateMutability: "view";
|
|
6440
|
+
}, {
|
|
6441
|
+
readonly type: "function";
|
|
6442
|
+
readonly name: "price";
|
|
6443
|
+
readonly inputs: readonly [];
|
|
6444
|
+
readonly outputs: readonly [{
|
|
6445
|
+
readonly name: "";
|
|
6446
|
+
readonly type: "int256";
|
|
6447
|
+
readonly internalType: "int256";
|
|
6448
|
+
}];
|
|
6449
|
+
readonly stateMutability: "view";
|
|
6450
|
+
}, {
|
|
6451
|
+
readonly type: "function";
|
|
6452
|
+
readonly name: "serialize";
|
|
6453
|
+
readonly inputs: readonly [];
|
|
6454
|
+
readonly outputs: readonly [{
|
|
6455
|
+
readonly name: "";
|
|
6456
|
+
readonly type: "bytes";
|
|
6457
|
+
readonly internalType: "bytes";
|
|
6458
|
+
}];
|
|
6459
|
+
readonly stateMutability: "view";
|
|
6460
|
+
}, {
|
|
6461
|
+
readonly type: "function";
|
|
6462
|
+
readonly name: "skipPriceCheck";
|
|
6463
|
+
readonly inputs: readonly [];
|
|
6464
|
+
readonly outputs: readonly [{
|
|
6465
|
+
readonly name: "";
|
|
6466
|
+
readonly type: "bool";
|
|
6467
|
+
readonly internalType: "bool";
|
|
6468
|
+
}];
|
|
6469
|
+
readonly stateMutability: "view";
|
|
6470
|
+
}, {
|
|
6471
|
+
readonly type: "function";
|
|
6472
|
+
readonly name: "version";
|
|
6473
|
+
readonly inputs: readonly [];
|
|
6474
|
+
readonly outputs: readonly [{
|
|
6475
|
+
readonly name: "";
|
|
6476
|
+
readonly type: "uint256";
|
|
6477
|
+
readonly internalType: "uint256";
|
|
6478
|
+
}];
|
|
6479
|
+
readonly stateMutability: "view";
|
|
6480
|
+
}, {
|
|
6481
|
+
readonly type: "error";
|
|
6482
|
+
readonly name: "IncorrectPriceException";
|
|
6483
|
+
readonly inputs: readonly [];
|
|
6484
|
+
}];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { constantPriceFeedAbi } from "../../abi/oracles.js";
|
|
2
|
+
import type { GearboxSDK } from "../../GearboxSDK.js";
|
|
3
|
+
import type { ConstantOracleStateHuman } from "../../types/index.js";
|
|
4
|
+
import type { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
5
|
+
import { AbstractPriceFeedContract } from "./AbstractPriceFeed.js";
|
|
6
|
+
type abi = typeof constantPriceFeedAbi;
|
|
7
|
+
export declare class ConstantPriceFeedContract extends AbstractPriceFeedContract<abi> {
|
|
8
|
+
readonly price: bigint;
|
|
9
|
+
constructor(sdk: GearboxSDK, args: PartialPriceFeedTreeNode);
|
|
10
|
+
stateHuman(raw?: boolean): Omit<ConstantOracleStateHuman, "stalenessPeriod">;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import type { IPriceUpdateTx, PriceFeedStateHuman, RawTx } from "../../types/ind
|
|
|
4
4
|
import type { PriceFeedRef } from "./PriceFeedRef.js";
|
|
5
5
|
export type PriceFeedUsageType = "Main" | "Reserve";
|
|
6
6
|
export type PriceFeedContractTypeLegacy = "PF_BALANCER_STABLE_LP_ORACLE" | "PF_BALANCER_WEIGHTED_LP_ORACLE" | "PF_BOUNDED_ORACLE" | "PF_CHAINLINK_ORACLE" | "PF_COMPOSITE_ORACLE" | "PF_CURVE_CRYPTO_LP_ORACLE" | "PF_CURVE_STABLE_LP_ORACLE" | "PF_CURVE_USD_ORACLE" | "PF_ERC4626_ORACLE" | "PF_MELLOW_LRT_ORACLE" | "PF_PENDLE_PT_TWAP_ORACLE" | "PF_PYTH_ORACLE" | "PF_REDSTONE_ORACLE" | "PF_WSTETH_ORACLE" | "PF_YEARN_ORACLE" | "PF_ZERO_ORACLE";
|
|
7
|
-
export type PriceFeedContractType = "PRICE_FEED::BALANCER_STABLE" | "PRICE_FEED::BALANCER_WEIGHTED" | "PRICE_FEED::BOUNDED" | "PRICE_FEED::COMPOSITE" | "PRICE_FEED::CURVE_CRYPTO" | "PRICE_FEED::CURVE_STABLE" | "PRICE_FEED::CURVE_USD" | "PRICE_FEED::ERC4626" | "PRICE_FEED::EXTERNAL" | "PRICE_FEED::MELLOW_LRT" | "PRICE_FEED::PENDLE_PT_TWAP" | "PRICE_FEED::PYTH" | "PRICE_FEED::REDSTONE" | "PRICE_FEED::WSTETH" | "PRICE_FEED::YEARN" | "PRICE_FEED::ZERO";
|
|
7
|
+
export type PriceFeedContractType = "PRICE_FEED::BALANCER_STABLE" | "PRICE_FEED::BALANCER_WEIGHTED" | "PRICE_FEED::BOUNDED" | "PRICE_FEED::COMPOSITE" | "PRICE_FEED::CONSTANT" | "PRICE_FEED::CURVE_CRYPTO" | "PRICE_FEED::CURVE_STABLE" | "PRICE_FEED::CURVE_USD" | "PRICE_FEED::ERC4626" | "PRICE_FEED::EXTERNAL" | "PRICE_FEED::MELLOW_LRT" | "PRICE_FEED::PENDLE_PT_TWAP" | "PRICE_FEED::PYTH" | "PRICE_FEED::REDSTONE" | "PRICE_FEED::WSTETH" | "PRICE_FEED::YEARN" | "PRICE_FEED::ZERO";
|
|
8
8
|
export interface IPriceFeedContract extends IBaseContract {
|
|
9
9
|
readonly hasLowerBoundCap: boolean;
|
|
10
10
|
readonly priceFeedType: PriceFeedContractType;
|
|
@@ -31,6 +31,10 @@ export interface BoundedOracleStateHuman extends BasePriceFeedStateHuman {
|
|
|
31
31
|
contractType: "PRICE_FEED::BOUNDED";
|
|
32
32
|
upperBound: bigint;
|
|
33
33
|
}
|
|
34
|
+
export interface ConstantOracleStateHuman extends BasePriceFeedStateHuman {
|
|
35
|
+
contractType: "PRICE_FEED::CONSTANT";
|
|
36
|
+
price: bigint;
|
|
37
|
+
}
|
|
34
38
|
export interface AssetPriceFeedStateHuman extends BasePriceFeedStateHuman {
|
|
35
39
|
contractType: PriceFeedContractType;
|
|
36
40
|
}
|