Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
swap-v2-sdk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
swap-v2-sdk
Commits
9b56cbc3
Unverified
Commit
9b56cbc3
authored
Mar 19, 2020
by
Noah Zinsmeister
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-arrange some exports
parent
dc5b3eae
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
28 deletions
+41
-28
constants.ts
src/constants.ts
+14
-5
fraction.ts
src/entities/fractions/fraction.ts
+1
-1
percent.ts
src/entities/fractions/percent.ts
+1
-2
price.ts
src/entities/fractions/price.ts
+1
-2
tokenAmount.ts
src/entities/fractions/tokenAmount.ts
+1
-2
pair.ts
src/entities/pair.ts
+11
-2
index.ts
src/index.ts
+11
-3
types.ts
src/types.ts
+0
-9
utils.ts
src/utils.ts
+1
-2
No files found.
src/constants.ts
View file @
9b56cbc3
import
JSBI
from
'
jsbi
'
// exports for external consumption
export
type
BigintIsh
=
JSBI
|
bigint
|
string
export
enum
ChainId
{
MAINNET
=
1
,
ROPSTEN
=
3
,
...
...
@@ -9,15 +11,23 @@ export enum ChainId {
KOVAN
=
42
}
export
const
FACTORY_ADDRESS
=
'
0xe2f197885abe8ec7c866cFf76605FD06d4576218
'
export
const
INIT_CODE_HASH
=
'
0x0b77fb54a078d9399fa29cac94f5b35b9f11611b456ab507c7f46754712b642b
'
export
enum
TradeType
{
EXACT_INPUT
,
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
export
const
ZERO
=
JSBI
.
BigInt
(
0
)
export
const
ONE
=
JSBI
.
BigInt
(
1
)
...
...
@@ -28,7 +38,6 @@ export const TEN = JSBI.BigInt(10)
export
const
_100
=
JSBI
.
BigInt
(
100
)
export
const
_997
=
JSBI
.
BigInt
(
997
)
export
const
_1000
=
JSBI
.
BigInt
(
1000
)
export
const
MINIMUM_LIQUIDITY
=
_1000
export
enum
SolidityType
{
uint8
=
'
uint8
'
,
...
...
src/entities/fractions/fraction.ts
View file @
9b56cbc3
...
...
@@ -4,7 +4,7 @@ import _Decimal from 'decimal.js-light'
import
_Big
,
{
RoundingMode
}
from
'
big.js
'
import
toFormat
from
'
toformat
'
import
{
BigintIsh
,
Rounding
}
from
'
../../
type
s
'
import
{
BigintIsh
,
Rounding
}
from
'
../../
constant
s
'
import
{
ONE
}
from
'
../../constants
'
import
{
parseBigintIsh
}
from
'
../../utils
'
...
...
src/entities/fractions/percent.ts
View file @
9b56cbc3
import
{
Rounding
}
from
'
../../types
'
import
{
_100
}
from
'
../../constants
'
import
{
Rounding
,
_100
}
from
'
../../constants
'
import
{
Fraction
}
from
'
./fraction
'
const
_100_PERCENT
=
new
Fraction
(
_100
)
...
...
src/entities/fractions/price.ts
View file @
9b56cbc3
import
invariant
from
'
tiny-invariant
'
import
JSBI
from
'
jsbi
'
import
{
BigintIsh
,
Rounding
}
from
'
../../types
'
import
{
TEN
}
from
'
../../constants
'
import
{
BigintIsh
,
Rounding
,
TEN
}
from
'
../../constants
'
import
{
Token
}
from
'
../token
'
import
{
Route
}
from
'
../route
'
import
{
Fraction
}
from
'
./fraction
'
...
...
src/entities/fractions/tokenAmount.ts
View file @
9b56cbc3
...
...
@@ -3,8 +3,7 @@ import JSBI from 'jsbi'
import
_Big
from
'
big.js
'
import
toFormat
from
'
toformat
'
import
{
BigintIsh
,
Rounding
}
from
'
../../types
'
import
{
TEN
,
SolidityType
}
from
'
../../constants
'
import
{
BigintIsh
,
Rounding
,
TEN
,
SolidityType
}
from
'
../../constants
'
import
{
parseBigintIsh
,
validateSolidityTypeInstance
}
from
'
../../utils
'
import
{
Token
}
from
'
../token
'
import
{
Fraction
}
from
'
./fraction
'
...
...
src/entities/pair.ts
View file @
9b56cbc3
...
...
@@ -6,8 +6,17 @@ import { Contract } from '@ethersproject/contracts'
import
{
pack
,
keccak256
}
from
'
@ethersproject/solidity
'
import
{
getCreate2Address
}
from
'
@ethersproject/address
'
import
{
BigintIsh
}
from
'
../types
'
import
{
FACTORY_ADDRESS
,
INIT_CODE_HASH
,
ZERO
,
ONE
,
FIVE
,
_997
,
_1000
,
MINIMUM_LIQUIDITY
}
from
'
../constants
'
import
{
BigintIsh
,
FACTORY_ADDRESS
,
INIT_CODE_HASH
,
MINIMUM_LIQUIDITY
,
ZERO
,
ONE
,
FIVE
,
_997
,
_1000
}
from
'
../constants
'
import
ERC20
from
'
../abis/ERC20.json
'
import
{
sqrt
,
parseBigintIsh
}
from
'
../utils
'
import
{
InsufficientReservesError
,
InsufficientInputAmountError
}
from
'
../errors
'
...
...
src/index.ts
View file @
9b56cbc3
import
JSBI
from
'
jsbi
'
export
{
JSBI
}
export
*
from
'
./types
'
export
*
from
'
./constants
'
export
*
from
'
./entities
'
export
{
BigintIsh
,
ChainId
,
TradeType
,
Rounding
,
FACTORY_ADDRESS
,
INIT_CODE_HASH
,
MINIMUM_LIQUIDITY
}
from
'
./constants
'
export
*
from
'
./errors
'
export
*
from
'
./entities
'
src/types.ts
deleted
100644 → 0
View file @
dc5b3eae
import
JSBI
from
'
jsbi
'
export
type
BigintIsh
=
JSBI
|
bigint
|
string
export
enum
Rounding
{
ROUND_DOWN
,
ROUND_HALF_UP
,
ROUND_UP
}
src/utils.ts
View file @
9b56cbc3
...
...
@@ -3,8 +3,7 @@ import warning from 'tiny-warning'
import
JSBI
from
'
jsbi
'
import
{
getAddress
}
from
'
@ethersproject/address
'
import
{
BigintIsh
}
from
'
./types
'
import
{
ZERO
,
ONE
,
TWO
,
THREE
,
SolidityType
,
SOLIDITY_TYPE_MAXIMA
}
from
'
./constants
'
import
{
BigintIsh
,
ZERO
,
ONE
,
TWO
,
THREE
,
SolidityType
,
SOLIDITY_TYPE_MAXIMA
}
from
'
./constants
'
export
function
validateSolidityTypeInstance
(
value
:
JSBI
,
solidityType
:
SolidityType
):
void
{
invariant
(
JSBI
.
greaterThanOrEqual
(
value
,
ZERO
),
`
${
value
}
is not a
${
solidityType
}
.`
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment