-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
1 changed file
with
38 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (C) 2020-2023 SubQuery Pte Ltd authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity 0.8.15; | ||
|
||
import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; | ||
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; | ||
import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol'; | ||
import '@openzeppelin/contracts/access/Ownable.sol'; | ||
|
||
contract VTSQToken is ERC20, Ownable, ERC20Burnable { | ||
using SafeERC20 for IERC20; | ||
address public minter; | ||
|
||
modifier isMinter() { | ||
require(minter == msg.sender, 'Not minter'); | ||
_; | ||
} | ||
|
||
constructor(address _minter, uint256 totalSupply) ERC20('VTSubQueryToken', 'vtSQT') Ownable() { | ||
minter = _minter; | ||
_mint(msg.sender, totalSupply); | ||
} | ||
|
||
function mint(address destination, uint256 amount) external isMinter { | ||
_mint(destination, amount); | ||
} | ||
|
||
/// #if_succeeds {:msg "minter should be set"} minter == _minter; | ||
/// #if_succeeds {:msg "owner functionality"} old(msg.sender == address(owner)); | ||
function setMinter(address _minter) external onlyOwner { | ||
minter = _minter; | ||
} | ||
|
||
function getMinter() external view returns (address) { | ||
return minter; | ||
} | ||
} |