Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Coin
- Optimization enabled
- true
- Compiler version
- v0.8.21+commit.d9974bed
- Optimization runs
- 200
- EVM Version
- paris
- Verified at
- 2024-05-12T23:39:08.828118Z
src/Counter.sol
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; contract Coin { // The keyword "public" makes variables // accessible from other contracts address public minter; mapping(address => uint) public balances; // Events allow clients to react to specific // contract changes you declare event Sent(address from, address to, uint amount); // Constructor code is only run when the contract // is created constructor() { minter = msg.sender; } // Sends an amount of newly created coins to an address // Can only be called by the contract creator function mint(address receiver, uint amount) public { require(msg.sender == minter); balances[receiver] += amount; } // Errors allow you to provide information about // why an operation failed. They are returned // to the caller of the function. error InsufficientBalance(uint requested, uint available); // Sends an amount of existing coins // from any caller to an address function send(address receiver, uint amount) public { if (amount > balances[msg.sender]) revert InsufficientBalance({ requested: amount, available: balances[msg.sender] }); balances[msg.sender] -= amount; balances[receiver] += amount; emit Sent(msg.sender, receiver, amount); } }
Compiler Settings
{"remappings":["forge-std/=lib/forge-std/src/"],"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"InsufficientBalance","inputs":[{"type":"uint256","name":"requested","internalType":"uint256"},{"type":"uint256","name":"available","internalType":"uint256"}]},{"type":"event","name":"Sent","inputs":[{"type":"address","name":"from","internalType":"address","indexed":false},{"type":"address","name":"to","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balances","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mint","inputs":[{"type":"address","name":"receiver","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"minter","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"send","inputs":[{"type":"address","name":"receiver","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50600080546001600160a01b031916331790556102f2806100326000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063075461721461005157806327e235e31461008157806340c10f19146100af578063d0679d34146100c4575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100a161008f36600461022e565b60016020526000908152604090205481565b604051908152602001610078565b6100c26100bd366004610250565b6100d7565b005b6100c26100d2366004610250565b61011f565b6000546001600160a01b031633146100ee57600080fd5b6001600160a01b03821660009081526001602052604081208054839290610116908490610290565b90915550505050565b3360009081526001602052604090205481111561017457336000908152600160205260409081902054905163cf47918160e01b815261016b918391600401918252602082015260400190565b60405180910390fd5b33600090815260016020526040812080548392906101939084906102a9565b90915550506001600160a01b038216600090815260016020526040812080548392906101c0908490610290565b9091555050604080513381526001600160a01b03841660208201529081018290527f3990db2d31862302a685e8086b5755072a6e2b5b780af1ee81ece35ee3cd33459060600160405180910390a15050565b80356001600160a01b038116811461022957600080fd5b919050565b60006020828403121561024057600080fd5b61024982610212565b9392505050565b6000806040838503121561026357600080fd5b61026c83610212565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102a3576102a361027a565b92915050565b818103818111156102a3576102a361027a56fea26469706673582212205d1a9e1e1019b5885ab4f72b1e2c5b6220b9525f1861b755bd71e4737ee54bc764736f6c63430008150033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063075461721461005157806327e235e31461008157806340c10f19146100af578063d0679d34146100c4575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100a161008f36600461022e565b60016020526000908152604090205481565b604051908152602001610078565b6100c26100bd366004610250565b6100d7565b005b6100c26100d2366004610250565b61011f565b6000546001600160a01b031633146100ee57600080fd5b6001600160a01b03821660009081526001602052604081208054839290610116908490610290565b90915550505050565b3360009081526001602052604090205481111561017457336000908152600160205260409081902054905163cf47918160e01b815261016b918391600401918252602082015260400190565b60405180910390fd5b33600090815260016020526040812080548392906101939084906102a9565b90915550506001600160a01b038216600090815260016020526040812080548392906101c0908490610290565b9091555050604080513381526001600160a01b03841660208201529081018290527f3990db2d31862302a685e8086b5755072a6e2b5b780af1ee81ece35ee3cd33459060600160405180910390a15050565b80356001600160a01b038116811461022957600080fd5b919050565b60006020828403121561024057600080fd5b61024982610212565b9392505050565b6000806040838503121561026357600080fd5b61026c83610212565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102a3576102a361027a565b92915050565b818103818111156102a3576102a361027a56fea26469706673582212205d1a9e1e1019b5885ab4f72b1e2c5b6220b9525f1861b755bd71e4737ee54bc764736f6c63430008150033