Created
March 13, 2026 08:12
-
-
Save renso3x/a17ef6509bea24b524f933b4379a0fc9 to your computer and use it in GitHub Desktop.
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.8.31; | |
| import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
| contract OwnToken is ERC20 { | |
| constructor(uint256 initialSupply) ERC20("RomeoEnso", "RE") { | |
| _mint(msg.sender, initialSupply * 10 ** decimals()); | |
| } | |
| } | |
| contract PayStore { | |
| ERC20 public token; | |
| constructor(address tokenAddress) { | |
| token = ERC20(tokenAddress); | |
| } | |
| function sendPayment(address vendor, uint amount) external { | |
| require(vendor != address(0), "Invalid address"); | |
| require(amount > 0, "Invalid amount"); | |
| bool success = token.transferFrom(msg.sender, vendor,amount); | |
| require(success, "Transfer Payment failed!"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment