Created
          August 29, 2021 08:33 
        
      - 
      
- 
        Save korrio/b178c8f5588560480a79834e8e734e6a to your computer and use it in GitHub Desktop. 
    NICK.sol
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.6.12; | |
| import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/token/ERC20/ERC20.sol"; | |
| import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/token/ERC20/ERC20Pausable.sol"; | |
| contract NickToken is ERC20, Pausable { | |
| mapping (address => uint256) balances; | |
| mapping (address => mapping (address => uint256)) allowed; | |
| mapping (address => bool) public pauselist; | |
| constructor () public ERC20("NICK Token", "NICK") { | |
| _mint(msg.sender, 1000000 * (10 ** uint256(decimals()))); | |
| } | |
| function mint(address account, uint256 amount) public whenNotPaused returns (bool) { | |
| _mint(account, amount); | |
| return true; | |
| } | |
| function transfer(address _to, uint256 _value) public override whenNotPaused returns (bool) { | |
| require(_value <= balances[msg.sender], "Insufficient Balance"); | |
| require(pauselist[msg.sender] == false && pauselist[_to] == false, "Address is in the pauselist"); | |
| balances[msg.sender] -= _value; | |
| balances[_to] += _value; | |
| emit Transfer(msg.sender, _to, _value); | |
| return true; | |
| } | |
| function transferFrom( | |
| address _from, | |
| address _to, | |
| uint256 _value | |
| ) public override whenNotPaused returns (bool) { | |
| require(_value <= balances[_from]); | |
| require(_value <= allowed[_from][msg.sender]); | |
| require(pauselist[_from] == false && pauselist[_to] == false, "Address is in the pauselist"); | |
| balances[_from] -= _value; | |
| balances[_to] += _value; | |
| allowed[_from][msg.sender] -= _value; | |
| emit Transfer(_from, _to, _value); | |
| return true; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment