Submitted by cmichel.
When minting / transferring / burning tokens, the SushiToken._beforeTokenTransfer function is called and supposed to correctly shift the voting power due to the increase/decrease in tokens for the from and to accounts.
However, it does not correctly do that, it tries to shift the votes from the from account, instead of the _delegates[from] account.
This can lead to transfers reverting.
Imagine the following transactions on the SushiToken contract.
Well illustrate the corresponding _moveDelegates calls and written checkpoints for each.
It should subtract from As delegatee A's checkpoint instead.
Users that delegated votes will be unable to transfer any of their tokens.
In SushiToken._beforeTokenTransfer, change the _moveDelegates call to be from _delegates[from] instead:
This is also how the original code from Compound does it.
maxsam4 (Sushi Miso) acknowledged:
ghoul-sol (judge) commented:
