Skip to content

Commit

Permalink
method name
Browse files Browse the repository at this point in the history
  • Loading branch information
zavelevsky committed Jul 8, 2024
1 parent f42164f commit 84dc050
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/utils/encoders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const isOrderEncodable = (order: DecodedOrder) => {
* @param {string} y - the second rate
* @returns {boolean} - true if the rates are equal after scaling, false otherwise
*/
export const scaleRatesAndCheckIsEqual = (x: string, y: string) => {
export const areScaledRatesEqual = (x: string, y: string): boolean => {
const xDec = new Decimal(x);
const yDec = new Decimal(y);
const xScaled = DecToBn(encodeRate(xDec));
Expand Down
10 changes: 5 additions & 5 deletions tests/encoders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import {
encodeOrder,
isOrderEncodable,
scaleRatesAndCheckIsEqual,
areScaledRatesEqual,
decodeOrder,
calculateRequiredLiquidity,
calculateCorrelatedZ,
Expand Down Expand Up @@ -191,23 +191,23 @@ describe('encoders', () => {
});
});

describe('scaleRatesAndCheckIsEqual', () => {
describe('areScaledRatesEqual', () => {
it('should return true when the rates are equal', () => {
const x = '0.5';
const y = '0.5';
expect(scaleRatesAndCheckIsEqual(x, y)).to.be.true;
expect(areScaledRatesEqual(x, y)).to.be.true;
});
it('should return false when the rates are not equal', () => {
const x = '0.5';
const y = '0.6';
expect(scaleRatesAndCheckIsEqual(x, y)).to.be.false;
expect(areScaledRatesEqual(x, y)).to.be.false;
});
it('should return true when the rates are only equal afr scaling', () => {
const x =
'9.999999999999947841981611412981873775987881042119111152377541884561651386320590972900390625';
const y =
'9.999999999999973770354085873786350785392842669271401327708947225166629806745858567718077125618947319';
expect(scaleRatesAndCheckIsEqual(x, y)).to.be.true;
expect(areScaledRatesEqual(x, y)).to.be.true;
});
});

Expand Down

0 comments on commit 84dc050

Please sign in to comment.