Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
- Contract name:
- Airdrop
- Optimization enabled
- false
- Compiler version
- v0.6.12+commit.27d51765
- EVM Version
- default
- Verified at
- 2022-10-27T15:07:00.498690Z
Contract source code
// SPDX-License-Identifier: No License (None) pragma solidity ^0.6.9; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/ownership/Ownable.sol * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the * build/artifacts folder) as well as the vanilla Ownable implementation from an openzeppelin version. */ contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @return the address of the owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(),"Not Owner"); _; } /** * @return true if `msg.sender` is the owner of the contract. */ function isOwner() public view returns (bool) { return msg.sender == _owner; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0),"Zero address not allowed"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } interface IERC20 { function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function transfer(address recipient, uint256 amount) external returns (bool); function mint(address to, uint256 amount) external returns (bool); } contract Airdrop is Ownable { address public signer; mapping (address => mapping(address => bool)) public isReceived; // token => user => isReceived mapping (address => uint256) public dropAmount; // token => amount of token to drop event SetSigner(address signer); event SetDropAmount(address token, uint256 dropAmount); function setSigner(address _address) external onlyOwner returns(bool) { signer = _address; emit SetSigner(_address); return true; } function setDropAmount(address _token, uint256 _dropAmount) external onlyOwner returns(bool) { dropAmount[_token] = _dropAmount; emit SetDropAmount(_token, _dropAmount); return true; } function faucet(address token, bytes32 r, bytes32 s, uint8 v) external returns(bool){ require(signer == ecrecover(keccak256(abi.encodePacked(token, msg.sender, dropAmount[token])), v, r, s), "ECDSA signature is not valid."); require(!isReceived[token][msg.sender], "Tokens already received"); isReceived[token][msg.sender] == true; IERC20(token).mint(msg.sender, dropAmount[token]); return true; } function airdrop(address token, uint256 amount, address[] calldata recipients) external onlyOwner returns(bool) { for (uint i = 0; i < recipients.length; i++) { IERC20(token).transfer(recipients[i], amount); } return true; } function airdrop2(address token, uint256[] calldata amounts, address[] calldata recipients) external onlyOwner returns(bool) { require(amounts.length == recipients.length); for (uint i = 0; i < recipients.length; i++) { IERC20(token).transfer(recipients[i], amounts[i]); } return true; } }
Contract ABI
[{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SetDropAmount","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"dropAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetSigner","inputs":[{"type":"address","name":"signer","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"airdrop","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address[]","name":"recipients","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"airdrop2","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256[]","name":"amounts","internalType":"uint256[]"},{"type":"address[]","name":"recipients","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"dropAmount","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"faucet","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"},{"type":"uint8","name":"v","internalType":"uint8"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOwner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isReceived","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setDropAmount","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_dropAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setSigner","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"signer","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063793f3f6011610071578063793f3f601461034a5780637f892ab1146104035780638da5cb5b1461045b5780638f32d59b1461048f578063a749f188146104af578063f2fde38b14610513576100b4565b806318b57dbf146100b9578063238ac933146101345780633ad73752146101685780634651370f146101e25780636c19e783146102e6578063715018a614610340575b600080fd5b61011c600480360360808110156100cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff169060200190929190505050610557565b60405180821515815260200191505060405180910390f35b61013c6109a8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101ca6004803603604081101561017e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109ce565b60405180821515815260200191505060405180910390f35b6102ce600480360360608110156101f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561023557600080fd5b82018360208201111561024757600080fd5b8035906020019184602083028401116401000000008311171561026957600080fd5b90919293919293908035906020019064010000000081111561028a57600080fd5b82018360208201111561029c57600080fd5b803590602001918460208302840111640100000000831117156102be57600080fd5b90919293919293905050506109fd565b60405180821515815260200191505060405180910390f35b610328600480360360208110156102fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b9b565b60405180821515815260200191505060405180910390f35b610348610cae565b005b6103eb6004803603606081101561036057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156103a757600080fd5b8201836020820111156103b957600080fd5b803590602001918460208302840111640100000000831117156103db57600080fd5b9091929391929390505050610de6565b60405180821515815260200191505060405180910390f35b6104456004803603602081101561041957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f5f565b6040518082815260200191505060405180910390f35b610463610f77565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610497610fa0565b60405180821515815260200191505060405180910390f35b6104fb600480360360408110156104c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ff7565b60405180821515815260200191505060405180910390f35b6105556004803603602081101561052957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611116565b005b600060018533600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051602001808473ffffffffffffffffffffffffffffffffffffffff1660601b81526014018373ffffffffffffffffffffffffffffffffffffffff1660601b815260140182815260200193505050506040516020818303038152906040528051906020012083868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561065a573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610726576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4543445341207369676e6174757265206973206e6f742076616c69642e00000081525060200191505060405180910390fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610823576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f546f6b656e7320616c726561647920726563656976656400000000000000000081525060200191505060405180910390fd5b60011515600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a905050508473ffffffffffffffffffffffffffffffffffffffff166340c10f1933600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561096057600080fd5b505af1158015610974573d6000803e3d6000fd5b505050506040513d602081101561098a57600080fd5b81019080805190602001909291905050505060019050949350505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b6000610a07610fa0565b610a79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74204f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b828290508585905014610a8b57600080fd5b60005b83839050811015610b8d578673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb858584818110610ac157fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16888885818110610aea57fe5b905060200201356040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610b4457600080fd5b505af1158015610b58573d6000803e3d6000fd5b505050506040513d6020811015610b6e57600080fd5b8101908080519060200190929190505050508080600101915050610a8e565b506001905095945050505050565b6000610ba5610fa0565b610c17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74204f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fbb10aee7ef5a307b8097c6a7f2892b909ff1736fd24a6a5260640c185f7153b682604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a160019050919050565b610cb6610fa0565b610d28576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74204f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000610df0610fa0565b610e62576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74204f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b83839050811015610f52578573ffffffffffffffffffffffffffffffffffffffff1663a9059cbb858584818110610e9857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16876040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f0957600080fd5b505af1158015610f1d573d6000803e3d6000fd5b505050506040513d6020811015610f3357600080fd5b8101908080519060200190929190505050508080600101915050610e65565b5060019050949350505050565b60036020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6000611001610fa0565b611073576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74204f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdfd5e2adfc7296973018a86cbb4eaa1086ad784161f8b7f8dd410d5e282941028383604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001905092915050565b61111e610fa0565b611190576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f4e6f74204f776e6572000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6111998161119c565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561123f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f5a65726f2061646472657373206e6f7420616c6c6f776564000000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea26469706673582212206acf074a2ecdc6afa5ad85e5ccdedbfa90d5221837fca9c11e4ef36a375a74ab64736f6c634300060c0033