@syncswap/sdk
Version:
SyncSwap TypeScript SDK for building DeFi applications
167 lines • 4.85 kB
JavaScript
import { BigNumber } from "ethers";
// synthetic class for zero
class ZeroBigNumber /*extends BigNumber*/ {
constructor() {
this.bn = BigNumber.from("0x00");
this._hex = this.bn._hex;
this._isBigNumber = this.bn._isBigNumber;
}
fromTwos(value) {
return this.bn.fromTwos(value);
}
toTwos(value) {
return this.bn.toTwos(value);
}
abs() {
return this;
}
add(other) {
return this.bn.add(other);
}
sub(other) {
return this.bn.sub(other);
}
div(other) {
return this.bn.div(other);
}
mul(other) {
return this.bn.mul(other);
}
mod(other) {
return this.bn.mod(other);
}
pow(other) {
return this.bn.pow(other);
}
and(other) {
return this.bn.and(other);
}
or(other) {
return this.bn.or(other);
}
xor(other) {
return this.bn.xor(other);
}
mask(value) {
return this.bn.mask(value);
}
shl(value) {
return this.bn.shl(value);
}
shr(value) {
return this.bn.shr(value);
}
eq(other) {
return this.bn.eq(other);
}
lt(other) {
return this.bn.lt(other);
}
lte(other) {
return this.bn.lte(other);
}
gt(other) {
return this.bn.gt(other);
}
gte(other) {
return this.bn.gte(other);
}
isNegative() {
return false;
}
isZero() {
return true;
}
toNumber() {
return 0;
}
toBigInt() {
return BigInt("0");
}
toString() {
return "0";
}
toHexString() {
return "0x00";
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
toJSON(key) {
return { type: "BigNumber", hex: "0x00" };
}
}
export const ZERO = new ZeroBigNumber();
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
export const ONE_ADDRESS = "0x0000000000000000000000000000000000000001";
export const ONE = BigNumber.from(1);
export const TWO = BigNumber.from(2);
export const THREE = BigNumber.from(3);
export const FOUR = BigNumber.from(4);
export const TEN = BigNumber.from(10);
export const ONE_MINUTE = BigNumber.from(60);
// Maximum value of uint256 type
export const UINT256_MAX = BigNumber.from(2).pow(256).sub(1);
export const UINT128_MAX = BigNumber.from(2).pow(128).sub(1);
export const UINT160_MAX = BigNumber.from(2).pow(160).sub(1);
export const Q_32 = BigNumber.from("4294967296");
export const Q_96 = BigNumber.from("79228162514264337593543950336");
export const Q_192 = BigNumber.from("6277101735386680763835789423207666416102355444464034512896");
export const Q_128 = BigNumber.from("340282366920938463463374607431768211456");
export const ETHER = TEN.pow(18);
export const DECIMALS_2 = TEN.pow(2);
export const DECIMALS_3 = TEN.pow(3);
export const DECIMALS_4 = TEN.pow(4);
export const DECIMALS_5 = TEN.pow(5);
export const DECIMALS_6 = TEN.pow(6);
export const DECIMALS_7 = TEN.pow(7);
export const DECIMALS_8 = TEN.pow(8);
export const DECIMALS_9 = TEN.pow(9);
export const DECIMALS_10 = TEN.pow(10);
export const DECIMALS_11 = TEN.pow(11);
export const DECIMALS_12 = TEN.pow(12);
export const DECIMALS_14 = TEN.pow(14);
export const DECIMALS_15 = TEN.pow(15);
export const DECIMALS_16 = TEN.pow(16);
export const DECIMALS_17 = TEN.pow(17);
export const DECIMALS_18 = TEN.pow(18);
export const DECIMALS_20 = TEN.pow(20);
export const DECIMALS_22 = TEN.pow(22);
export const DECIMALS_24 = TEN.pow(24);
export const DECIMALS_26 = TEN.pow(26);
export const DECIMALS_27 = TEN.pow(27);
export const DECIMALS_21 = TEN.pow(21);
export const DECIMALS_28 = TEN.pow(28);
export const DECIMALS_30 = TEN.pow(30);
export const DECIMALS_32 = TEN.pow(32);
export const DECIMALS_33 = TEN.pow(33);
export const DECIMALS_36 = TEN.pow(36);
export const DECIMALS_64 = TEN.pow(64);
export const DECIMALS_72 = TEN.pow(72);
export const DECIMALS_114 = TEN.pow(114);
export const DECIMALS_128 = TEN.pow(128);
export const HALF_DECIMALS_18 = DECIMALS_18.div(2);
export const DECIMALS_36_Q96 = DECIMALS_36.mul(Q_96);
export const BILLION = DECIMALS_9;
export const MILLION_BILLION = BILLION.mul(1000000);
export const NINE_MILLION_BILLION = MILLION_BILLION.mul(9);
export const YEAR_SECONDS = BigNumber.from(31536000);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const EMPTY_SET = new Set();
export function emptySet() {
return EMPTY_SET;
}
export const BUNDLE_ID = "1";
export const timeframeOptions = {
//DAY: '1 day',
WEEK: "1 week",
MONTH: "1 month",
// THREE_MONTHS: '3 months',
// YEAR: '1 year',
HALF_YEAR: "6 months",
ALL_TIME: "All time",
};
export const ZERO_FEE_DATA = {
gamma: ZERO,
minFee: 0,
maxFee: 0,
};
//# sourceMappingURL=constants.js.map