Coder Social home page Coder Social logo

kanga's People

Contributors

johnwhitton avatar

Stargazers

 avatar  avatar

Watchers

 avatar

kanga's Issues

Token Holder Rewards Test Suite

Is your feature request related to a problem? Please describe.
Currently token rewards are not consistently going to the fee-to address set in the factory.
This Issue is to write a test harness for this to enable the debugging of the issue and setting up a foundation for Token Holder Rewards.

Describe the solution you'd like

  • Write a test utility to check that the fee_to receives liquidity pool tokens when liquidity is added to the pool.
  • Also update the checkFactory deploy script to include the creation of a test suite of tokens and liquidity pools.
  • Document the token holder rewards process flow including what happens upon minting, trading and withdrawal of liquidity.

Verification of contracts

Update Deploy Process so hardhat etherscan-verify works seamlessly
Currently when doingyarn kovan:verify the factory and Pair contracts are not verified due to missing metadata

Contract UniswapV2Factory was deployed without saving metadata. Cannot submit to etherscan, skipping.
Contract UniswapV2Pair was deployed without saving metadata. Cannot submit to etherscan, skipping.

Also we are falling back on solcinput for other contracts

Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying MiniBreederV2 (0x7A0a3f4b33baC113F0E7b26D6a5be7a144CE514d) ...
waiting for result...
 => contract MiniBreederV2 is now verified

Describe the solution you'd like
Update the deploy process and scripts so that the deploy works seamlessly.

Describe alternatives you've considered

  • Need to update the factory and pair scripts as currenty factory and pair deploy are a two step process
  • Need to look at whether we can flatten the contracts
  • Could update the version of solidity we're using

Additional context
Log from verify:kovan

