From 4004202d9b69de1e00715ea40fdbe8edaf972212 Mon Sep 17 00:00:00 2001 From: Rubilmax Date: Fri, 14 Oct 2022 10:52:20 +0200 Subject: [PATCH] fix(compound): rename mul/div operations BREAKING CHANGE: compoundMul (resp. compoundDiv) renamed to compMul (resp. compDiv) --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 62365c6..d1fe836 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,8 +22,8 @@ declare module "@ethersproject/bignumber/lib/bignumber" { max: (other: BigNumberish) => BigNumber; sum: (others: BigNumberish[]) => BigNumber; - compoundMul: (other: BigNumberish) => BigNumber; - compoundDiv: (other: BigNumberish) => BigNumber; + compMul: (other: BigNumberish) => BigNumber; + compDiv: (other: BigNumberish) => BigNumber; percentAdd: (pct: BigNumberish) => BigNumber; percentSub: (pct: BigNumberish) => BigNumber; @@ -75,10 +75,10 @@ BigNumber.prototype.sum = function (others: BigNumberish[]) { return others.reduce((acc, val) => acc.add(val), this); }; -BigNumber.prototype.compoundMul = function (other: BigNumberish) { +BigNumber.prototype.compMul = function (other: BigNumberish) { return BigNumber.from(this).mul(other).div(WAD); }; -BigNumber.prototype.compoundDiv = function (other: BigNumberish) { +BigNumber.prototype.compDiv = function (other: BigNumberish) { return WAD.mul(this).mul(WAD).div(other).div(WAD); };