ERC20FaucetStorage.sol (1566B)
1 pragma solidity >=0.8.0; 2 3 // SPDX-License-Identifier: AGPL-3.0-or-later 4 5 contract SingleShotFaucetStorage { 6 // Implements EIP 173 7 address public owner; 8 address newOwner; 9 10 mapping (address => uint256) usedAccounts; 11 address[] public entry; 12 13 // Implements EIP 173 14 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 15 16 // Implements AccountsIndex 17 event AddressAdded(uint256 indexed accountIndex, address _account); // AccountsIndex 18 19 // Implements AccountsIndex 20 uint256 constant public time = 0; 21 22 constructor() { 23 owner = msg.sender; 24 entry.push(address(0)); 25 usedAccounts[address(0)] = 1; 26 } 27 28 // Implements EIP 173 29 function transferOwnership(address _newOwner) external { 30 address _oldOwner; 31 32 require(msg.sender == owner); 33 _oldOwner = owner; 34 35 owner = _newOwner; 36 37 emit OwnershipTransferred(_oldOwner, owner); 38 } 39 40 // Implements AccountsIndex 41 function have(address _account) external view returns (bool) { 42 return usedAccounts[_account] > 0; 43 } 44 45 // Implements AccountsIndex 46 function add(address _account) external returns (bool) { 47 require(msg.sender == owner, 'ERR_AXX'); 48 49 uint256 l; 50 51 l = entry.length; 52 entry.push(_account); 53 usedAccounts[_account] = l; 54 emit AddressAdded(l, _account); 55 return true; 56 } 57 58 // Implements EIP165 59 function supportsInterface(bytes4 _sum) public pure returns (bool) { 60 if (_sum == 0xb7bca625) { // AccountsIndex 61 return true; 62 } 63 if (_sum == 0x01ffc9a7) { // EIP165 64 return true; 65 } 66 if (_sum == 0x9493f8b2) { // EIP173 67 return true; 68 } 69 return false; 70 } 71 }