Created
June 9, 2024 10:23
-
-
Save arcticfloyd1984/9c3ba37812e405a9c0f64c7e64bfd4b5 to your computer and use it in GitHub Desktop.
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
// SPDX-License-Identifier: MIT | |
// Compatible with OpenZeppelin Contracts ^5.0.0 | |
pragma solidity ^0.8.20; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; | |
import { | |
ERC2771Context | |
} from "@gelatonetwork/relay-context/contracts/vendor/ERC2771Context.sol"; | |
contract GelatoToken is ERC2771Context, ERC20, ERC20Burnable { | |
address owner; | |
constructor(address trustedForwarder) // trusted forwarder | |
ERC20("GelatoToken", "GT") | |
ERC2771Context(trustedForwarder) | |
{ | |
_mint(msg.sender, 10000000000000000000000000); // minting total supply to deployer | |
owner = msg.sender; | |
} | |
event Burn(address indexed sender, uint256 value); | |
function mint(address to, uint256 amount) public { | |
require(_msgSender() == owner, "Minter is not owner"); | |
_mint(to, amount); | |
} | |
function burn(uint256 value) override public virtual { | |
_burn(_msgSender(), value); | |
emit Burn(_msgSender(), value); | |
} | |
function _msgSender() internal view override(Context, ERC2771Context) returns(address) { | |
return ERC2771Context._msgSender(); | |
} | |
function _msgData() internal view override(Context, ERC2771Context) returns(bytes calldata) { | |
return ERC2771Context._msgData(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment