-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove OZ dependency in dispatch
- Loading branch information
Showing
2 changed files
with
39 additions
and
7 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 |
---|---|---|
@@ -1,8 +1,42 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
import {ERC20} from "../../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; | ||
contract ERC20Standard { | ||
address public owner; | ||
uint256 public totalSupply; | ||
mapping(address => uint256) public balanceOf; | ||
mapping(address => mapping(address => uint256)) public allowance; | ||
|
||
contract ERC20Standard is ERC20 { | ||
constructor(string memory name, string memory symbol) ERC20(name, symbol) {} | ||
constructor() { | ||
owner = msg.sender; | ||
} | ||
|
||
modifier onlyOwner() { | ||
require(msg.sender == owner); | ||
_; | ||
} | ||
|
||
function _transfer(address _from, address _to, uint256 _amount) internal returns (bool) { | ||
balanceOf[_from] -= _amount; | ||
balanceOf[_to] += _amount; | ||
return true; | ||
} | ||
|
||
function transfer(address _to, uint256 _amount) public returns (bool) { | ||
return _transfer(msg.sender, _to, _amount); | ||
} | ||
|
||
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool) { | ||
allowance[_from][msg.sender] -= _amount; | ||
return _transfer(_from, _to, _amount); | ||
} | ||
|
||
function approve(address _spender, uint256 _amount) public { | ||
allowance[msg.sender][_spender] = _amount; | ||
} | ||
|
||
function mint(address _receiver, uint256 _amount) public onlyOwner { | ||
balanceOf[_receiver] += _amount; | ||
totalSupply += _amount; | ||
} | ||
} |
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