# The code of MARK token issuance restriction contract

**Below is the code of MARK token issuance restriction contract**

**contract address：0x6d37b10922ccfbcdd71273cebfb47ddba32bb376**

// SPDX-License-Identifier: MIT\
pragma solidity ^0.8.0;

/\*\*\
\* [@dev](http://twitter.com/dev) Provides information about the current execution context, including the\
\* sender of the transaction and its data. While these are generally available\
\* via msg.sender and msg.data, they should not be accessed in such a direct\
\* manner, since when dealing with meta-transactions the account sending and\
\* paying for execution may not be the actual sender (as far as an application\
\* is concerned).\
\*\
\* This contract is only required for intermediate, library-like contracts.\
\*/\
abstract contract Context {\
function \_msgSender() internal view virtual returns (address) {\
return msg.sender;\
}

function \_msgData() internal view virtual returns (bytes calldata) {\
return msg.data;\
}\
}/\* \*/

/\*\*\
\* [@dev](http://twitter.com/dev) Contract module which provides a basic access control mechanism, where\
\* there is an account (an owner) that can be granted exclusive access to\
\* specific functions.\
\*\
\* By default, the owner account will be the one that deploys the contract. This\
\* can later be changed with {transferOwnership}.\
\*\
\* This module is used through inheritance. It will make available the modifier\
\* \`onlyOwner\`, which can be applied to your functions to restrict their use to\
\* the owner.\
\*/\
abstract contract Ownable is Context {\
address private \_owner;

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

/\*\*\
\* [@dev](http://twitter.com/dev) Initializes the contract setting the deployer as the initial owner.\
\*/\
constructor() {\
\_setOwner(\_msgSender());\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Returns the address of the current owner.\
\*/\
function owner() public view virtual returns (address) {\
return \_owner;\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Throws if called by any account other than the owner.\
\*/\
modifier onlyOwner() {\
require(owner() == \_msgSender(), “Ownable: caller is not the owner”);\
\_;\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Leaves the contract without owner. It will not be possible to call\
\* \`onlyOwner\` functions anymore. Can only be called by the current owner.\
\*\
\* NOTE: Renouncing ownership will leave the contract without an owner,\
\* thereby removing any functionality that is only available to the owner.\
\*/\
function renounceOwnership() public virtual onlyOwner {\
\_setOwner(address(0));\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Transfers ownership of the contract to a new account (\`newOwner\`).\
\* Can only be called by the current owner.\
\*/\
function transferOwnership(address newOwner) public virtual onlyOwner {\
require(newOwner != address(0), “Ownable: new owner is the zero address”);\
\_setOwner(newOwner);\
}

function \_setOwner(address newOwner) private {\
address oldOwner = \_owner;\
\_owner = newOwner;\
emit OwnershipTransferred(oldOwner, newOwner);\
}\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Wrappers over Solidity’s arithmetic operations with added overflow checks.\
\* Arithmetic operations in Solidity wrap on overflow. This can easily result in bugs, because programmers usually assume that an overflow raises an\
\* error, which is the standard behavior in high level programming languages. \`SafeMath\` restores this intuition by reverting the transaction when an operation overflows.\
\* Using this library instead of the unchecked operations eliminates an entire class of bugs, so it’s recommended to use it always.\
\*/\
library SafeMath {\
function add(uint256 a, uint256 b) internal pure returns (uint256) {\
uint256 c = a + b;\
require(c >= a, “SafeMath: addition overflow”);

return c;\
}

function sub(uint256 a, uint256 b) internal pure returns (uint256) {\
return sub(a, b, “SafeMath: subtraction overflow”);\
}

function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\
require(b <= a, errorMessage);\
uint256 c = a — b;

return c;\
}

function mul(uint256 a, uint256 b) internal pure returns (uint256) {\
if (a == 0) {\
return 0;\
}

uint256 c = a \* b;\
require(c / a == b, “SafeMath: multiplication overflow”);

return c;\
}

function div(uint256 a, uint256 b) internal pure returns (uint256) {\
return div(a, b, “SafeMath: division by zero”);\
}

function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\
require(b > 0, errorMessage);\
uint256 c = a / b;

return c;\
}

function mod(uint256 a, uint256 b) internal pure returns (uint256) {\
return mod(a, b, “SafeMath: modulo by zero”);\
}

function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\
require(b != 0, errorMessage);\
return a % b;\
}\
}

interface IMark {\
/\*\*\
\* [@dev](http://twitter.com/dev) Returns the amount of tokens in existence.\
\*/\
function totalSupply() external view returns (uint256);

/\*\*\
\* [@dev](http://twitter.com/dev) Mint mark to the account.\
\*/\
function mint(address account, uint256 amount) external;

/\*\*\
\* [@dev](http://twitter.com/dev) Mint mark.\
\*/\
function burn(uint256 amount) external;\
}

contract Minter is Ownable {

using SafeMath for uint256;\
/\*\*\
\* [@dev](http://twitter.com/dev) After 28800 blocknumber\
\* (HECO chain is an average of one block every 3 seconds, 3x28800=86400, that is, 1 day),\
\* 1 billion additional blocks can be issued;\
\*/\
uint256 public constant BLOCKPERIOD = 28800; // Block period\
uint256 public constant MAXSUPPLY = 1095000000000 \* 1e18; // Maximum supply\
uint256 public constant DAYLIMIT = 1000000000 \* 1e18; // Daily minting limit\
uint256 public mintedAmount = 5000000000 \* 1e18; // Total number of minted\
uint256 public burnAmount; // Total number of burned

bool public activate; // Is it activated\
uint256 public startBlockNumber; // Starting block number

address public mark;\
\
constructor(address \_mark) {\
mark = \_mark;\
}

function mint(address account, uint256 amount) public onlyOwner {\
require(activate, “Not initiated”);\
require(block.number >= startBlockNumber, “Starting block number not reached”);

uint256 limitMintable = getLimitMintable();\
\
require(amount <= limitMintable, “Minting exceeds the limit”);\
IMark(mark).mint(account, amount);\
mintedAmount = mintedAmount.add(amount);\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Get the current block number\
\*/\
function getBlockNumber() public view returns(uint256) {\
return block.number;\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Get the current total supply\
\*/\
function totalSupply() public view returns(uint256) {\
return IMark(mark).totalSupply();\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Get the total amount of coins that can be minted by MARK\
\*/\
function getTotalMintable() public view returns(uint256) {\
return MAXSUPPLY.sub(mintedAmount);\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Get the current limit of mintable coins\
\*/\
function getLimitMintable() public view returns(uint256) {\
if (!activate || block.number <= startBlockNumber) {\
return 0;\
}

uint256 \_mintable = block.number.sub(startBlockNumber)\
.div(BLOCKPERIOD)\
.add(1)\
.mul(DAYLIMIT);

if (\_mintable <= mintedAmount) {\
return 0;\
}\
\
if (\_mintable >= MAXSUPPLY) {\
return MAXSUPPLY.sub(mintedAmount);\
}

return \_mintable.sub(mintedAmount);\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Burn operation can only be performed by the administrator\
\*/\
function burn(uint256 amount) public onlyOwner {\
IMark(mark).burn(amount);\
burnAmount = burnAmount.add(amount);\
}

/\*\*\
\* [@dev](http://twitter.com/dev) Can only be started once\
\*/\
function startUp(uint256 \_startBlockNumber) public onlyOwner {\
require(!activate, “Activated”);\
require(\
\_startBlockNumber > block.number,\
“The start block number should be greater than the current block number”\
);\
activate = true;\
startBlockNumber = \_startBlockNumber;\
}

}
