Skip to main content
PulseScanner.io

Address

0xb6ca7399b4f9ca56fc27cbff44f4d2e4eef1fc81
Current Holdings
$0.00
TXs sent
not counted
First Active
2023-05-13
block 17,250,083
Last Active
114 days ago
block 26,607,955
Funded By
not identified

Net worth historyi

1 snapshot · to block 18,926,199
exact matchMuseTokensolc 0.6.6+commit.6c089d02runtime exact · creation exact
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol";

contract MuseToken is ERC20PresetMinterPauser {
    // Cap at 1 million
    uint256 internal _cap = 1000000 * 10**18;

    constructor() public ERC20PresetMinterPauser("Muse", "MUSE") {}

    /**
     * @dev Returns the cap on the token's total supply.
     */
    function cap() public view returns (uint256) {
        return _cap;
    }

    // change cap in case of decided by the community
    function changeCap(uint256 _newCap) external {
        require(
            hasRole(MINTER_ROLE, _msgSender()),
            "ERC20PresetMinterPauser: must have minter role to mint"
        );
        _cap = _newCap;
    }

    /**
     * @dev See {ERC20-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - minted tokens must not cause the total supply to go over the cap.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override(ERC20PresetMinterPauser) {
        super._beforeTokenTransfer(from, to, amount);

        if (from == address(0)) {
            // When minting tokens
            require(
                totalSupply().add(amount) <= _cap,
                "ERC20Capped: cap exceeded"
            );
        }
    }
}