Skip to content

Commit

Permalink
update to latest deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahZinsmeister committed Mar 13, 2020
1 parent c6b4ca3 commit 99198eb
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"dependencies": {
"@ethersproject/address": "^5.0.0-beta.134",
"@ethersproject/contracts": "^5.0.0-beta.143",
"@ethersproject/keccak256": "^5.0.0-beta.131",
"@ethersproject/networks": "^5.0.0-beta.135",
"@ethersproject/providers": "^5.0.0-beta.153",
"@ethersproject/solidity": "^5.0.0-beta.131",
"big.js": "^5.2.2",
"decimal.js-light": "^2.5.0",
"jsbi": "^3.1.1",
Expand Down
10 changes: 2 additions & 8 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ export enum ChainId {
KOVAN = 42
}

export const FACTORY_ADDRESS = {
[ChainId.MAINNET]: '',
[ChainId.ROPSTEN]: '',
[ChainId.RINKEBY]: '0xF231A51299c872040C002f3E1918D806F951Efcb',
[ChainId.GÖRLI]: '',
[ChainId.KOVAN]: ''
}
export const FACTORY_ADDRESS = '0xE9DFfc628C6933f2c74356430099bD7639F25D5C'

export const INIT_CODE_HASH = '0x762dbd0ad132fda0dfcfbc963d8f43f78fc3e23b604fc4c34f61c2ca7b3e1b36'
export const INIT_CODE_HASH = '0x8548287401d15401e1162bb5bc290f6fba82afcb66944df43c3017817522771b'

export enum TradeType {
EXACT_INPUT,
Expand Down
8 changes: 4 additions & 4 deletions src/entities/exchange.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import invariant from 'tiny-invariant'
import JSBI from 'jsbi'
import { getCreate2Address } from '@ethersproject/address'
import { keccak256 } from '@ethersproject/keccak256'
import { getNetwork } from '@ethersproject/networks'
import { getDefaultProvider } from '@ethersproject/providers'
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'
Expand All @@ -29,8 +29,8 @@ export class Exchange {
[tokens[0].address]: {
...CACHE?.[tokens[0].address],
[tokens[1].address]: getCreate2Address(
FACTORY_ADDRESS[tokens[0].chainId],
keccak256(`${tokens[0].address.toLowerCase()}${tokens[1].address.slice(2).toLowerCase()}`),
FACTORY_ADDRESS,
keccak256(['bytes'], [pack(['address', 'address'], [tokens[0].address, tokens[1].address])]),
INIT_CODE_HASH
)
}
Expand Down
2 changes: 1 addition & 1 deletion test/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ describe('data', () => {
it('Exchange', async () => {
const token = new Token(ChainId.RINKEBY, '0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735', 18) // DAI
const exchange = await Exchange.fetchData(WETH[ChainId.RINKEBY], token)
expect(exchange.liquidityToken.address).toEqual('0xF52A46f3Ddc2A35aD1ed7166aC3dd3435DC4AC4A')
expect(exchange.liquidityToken.address).toEqual('0xA7D5493AA915Fcb8a9C0Bd77B587275A53fDdE6d')
})
})
30 changes: 29 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@
"@ethersproject/logger" ">=5.0.0-beta.129"
"@ethersproject/strings" ">=5.0.0-beta.130"

"@ethersproject/keccak256@>=5.0.0-beta.127", "@ethersproject/keccak256@^5.0.0-beta.131":
"@ethersproject/keccak256@>=5.0.0-beta.127":
version "5.0.0-beta.131"
resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.0.0-beta.131.tgz#b5778723ee75208065b9b9ad30c71d480f41bb31"
integrity sha512-KQnqMwGV0IMOjAr/UTFO8DuLrmN1uaMvcV3zh9hiXhh3rCuY+WXdeUh49w1VQ94kBKmaP0qfGb7z4SdhUWUHjw==
Expand Down Expand Up @@ -947,6 +947,15 @@
dependencies:
"@ethersproject/bytes" ">=5.0.0-beta.129"

"@ethersproject/sha2@>=5.0.0-beta.129":
version "5.0.0-beta.135"
resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.0.0-beta.135.tgz#e597572ba991fe044d50f8d75704bb4a2b2c64b4"
integrity sha512-DK/cUT5ilCVLtf1xk7XDPB9xGHsXiU3TsULKsEg823cTBIhFl2l0IiHAGqu9uiMlSJRpb2BwrWQuMgmFe/vMwQ==
dependencies:
"@ethersproject/bytes" ">=5.0.0-beta.129"
"@ethersproject/logger" ">=5.0.0-beta.129"
hash.js "1.1.3"

"@ethersproject/signing-key@>=5.0.0-beta.129":
version "5.0.0-beta.135"
resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.0.0-beta.135.tgz#f739e800aad9e01b77a8ec2c353b9b66ce5738fa"
Expand All @@ -957,6 +966,17 @@
"@ethersproject/properties" ">=5.0.0-beta.131"
elliptic "6.5.2"

"@ethersproject/solidity@^5.0.0-beta.131":
version "5.0.0-beta.131"
resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.0.0-beta.131.tgz#7d826e98cc0a29e25f0ff52ae17c07483f5d93d4"
integrity sha512-i5vuj2CXGMkVPo08bmElC2cvhjRDNRZZ8nzvx2WCi75Zh42xD0XNV77E9ZLYgS0WoZSiAi/F71nXSBnM7FAqJg==
dependencies:
"@ethersproject/bignumber" ">=5.0.0-beta.130"
"@ethersproject/bytes" ">=5.0.0-beta.129"
"@ethersproject/keccak256" ">=5.0.0-beta.127"
"@ethersproject/sha2" ">=5.0.0-beta.129"
"@ethersproject/strings" ">=5.0.0-beta.130"

"@ethersproject/strings@>=5.0.0-beta.130":
version "5.0.0-beta.136"
resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.0.0-beta.136.tgz#053cbf4f9f96a7537cbc50300597f2d707907f51"
Expand Down Expand Up @@ -3093,6 +3113,14 @@ has@^1.0.3:
dependencies:
function-bind "^1.1.1"

hash.js@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846"
integrity sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==
dependencies:
inherits "^2.0.3"
minimalistic-assert "^1.0.0"

hash.js@^1.0.0, hash.js@^1.0.3:
version "1.1.7"
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
Expand Down

0 comments on commit 99198eb

Please sign in to comment.