Skip to content

Commit

Permalink
get the constant test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
moodysalem committed Mar 5, 2021
1 parent 127be65 commit 21c9fb4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"devDependencies": {
"@types/big.js": "^4.0.5",
"@types/jest": "^24.0.25",
"@uniswap/v3-core": "^1.0.0-beta.9",
"tsdx": "^0.14.1"
},
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions src/constants.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { INIT_CODE_HASH } from './constants'

// import { bytecode } from '@uniswap/v3-core/build/UniswapV3Pair.json'
import { bytecode } from '@uniswap/v3-core/artifacts/contracts/UniswapV3Pool.sol/UniswapV3Pool.json'
import { keccak256 } from '@ethersproject/solidity'

// this _could_ go in constants, except that it would cost every consumer of the sdk the CPU to compute the hash
// and load the JSON.
const COMPUTED_INIT_CODE_HASH = keccak256(['bytes'], [`0x${'' /*bytecode*/}`])
const COMPUTED_INIT_CODE_HASH = keccak256(['bytes'], [bytecode])

describe('constants', () => {
describe('INIT_CODE_HASH', () => {
it.skip('matches computed bytecode hash', () => {
it('matches computed bytecode hash', () => {
expect(COMPUTED_INIT_CODE_HASH).toEqual(INIT_CODE_HASH)
})
})
Expand Down
5 changes: 2 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import JSBI from 'jsbi'

// todo: replace with v3 factory address
export const FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f'
export const FACTORY_ADDRESS = '0x1F98431c8aD98523631AE4a59f267346ea31F984'

// todo: replace with v3 init code hash
export const INIT_CODE_HASH = '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f'
export const INIT_CODE_HASH = '0xd4f1a40e4bf7e60d35149863dcd741cd4bb1f6b8e723b3140eca4a488aec8a51'

export const MINIMUM_LIQUIDITY = JSBI.BigInt(1000)

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"esModuleInterop": true
"esModuleInterop": true,
"resolveJsonModule": true
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,11 @@
tiny-warning "^1.0.3"
toformat "^2.0.0"

"@uniswap/v3-core@^1.0.0-beta.9":
version "1.0.0-beta.9"
resolved "https://registry.yarnpkg.com/@uniswap/v3-core/-/v3-core-1.0.0-beta.9.tgz#339eecc9a7a5baea0c41d42c3941eb247786634b"
integrity sha512-u9/44IQmoKKYBxQdv3CJ1uhSXXT5KMxgrWYY4HJkdbqkDT/v2Y2buP80mL3Ox3W5fz1OHwpkvckFMp9zrZLoCw==

abab@^2.0.0:
version "2.0.5"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a"
Expand Down

0 comments on commit 21c9fb4

Please sign in to comment.