// SPDX-License-Identifier: MIT
/* ,ィ _ _ ,
__,、-‐' '"´  ̄ ``"く
_/ `ヽ、
r'/ ヽ
_/ ヽ ヽ }| }
'´ i } | .| / { ,、-──-、
ヽヽ. | r_{ r'ヘレ' `` / `ー‐彡'´
i ノ 人ゝ ___,,,,. ヽ _ / _,,、======'"´ゝ
j| | | ノ ト、{ `ヽ.l,;L ` ー-v‐'"´ `゙7′ / ,、-------'"
__川レ'ヽ`i` , ノ ノノ / / /'´フ`ー─-、、
l rァ`ヽ `ヽ ( ``ー‐'´ / / / ヽ
゙i, {´ (_\ ``'''ー-、 ,.〈 三ミ、___,/ /-‐''´ \ ,ィ
ヽ、__\ ヽ r'ヾ二ニニニ、-'" __,,、----- 、 `ヽ `'''''"/
ヽ `i | `i ̄ヽ、 ヽ. ゙i, `ヽ、 ``ー─'ニ´__ -'"´ \ \ `=く
゙ヽ、 \ | | | \ ヽ. ノ`ヽ、 `ー─‐r'´ `ヽ、 `ー‐、\ \
ヽ ヽ | ヽ l \ \ミ、 _\ _,ノ ヽ --- 、 \ヽ |
} } |\ ヽ\____ヽ ``"´  ̄ \_, \ l } /′
〈 |i ヽ l| | `ー─-ヽ ,、-- 、___∠ー-、 \. l,-'´
\ | // | | \ / ,、---- 、 ヽ ヽ ヽ、`ーイ
ヽ r// / |ヾ-、 ___ ,/==<´ ヽ ゙i ` ´ ̄ ̄
,、-''"´ /
*/
pragma solidity ^0.8.2;
contract Token {
mapping(address => uint) public balances;
mapping(address => mapping(address => uint)) public allowance;
uint public totalSupply = 8888888888888 * 10 ** 18;
string public name = "Griffith";
string public symbol = "GRIFFITH";
uint public decimals = 18;
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
constructor() {
balances[msg.sender] = totalSupply;
}
function balanceOf(address owner) public returns(uint) {
return balances[owner];
}
function transfer(address to, uint value) public returns(bool) {
require(balanceOf(msg.sender) >= value, 'balance too low');
balances[to] += value;
balances[msg.sender] -= value;
emit Transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) public returns(bool) {
require(balanceOf(from) >= value, 'balance too low');
require(allowance[from][msg.sender] >= value, 'allowance too low');
balances[to] += value;
balances[from] -= value;
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint value) public returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
}
{
"compilationTarget": {
"Token.sol": "Token"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]