Skip to content

Commit fff02bc

Browse files
committed
3.1.1
1 parent 31aa955 commit fff02bc

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@reserve-protocol/dtf-rebalance-lib",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "Rebalancing library for DTFs in typescript",
55
"main": "dist/index.js",
66
"module": "dist/index.js",

test/5.0.0/unit.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe("NATIVE DTFs", () => {
176176

177177
// Verify that deferWeights set the weights and limits correctly
178178
assert.equal(weightsDeferred[0].low, 0n); // USDC target is 0, so low stays 0
179-
assert.equal(weightsDeferred[0].high, 0n); // USDC target is 0, so high stays 0
179+
assert.equal(weightsDeferred[0].high, bn("1e54")); // deferWeights sets high to 1e54 for all tokens
180180
assert.equal(weightsDeferred[1].low, 0n); // DAI low should be 0 (deferWeights sets low to 0)
181181
assert.equal(weightsDeferred[1].high, bn("1e54")); // DAI high should be 1e54 (D27n * D27n)
182182
assert.equal(weightsDeferred[2].low, 0n); // USDT low should be 0 (deferWeights sets low to 0)
@@ -209,27 +209,27 @@ describe("NATIVE DTFs", () => {
209209
finalStageAtForTest,
210210
);
211211

212-
// The getOpenAuction function will calculate ideal weights and then clamp them
213-
// With deferWeights, the weight ranges are extremely wide (low=0, high=1e54)
214-
// During EJECT, high weights are kept at their original values
212+
// The getOpenAuction function calculates ideal weights based on target basket
213+
// With deferWeights, the initial weight ranges are wide (low=0, high=1e54)
214+
// but getOpenAuction computes appropriate weights for the auction
215215
assertOpenAuctionArgsEqual(openAuctionArgs, {
216216
rebalanceNonce: 1n,
217217
tokens: tokens,
218218
newWeights: [
219-
weightsDeferred[0], // USDC: unchanged (still 0)
219+
{ low: 0n, spot: 0n, high: 0n }, // USDC: target is 0, so all zeros
220220
{
221-
low: bn("500000000000000000000000000"), // Current implementation returns spot value
222-
spot: bn("500000000000000000000000000"),
223-
high: bn("1e54"), // Keep original high weight unchanged during ejection
221+
low: bn("500000000000000500000000000"),
222+
spot: bn("500000000000000500000000000"),
223+
high: bn("549999999999999950000000000"),
224224
},
225225
{
226-
low: bn("500000000000000"), // Current implementation returns spot value
227-
spot: bn("500000000000000"),
228-
high: bn("1e54"), // Keep original high weight unchanged during ejection
226+
low: bn("500000000000001"),
227+
spot: bn("500000000000001"),
228+
high: bn("550000000000000"),
229229
},
230230
],
231231
newPrices: defaultExpectedPrices_USDC_DAI_USDT,
232-
newLimits: { low: bn("0.9e18"), spot: bn("1e18"), high: bn("1e18") }, // getOpenAuction returns modified limits
232+
newLimits: { low: bn("0.9e18"), spot: bn("1e18"), high: bn("1e18") },
233233
});
234234
});
235235

0 commit comments

Comments
 (0)