Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Sponsored
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 16437644 | 129 days 1 hr ago | IN | Contract Creation | 0 ETH | 0.0121303 |
Loading...
Loading
Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xfeA232...70612Cc1
Contract Name:
Whitelist
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../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. * * By default, the owner account will be the one that deploys the contract. 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; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @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 { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /// @notice An error used to indicate that an action could not be completed because either the `msg.sender` or /// `msg.origin` is not authorized. error Unauthorized(); /// @notice An error used to indicate that an action could not be completed because the contract either already existed /// or entered an illegal condition which is not recoverable from. error IllegalState(); /// @notice An error used to indicate that an action could not be completed because of an illegal argument was passed /// to the function. error IllegalArgument();
//SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "../base/Errors.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../libraries/Sets.sol"; /// @title Whitelist /// @author Mellow Finance interface IWhitelist { /// @dev Emitted when a contract is added to the whitelist. /// /// @param account The account that was added to the whitelist. event AccountAdded(address account); /// @dev Emitted when a contract is removed from the whitelist. /// /// @param account The account that was removed from the whitelist. event AccountRemoved(address account); /// @dev Emitted when the whitelist is deactivated. event WhitelistDisabled(); /// @dev Returns the list of addresses that are whitelisted for the given contract address. /// /// @return addresses The addresses that are whitelisted to interact with the given contract. function getAddresses() external view returns (address[] memory addresses); /// @dev Returns the disabled status of a given whitelist. /// /// @return disabled A flag denoting if the given whitelist is disabled. function disabled() external view returns (bool); /// @dev Adds an contract to the whitelist. /// /// @param caller The address to add to the whitelist. function add(address caller) external; /// @dev Adds a contract to the whitelist. /// /// @param caller The address to remove from the whitelist. function remove(address caller) external; /// @dev Disables the whitelist of the target whitelisted contract. /// /// This can only occur once. Once the whitelist is disabled, then it cannot be reenabled. function disable() external; /// @dev Checks that the `msg.sender` is whitelisted when it is not an EOA. /// /// @param account The account to check. /// /// @return whitelisted A flag denoting if the given account is whitelisted. function isWhitelisted(address account) external view returns (bool); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /// @title Sets /// @author Mellow Finance library Sets { using Sets for AddressSet; /// @notice A data structure holding an array of values with an index mapping for O(1) lookup. struct AddressSet { address[] values; mapping(address => uint256) indexes; } /// @dev Add a value to a Set /// /// @param self The Set. /// @param value The value to add. /// /// @return Whether the operation was successful (unsuccessful if the value is already contained in the Set) function add(AddressSet storage self, address value) internal returns (bool) { if (self.contains(value)) { return false; } self.values.push(value); self.indexes[value] = self.values.length; return true; } /// @dev Remove a value from a Set /// /// @param self The Set. /// @param value The value to remove. /// /// @return Whether the operation was successful (unsuccessful if the value was not contained in the Set) function remove(AddressSet storage self, address value) internal returns (bool) { uint256 index = self.indexes[value]; if (index == 0) { return false; } // Normalize the index since we know that the element is in the set. index--; uint256 lastIndex = self.values.length - 1; if (index != lastIndex) { address lastValue = self.values[lastIndex]; self.values[index] = lastValue; self.indexes[lastValue] = index + 1; } self.values.pop(); delete self.indexes[value]; return true; } /// @dev Returns true if the value exists in the Set /// /// @param self The Set. /// @param value The value to check. /// /// @return True if the value is contained in the Set, False if it is not. function contains(AddressSet storage self, address value) internal view returns (bool) { return self.indexes[value] != 0; } }
pragma solidity ^0.8.11; import "./base/Errors.sol"; import "./interfaces/IWhitelist.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./libraries/Sets.sol"; /// @title Whitelist /// @author Mellow Finance contract Whitelist is IWhitelist, Ownable { using Sets for Sets.AddressSet; Sets.AddressSet addresses; /// @inheritdoc IWhitelist bool public override disabled; constructor() Ownable() {} /// @inheritdoc IWhitelist function getAddresses() external view returns (address[] memory) { return addresses.values; } /// @inheritdoc IWhitelist function add(address caller) external override { _onlyAdmin(); if (disabled) { revert IllegalState(); } addresses.add(caller); emit AccountAdded(caller); } /// @inheritdoc IWhitelist function remove(address caller) external override { _onlyAdmin(); if (disabled) { revert IllegalState(); } addresses.remove(caller); emit AccountRemoved(caller); } /// @inheritdoc IWhitelist function disable() external override { _onlyAdmin(); disabled = true; emit WhitelistDisabled(); } /// @inheritdoc IWhitelist function isWhitelisted(address account) external view override returns (bool) { return disabled || addresses.contains(account); } /// @dev Reverts if the caller is not the contract owner. function _onlyAdmin() internal view { if (msg.sender != owner()) { revert Unauthorized(); } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"IllegalState","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"AccountAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"AccountRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"WhitelistDisabled","type":"event"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"remove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61075c8061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063715018a611610066578063715018a6146100f05780638da5cb5b146100f8578063a39fac1214610113578063ee07080514610128578063f2fde38b1461013557600080fd5b80630a3b0a4f1461009857806329092d0e146100ad5780632f2770db146100c05780633af32abf146100c8575b600080fd5b6100ab6100a6366004610621565b610148565b005b6100ab6100bb366004610621565b6101c0565b6100ab610231565b6100db6100d6366004610621565b610271565b60405190151581526020015b60405180910390f35b6100ab6102a2565b6000546040516001600160a01b0390911681526020016100e7565b61011b6102b6565b6040516100e79190610651565b6003546100db9060ff1681565b6100ab610143366004610621565b61031b565b610150610399565b60035460ff161561017457604051634a613c4160e01b815260040160405180910390fd5b61017f6001826103c3565b506040516001600160a01b03821681527f8f42195a0bbfa58954be4349deb9efc38bdb9c298e529f705f8bc1e38bce0399906020015b60405180910390a150565b6101c8610399565b60035460ff16156101ec57604051634a613c4160e01b815260040160405180910390fd5b6101f7600182610433565b506040516001600160a01b03821681527fbf2e373b8263f701e10efcac80ea442afcb29c6852b3a42b0b46cc8edaaf54a7906020016101b5565b610239610399565b6003805460ff191660011790556040517f212c6e1d3045c9581ef0adf2504dbb1d137f52f38162ccf77a16c69d14eba5c390600090a1565b60035460009060ff168061029c57506001600160a01b03821660009081526002602052604090205415155b92915050565b6102aa610577565b6102b460006105d1565b565b6060600160000180548060200260200160405190810160405280929190818152602001828054801561031157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116102f3575b5050505050905090565b610323610577565b6001600160a01b03811661038d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610396816105d1565b50565b6000546001600160a01b031633146102b4576040516282b42960e81b815260040160405180910390fd5b6001600160a01b0381166000908152600183016020526040812054156103eb5750600061029c565b508154600180820184556000848152602080822090930180546001600160a01b0319166001600160a01b03959095169485179055845493815293810190915260409092205590565b6001600160a01b03811660009081526001830160205260408120548061045d57600091505061029c565b80610467816106b4565b85549092506000915061047c906001906106cb565b905080821461051c57600085600001828154811061049c5761049c6106e2565b60009182526020909120015486546001600160a01b03909116915081908790859081106104cb576104cb6106e2565b600091825260209091200180546001600160a01b0319166001600160a01b03929092169190911790556104ff8360016106f8565b6001600160a01b0390911660009081526001870160205260409020555b845485908061052d5761052d610710565b60008281526020808220600019908401810180546001600160a01b03191690559092019092556001600160a01b039590951681526001958601909452505060408220919091555090565b6000546001600160a01b031633146102b45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610384565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561063357600080fd5b81356001600160a01b038116811461064a57600080fd5b9392505050565b6020808252825182820181905260009190848201906040850190845b818110156106925783516001600160a01b03168352928401929184019160010161066d565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b6000816106c3576106c361069e565b506000190190565b6000828210156106dd576106dd61069e565b500390565b634e487b7160e01b600052603260045260246000fd5b6000821982111561070b5761070b61069e565b500190565b634e487b7160e01b600052603160045260246000fdfea26469706673582212209cdba945589f5bf33a58674786bb4742b609864f4f23299d4dd71bab67c4ccf964736f6c634300080b0033
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.