Skip to content

Commit

Permalink
Merge pull request #12 from curvefi/fix/futureBands
Browse files Browse the repository at this point in the history
Fix: future bands
  • Loading branch information
Macket authored Aug 25, 2023
2 parents 2c03437 + e3700d2 commit d3044d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curvefi/stablecoin-api",
"version": "1.3.3",
"version": "1.3.4",
"description": "JavaScript library for Curve Stablecoin",
"main": "lib/index.js",
"author": "Macket",
Expand Down
4 changes: 2 additions & 2 deletions src/llammas/LlammaTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ export class LlammaTemplate {

const N = await this.userRange();
const _collateral = _currentCollateral.add(parseUnits(collateral, this.collateralDecimals));
const _debt = _currentDebt.add(parseUnits(debt, this.collateralDecimals));
const _debt = _currentDebt.add(parseUnits(debt));

const _n1 = await this._calcN1(_collateral, _debt, N);
const _n2 = _n1.add(N - 1);
Expand Down Expand Up @@ -976,7 +976,7 @@ export class LlammaTemplate {
if (_currentDebt.eq(0)) throw Error(`Loan for ${address} does not exist`);

const N = await this.userRange(address);
const _debt = _currentDebt.sub(parseUnits(debt, this.collateralDecimals));
const _debt = _currentDebt.sub(parseUnits(debt));
const _n1 = await this._calcN1(_currentCollateral, _debt, N);
const _n2 = _n1.add(N - 1);

Expand Down
6 changes: 3 additions & 3 deletions test/general.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getLlamma, LlammaTemplate } from "../src/llammas";
import { BN } from "../src/utils";


const LLAMMAS = ['eth'];
const LLAMMAS = ['sfrxeth', 'wsteth', 'wbtc', 'eth'];

const generalTest = (id: string) => {
describe(`${id} llamma general test`, function () {
Expand Down Expand Up @@ -137,7 +137,7 @@ const generalTest = (id: string) => {

assert.approximately(Number(removeCollateralPrices[0]), Number(userPrices[0]), 1e-2, 'price 0');
assert.approximately(Number(removeCollateralPrices[1]), Number(userPrices[1]), 1e-2, 'price 1');
assert.approximately(Number(removeCollateralFullHealth), Number(fullHealth), 1e-3, 'full health');
assert.approximately(Number(removeCollateralFullHealth), Number(fullHealth), 1e-2, 'full health');
assert.approximately(Number(removeCollateralHealth), Number(health), 1e-4, 'health');
assert.equal(Number(balances.collateral), Number(initialBalances.collateral) + Number(collateralAmount), 'wallet collateral');
assert.equal(Number(balances.stablecoin), Number(initialBalances.stablecoin), 'wallet stablecoin');
Expand Down Expand Up @@ -168,7 +168,7 @@ const generalTest = (id: string) => {

assert.approximately(Number(repayPrices[0]), Number(userPrices[0]), 1e-2, 'price 0');
assert.approximately(Number(repayPrices[1]), Number(userPrices[1]), 1e-2, 'price 1');
assert.approximately(Number(repayFullHealth), Number(fullHealth), 1e-3, 'full health');
assert.approximately(Number(repayFullHealth), Number(fullHealth), 1e-2, 'full health');
assert.approximately(Number(repayHealth), Number(health), 1e-4, 'health');
assert.equal(Number(balances.collateral), Number(initialBalances.collateral), 'wallet collateral');
assert.equal(balances.stablecoin, BN(initialBalances.stablecoin).minus(BN(debtAmount)).toString(), 'wallet stablecoin');
Expand Down

0 comments on commit d3044d0

Please sign in to comment.