Skip to content

Instantly share code, notes, and snippets.

@renso3x
Created March 13, 2026 08:12
Show Gist options
  • Select an option

  • Save renso3x/a17ef6509bea24b524f933b4379a0fc9 to your computer and use it in GitHub Desktop.

Select an option

Save renso3x/a17ef6509bea24b524f933b4379a0fc9 to your computer and use it in GitHub Desktop.
// 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