Skip to content

Instantly share code, notes, and snippets.

@yosriady
Last active June 8, 2024 19:07
Show Gist options
  • Save yosriady/78835e5051759118cd0631002067b19a to your computer and use it in GitHub Desktop.
Save yosriady/78835e5051759118cd0631002067b19a to your computer and use it in GitHub Desktop.
Web3 Saigon example Solidity code
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
contract SimpleToken {
string public constant name = "dogwifpho";
string public constant symbol = "PHO";
uint8 public constant decimals = 18;
address public minter;
mapping (address => uint) private _balances;
constructor() {
minter = msg.sender;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function mint(address to, uint amount) public returns (bool) {
require(msg.sender == minter);
require(amount > 0);
_balances[to] += amount;
return true;
}
function transfer(address to, uint amount) public returns (bool) {
require(amount <= _balances[msg.sender], "Insufficient balance.");
_balances[msg.sender] -= amount;
_balances[to] += amount;
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment