-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64a883c
commit 3cfe305
Showing
3 changed files
with
52 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,32 +3,14 @@ pragma solidity 0.8.20; | |
|
||
import "../v1/FiatTokenV1.sol"; | ||
|
||
error InvalidReInitialization(address addr); | ||
|
||
/// @custom:security-contact [email protected] | ||
contract FiatTokenV2 is FiatTokenV1 { | ||
uint8 internal _initializedVersion; | ||
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); | ||
|
||
function initializeV2(address burner) external { | ||
if (_initializedVersion > 0) { | ||
revert InvalidReInitialization(msg.sender); | ||
} | ||
|
||
_grantRole(BURNER_ROLE, burner); | ||
|
||
_initializedVersion = 1; | ||
} | ||
|
||
function burnBurner(uint256 value) public onlyRole(BURNER_ROLE) { | ||
function burnByBurner(uint256 value) public onlyRole(BURNER_ROLE) { | ||
_burn(_msgSender(), value); | ||
} | ||
|
||
function burnFromBurner(address account, uint256 value) public onlyRole(BURNER_ROLE) { | ||
_spendAllowance(account, _msgSender(), value); | ||
_burn(account, value); | ||
} | ||
|
||
function version() public pure virtual override(FiatTokenV1) returns (string memory) { | ||
return "2"; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.