You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When generating and retrieving pairs using the UniswapV2Factory the INIT_CODE_PAIR_HASH appears to be different when deploying vs testing locally.
I found the cause of the problem.Because I did not use pre-compiled smart contracts.Instead I used truffle to compile smart contracts.When I compiled the CalHash contract with yarn compile,
To Reproduce
For deployment we use the hash generated by the following
However when running 00_InitHash.test.ts we get the value 0xb96a05d90581cfac1f99c92b02f2e69fbca4e5c26498be0dc204d91318c9f56b
and when trying to addLiquidity await addLiquidityKLP(this, "kangaEth", this.kanga, this.weth, "6000000000000000000", "6000000000000000000", "60000000000000000000", "6000000000000000000", this.alice.address)
we get the following error
2) KangaMaker
checkInitHash
check ability to add liquidity:
Error: Transaction reverted: function call to a non-contract account
at UniswapV2Router02.getReserves (contracts/uniswapv2/libraries/UniswapV2Library.sol:33)
at UniswapV2Router02._addLiquidity (contracts/uniswapv2/UniswapV2Router02.sol:46)
at UniswapV2Router02.addLiquidity (contracts/uniswapv2/UniswapV2Router02.sol:72)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at EthModule._estimateGasAction (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:402:9)
at HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:102:18)
at EthersProviderWrapper.send (node_modules/hardhat-deploy-ethers/src/ethers-provider-wrapper.ts:13:20)
This can be resolved by updating And we have added this value to the UniswapV2Library.sol to b96a05d90581cfac1f99c92b02f2e69fbca4e5c26498be0dc204d91318c9f56b but then deployments are broken
Expected behavior
The same init_hash can be used for testing and deployment
Adding liquidity works for testing and deployments.
Actual behavior
init_hash is different for testing and deployments
Adding liquidity fails when using the wrong init_hash
maybe it wasn't very clear but which one allowed you to migrate
0x2b3916d184be5391113dc61053ef6e55b1214905619aa198de8ef903f9acffd2
or
0xb96a05d90581cfac1f99c92b02f2e69fbca4e5c26498be0dc204d91318c9f56b
Describe the bug
When generating and retrieving pairs using the UniswapV2Factory the INIT_CODE_PAIR_HASH appears to be different when deploying vs testing locally.
Believe the problem is similar to Uniswap/v2-core#102
To Reproduce
For deployment we use the hash generated by the following
const MANUAL_INIT_CODE_HASH = keccak256(['bytes'],[bytecode]);
which is
0x2b3916d184be5391113dc61053ef6e55b1214905619aa198de8ef903f9acffd2
And we have added this value to the UniswapV2Library.sol minus the 0x prefix.
You can see the value returned on Kovan using the UniswapV2Factory in explorer
However when running 00_InitHash.test.ts we get the value
0xb96a05d90581cfac1f99c92b02f2e69fbca4e5c26498be0dc204d91318c9f56b
and when trying to addLiquidity
await addLiquidityKLP(this, "kangaEth", this.kanga, this.weth, "6000000000000000000", "6000000000000000000", "60000000000000000000", "6000000000000000000", this.alice.address)
we get the following error
This can be resolved by updating And we have added this value to the UniswapV2Library.sol to
b96a05d90581cfac1f99c92b02f2e69fbca4e5c26498be0dc204d91318c9f56b
but then deployments are brokenExpected behavior
Actual behavior
Additional context
Reference tickets
The text was updated successfully, but these errors were encountered: