diff --git a/contracts/contracts/Booster.sol b/contracts/contracts/Booster.sol index 927fde8..e275102 100644 --- a/contracts/contracts/Booster.sol +++ b/contracts/contracts/Booster.sol @@ -372,6 +372,15 @@ contract Booster{ return true; } + function setGaugeRedirect(uint256 _pid) external returns(bool){ + address stash = poolInfo[_pid].stash; + require(msg.sender == stash,"!auth"); + address gauge = poolInfo[_pid].gauge; + bytes memory data = abi.encodeWithSelector(bytes4(keccak256("set_rewards_receiver(address)")), stash); + IStaker(staker).execute(gauge,uint256(0),data); + return true; + } + //claim crv and extra rewards and disperse to reward contracts function _earmarkRewards(uint256 _pid) internal { PoolInfo storage pool = poolInfo[_pid]; diff --git a/contracts/contracts/Interfaces.sol b/contracts/contracts/Interfaces.sol index c9a8d76..4796a17 100644 --- a/contracts/contracts/Interfaces.sol +++ b/contracts/contracts/Interfaces.sol @@ -85,6 +85,7 @@ interface IStaker{ function voteGaugeWeight(address,uint256) external; function balanceOfPool(address) external view returns (uint256); function operator() external view returns (address); + function execute(address _to, uint256 _value, bytes calldata _data) external returns (bool, bytes memory); } interface IRewards{ diff --git a/contracts/contracts/RedirectableGaugeTest.sol b/contracts/contracts/RedirectableGaugeTest.sol new file mode 100644 index 0000000..dd4dbad --- /dev/null +++ b/contracts/contracts/RedirectableGaugeTest.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.6.12; + +import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; +import '@openzeppelin/contracts/utils/Address.sol'; +import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; + +contract RedirectableGauge{ + using SafeERC20 for IERC20; + using Address for address; + + + mapping(address => address) public redirectMap; + + constructor() public { + } + + function deposit(uint256 _amount) external{ + + } + + function balanceOf(address _account) external view returns (uint256){ + return 0; + } + + function withdraw(uint256 _amount) external{ + + } + + function claim_rewards() external{ + + } + + function reward_tokens(uint256 _token) external view returns(address){ + return address(0); + } + + function set_rewards_receiver(address _receiver) external returns(bool){ + redirectMap[msg.sender] = _receiver; + return true; + } +} \ No newline at end of file diff --git a/contracts/test/12_Vesting.js b/contracts/test/12_Vesting.js index e886941..e6c7f38 100644 --- a/contracts/test/12_Vesting.js +++ b/contracts/test/12_Vesting.js @@ -4,6 +4,7 @@ const MerkleTree = require('./helpers/merkleTree'); var jsonfile = require('jsonfile'); var droplist = jsonfile.readFileSync('../airdrop/drop_proofs.json'); var contractList = jsonfile.readFileSync('./contracts.json'); +var distroList = jsonfile.readFileSync('./migrations/distro.json'); const VestedEscrow = artifacts.require("VestedEscrow"); const cvxRewardPool = artifacts.require("cvxRewardPool"); @@ -18,6 +19,25 @@ contract("VestedEscrow Test", async accounts => { let cvxRewards = await cvxRewardPool.at(contractList.system.cvxRewards) let cvx = await ConvexToken.at(contractList.system.cvx) + var team = distroList.vested.team.addresses; + var investor = distroList.vested.investor.addresses; + var treasury = distroList.vested.treasury.addresses; + for(var i = 0; i < team.length; i++){ + await vested.lockedOf(team[i]).then(a=>console.log(team[i] + " locked: " +a)) + await vested.balanceOf(team[i]).then(a=>console.log(team[i] + " balance: " +a)) + await vested.vestedOf(team[i]).then(a=>console.log(team[i] + " vested: " +a)) + } + for(var i = 0; i < investor.length; i++){ + await vested.lockedOf(investor[i]).then(a=>console.log(investor[i] + " locked: " +a)) + await vested.balanceOf(investor[i]).then(a=>console.log(investor[i] + " balance: " +a)) + await vested.vestedOf(investor[i]).then(a=>console.log(investor[i] + " vested: " +a)) + } + for(var i = 0; i < treasury.length; i++){ + await vested.lockedOf(treasury[i]).then(a=>console.log(treasury[i] + " locked: " +a)) + await vested.balanceOf(treasury[i]).then(a=>console.log(treasury[i] + " balance: " +a)) + await vested.vestedOf(treasury[i]).then(a=>console.log(treasury[i] + " vested: " +a)) + } + let accountA = "0xAAc0aa431c237C2C0B5f041c8e59B3f1a43aC78F"; let accountB = "0xb3DF5271b92e9fD2fed137253BB4611285923f16"; for(var i = 0; i < 13; i++){