Commit 9b56cbc3 authored by Noah Zinsmeister's avatar Noah Zinsmeister

re-arrange some exports

parent dc5b3eae
import JSBI from 'jsbi' import JSBI from 'jsbi'
// exports for external consumption // exports for external consumption
export type BigintIsh = JSBI | bigint | string
export enum ChainId { export enum ChainId {
MAINNET = 1, MAINNET = 1,
ROPSTEN = 3, ROPSTEN = 3,
...@@ -9,15 +11,23 @@ export enum ChainId { ...@@ -9,15 +11,23 @@ export enum ChainId {
KOVAN = 42 KOVAN = 42
} }
export const FACTORY_ADDRESS = '0xe2f197885abe8ec7c866cFf76605FD06d4576218'
export const INIT_CODE_HASH = '0x0b77fb54a078d9399fa29cac94f5b35b9f11611b456ab507c7f46754712b642b'
export enum TradeType { export enum TradeType {
EXACT_INPUT, EXACT_INPUT,
EXACT_OUTPUT EXACT_OUTPUT
} }
export enum Rounding {
ROUND_DOWN,
ROUND_HALF_UP,
ROUND_UP
}
export const FACTORY_ADDRESS = '0xe2f197885abe8ec7c866cFf76605FD06d4576218'
export const INIT_CODE_HASH = '0x0b77fb54a078d9399fa29cac94f5b35b9f11611b456ab507c7f46754712b642b'
export const MINIMUM_LIQUIDITY = JSBI.BigInt(1000)
// exports for internal consumption // exports for internal consumption
export const ZERO = JSBI.BigInt(0) export const ZERO = JSBI.BigInt(0)
export const ONE = JSBI.BigInt(1) export const ONE = JSBI.BigInt(1)
...@@ -28,7 +38,6 @@ export const TEN = JSBI.BigInt(10) ...@@ -28,7 +38,6 @@ export const TEN = JSBI.BigInt(10)
export const _100 = JSBI.BigInt(100) export const _100 = JSBI.BigInt(100)
export const _997 = JSBI.BigInt(997) export const _997 = JSBI.BigInt(997)
export const _1000 = JSBI.BigInt(1000) export const _1000 = JSBI.BigInt(1000)
export const MINIMUM_LIQUIDITY = _1000
export enum SolidityType { export enum SolidityType {
uint8 = 'uint8', uint8 = 'uint8',
......
...@@ -4,7 +4,7 @@ import _Decimal from 'decimal.js-light' ...@@ -4,7 +4,7 @@ import _Decimal from 'decimal.js-light'
import _Big, { RoundingMode } from 'big.js' import _Big, { RoundingMode } from 'big.js'
import toFormat from 'toformat' import toFormat from 'toformat'
import { BigintIsh, Rounding } from '../../types' import { BigintIsh, Rounding } from '../../constants'
import { ONE } from '../../constants' import { ONE } from '../../constants'
import { parseBigintIsh } from '../../utils' import { parseBigintIsh } from '../../utils'
......
import { Rounding } from '../../types' import { Rounding, _100 } from '../../constants'
import { _100 } from '../../constants'
import { Fraction } from './fraction' import { Fraction } from './fraction'
const _100_PERCENT = new Fraction(_100) const _100_PERCENT = new Fraction(_100)
......
import invariant from 'tiny-invariant' import invariant from 'tiny-invariant'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { BigintIsh, Rounding } from '../../types' import { BigintIsh, Rounding, TEN } from '../../constants'
import { TEN } from '../../constants'
import { Token } from '../token' import { Token } from '../token'
import { Route } from '../route' import { Route } from '../route'
import { Fraction } from './fraction' import { Fraction } from './fraction'
......
...@@ -3,8 +3,7 @@ import JSBI from 'jsbi' ...@@ -3,8 +3,7 @@ import JSBI from 'jsbi'
import _Big from 'big.js' import _Big from 'big.js'
import toFormat from 'toformat' import toFormat from 'toformat'
import { BigintIsh, Rounding } from '../../types' import { BigintIsh, Rounding, TEN, SolidityType } from '../../constants'
import { TEN, SolidityType } from '../../constants'
import { parseBigintIsh, validateSolidityTypeInstance } from '../../utils' import { parseBigintIsh, validateSolidityTypeInstance } from '../../utils'
import { Token } from '../token' import { Token } from '../token'
import { Fraction } from './fraction' import { Fraction } from './fraction'
......
...@@ -6,8 +6,17 @@ import { Contract } from '@ethersproject/contracts' ...@@ -6,8 +6,17 @@ import { Contract } from '@ethersproject/contracts'
import { pack, keccak256 } from '@ethersproject/solidity' import { pack, keccak256 } from '@ethersproject/solidity'
import { getCreate2Address } from '@ethersproject/address' import { getCreate2Address } from '@ethersproject/address'
import { BigintIsh } from '../types' import {
import { FACTORY_ADDRESS, INIT_CODE_HASH, ZERO, ONE, FIVE, _997, _1000, MINIMUM_LIQUIDITY } from '../constants' BigintIsh,
FACTORY_ADDRESS,
INIT_CODE_HASH,
MINIMUM_LIQUIDITY,
ZERO,
ONE,
FIVE,
_997,
_1000
} from '../constants'
import ERC20 from '../abis/ERC20.json' import ERC20 from '../abis/ERC20.json'
import { sqrt, parseBigintIsh } from '../utils' import { sqrt, parseBigintIsh } from '../utils'
import { InsufficientReservesError, InsufficientInputAmountError } from '../errors' import { InsufficientReservesError, InsufficientInputAmountError } from '../errors'
......
import JSBI from 'jsbi' import JSBI from 'jsbi'
export { JSBI } export { JSBI }
export * from './types' export {
export * from './constants' BigintIsh,
export * from './entities' ChainId,
TradeType,
Rounding,
FACTORY_ADDRESS,
INIT_CODE_HASH,
MINIMUM_LIQUIDITY
} from './constants'
export * from './errors' export * from './errors'
export * from './entities'
import JSBI from 'jsbi'
export type BigintIsh = JSBI | bigint | string
export enum Rounding {
ROUND_DOWN,
ROUND_HALF_UP,
ROUND_UP
}
...@@ -3,8 +3,7 @@ import warning from 'tiny-warning' ...@@ -3,8 +3,7 @@ import warning from 'tiny-warning'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { getAddress } from '@ethersproject/address' import { getAddress } from '@ethersproject/address'
import { BigintIsh } from './types' import { BigintIsh, ZERO, ONE, TWO, THREE, SolidityType, SOLIDITY_TYPE_MAXIMA } from './constants'
import { ZERO, ONE, TWO, THREE, SolidityType, SOLIDITY_TYPE_MAXIMA } from './constants'
export function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void { export function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void {
invariant(JSBI.greaterThanOrEqual(value, ZERO), `${value} is not a ${solidityType}.`) invariant(JSBI.greaterThanOrEqual(value, ZERO), `${value} is not a ${solidityType}.`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment