diff --git a/src/VotingPowerExchange.sol b/src/VotingPowerExchange.sol index 8328f99..391b9e0 100644 --- a/src/VotingPowerExchange.sol +++ b/src/VotingPowerExchange.sol @@ -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); diff --git a/test/fuzz/FuzzVotingPowerExchange.t.sol b/test/fuzz/FuzzVotingPowerExchange.t.sol index cfa8546..f13f86d 100644 --- a/test/fuzz/FuzzVotingPowerExchange.t.sol +++ b/test/fuzz/FuzzVotingPowerExchange.t.sol @@ -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