Skip to content

Commit

Permalink
Merge pull request #208 from aave/fix/gho-token-cei-order
Browse files Browse the repository at this point in the history
fix: Change order of GhoToken for CEI pattern
  • Loading branch information
Steven Valeri authored Dec 15, 2022
2 parents 17ffc03 + 3289293 commit 6b84d1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/contracts/gho/GhoToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ contract GhoToken is ERC20, Ownable, IGhoToken {
require(bucketCapacity >= newBucketLevel, 'FACILITATOR_BUCKET_CAPACITY_EXCEEDED');
_facilitators[msg.sender].bucketLevel = uint128(newBucketLevel);

emit FacilitatorBucketLevelUpdated(msg.sender, currentBucketLevel, newBucketLevel);
_mint(account, amount);

emit FacilitatorBucketLevelUpdated(msg.sender, currentBucketLevel, newBucketLevel);
}

/**
Expand All @@ -50,11 +51,14 @@ contract GhoToken is ERC20, Ownable, IGhoToken {
*/
function burn(uint256 amount) external override {
require(amount != 0, 'INVALID_BURN_AMOUNT');

uint256 currentBucketLevel = _facilitators[msg.sender].bucketLevel;
uint256 newBucketLevel = currentBucketLevel - amount;
_facilitators[msg.sender].bucketLevel = uint128(newBucketLevel);
emit FacilitatorBucketLevelUpdated(msg.sender, currentBucketLevel, newBucketLevel);

_burn(msg.sender, amount);

emit FacilitatorBucketLevelUpdated(msg.sender, currentBucketLevel, newBucketLevel);
}

/// @inheritdoc IGhoToken
Expand Down

0 comments on commit 6b84d1b

Please sign in to comment.