diff --git a/contracts/powerindex-mining/PoolsLens.sol b/contracts/powerindex-mining/PoolsLens.sol index 6e68861..4081e2f 100644 --- a/contracts/powerindex-mining/PoolsLens.sol +++ b/contracts/powerindex-mining/PoolsLens.sol @@ -14,7 +14,6 @@ https://powerpool.finance/ pragma solidity 0.8.11; import "@openzeppelin/contracts-0.8/access/Ownable.sol"; -import "hardhat/console.sol"; interface IUniswapV2Router { function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); @@ -139,6 +138,7 @@ struct TokenBalances { uint256 LpUserBalance; uint256 LpMiningBalance; uint256 LpMiningAllowance; + uint256 LpRouterAllowance; TokenPrices prices; } @@ -343,7 +343,7 @@ contract PoolsLens is Ownable { } // Accepts amount of token A from pair and returns corresponding amount of token B from pair. (You can switch both tokens) - function getTokenBAmount(uint256 tokenAAmountWei, address tokenAAddress, address tokenBAddress) external view returns(uint256) { + function getTokenBAmount(uint256 tokenAAmountWei, address tokenAAddress, address) external view returns(uint256) { Pool memory pool = mining.pools(0); (uint112 reserve0, uint112 reserve1,) = ILpToken(pool.lpToken).getReserves(); uint256 reserveA; @@ -390,6 +390,7 @@ contract PoolsLens is Ownable { LpUserBalance: ERC20(pool.lpToken).balanceOf(_owner), LpMiningBalance: ERC20(pool.lpToken).balanceOf(address(mining)), LpMiningAllowance: ERC20(pool.lpToken).allowance(_owner, address(mining)), + LpRouterAllowance: ERC20(pool.lpToken).allowance(_owner, address(uniRouter)), prices: getPrices() }); } else { @@ -400,6 +401,7 @@ contract PoolsLens is Ownable { LpUserBalance: 0, LpMiningBalance: ERC20(pool.lpToken).balanceOf(address(mining)), LpMiningAllowance: 0, + LpRouterAllowance: 0, prices: getPrices() }); } diff --git a/hardhat.config.js b/hardhat.config.js index 6d025b4..313a15d 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -80,8 +80,6 @@ const config = { forking: { url: 'https://mainnet-eth.powerpool.finance', }, - // run the deploy-pools-lens task - after: ['deploy-pools-lens'] }, ganache: { url: 'http://127.0.0.1:8945', @@ -91,7 +89,14 @@ const config = { mainnet: { url: 'https://mainnet-eth.compound.finance', accounts: getAccounts('mainnet'), - gasPrice: 36 * 10 ** 9, + gasPrice: 8 * 10 ** 9, + gasMultiplier: 1.2, + timeout: 2000000, + }, + sepolia: { + url: 'https://rpc.sepolia.org', + accounts: getAccounts('sepolia'), + gasPrice: 1 * 10 ** 9, gasMultiplier: 1.2, timeout: 2000000, }, diff --git a/package.json b/package.json index 260b57b..fbed431 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@ethersproject/abstract-signer": "^5.0.1", "@ethersproject/bignumber": "^5.0.3", "@nomiclabs/hardhat-ethers": "^2.0.0", - "@nomiclabs/hardhat-etherscan": "^2.0.1", + "@nomiclabs/hardhat-etherscan": "3.1.7", "@nomiclabs/hardhat-truffle5": "^2.0.0", "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/test-helpers": "^0.5.6", diff --git a/verify-args.js b/verify-args.js new file mode 100644 index 0000000..fa40541 --- /dev/null +++ b/verify-args.js @@ -0,0 +1,7 @@ +module.exports = [ + '0xF09232320eBEAC33fae61b24bB8D7CA192E58507', + '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + '0xdAC17F958D2ee523a2206206994597C13D831ec7', + '0x38e4adB44ef08F22F5B5b76A8f0c2d0dCbE7DcA1' +] diff --git a/yarn.lock b/yarn.lock index dc24327..7e2bec2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -250,7 +250,7 @@ "@ethersproject/properties" "^5.0.3" "@ethersproject/strings" "^5.0.4" -"@ethersproject/abi@5.1.0", "@ethersproject/abi@^5.0.0-beta.146", "@ethersproject/abi@^5.0.2", "@ethersproject/abi@^5.1.0": +"@ethersproject/abi@5.1.0", "@ethersproject/abi@^5.0.0-beta.146", "@ethersproject/abi@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.1.0.tgz#d582c9f6a8e8192778b5f2c991ce19d7b336b0c5" integrity sha512-N/W9Sbn1/C6Kh2kuHRjf/hX6euMK4+9zdJRBB8sDWmihVntjUAfxbusGZKzDQD8i3szAHhTz8K7XADV5iFNfJw== @@ -1177,18 +1177,21 @@ resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.2.tgz#c472abcba0c5185aaa4ad4070146e95213c68511" integrity sha512-6quxWe8wwS4X5v3Au8q1jOvXYEPkS1Fh+cME5u6AwNdnI4uERvPlVjlgRWzpnb+Rrt1l/cEqiNRH9GlsBMSDQg== -"@nomiclabs/hardhat-etherscan@^2.0.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-2.1.1.tgz#186f3fa652a0ca20fb77aa857cfad2da845d5cbf" - integrity sha512-8TNUFsO5DpAfwNlXMDhcEtFAMOYsVNaQL2vq5vuCD45kUKBgL8H21++zOk231ha9D7LQWBMCIg7A7iPxw6Jwmg== +"@nomiclabs/hardhat-etherscan@3.1.7": + version "3.1.7" + resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.7.tgz#72e3d5bd5d0ceb695e097a7f6f5ff6fcbf062b9a" + integrity sha512-tZ3TvSgpvsQ6B6OGmo1/Au6u8BrAkvs1mIC/eURA3xgIfznUZBhmpne8hv7BXUzw9xNL3fXdpOYgOQlVMTcoHQ== dependencies: - "@ethersproject/abi" "^5.0.2" + "@ethersproject/abi" "^5.1.2" "@ethersproject/address" "^5.0.2" - cbor "^5.0.2" + cbor "^8.1.0" + chalk "^2.4.2" debug "^4.1.1" fs-extra "^7.0.1" - node-fetch "^2.6.0" + lodash "^4.17.11" semver "^6.3.0" + table "^6.8.0" + undici "^5.14.0" "@nomiclabs/hardhat-truffle5@^2.0.0": version "2.0.0" @@ -2063,6 +2066,11 @@ ansi-regex@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -3374,7 +3382,7 @@ cbor@^4.1.5: json-text-sequence "^0.1" nofilter "^1.0.3" -cbor@^5.0.2, cbor@^5.1.0: +cbor@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/cbor/-/cbor-5.2.0.tgz#4cca67783ccd6de7b50ab4ed62636712f287a67c" integrity sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A== @@ -3390,6 +3398,13 @@ cbor@^7.0.0: "@cto.af/textdecoder" "^0.0.0" nofilter "^2.0.3" +cbor@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/cbor/-/cbor-8.1.0.tgz#cfc56437e770b73417a2ecbfc9caf6b771af60d5" + integrity sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg== + dependencies: + nofilter "^3.1.0" + chai-bn@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/chai-bn/-/chai-bn-0.2.1.tgz#1dad95e24c3afcd8139ab0262e9bbefff8a30ab7" @@ -8113,11 +8128,6 @@ node-fetch@2.1.2: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5" integrity sha1-q4hOjn5X44qUR1POxwb3iNF2i7U= -node-fetch@^2.6.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" - integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== - node-fetch@~1.7.1: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" @@ -8153,6 +8163,11 @@ nofilter@^2.0.3: dependencies: "@cto.af/textdecoder" "^0.0.0" +nofilter@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-3.1.0.tgz#c757ba68801d41ff930ba2ec55bab52ca184aa66" + integrity sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g== + nopt@3.x: version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" @@ -9924,6 +9939,15 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string.prototype.trim@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz#6014689baf5efaf106ad031a5fa45157666ed1bd" @@ -9996,6 +10020,13 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-dirs@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/strip-dirs/-/strip-dirs-2.1.0.tgz#4987736264fc344cf20f6c34aca9d13d1d4ed6c5" @@ -10151,6 +10182,17 @@ table@^6.0.4: slice-ansi "^4.0.0" string-width "^4.2.0" +table@^6.8.0: + version "6.8.2" + resolved "https://registry.yarnpkg.com/table/-/table-6.8.2.tgz#c5504ccf201213fa227248bdc8c5569716ac6c58" + integrity sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA== + dependencies: + ajv "^8.0.1" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + tape@^4.6.3: version "4.13.3" resolved "https://registry.yarnpkg.com/tape/-/tape-4.13.3.tgz#51b3d91c83668c7a45b1a594b607dee0a0b46278"