Address Contract Verified
Address
0x30aE41D5f9988D359c733232C6c693c0e645C77E
Balance
0 ETH
Nonce
110
Code Size
9020 bytes
Creator
0xD9D3c1D0...BC78 at tx 0xbbbd6b8e...2f89e7
Indexed Transactions
0
Contract Bytecode
9020 bytes
0x608060405234801562000010575f80fd5b5060043610620000fe575f3560e01c806395d89b411162000097578063d6d2bb98116200006d578063d6d2bb98146200028e578063dd62ed3e14620002c4578063de0e9a3e14620002fa578063ea598cb0146200031a57620000fe565b806395d89b41146200022a578063a9059cbb146200024c578063b8bdd4b2146200028257620000fe565b806323b872dd11620000d957806323b872dd146200017c578063313ce56714620001b257806370a0823114620001d45780637844c393146200020a57620000fe565b806306fdde031462000102578063095ea7b3146200012457806318160ddd146200015a575b5f80fd5b6200010c6200033a565b6040516200011b9190620014a8565b60405180910390f35b6200014260048036038101906200013c919062001567565b620003d2565b604051620001519190620015c8565b60405180910390f35b62000164620003f8565b604051620001739190620015f4565b60405180910390f35b6200019a60048036038101906200019491906200160f565b62000401565b604051620001a99190620015c8565b60405180910390f35b620001bc62000435565b604051620001cb919062001685565b60405180910390f35b620001f26004803603810190620001ec9190620016a0565b62000439565b604051620002019190620015f4565b60405180910390f35b620002286004803603810190620002229190620016d0565b6200047e565b005b6200023462000691565b604051620002439190620014a8565b60405180910390f35b6200026a600480360381019062000264919062001567565b62000729565b604051620002799190620015c8565b60405180910390f35b6200028c6200074f565b005b620002ac6004803603810190620002a69190620016a0565b62000904565b604051620002bb919062001711565b60405180910390f35b620002e26004803603810190620002dc91906200172c565b62000934565b604051620002f19190620015f4565b60405180910390f35b620003186004803603810190620003129190620016d0565b620009b6565b005b620003386004803603810190620003329190620016d0565b62000ad9565b005b6060600380546200034b906200179e565b80601f016020809104026020016040519081016040528092919081815260200182805462000379906200179e565b8015620003c85780601f106200039e57610100808354040283529160200191620003c8565b820191905f5260205f20905b815481529060010190602001808311620003aa57829003601f168201915b5050505050905090565b5f80620003de62000d55565b9050620003ed81858562000d5c565b600191505092915050565b5f600254905090565b5f806200040d62000d55565b90506200041c85828562000d70565b6200042985858562000e0a565b60019150509392505050565b5f90565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b80733eddc7ebc7db94f54b72d8ed1f42ce6a527305bb73ffffffffffffffffffffffffffffffffffffffff1663bbd39ac073cd063b3081ea55535e5b60a21eff7f14e785a8776040518263ffffffff1660e01b8152600401620004e2919062001711565b6020604051808303815f875af1158015620004ff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620005259190620017e8565b101562000569576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620005609062001866565b60405180910390fd5b5f5b818110156200063d57733eddc7ebc7db94f54b72d8ed1f42ce6a527305bb73ffffffffffffffffffffffffffffffffffffffff166040518060400160405280600481526020017f5479f98b00000000000000000000000000000000000000000000000000000000815250604051620005e49190620018d0565b5f604051808303815f865af19150503d805f81146200061f576040519150601f19603f3d011682016040523d82523d5f602084013e62000624565b606091505b5050508080620006349062001915565b9150506200056b565b506200064a338262000f02565b3373ffffffffffffffffffffffffffffffffffffffff16817f0698dc68abe4e268dc6d6cbabea5fc24ae8bace764c1ab5e1dbe12a4d9067b0b60405160405180910390a350565b606060048054620006a2906200179e565b80601f0160208091040260200160405190810160405280929190818152602001828054620006d0906200179e565b80156200071f5780601f10620006f5576101008083540402835291602001916200071f565b820191905f5260205f20905b8154815290600101906020018083116200070157829003601f168201915b5050505050905090565b5f806200073562000d55565b90506200074481858562000e0a565b600191505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff1660055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146200081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200081390620019af565b60405180910390fd5b6040516200082a9062001406565b604051809103905ff08015801562000844573d5f803e3d5ffd5b5060055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff167f2c601b1355d1a6cd1373df5a1e2460c77aedfbb5c16c66b47bb96b35462808e260405160405180910390a2565b6005602052805f5260405f205f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b80620009c23362000439565b101562000a06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620009fd9062001a1d565b60405180910390fd5b733eddc7ebc7db94f54b72d8ed1f42ce6a527305bb73ffffffffffffffffffffffffffffffffffffffff166390b98a1133836040518363ffffffff1660e01b815260040162000a5792919062001a3d565b5f604051808303815f87803b15801562000a6f575f80fd5b505af115801562000a82573d5f803e3d5ffd5b5050505062000a92338262000f86565b3373ffffffffffffffffffffffffffffffffffffffff16817f1d27d1c62712f590d53fa9eb8bbf3a75d09503deae319bb9d99644339cb312e160405160405180910390a350565b5f60055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160362000baa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000ba19062001ab6565b60405180910390fd5b81733eddc7ebc7db94f54b72d8ed1f42ce6a527305bb73ffffffffffffffffffffffffffffffffffffffff1663bbd39ac0836040518263ffffffff1660e01b815260040162000bfa919062001711565b6020604051808303815f875af115801562000c17573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062000c3d9190620017e8565b101562000c81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000c789062001b24565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16638d3c100a83733eddc7ebc7db94f54b72d8ed1f42ce6a527305bb6040518363ffffffff1660e01b815260040162000cd292919062001bab565b5f604051808303815f87803b15801562000cea575f80fd5b505af115801562000cfd573d5f803e3d5ffd5b5050505062000d0d338362000f02565b3373ffffffffffffffffffffffffffffffffffffffff16827f9c307a39a47fdf1a019642a4e8a585ffe9894b5018226029887fe6d4241611bb60405160405180910390a35050565b5f33905090565b62000d6b83838360016200100a565b505050565b5f62000d7d848462000934565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811462000e04578181101562000df3578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040162000dea9392919062001bd6565b60405180910390fd5b62000e0384848484035f6200100a565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160362000e7d575f6040517f96c6fd1e00000000000000000000000000000000000000000000000000000000815260040162000e74919062001711565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160362000ef0575f6040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000ee7919062001711565b60405180910390fd5b62000efd838383620011e2565b505050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160362000f75575f6040517fec442f0500000000000000000000000000000000000000000000000000000000815260040162000f6c919062001711565b60405180910390fd5b62000f825f8383620011e2565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160362000ff9575f6040517f96c6fd1e00000000000000000000000000000000000000000000000000000000815260040162000ff0919062001711565b60405180910390fd5b62001006825f83620011e2565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036200107d575f6040517fe602df0500000000000000000000000000000000000000000000000000000000815260040162001074919062001711565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603620010f0575f6040517f94280d62000000000000000000000000000000000000000000000000000000008152600401620010e7919062001711565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508015620011dc578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051620011d39190620015f4565b60405180910390a35b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160362001236578060025f82825462001229919062001c11565b9250508190555062001307565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015620012c2578381836040517fe450d38c000000000000000000000000000000000000000000000000000000008152600401620012b99392919062001bd6565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160362001350578060025f82825403925050819055506200139a565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620013f99190620015f4565b60405180910390a3505050565b6106bb8062001c4c83390190565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156200144d57808201518184015260208101905062001430565b5f8484015250505050565b5f601f19601f8301169050919050565b5f620014748262001414565b6200148081856200141e565b9350620014928185602086016200142e565b6200149d8162001458565b840191505092915050565b5f6020820190508181035f830152620014c2818462001468565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f620014f982620014ce565b9050919050565b6200150b81620014ed565b811462001516575f80fd5b50565b5f81359050620015298162001500565b92915050565b5f819050919050565b62001543816200152f565b81146200154e575f80fd5b50565b5f81359050620015618162001538565b92915050565b5f806040838503121562001580576200157f620014ca565b5b5f6200158f8582860162001519565b9250506020620015a28582860162001551565b9150509250929050565b5f8115159050919050565b620015c281620015ac565b82525050565b5f602082019050620015dd5f830184620015b7565b92915050565b620015ee816200152f565b82525050565b5f602082019050620016095f830184620015e3565b92915050565b5f805f60608486031215620016295762001628620014ca565b5b5f620016388682870162001519565b93505060206200164b8682870162001519565b92505060406200165e8682870162001551565b9150509250925092565b5f60ff82169050919050565b6200167f8162001668565b82525050565b5f6020820190506200169a5f83018462001674565b92915050565b5f60208284031215620016b857620016b7620014ca565b5b5f620016c78482850162001519565b91505092915050565b5f60208284031215620016e857620016e7620014ca565b5b5f620016f78482850162001551565b91505092915050565b6200170b81620014ed565b82525050565b5f602082019050620017265f83018462001700565b92915050565b5f8060408385031215620017455762001744620014ca565b5b5f620017548582860162001519565b9250506020620017678582860162001519565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680620017b657607f821691505b602082108103620017cc57620017cb62001771565b5b50919050565b5f81519050620017e28162001538565b92915050565b5f602082840312156200180057620017ff620014ca565b5b5f6200180f84828501620017d2565b91505092915050565b7f4e6f7420656e6f75676820636f696e7320696e206661756365740000000000005f82015250565b5f6200184e601a836200141e565b91506200185b8262001818565b602082019050919050565b5f6020820190508181035f8301526200187f8162001840565b9050919050565b5f81519050919050565b5f81905092915050565b5f620018a68262001886565b620018b2818562001890565b9350620018c48185602086016200142e565b80840191505092915050565b5f620018dd82846200189a565b915081905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f62001921826200152f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203620019565762001955620018e8565b5b600182019050919050565b7f44726f7020626f7820616c7265616479206578697374730000000000000000005f82015250565b5f620019976017836200141e565b9150620019a48262001961565b602082019050919050565b5f6020820190508181035f830152620019c88162001989565b9050919050565b7f4e6f7420656e6f75676820636f696e7320746f20756e777261700000000000005f82015250565b5f62001a05601a836200141e565b915062001a1282620019cf565b602082019050919050565b5f6020820190508181035f83015262001a3681620019f7565b9050919050565b5f60408201905062001a525f83018562001700565b62001a616020830184620015e3565b9392505050565b7f596f75206d7573742063726561746520612064726f7020626f782066697273745f82015250565b5f62001a9e6020836200141e565b915062001aab8262001a68565b602082019050919050565b5f6020820190508181035f83015262001acf8162001a90565b9050919050565b7f4e6f7420656e6f75676820636f696e7320696e2064726f7020626f78000000005f82015250565b5f62001b0c601c836200141e565b915062001b198262001ad6565b602082019050919050565b5f6020820190508181035f83015262001b3d8162001afe565b9050919050565b5f819050919050565b5f62001b6d62001b6762001b6184620014ce565b62001b44565b620014ce565b9050919050565b5f62001b808262001b4d565b9050919050565b5f62001b938262001b74565b9050919050565b62001ba58162001b87565b82525050565b5f60408201905062001bc05f830185620015e3565b62001bcf602083018462001b9a565b9392505050565b5f60608201905062001beb5f83018662001700565b62001bfa6020830185620015e3565b62001c096040830184620015e3565b949350505050565b5f62001c1d826200152f565b915062001c2a836200152f565b925082820190508082111562001c455762001c44620018e8565b5b9291505056fe608060405234801561000f575f80fd5b50335f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610081575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016100789190610196565b60405180910390fd5b6100908161009660201b60201c565b506101af565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61018082610157565b9050919050565b61019081610176565b82525050565b5f6020820190506101a95f830184610187565b92915050565b6104ff806101bc5f395ff3fe608060405234801561000f575f80fd5b506004361061004a575f3560e01c8063715018a61461004e5780638d3c100a146100585780638da5cb5b14610074578063f2fde38b14610092575b5f80fd5b6100566100ae565b005b610072600480360381019061006d91906103d8565b6100c1565b005b61007c61013c565b6040516100899190610425565b60405180910390f35b6100ac60048036038101906100a79190610468565b610163565b005b6100b66101e7565b6100bf5f61026e565b565b6100c96101e7565b8073ffffffffffffffffffffffffffffffffffffffff166390b98a116100ed61013c565b846040518363ffffffff1660e01b815260040161010b9291906104a2565b5f604051808303815f87803b158015610122575f80fd5b505af1158015610134573d5f803e3d5ffd5b505050505050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61016b6101e7565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036101db575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016101d29190610425565b60405180910390fd5b6101e48161026e565b50565b6101ef61032f565b73ffffffffffffffffffffffffffffffffffffffff1661020d61013c565b73ffffffffffffffffffffffffffffffffffffffff161461026c5761023061032f565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016102639190610425565b60405180910390fd5b565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f80fd5b5f819050919050565b61034c8161033a565b8114610356575f80fd5b50565b5f8135905061036781610343565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103968261036d565b9050919050565b5f6103a78261038c565b9050919050565b6103b78161039d565b81146103c1575f80fd5b50565b5f813590506103d2816103ae565b92915050565b5f80604083850312156103ee576103ed610336565b5b5f6103fb85828601610359565b925050602061040c858286016103c4565b9150509250929050565b61041f8161038c565b82525050565b5f6020820190506104385f830184610416565b92915050565b6104478161038c565b8114610451575f80fd5b50565b5f813590506104628161043e565b92915050565b5f6020828403121561047d5761047c610336565b5b5f61048a84828501610454565b91505092915050565b61049c8161033a565b82525050565b5f6040820190506104b55f830185610416565b6104c26020830184610493565b939250505056fea26469706673582212202a05c88132ac7f78d55366c9bee04544ecb81ab88c6c5b3e46b0f5a1aad00ed964736f6c63430008140033a2646970667358221220cae359c63c396ae5b0d9f37b6c54a2ec3bfdd898256404304ca071481662c9fc64736f6c63430008140033
Verified Source Code Full Match
Compiler: v0.8.20+commit.a1b79de6
EVM: shanghai
Optimization: No
WrappedAyeAyeCoin.sol 79 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface AyeAyeCoin {
function coinBalanceOf(address _owner) external returns (uint256);
function sendCoin(address _receiver, uint256 _amount) external;
}
contract DropBox is Ownable(msg.sender) {
function collect(uint256 value, AyeAyeCoin aaInt) public onlyOwner {
aaInt.sendCoin(owner(), value);
}
}
contract WrappedAyeAyeCoin is ERC20 {
event DropBoxCreated(address indexed owner);
event ClaimedAndWrapped(uint256 indexed value, address indexed owner);
event Wrapped(uint256 indexed value, address indexed owner);
event Unwrapped(uint256 indexed value, address indexed owner);
bytes constant claimSig = hex"5479f98b";
address constant faucetAddr = 0xcD063B3081Ea55535E5b60a21eff7f14E785A877;
address constant aaAddr = 0x3edDc7ebC7db94f54b72D8Ed1F42cE6A527305bB;
AyeAyeCoin constant aaInt = AyeAyeCoin(aaAddr);
mapping(address => address) public dropBoxes;
constructor() ERC20("Wrapped AyeAyeCoin", "WAAC") {}
function createDropBox() public {
require(dropBoxes[msg.sender] == address(0), "Drop box already exists");
dropBoxes[msg.sender] = address(new DropBox());
emit DropBoxCreated(msg.sender);
}
function claimAndWrap(uint256 value) public {
require(aaInt.coinBalanceOf(faucetAddr) >= value, "Not enough coins in faucet");
for (uint256 i = 0; i < value; i++) {
aaAddr.call(claimSig);
}
_mint(msg.sender, value);
emit ClaimedAndWrapped(value, msg.sender);
}
function wrap(uint256 value) public {
address dropBox = dropBoxes[msg.sender];
require(dropBox != address(0), "You must create a drop box first");
require(aaInt.coinBalanceOf(dropBox) >= value, "Not enough coins in drop box");
DropBox(dropBox).collect(value, aaInt);
_mint(msg.sender, value);
emit Wrapped(value, msg.sender);
}
function unwrap(uint256 value) public {
require(balanceOf(msg.sender) >= value, "Not enough coins to unwrap");
aaInt.sendCoin(msg.sender, value);
_burn(msg.sender, value);
emit Unwrapped(value, msg.sender);
}
function decimals() public pure override returns (uint8) {
return 0;
}
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
dropBoxes 0xd6d2bb98 → address
name 0x06fdde03 → string
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 7 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 value
returns: bool
claimAndWrap 0x7844c393
uint256 value
createDropBox 0xb8bdd4b2
No parameters
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
unwrap 0xde0e9a3e
uint256 value
wrap 0xea598cb0
uint256 value
Recent Transactions
No transactions found for this address