johnlaptop kanga (v0.1.0) $ yarn kovan:verify
yarn run v1.22.11
warning ../../package.json: No license field
$ hardhat --network kovan etherscan-verify --solc-input
(node:70242) Warning: Accessing non-existent property 'VERSION' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
verifying Billabong (0xC1e88aF95a8F81a3aB19b8b1b46bde28cA2F352a) ...
waiting for result...
Failed to verify contract Billabong: NOTOK, Fail - Unable to verify
{
  "apikey": "XXXXXX",
  "module": "contract",
  "action": "verifysourcecode",
  "contractaddress": "0xC1e88aF95a8F81a3aB19b8b1b46bde28cA2F352a",
  "sourceCode": "...",
  "codeformat": "solidity-standard-json-input",
  "contractname": "contracts/Billabong.sol:Billabong",
  "compilerversion": "v0.6.12+commit.27d51765",
  "constructorArguements": "0000000000000000000000001428261e49e2c1554438edb657915436c05d134e",
  "licenseType": 3
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying Billabong (0xC1e88aF95a8F81a3aB19b8b1b46bde28cA2F352a) ...
waiting for result...
 => contract Billabong is now verified
verifying ERC20Mock (0xEE78e3A95c6CfE7f66260B927E5458A34C61F235) ...
waiting for result...
Failed to verify contract ERC20Mock: NOTOK, Fail - Unable to verify
{
  "apikey": "XXXXXX",
  "module": "contract",
  "action": "verifysourcecode",
  "contractaddress": "0xEE78e3A95c6CfE7f66260B927E5458A34C61F235",
  "sourceCode": "...",
  "codeformat": "solidity-standard-json-input",
  "contractname": "contracts/mocks/ERC20Mock.sol:ERC20Mock",
  "compilerversion": "v0.6.12+commit.27d51765",
  "constructorArguements": "000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000204fce5e3e250261100000000000000000000000000000000000000000000000000000000000000000000003555354000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035553540000000000000000000000000000000000000000000000000000000000",
  "licenseType": 3
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying ERC20Mock (0xEE78e3A95c6CfE7f66260B927E5458A34C61F235) ...
waiting for result...
 => contract ERC20Mock is now verified
verifying KangaBounce (0x67540479658e79C0e308De1aA83364128d4795c7) ...
waiting for result...
Failed to verify contract KangaBounce: NOTOK, Fail - Unable to verify
{
  "apikey": "XXXXXX",
  "module": "contract",
  "action": "verifysourcecode",
  "contractaddress": "0x67540479658e79C0e308De1aA83364128d4795c7",
  "sourceCode": "...",
  "codeformat": "solidity-standard-json-input",
  "contractname": "contracts/KangaBounce.sol:KangaBounce",
  "compilerversion": "v0.6.12+commit.27d51765",
  "constructorArguements": "0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000004ded055ad5a6734286d5cc6855311aacb6e1e1c8",
  "licenseType": 3
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying KangaBounce (0x67540479658e79C0e308De1aA83364128d4795c7) ...
waiting for result...
 => contract KangaBounce is now verified
verifying KangaMaker (0xDC5025743489820F876C5a63686A76052041BA9e) ...
waiting for result...
Failed to verify contract KangaMaker: NOTOK, Fail - Unable to verify
{
  "apikey": "XXXXXX",
  "module": "contract",
  "action": "verifysourcecode",
  "contractaddress": "0xDC5025743489820F876C5a63686A76052041BA9e",
  "sourceCode": "...",
  "codeformat": "solidity-standard-json-input",
  "contractname": "contracts/KangaMaker.sol:KangaMaker",
  "compilerversion": "v0.6.12+commit.27d51765",
  "constructorArguements": "00000000000000000000000080a000f9d85cfb9a426065189b7feee868a8a41c000000000000000000000000c1e88af95a8f81a3ab19b8b1b46bde28ca2f352a0000000000000000000000001428261e49e2c1554438edb657915436c05d134e000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c",
  "licenseType": 3
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying KangaMaker (0xDC5025743489820F876C5a63686A76052041BA9e) ...
waiting for result...
 => contract KangaMaker is now verified
verifying KangaToken (0x1428261e49E2C1554438eDB657915436c05d134E) ...
waiting for result...
Failed to verify contract KangaToken: NOTOK, Fail - Unable to verify
{
  "apikey": "XXXXXX",
  "module": "contract",
  "action": "verifysourcecode",
  "contractaddress": "0x1428261e49E2C1554438eDB657915436c05d134E",
  "sourceCode": "...",
  "codeformat": "solidity-standard-json-input",
  "contractname": "contracts/KangaToken.sol:KangaToken",
  "compilerversion": "v0.6.12+commit.27d51765",
  "licenseType": 3
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying KangaToken (0x1428261e49E2C1554438eDB657915436c05d134E) ...
waiting for result...
 => contract KangaToken is now verified
verifying MasterBreeder (0x2c546deB5980c636039DFB7d3a95660a658E8C59) ...
waiting for result...
Failed to verify contract MasterBreeder: NOTOK, Fail - Unable to verify
{
  "apikey": "XXXXXX",
  "module": "contract",
  "action": "verifysourcecode",
  "contractaddress": "0x2c546deB5980c636039DFB7d3a95660a658E8C59",
  "sourceCode": "...",
  "codeformat": "solidity-standard-json-input",
  "contractname": "contracts/MasterBreeder.sol:MasterBreeder",
  "compilerversion": "v0.6.12+commit.27d51765",
  "constructorArguements": "0000000000000000000000001428261e49e2c1554438edb657915436c05d134e0000000000000000000000009cf3000a2f555607ce330bf70b0f67c7cbcd3be800000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003635c9adc5dea00000",
  "licenseType": 3
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying MasterBreeder (0x2c546deB5980c636039DFB7d3a95660a658E8C59) ...
waiting for result...
 => contract MasterBreeder is now verified
verifying MiniBreederV2 (0x7A0a3f4b33baC113F0E7b26D6a5be7a144CE514d) ...
waiting for result...
Failed to verify contract MiniBreederV2: NOTOK, Fail - Unable to verify
{
  "apikey": "XXXXXX",
  "module": "contract",
  "action": "verifysourcecode",
  "contractaddress": "0x7A0a3f4b33baC113F0E7b26D6a5be7a144CE514d",
  "sourceCode": "...",
  "codeformat": "solidity-standard-json-input",
  "contractname": "contracts/MiniBreederV2.sol:MiniBreederV2",
  "compilerversion": "v0.6.12+commit.27d51765",
  "constructorArguements": "0000000000000000000000001428261e49e2c1554438edb657915436c05d134e",
  "licenseType": 3
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying MiniBreederV2 (0x7A0a3f4b33baC113F0E7b26D6a5be7a144CE514d) ...
waiting for result...
 => contract MiniBreederV2 is now verified
already verified: Multicall2 (0x6975Aba6A5562Cd513738a31F95F6D943E8bC93D), skipping.
Contract UniswapV2Factory was deployed without saving metadata. Cannot submit to etherscan, skipping.
Contract UniswapV2Pair was deployed without saving metadata. Cannot submit to etherscan, skipping.
verifying UniswapV2Router02 (0x4DED055AD5a6734286d5Cc6855311aAcb6E1e1C8) ...
waiting for result...
Failed to verify contract UniswapV2Router02: NOTOK, Fail - Unable to verify
{
  "apikey": "XXXXXX",
  "module": "contract",
  "action": "verifysourcecode",
  "contractaddress": "0x4DED055AD5a6734286d5Cc6855311aAcb6E1e1C8",
  "sourceCode": "...",
  "codeformat": "solidity-standard-json-input",
  "contractname": "contracts/uniswapv2/UniswapV2Router02.sol:UniswapV2Router02",
  "compilerversion": "v0.6.12+commit.27d51765",
  "constructorArguements": "00000000000000000000000080a000f9d85cfb9a426065189b7feee868a8a41c000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c",
  "licenseType": 5
}
Falling back on solcInput. etherscan seems to sometime require full solc-input with all source files, even though this should not be needed. See https://github.com/ethereum/solidity/issues/9573
verifying UniswapV2Router02 (0x4DED055AD5a6734286d5Cc6855311aAcb6E1e1C8) ...
waiting for result...
 => contract UniswapV2Router02 is now verified
✨  Done in 453.47s.

Problem with INIT_CODE_PAIR_HASH

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

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

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

 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

  1. The same init_hash can be used for testing and deployment
  2. Adding liquidity works for testing and deployments.

Actual behavior

  1. init_hash is different for testing and deployments
  2. Adding liquidity fails when using the wrong init_hash

Additional context
Reference tickets

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.