mirror of
https://github.com/luxfi/uma.git
synced 2026-10-30 15:14:44 +00:00
87 lines
3.1 KiB
Solidity
87 lines
3.1 KiB
Solidity
// SPDX-License-Identifier: AGPL-3.0-only
|
|
pragma solidity ^0.8.0;
|
|
import "../../common/implementation/ExpandedERC20.sol";
|
|
import "../../common/implementation/Lockable.sol";
|
|
|
|
/**
|
|
* @title Burnable and mintable ERC20.
|
|
* @dev The contract deployer will initially be the only minter, burner and owner capable of adding new roles.
|
|
*/
|
|
|
|
contract SyntheticToken is ExpandedERC20, Lockable {
|
|
/**
|
|
* @notice Constructs the SyntheticToken.
|
|
* @param tokenName The name which describes the new token.
|
|
* @param tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars.
|
|
* @param tokenDecimals The number of decimals to define token precision.
|
|
*/
|
|
constructor(
|
|
string memory tokenName,
|
|
string memory tokenSymbol,
|
|
uint8 tokenDecimals
|
|
) ExpandedERC20(tokenName, tokenSymbol, tokenDecimals) nonReentrant() {}
|
|
|
|
/**
|
|
* @notice Add Minter role to account.
|
|
* @dev The caller must have the Owner role.
|
|
* @param account The address to which the Minter role is added.
|
|
*/
|
|
function addMinter(address account) external override nonReentrant() {
|
|
addMember(uint256(Roles.Minter), account);
|
|
}
|
|
|
|
/**
|
|
* @notice Remove Minter role from account.
|
|
* @dev The caller must have the Owner role.
|
|
* @param account The address from which the Minter role is removed.
|
|
*/
|
|
function removeMinter(address account) external nonReentrant() {
|
|
removeMember(uint256(Roles.Minter), account);
|
|
}
|
|
|
|
/**
|
|
* @notice Add Burner role to account.
|
|
* @dev The caller must have the Owner role.
|
|
* @param account The address to which the Burner role is added.
|
|
*/
|
|
function addBurner(address account) external override nonReentrant() {
|
|
addMember(uint256(Roles.Burner), account);
|
|
}
|
|
|
|
/**
|
|
* @notice Removes Burner role from account.
|
|
* @dev The caller must have the Owner role.
|
|
* @param account The address from which the Burner role is removed.
|
|
*/
|
|
function removeBurner(address account) external nonReentrant() {
|
|
removeMember(uint256(Roles.Burner), account);
|
|
}
|
|
|
|
/**
|
|
* @notice Reset Owner role to account.
|
|
* @dev The caller must have the Owner role.
|
|
* @param account The new holder of the Owner role.
|
|
*/
|
|
function resetOwner(address account) external override nonReentrant() {
|
|
resetMember(uint256(Roles.Owner), account);
|
|
}
|
|
|
|
/**
|
|
* @notice Checks if a given account holds the Minter role.
|
|
* @param account The address which is checked for the Minter role.
|
|
* @return bool True if the provided account is a Minter.
|
|
*/
|
|
function isMinter(address account) public view nonReentrantView() returns (bool) {
|
|
return holdsRole(uint256(Roles.Minter), account);
|
|
}
|
|
|
|
/**
|
|
* @notice Checks if a given account holds the Burner role.
|
|
* @param account The address which is checked for the Burner role.
|
|
* @return bool True if the provided account is a Burner.
|
|
*/
|
|
function isBurner(address account) public view nonReentrantView() returns (bool) {
|
|
return holdsRole(uint256(Roles.Burner), account);
|
|
}
|
|
}
|