Skip to content

Commit

Permalink
change the way of burning util token
Browse files Browse the repository at this point in the history
  • Loading branch information
thurendous committed Oct 2, 2024
1 parent 6fab322 commit 781f53f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/VotingPowerExchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ contract VotingPowerExchange is AccessControl, EIP712 {
burningTokenAmount = calculateIncrementedBurningAmount(incrementedVotingPower, currentVotingPower);
}

// msg.sender send utilityToken to the sender
// exchange role address need to approve this contract to transfer the utilityToken
utilityToken.transferFrom(msg.sender, sender, burningTokenAmount);
// burn utilityToken from the `sender`
utilityToken.burnByBurner(sender, burningTokenAmount);

Expand Down
1 change: 1 addition & 0 deletions test/fuzz/FuzzVotingPowerExchange.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ contract VotingPwoerExchangeTest is Test {
utilityToken.mint(user, 1_000 * 1e18);
utilityToken.mint(participant, 100_000 * 1e18);
utilityToken.mint(participant2, 10_000 * 1e18);
utilityToken.mint(exchanger, 10_000 * 1e18);
vm.stopPrank();

// set the voting power cap to 99e18
Expand Down

0 comments on commit 781f53f

Please sign in to comment.