@bancor/carbon-sdk
Version:
The SDK is a READ-ONLY tool, intended to facilitate working with Carbon contracts. It's a convenient wrapper around our matching algorithm, allowing programs and users get a ready to use transaction data that will allow them to manage strategies and fulfi
2 lines (1 loc) • 979 B
JavaScript
import{BigNumber as r}from"@ethersproject/bignumber";export{BigNumber}from"@ethersproject/bignumber";import{parseUnits as o,formatUnits as t}from"@ethersproject/units";import e from"decimal.js";const n=e.clone();n.set({precision:100,rounding:n.ROUND_HALF_DOWN,toExpNeg:-300,toExpPos:300});const i=(o,t)=>{const e=r.from(o),n=r.from(t);return e.lt(n)?e:n},s=(o,t)=>{const e=r.from(o),n=r.from(t);return e.gt(n)?e:n},m=2**48,c=new n(10),u=r.from(2).pow(256).sub(1),p=(r,o)=>{const t=r-o;return c.pow(t)},f=r=>new n(r.toString()),d=o=>r.from(o.toFixed()),g=(r,o,t)=>o.eq(t)?r:r.mul(o).div(t);function x(r,o){return new n(r).toFixed(o,n.ROUND_DOWN).replace(/(\.\d*?[1-9])0+$|\.0*$/,"$1")}function a(r,t){const e=x(r,t);return o(e,t)}function b(r,o){const e=t(r,o);return new n(e).toFixed()}export{s as BigNumberMax,i as BigNumberMin,f as BnToDec,d as DecToBn,n as Decimal,u as MAX_UINT256,m as ONE,c as TEN,b as formatUnits,g as mulDiv,a as parseUnits,p as tenPow,x as trimDecimal};