@reserve-protocol/dtf-rebalance-lib 0.0.5 → 0.0.7
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/open-auction.d.ts +12 -0
- package/dist/open-auction.js +3 -2
- package/package.json +1 -1
- package/src/open-auction.ts +2 -2
package/dist/open-auction.d.ts
CHANGED
@@ -32,6 +32,18 @@ export interface OpenAuctionArgs {
|
|
32
32
|
newPrices: PriceRange[];
|
33
33
|
newLimits: RebalanceLimits;
|
34
34
|
}
|
35
|
+
/**
|
36
|
+
* Generator for the `targetBasket` parameter
|
37
|
+
*
|
38
|
+
* Depending on the usecase, pass either:
|
39
|
+
* - TRACKING: CURRENT prices
|
40
|
+
* - NATIVE: HISTORICAL prices
|
41
|
+
*
|
42
|
+
* @param _initialWeights D27{tok/BU} The initial historical weights emitted in the RebalanceStarted event
|
43
|
+
* @param _prices {USD/wholeTok} either CURRENT or HISTORICAL prices
|
44
|
+
* @returns D18{1} The target basket
|
45
|
+
*/
|
46
|
+
export declare const getTargetBasket: (_initialWeights: WeightRange[], _prices: number[], _decimals: bigint[]) => bigint[];
|
35
47
|
/**
|
36
48
|
* Get the values needed to call `folio.openAuction()` as the AUCTION_LAUNCHER
|
37
49
|
*
|
package/dist/open-auction.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getOpenAuction = exports.AuctionRound = void 0;
|
6
|
+
exports.getOpenAuction = exports.getTargetBasket = exports.AuctionRound = void 0;
|
7
7
|
const decimal_js_light_1 = __importDefault(require("decimal.js-light"));
|
8
8
|
const numbers_1 = require("./numbers");
|
9
9
|
const types_1 = require("./types");
|
@@ -43,6 +43,7 @@ const getTargetBasket = (_initialWeights, _prices, _decimals) => {
|
|
43
43
|
// D18{1} = {USD/wholeBU} / {USD/wholeBU} * D18
|
44
44
|
return vals.map((val) => (0, numbers_1.bn)(val.div(totalValue).mul(numbers_1.D18d)));
|
45
45
|
};
|
46
|
+
exports.getTargetBasket = getTargetBasket;
|
46
47
|
/**
|
47
48
|
* Get the values needed to call `folio.openAuction()` as the AUCTION_LAUNCHER
|
48
49
|
*
|
@@ -66,7 +67,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
|
|
66
67
|
_prices.length != _priceError.length) {
|
67
68
|
throw new Error('length mismatch');
|
68
69
|
}
|
69
|
-
if (_finalStageAt
|
70
|
+
if (_finalStageAt > 1) {
|
70
71
|
throw new Error('finalStageAt must be less than 1');
|
71
72
|
}
|
72
73
|
// ================================================================
|
package/package.json
CHANGED
package/src/open-auction.ts
CHANGED
@@ -59,7 +59,7 @@ export interface OpenAuctionArgs {
|
|
59
59
|
* @param _prices {USD/wholeTok} either CURRENT or HISTORICAL prices
|
60
60
|
* @returns D18{1} The target basket
|
61
61
|
*/
|
62
|
-
const getTargetBasket = (
|
62
|
+
export const getTargetBasket = (
|
63
63
|
_initialWeights: WeightRange[],
|
64
64
|
_prices: number[],
|
65
65
|
_decimals: bigint[]
|
@@ -123,7 +123,7 @@ export const getOpenAuction = (
|
|
123
123
|
throw new Error('length mismatch')
|
124
124
|
}
|
125
125
|
|
126
|
-
if (_finalStageAt
|
126
|
+
if (_finalStageAt > 1) {
|
127
127
|
throw new Error('finalStageAt must be less than 1')
|
128
128
|
}
|
129
129
|
|