Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Removed voting for same pool and 0 voting
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Cronje <andre.cronje@yearn.finance>
  • Loading branch information
Andre Cronje committed Feb 10, 2022
1 parent 09cca22 commit ad0dadd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions contracts/BaseV1-voter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ contract BaseV1Voter {

if (isGauge[_gauge]) {
int256 _poolWeight = _weights[i] * _weight / _totalVoteWeight;
require(votes[_tokenId][_pool] == 0);
require(_poolWeight != 0);
_updateFor(_gauge);

poolVote[_tokenId].push(_pool);
Expand Down
4 changes: 2 additions & 2 deletions test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ describe("core", function () {
});

it("vote hacking", async function () {
await gauge_factory.vote(1, [pair.address, pair.address, pair.address, pair.address], [5000,5000,5000,5000]);
await gauge_factory.vote(1, [pair.address], [5000]);
expect(await gauge_factory.usedWeights(1)).to.closeTo((await ve.balanceOfNFT(1)), 1000);
expect(await bribe.balanceOf(1)).to.equal(await gauge_factory.votes(1, pair.address));
await gauge_factory.reset(1);
Expand Down Expand Up @@ -533,7 +533,7 @@ describe("core", function () {
});

it("vote hacking break mint", async function () {
await gauge_factory.vote(1, [pair.address, pair.address, pair.address, pair.address], [5000,5000,5000,5000]);
await gauge_factory.vote(1, [pair.address], [5000]);

expect(await gauge_factory.usedWeights(1)).to.closeTo((await ve.balanceOfNFT(1)), 1000);
expect(await bribe.balanceOf(1)).to.equal(await gauge_factory.votes(1, pair.address));
Expand Down

0 comments on commit ad0dadd

Please sign in to comment.