Skip to content

Commit

Permalink
Simplified boolean logic in beforeTokenTransfer
Browse files Browse the repository at this point in the history
  • Loading branch information
asselstine committed Oct 6, 2021
1 parent f97e73a commit 0a89dce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contracts/Ticket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,16 @@ contract Ticket is ControlledToken, ITicket {
_toDelegate = delegates[_to];
}

// If we are minting, or transferring tokens from an undelegated account to a delegated account
if (_from == address(0) || (_fromDelegate == address(0) && _toDelegate != address(0))) {
// If we are transferring tokens from an undelegated account to a delegated account
if (_fromDelegate == address(0) && _toDelegate != address(0)) {
_increaseTotalSupplyTwab(_amount);
} // otherwise, if the from delegate is set, then decrease their twab
else if (_fromDelegate != address(0)) {
_decreaseUserTwab(_from, _fromDelegate, _amount);
}

// if we are burning, or transferring tokens from a delegated account to an undelegated account
if (_to == address(0) || (_fromDelegate != address(0) && _toDelegate == address(0))) {
// if we are transferring tokens from a delegated account to an undelegated account
if (_fromDelegate != address(0) && _toDelegate == address(0)) {
_decreaseTotalSupplyTwab(_amount);
} // otherwise if the to delegate is set, then increase their twab
else if (_toDelegate != address(0)) {
Expand Down

0 comments on commit 0a89dce

Please sign in to comment.