diff --git a/contracts/powerindex-mining/DeprecatedBscPoolsLens.sol b/contracts/powerindex-mining/DeprecatedBscPoolsLens.sol new file mode 100644 index 0000000..566ba64 --- /dev/null +++ b/contracts/powerindex-mining/DeprecatedBscPoolsLens.sol @@ -0,0 +1,143 @@ +/* +https://powerpool.finance/ + wrrrw r wrr + ppwr rrr wppr0 prwwwrp prwwwrp wr0 + rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0 + rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw prwww0 pp wr pp wr r0 + r0rprprwrrrp pr0 pp wr pr pp rwwr wr 0r pp wr pr wr pr r0 + prwr wrr0wpwr 00 www0 0w0ww www0 0w 00 www0 www0 0www0 + wrr ww0rrrr +*/ + +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.11; + +interface ILpToken { + function getBalance(address tokenAddress) external view returns (uint256); + function totalSupply() external view returns (uint256); + function allowance(address owner, address spender) external view returns(uint256); + function balanceOf(address wallet) external view returns (uint256); + function symbol() external view returns (string memory); + function decimals() external view returns (uint8); + function getFinalTokens() external view returns (address[] memory); + function getNormalizedWeight(address) external view returns (uint256); + function getSwapFee() external view returns (uint256); + function getCommunityFee() external view returns (Fees memory); +} + +struct EarnListItem { + address lpToken; + uint8 poolType; + uint256 pid; + uint256 totalSupply; + uint256 userTotalBalance; // user wallet balance + user mining balance + PartOfThePool[] tokensDistribution; +} + +struct PartOfThePool { + address tokenAddress; + string symbol; + uint256 percent; +} + +struct LiquidityTokens { + address tokenAddress; + uint256 balance; + uint8 decimals; + string symbol; + uint256 tokenAmountForOneLpMulti; +} + +struct Fees { + uint256 communitySwapFee; + uint256 communityJoinFee; + uint256 communityExitFee; + address communityFeeReceiver; +} + +struct RemoveLiquidityData { + address lpToken; + uint8 poolType; + uint256 pid; + string symbol; + uint256 balance; + uint256 allowance; + Fees fees; + LiquidityTokens[] tokens; +} + +contract DeprecatedBscPoolsLens { + ILpToken public singlePool; + + constructor(ILpToken _pool) { + singlePool = _pool; + } + + function getEarnList(address _user) external view returns (EarnListItem[] memory) { + EarnListItem[] memory earnPools = new EarnListItem[](1); + ILpToken pool = singlePool; + + earnPools[0] = EarnListItem({ + lpToken: address(pool), + poolType: 0, + pid: 0, + totalSupply: pool.totalSupply(), + tokensDistribution: new PartOfThePool[](pool.getFinalTokens().length), + userTotalBalance: 0 + }); + + EarnListItem memory earnPool = earnPools[0]; + + // User balance + if (_user != address(0)) { + earnPool.userTotalBalance = pool.balanceOf(_user); + } + + // get tokens percents + address[] memory finalTokens = pool.getFinalTokens(); + for (uint8 j = 0; j < finalTokens.length; j++) { + earnPool.tokensDistribution[j] = PartOfThePool({ + tokenAddress: finalTokens[j], + symbol: ILpToken(finalTokens[j]).symbol(), + percent: pool.getNormalizedWeight(finalTokens[j]) + }); + } + + return earnPools; + } + + function removeLiquidityInfo(address _user, uint256 _pid) external view returns (RemoveLiquidityData memory) { + ILpToken pool = singlePool; + LiquidityTokens[] memory tokens = new LiquidityTokens[](pool.getFinalTokens().length); + + for (uint8 i = 0; i < pool.getFinalTokens().length; i++) { + LiquidityTokens memory token = tokens[i]; + + token.tokenAddress = pool.getFinalTokens()[i]; + token.balance = ILpToken(pool.getFinalTokens()[i]).balanceOf(_user); + token.decimals = ILpToken(pool.getFinalTokens()[i]).decimals(); + token.symbol = ILpToken(pool.getFinalTokens()[i]).symbol(); + token.tokenAmountForOneLpMulti = getMultiTokensOut(token.tokenAddress, token.decimals); + } + + return RemoveLiquidityData({ + lpToken: address(pool), + poolType: 0, + pid: _pid, + symbol: pool.symbol(), + balance: pool.balanceOf(_user), + allowance: pool.allowance(_user, address(pool)), + fees: pool.getCommunityFee(), + tokens: tokens + }); + } + + function getMultiTokensOut(address _tokenAddress, uint8 _decimals) internal view returns (uint256) { + ILpToken pool = singlePool; + uint256 totalSupply = pool.totalSupply(); + uint256 reserve = pool.getBalance(_tokenAddress); + + return (((1 ether * 10**18) / totalSupply) * (reserve * 10**(18 - _decimals))) / 10**18; + } +} diff --git a/contracts/powerindex-mining/DeprecatedPoolsLens.sol b/contracts/powerindex-mining/DeprecatedPoolsLens.sol new file mode 100644 index 0000000..de9e892 --- /dev/null +++ b/contracts/powerindex-mining/DeprecatedPoolsLens.sol @@ -0,0 +1,436 @@ +/* +https://powerpool.finance/ + wrrrw r wrr + ppwr rrr wppr0 prwwwrp prwwwrp wr0 + rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0 + rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw prwww0 pp wr pp wr r0 + r0rprprwrrrp pr0 pp wr pr pp rwwr wr 0r pp wr pr wr pr r0 + prwr wrr0wpwr 00 www0 0w0ww www0 0w 00 www0 www0 0www0 + wrr ww0rrrr +*/ + +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.11; + +interface IVestedLpMining { + function pools(uint256 index) external view returns (Pool calldata); + function users(uint256 poolId, address userAddress) external view returns (miningUserDataStruct calldata); + function cvpPerBlock() external view returns (uint96); + function totalAllocPoint() external view returns (uint256); + function vestableCvp(uint256 pId, address user) external view returns (uint256); + function poolBoostByLp(uint256 pId) external view returns (uint256, uint256, uint32, uint256, uint256); + function usersPoolBoost(uint256 pId, address user) external view returns(uint256 balance, uint32 lastUpdateBlock); + + function poolLength() external view returns(uint); + function reservoir() external view returns(address); +} + +interface ILpToken { + function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32); + function getBalance(address tokenAddress) external view returns (uint256); + function token0() external view returns (address); + function token1() external view returns (address); + function totalSupply() external view returns (uint256); + function balanceOf(address wallet) external view returns (uint256); + function symbol() external view returns (string memory); + function factory() external view returns (address); + function getFinalTokens() external view returns (address[] memory); + function getNormalizedWeight(address) external view returns (uint256); + function getDenormalizedWeight(address) external view returns (uint256); + function getTotalDenormalizedWeight() external view returns (uint256); + function getSwapFee() external view returns (uint256); + function getCommunityFee() external view returns (Fees memory); + function calcSingleOutGivenPoolIn(uint256, uint256, uint256, uint256, uint256, uint256) external view returns (uint256); +} + +interface ERC20 { + function balanceOf(address wallet) external view returns (uint256); + function allowance(address owner, address spender) external view returns(uint256); + function decimals() external view returns (uint8); +} + +struct Pool { + address lpToken; // address of the LP token contract + bool votesEnabled; // if the pool is enabled to write votes + uint8 poolType; // pool type (1 - Uniswap, 2 - Balancer, 3 - custom, 4 - sushi) + uint32 allocPoint; // points assigned to the pool, which affect CVPs distribution between pools + uint32 lastUpdateBlock; // latest block when the pool params which follow was updated + uint256 accCvpPerLpt; // accumulated distributed CVPs per one deposited LP token, times 1e12 +} + +struct FarmingListItem { + address lpToken; + uint8 poolType; + uint256 pid; + uint256 lpAtMiningAmount; + uint256 vestableCvp; + bool isBoosted; +} + +struct EarnListItem { + address lpToken; + uint8 poolType; + uint256 pid; + uint256 totalSupply; + uint256 userTotalBalance; // user wallet balance + user mining balance + PartOfThePool[] tokensDistribution; +} + +struct PartOfThePool { + address tokenAddress; + string symbol; + uint256 percent; +} + +struct FarmingDetail { + address lpToken; + uint8 poolType; + uint256 pid; + uint256 lpMiningBalance; + uint256 lpUserBalance; + uint256 lpTotalSupply; + uint256 vestableCvp; + uint256 lpTokenUserStakedAtMining; + uint256 boostedAmount; + bool isReservoirEnough; + bool isSushi; + bool isBalancer; +} + +struct miningUserDataStruct { + uint32 lastUpdateBlock; + uint32 vestingBlock; + uint96 pendedCvp; + uint96 cvpAdjust; + uint256 lptAmount; +} + +struct tokenInfo { + address tokenAddress; + string tokenSymbol; + uint256 reserves; + uint8 decimals; + uint256 tokenAmountPerLPToken; +} + +struct tokenRemove { + address lpToken; + address routerAddress; + uint8 poolType; + uint256 pid; + uint256 lpTotalSupply; + uint256 balance; + uint256 allowance; + tokenInfo token1; + tokenInfo token2; +} + +struct LiquidityTokens { + address tokenAddress; + uint256 balance; + uint8 decimals; + string symbol; + uint256 tokenAmountForOneLpSingle; + uint256 tokenAmountForOneLpMulti; +} + +struct Fees { + uint256 communitySwapFee; + uint256 communityJoinFee; + uint256 communityExitFee; + address communityFeeReceiver; +} + +struct RemoveLiquidityData { + address lpToken; + uint8 poolType; + uint256 pid; + string symbol; + uint256 balance; + uint256 allowance; + Fees fees; + LiquidityTokens[] tokens; +} + +contract DeprecatedPoolsLens { + IVestedLpMining public mining; + + address immutable public cvpAddress; + mapping(uint8 => uint8) public earnPidMap; + + constructor( + IVestedLpMining _mining, + address _cvpAddress + ) { + mining = _mining; + cvpAddress = _cvpAddress; + + earnPidMap[0] = 13; + earnPidMap[1] = 6; + earnPidMap[2] = 10; + earnPidMap[3] = 9; + } + + function getFarmingList(address _user) external view returns (FarmingListItem[] memory) { + Pool[] memory pools = new Pool[](8); + pools[0] = mining.pools(6); + pools[1] = mining.pools(7); + pools[2] = mining.pools(8); + pools[3] = mining.pools(9); + pools[4] = mining.pools(10); + pools[5] = mining.pools(11); + pools[6] = mining.pools(12); + pools[7] = mining.pools(13); + + FarmingListItem[] memory farmingPools = new FarmingListItem[](8); + + for (uint256 i = 0; i < 8; i++) { + Pool memory pool = pools[i]; + + farmingPools[i] = FarmingListItem({ + lpToken: pool.lpToken, + poolType: pool.poolType, + pid: i + 6, + lpAtMiningAmount: 0, + vestableCvp: 0, + isBoosted: false + }); + + FarmingListItem memory farmingPool = farmingPools[i]; + + // User total lp and balance + if (_user != address(0)) { + uint256 vestableCvp = mining.vestableCvp(farmingPool.pid, _user); + farmingPool.lpAtMiningAmount = mining.users(farmingPool.pid, _user).lptAmount; + farmingPool.vestableCvp = vestableCvp; + } + + // Check if pool is boostable + (uint256 lpBoostRate,,,,) = mining.poolBoostByLp(farmingPool.pid); + if (lpBoostRate > 0) { + farmingPool.isBoosted = true; + } + } + + return farmingPools; + } + + function getFarmingDetail(address _user, uint256 _pid) external view returns (FarmingDetail memory) { + Pool memory pool = mining.pools(_pid); + + // User total lp and balance + uint256 lpTokenUserStaked; + uint256 vestableCvp; + uint boostAmount; + if (_user != address(0)) { + lpTokenUserStaked = mining.users(_pid, _user).lptAmount; + vestableCvp = mining.vestableCvp(_pid, _user); + (boostAmount,) = mining.usersPoolBoost(_pid, _user); + } + + // Check if can claim cvp + bool isReservoirEnough = vestableCvp <= ERC20(cvpAddress).balanceOf(mining.reservoir()) || vestableCvp <= ERC20(cvpAddress).allowance(mining.reservoir(), address(mining)); + + // check if 3rd party pool involved (so later it can be unwrapped to one of PowerPool pool) + bool isSushi = _pid == 11 || _pid == 12; + bool isBalancer = _pid == 7 || _pid == 8; + + return FarmingDetail({ + lpToken: pool.lpToken, + poolType: pool.poolType, + pid: _pid, + lpMiningBalance: ILpToken(pool.lpToken).balanceOf(address(mining)), + lpUserBalance: ILpToken(pool.lpToken).balanceOf(_user), + lpTotalSupply: ILpToken(pool.lpToken).totalSupply(), + vestableCvp: vestableCvp, + lpTokenUserStakedAtMining: lpTokenUserStaked, + boostedAmount: boostAmount, + isReservoirEnough: isReservoirEnough, + isSushi: isSushi, + isBalancer: isBalancer + }); + } + + function getSecondaryLiquidityRemoveInfo(address _user, uint _pid) external view returns (tokenRemove memory) { + Pool memory pool = mining.pools(_pid); + bool isSushi = pool.poolType == 4; + + address routerContract; + if (isSushi) { // sushi + routerContract = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F; + return getSushiInfo(_user, _pid, routerContract, pool); + } else { // balancer + routerContract = pool.lpToken; + return getBalancerInfo(_user, _pid, routerContract, pool); + } + } + + // Returns specific for balancer data. Used when building interface for balancer redeem + function getBalancerInfo(address _user, uint _pid, address _router, Pool memory _pool) internal view returns (tokenRemove memory) { + uint256 reserve0 = ILpToken(_pool.lpToken).getBalance(ILpToken(_pool.lpToken).getFinalTokens()[0]); + uint256 reserve1 = ILpToken(_pool.lpToken).getBalance(ILpToken(_pool.lpToken).getFinalTokens()[1]); + + uint8 token1Decimals = ERC20(ILpToken(_pool.lpToken).getFinalTokens()[0]).decimals(); + uint8 token2Decimals = ERC20(ILpToken(_pool.lpToken).getFinalTokens()[1]).decimals(); + uint256 lpTotalSupply = ILpToken(_pool.lpToken).totalSupply(); + + return tokenRemove({ + lpToken: _pool.lpToken, + routerAddress: _router, + poolType: _pool.poolType, + pid: _pid, + lpTotalSupply: lpTotalSupply, + balance: ERC20(_pool.lpToken).balanceOf(_user), + allowance: ERC20(_pool.lpToken).allowance(_user, _router), + token1: tokenInfo({ + tokenAddress: ILpToken(_pool.lpToken).getFinalTokens()[0], + tokenSymbol: ILpToken(ILpToken(_pool.lpToken).getFinalTokens()[0]).symbol(), + decimals: token1Decimals, + reserves: reserve0, + tokenAmountPerLPToken: (((1 ether * 10**18) / lpTotalSupply) * (reserve0 * 10**(18 - token1Decimals))) / 10**18 + }), + token2: tokenInfo({ + tokenAddress: ILpToken(_pool.lpToken).getFinalTokens()[1], + tokenSymbol: ILpToken(ILpToken(_pool.lpToken).getFinalTokens()[1]).symbol(), + decimals: token2Decimals, + reserves: reserve1, + tokenAmountPerLPToken: (((1 ether * 10**18) / lpTotalSupply) * (reserve1 * 10**(18 - token2Decimals))) / 10**18 + }) + }); + } + + // Returns specific for sushi data. Used when building interface for sushi redeem + function getSushiInfo(address _user, uint _pid, address _router, Pool memory _pool) internal view returns (tokenRemove memory) { + (uint112 reserve0, uint112 reserve1,) = ILpToken(_pool.lpToken).getReserves(); + + uint8 token1Decimals = ERC20(ILpToken(_pool.lpToken).token0()).decimals(); + uint8 token2Decimals = ERC20(ILpToken(_pool.lpToken).token1()).decimals(); + uint256 lpTotalSupply = ILpToken(_pool.lpToken).totalSupply(); + + return tokenRemove({ + lpToken: _pool.lpToken, + routerAddress: _router, + poolType: _pool.poolType, + pid: _pid, + lpTotalSupply: lpTotalSupply, + balance: ERC20(_pool.lpToken).balanceOf(_user), + allowance: ERC20(_pool.lpToken).allowance(_user, _router), + token1: tokenInfo({ + tokenAddress: ILpToken(_pool.lpToken).token0(), + tokenSymbol: ILpToken(ILpToken(_pool.lpToken).token0()).symbol(), + decimals: token1Decimals, + reserves: reserve0, + tokenAmountPerLPToken: (((1 ether * 10**18) / lpTotalSupply) * (reserve0 * 10**(18 - token1Decimals))) / 10**18 + }), + token2: tokenInfo({ + tokenAddress: ILpToken(_pool.lpToken).token1(), + tokenSymbol: ILpToken(ILpToken(_pool.lpToken).token1()).symbol(), + decimals: token2Decimals, + reserves: reserve1, + tokenAmountPerLPToken: (((1 ether * 10**18) / lpTotalSupply) * (reserve1 * 10**(18 - token2Decimals))) / 10**18 + }) + }); + } + + function getEarnList(address _user) external view returns (EarnListItem[] memory) { + Pool[] memory pools = new Pool[](4); + pools[0] = mining.pools(13); + pools[1] = mining.pools(6); + pools[2] = mining.pools(10); + pools[3] = mining.pools(9); + + EarnListItem[] memory earnPools = new EarnListItem[](4); + for (uint8 i = 0; i < 4; i++) { + Pool memory pool = pools[i]; + + earnPools[i] = EarnListItem({ + lpToken: pool.lpToken, + poolType: pool.poolType, + pid: earnPidMap[i], + totalSupply: ILpToken(pool.lpToken).totalSupply(), + tokensDistribution: new PartOfThePool[](ILpToken(pool.lpToken).getFinalTokens().length), + userTotalBalance: 0 + }); + + EarnListItem memory earnPool = earnPools[i]; + + // User balance + if (_user != address(0)) { + earnPool.userTotalBalance = ILpToken(pool.lpToken).balanceOf(_user) + mining.users(earnPool.pid, _user).lptAmount; + } + + // get tokens percents + address[] memory finalTokens = ILpToken(pool.lpToken).getFinalTokens(); + for (uint8 j = 0; j < finalTokens.length; j++) { + if (finalTokens[j] == 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2) continue; // fcked up token symbol (bytes32), pass that + earnPool.tokensDistribution[j] = PartOfThePool({ + tokenAddress: finalTokens[j], + symbol: ILpToken(finalTokens[j]).symbol(), + percent: ILpToken(pool.lpToken).getNormalizedWeight(finalTokens[j]) + }); + } + } + + return earnPools; + } + + function removeLiquidityInfo(address _user, uint256 _pid) external view returns (RemoveLiquidityData memory) { + Pool memory pool = mining.pools(_pid); + + LiquidityTokens[] memory tokens = new LiquidityTokens[](ILpToken(pool.lpToken).getFinalTokens().length); + + for (uint8 i = 0; i < ILpToken(pool.lpToken).getFinalTokens().length; i++) { + LiquidityTokens memory token = tokens[i]; + + token.tokenAddress = ILpToken(pool.lpToken).getFinalTokens()[i]; + token.balance = ERC20(ILpToken(pool.lpToken).getFinalTokens()[i]).balanceOf(_user); + token.decimals = ERC20(ILpToken(pool.lpToken).getFinalTokens()[i]).decimals(); + if (ILpToken(pool.lpToken).getFinalTokens()[i] == 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2) { + token.symbol = 'MKR'; + } else { + token.symbol = ILpToken(ILpToken(pool.lpToken).getFinalTokens()[i]).symbol(); + } + token.tokenAmountForOneLpSingle = getSingleTokenOut(_pid, token.tokenAddress); + token.tokenAmountForOneLpMulti = getMultiTokensOut(_pid, token.tokenAddress, token.decimals); + } + + return RemoveLiquidityData({ + lpToken: pool.lpToken, + poolType: pool.poolType, + pid: _pid, + symbol: ILpToken(pool.lpToken).symbol(), + balance: ILpToken(pool.lpToken).balanceOf(_user), + allowance: ERC20(pool.lpToken).allowance(_user, pool.lpToken), + fees: ILpToken(pool.lpToken).getCommunityFee(), + tokens: tokens + }); + } + + function getSingleTokenOut(uint256 _pid, address _tokenAddress) internal view returns (uint256) { + Pool memory pool = mining.pools(_pid); + + if (_pid == 13) { + // usd handler. Disabled due to security breach + return 0; + } else { + uint256 communitySwapFee = ILpToken(pool.lpToken).getCommunityFee().communitySwapFee; + return ILpToken(pool.lpToken).calcSingleOutGivenPoolIn( + ILpToken(pool.lpToken).getBalance(_tokenAddress), + ILpToken(pool.lpToken).getDenormalizedWeight(_tokenAddress), + ILpToken(pool.lpToken).totalSupply(), + ILpToken(pool.lpToken).getTotalDenormalizedWeight(), + 1 ether - communitySwapFee, + ILpToken(pool.lpToken).getSwapFee() + ); + } + } + + function getMultiTokensOut(uint256 _pid, address _tokenAddress, uint8 _decimals) internal view returns (uint256) { + Pool memory pool = mining.pools(_pid); + uint256 totalSupply = ILpToken(pool.lpToken).totalSupply(); + uint256 reserve = ILpToken(pool.lpToken).getBalance(_tokenAddress); + + return (((1 ether * 10**18) / totalSupply) * (reserve * 10**(18 - _decimals))) / 10**18; + } +} diff --git a/hardhat.config.js b/hardhat.config.js index 37c28e9..5e4356b 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -11,6 +11,8 @@ require('./tasks/fetchVaultsData4'); require('./tasks/deployMainnetPowerIndexPool'); require('./tasks/deployErc20PiptSwap'); require('./tasks/deployPoolsLens'); +require('./tasks/deployDeprecatedPoolsLens'); +require('./tasks/deployBscDeprecatedPoolsLens'); require('./tasks/testMainnetErc20PiptSwap'); require('./tasks/deployPoolRestrictions'); require('./tasks/deployMainnetYeti'); @@ -71,14 +73,14 @@ const config = { }, networks: { hardhat: { - chainId: 1, + chainId: 56, accounts: testAccounts, allowUnlimitedContractSize: true, gas: 12000000, loggingEnabled: true, blockGasLimit: 12000000, forking: { - url: 'https://mainnet-eth.powerpool.finance', + url: 'https://divine-icy-yard.bsc.quiknode.pro/1ec99ee8099d558029e893df069f138441e17e80/', }, }, ganache: { @@ -89,7 +91,14 @@ const config = { mainnet: { url: 'https://rough-compatible-hill.quiknode.pro/b7052dc47d31d455c2a770377f7db70735924fba/', accounts: getAccounts('mainnet'), - gasPrice: 9 * 10 ** 9, + gasPrice: 5 * 10 ** 9, + gasMultiplier: 1.2, + timeout: 2000000, + }, + binance: { + url: 'https://divine-icy-yard.bsc.quiknode.pro/1ec99ee8099d558029e893df069f138441e17e80/', + accounts: getAccounts('binance'), + gasPrice: 10 ** 9, gasMultiplier: 1.2, timeout: 2000000, }, diff --git a/tasks/deployBscDeprecatedPoolsLens.js b/tasks/deployBscDeprecatedPoolsLens.js new file mode 100644 index 0000000..11e810f --- /dev/null +++ b/tasks/deployBscDeprecatedPoolsLens.js @@ -0,0 +1,17 @@ +require('@nomiclabs/hardhat-truffle5'); + + +task('deploy-bsc-deprecated-pools-lens', 'Deploy deprecated pools lens').setAction(async (__, {network}) => { + const PoolsLens = artifacts.require('DeprecatedBscPoolsLens'); + + const { web3 } = PoolsLens; + + const [deployer] = await web3.eth.getAccounts(); + console.log('deployer', deployer); + const sendOptions = { from: deployer }; + const poolsLens = await PoolsLens.new( + '0x40E46dE174dfB776BB89E04dF1C47d8a66855EB3', + sendOptions, + ); + console.log('Deprecated bsc pools lens deployed address: ', poolsLens.address); +}); diff --git a/tasks/deployDeprecatedPoolsLens.js b/tasks/deployDeprecatedPoolsLens.js new file mode 100644 index 0000000..16e1898 --- /dev/null +++ b/tasks/deployDeprecatedPoolsLens.js @@ -0,0 +1,18 @@ +require('@nomiclabs/hardhat-truffle5'); + + +task('deploy-deprecated-pools-lens', 'Deploy deprecated pools lens').setAction(async (__, {network}) => { + const PoolsLens = artifacts.require('DeprecatedPoolsLens'); + + const { web3 } = PoolsLens; + + const [deployer] = await web3.eth.getAccounts(); + console.log('deployer', deployer); + const sendOptions = { from: deployer }; + const poolsLens = await PoolsLens.new( + '0xF09232320eBEAC33fae61b24bB8D7CA192E58507', + '0x38e4adB44ef08F22F5B5b76A8f0c2d0dCbE7DcA1', + sendOptions, + ); + console.log('Deprecated pools lens deployed address: ', poolsLens.address); +}); diff --git a/test/DeprecatedBscPoolsLens.test.js b/test/DeprecatedBscPoolsLens.test.js new file mode 100644 index 0000000..8fb677b --- /dev/null +++ b/test/DeprecatedBscPoolsLens.test.js @@ -0,0 +1,19 @@ +// const { expectRevert, time } = require('@openzeppelin/test-helpers'); +const { ethers} = require('hardhat'); +const PoolsLens = artifacts.require('DeprecatedBscPoolsLens'); +const zeroAddress = '0x0000000000000000000000000000000000000000'; + +describe.only('DeprecatedBscPoolsLens', async () => { + try { + it('chore test pass', async () => { + this.poolsLens = await PoolsLens.new( + '0x40E46dE174dfB776BB89E04dF1C47d8a66855EB3' + ); + // const result = await this.poolsLens.getEarnList('0x8b19f6F51501dA80FCEFb578427907f223005F7A'); + const result = await this.poolsLens.removeLiquidityInfo('0x8b19f6F51501dA80FCEFb578427907f223005F7A', 0); + console.log('main: ', result); + }); + } catch (e) { + console.error(e) + } +}); diff --git a/test/DeprecatedPoolsLens.test.js b/test/DeprecatedPoolsLens.test.js new file mode 100644 index 0000000..83e9b72 --- /dev/null +++ b/test/DeprecatedPoolsLens.test.js @@ -0,0 +1,28 @@ +// const { expectRevert, time } = require('@openzeppelin/test-helpers'); +const { ethers} = require('hardhat'); +const PoolsLens = artifacts.require('DeprecatedPoolsLens'); +const zeroAddress = '0x0000000000000000000000000000000000000000'; + +describe('DeprecatedPoolsLens', async () => { + try { + it('chore test pass', async () => { + this.poolsLens = await PoolsLens.new( + '0xF09232320eBEAC33fae61b24bB8D7CA192E58507', + '0x38e4adB44ef08F22F5B5b76A8f0c2d0dCbE7DcA1', + ); + // const result = await this.poolsLens.getPoolData(ethers.constants.AddressZero); + // const result = await this.poolsLens.getFarmingDetail('0x8b19f6F51501dA80FCEFb578427907f223005F7A', 6); + // const result = await this.poolsLens.getEarnList('0x8b19f6F51501dA80FCEFb578427907f223005F7A'); + // const result = await this.poolsLens.removeLiquidityInfo('0x8b19f6F51501dA80FCEFb578427907f223005F7A', 6); // balancer + + // const result = await this.poolsLens.getSecondaryLiquidityRemoveInfo('0x8b19f6F51501dA80FCEFb578427907f223005F7A', 7); // balancer + // const result = await this.poolsLens.getSecondaryLiquidityRemoveInfo('0x8b19f6F51501dA80FCEFb578427907f223005F7A', 11); // sushi + + // const result = await this.poolsLens.getFarmingDetail('0xCce0bca1365a02e5770390165E64d1F59238D92e', 7); + // const result = await this.poolsLens.getMiningManager(ethers.constants.AddressZero); + console.log('main: ', result); + }); + } catch (e) { + console.error(e) + } +}); diff --git a/test/PoolsLens.test.js b/test/PoolsLens.test.js index 0f57838..69aaf7d 100644 --- a/test/PoolsLens.test.js +++ b/test/PoolsLens.test.js @@ -4,7 +4,7 @@ const { ethers} = require('hardhat'); const PoolsLens = artifacts.require('PoolsLens'); const zeroAddress = '0x0000000000000000000000000000000000000000'; -describe.only('PoolsLens', async () => { +describe('PoolsLens', async () => { try { it('Zero pool is doing fine', async () => { this.poolsLens = await PoolsLens.new( diff --git a/verify-args.js b/verify-args.js index fa40541..cdb9574 100644 --- a/verify-args.js +++ b/verify-args.js @@ -1,7 +1,3 @@ module.exports = [ - '0xF09232320eBEAC33fae61b24bB8D7CA192E58507', - '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', - '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', - '0xdAC17F958D2ee523a2206206994597C13D831ec7', - '0x38e4adB44ef08F22F5B5b76A8f0c2d0dCbE7DcA1' + '0x40E46dE174dfB776BB89E04dF1C47d8a66855EB3' ]