mirror of
https://github.com/logos-messaging/logos-messaging-rlnv2-contract.git
synced 2026-01-08 17:03:12 +00:00
* Add proxy contract for TST * Fix token proxy update function to use provided new TST address * Transfer token proxy contract ownership to deployer * Add Token Proxy Contract Owner as init input * Add UUPSUPgradeable to TST * Formatting * fix import format * Add README to explain TST usage * Linting fix * Check TST test transfer return val * Add descriptions in README for TST usage * Fix linting * Use TST token deployer in test conrtact, update test README * USe assertTrue in TST test
68 lines
2.2 KiB
Solidity
68 lines
2.2 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity >=0.8.19 <0.9.0;
|
|
|
|
import { BaseScript } from "../script/Base.s.sol";
|
|
import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
|
|
import { ERC20PermitUpgradeable } from
|
|
"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol";
|
|
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
|
|
error AccountNotMinter();
|
|
error AccountAlreadyMinter();
|
|
error AccountNotInMinterList();
|
|
|
|
contract TestStableToken is
|
|
Initializable,
|
|
ERC20Upgradeable,
|
|
ERC20PermitUpgradeable,
|
|
OwnableUpgradeable,
|
|
UUPSUpgradeable
|
|
{
|
|
mapping(address => bool) public isMinter;
|
|
|
|
event MinterAdded(address indexed account);
|
|
event MinterRemoved(address indexed account);
|
|
|
|
modifier onlyOwnerOrMinter() {
|
|
if (msg.sender != owner() && !isMinter[msg.sender]) revert AccountNotMinter();
|
|
_;
|
|
}
|
|
|
|
constructor() {
|
|
_disableInitializers();
|
|
}
|
|
|
|
function initialize() public initializer {
|
|
__ERC20_init("TestStableToken", "TST");
|
|
__ERC20Permit_init("TestStableToken");
|
|
__Ownable_init();
|
|
__UUPSUpgradeable_init();
|
|
}
|
|
|
|
function _authorizeUpgrade(address newImplementation) internal override onlyOwner { }
|
|
|
|
function addMinter(address account) external onlyOwner {
|
|
if (isMinter[account]) revert AccountAlreadyMinter();
|
|
isMinter[account] = true;
|
|
emit MinterAdded(account);
|
|
}
|
|
|
|
function removeMinter(address account) external onlyOwner {
|
|
if (!isMinter[account]) revert AccountNotInMinterList();
|
|
isMinter[account] = false;
|
|
emit MinterRemoved(account);
|
|
}
|
|
|
|
function mint(address to, uint256 amount) external onlyOwnerOrMinter {
|
|
_mint(to, amount);
|
|
}
|
|
}
|
|
|
|
contract TestStableTokenFactory is BaseScript {
|
|
function run() public broadcast returns (address) {
|
|
return address(new TestStableToken());
|
|
}
|
|
}
|