Created
August 6, 2022 19:26
-
-
Save Jesserc/b476cd27ed064ec14aabaa603b268520 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 | |
pragma solidity ^0.8.4; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
contract Bridge is ERC20{ | |
address owner; | |
modifier onlyOnwer(){ | |
require(msg.sender == owner,"Not owner"); | |
_; | |
} | |
constructor() ERC20("Jesserc", unicode"⛓") { | |
owner = msg.sender; | |
_mint(address(this), 10000 * 10 ** decimals()); | |
} | |
function sendTokenExternal( address to, uint256 amount) public onlyOnwer{ | |
require(to != address(0), "ERC: not a valid address"); | |
uint currentBal = balanceOf(address(this)); | |
require(currentBal >= amount,"Sorry, insufficient balance"); | |
_transfer(address(this),to, amount); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment