UNPKG

goosefx-amm-sdk

Version:

SDK for the GooseFx AMM

2 lines 418 B
import o from"bn.js";var s=new o(0);function B(e,r){if(r.isZero())throw Error("divisor is zero");return e.mod(r)}function N(e,r){if(r.isZero())throw Error("rhs is zero");let t=e.div(r);return t.isZero()?[t,r]:e.sub(t.mul(r)).isZero()?[t,r]:[t.add(new o(1)),r]}function f(e,r){return e.gt(r)?e.sub(r):new o(0)}export{s as ZERO,N as checkedCeilDiv,B as checkedRem,f as saturatingSub}; //# sourceMappingURL=common.mjs.map