Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- WhitelistContract
- Optimization enabled
- true
- Compiler version
- v0.8.0+commit.c7dfd78e
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-09-26T15:35:33.847998Z
Contract source code
// SPDX-License-Identifier: No License (None) pragma solidity ^0.8.0; /** * @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 { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { _owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == msg.sender, "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 { emit OwnershipTransferred(_owner, address(0)); _owner = 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"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract WhitelistContract is Ownable { mapping(address => bool) public isWhitelisted; mapping(address => bool) public isBlacklisted; mapping(address => bool) public isSystem; event Whitelist(address indexed _who, bool _status); event Blacklist(address indexed _who, bool _status); event System(address indexed _who, bool _status); modifier onlyOwnerOrSystem() { require(isSystem[msg.sender] || owner() == msg.sender, "Ownable: caller is not the owner or system"); _; } function onlyWhitelisted(address _sender, address _recipient) external view returns (bool) { require(isWhitelisted[_sender], "Address must be whitelisted to initiate a transaction"); require(isWhitelisted[_recipient], "Address must be whitelisted to receive a transaction"); return true; } function setSystem(address _who, bool _status) onlyOwner external { isSystem[_who] = _status; emit System(_who, _status); } function setBlacklisted(address _who, bool _status) onlyOwner external { isBlacklisted[_who] = _status; if(_status) { isWhitelisted[_who] = false; emit Whitelist(_who, false); } emit Blacklist(_who, _status); } function setWhitelisted(address _who, bool _status) onlyOwnerOrSystem external { require(!isBlacklisted[_who], "Address blacklisted"); isWhitelisted[_who] = _status; emit Whitelist(_who, _status); } }
Contract ABI
[{"type":"event","name":"Blacklist","inputs":[{"type":"address","name":"_who","internalType":"address","indexed":true},{"type":"bool","name":"_status","internalType":"bool","indexed":false}],"anonymous":false},{"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":"System","inputs":[{"type":"address","name":"_who","internalType":"address","indexed":true},{"type":"bool","name":"_status","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"Whitelist","inputs":[{"type":"address","name":"_who","internalType":"address","indexed":true},{"type":"bool","name":"_status","internalType":"bool","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isBlacklisted","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isSystem","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isWhitelisted","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"onlyWhitelisted","inputs":[{"type":"address","name":"_sender","internalType":"address"},{"type":"address","name":"_recipient","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":[],"name":"setBlacklisted","inputs":[{"type":"address","name":"_who","internalType":"address"},{"type":"bool","name":"_status","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSystem","inputs":[{"type":"address","name":"_who","internalType":"address"},{"type":"bool","name":"_status","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWhitelisted","inputs":[{"type":"address","name":"_who","internalType":"address"},{"type":"bool","name":"_status","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50600080546001600160a01b0319163390811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36108528061005f6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80639281aa0b116100665780639281aa0b14610111578063c1d8ef0214610124578063d01dd6d214610137578063f2fde38b1461014a578063fe575a871461015d5761009e565b806334cdcf26146100a35780633af32abf146100cc578063416fe85c146100df578063715018a6146100f45780638da5cb5b146100fc575b600080fd5b6100b66100b13660046105d5565b610170565b6040516100c39190610676565b60405180910390f35b6100b66100da3660046105d5565b610185565b6100f26100ed366004610628565b61019a565b005b6100f2610232565b6101046102ab565b6040516100c39190610662565b6100f261011f366004610628565b6102ba565b6100b66101323660046105f6565b610390565b6100f2610145366004610628565b610409565b6100f26101583660046105d5565b6104f4565b6100b661016b3660046105d5565b6105a4565b60036020526000908152604090205460ff1681565b60016020526000908152604090205460ff1681565b336101a36102ab565b6001600160a01b0316146101d25760405162461bcd60e51b81526004016101c9906107e7565b60405180910390fd5b6001600160a01b03821660008181526003602052604090819020805460ff1916841515179055517f80e56673511ab7e754ebf2506b0b3793e855c14df2b6ae5f49023485fb22800d90610226908490610676565b60405180910390a25050565b3361023b6102ab565b6001600160a01b0316146102615760405162461bcd60e51b81526004016101c9906107e7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b3360009081526003602052604090205460ff16806102e75750336102dc6102ab565b6001600160a01b0316145b6103035760405162461bcd60e51b81526004016101c99061079d565b6001600160a01b03821660009081526002602052604090205460ff161561033c5760405162461bcd60e51b81526004016101c990610770565b6001600160a01b03821660008181526001602052604090819020805460ff1916841515179055517f5a25e09a5dba33161281055e015f1279b6b10204d8f90dd56a8ce2b82322d43d90610226908490610676565b6001600160a01b03821660009081526001602052604081205460ff166103c85760405162461bcd60e51b81526004016101c99061071b565b6001600160a01b03821660009081526001602052604090205460ff166104005760405162461bcd60e51b81526004016101c990610681565b50600192915050565b336104126102ab565b6001600160a01b0316146104385760405162461bcd60e51b81526004016101c9906107e7565b6001600160a01b0382166000908152600260205260409020805460ff191682158015919091179091556104bb576001600160a01b038216600081815260016020526040808220805460ff19169055517f5a25e09a5dba33161281055e015f1279b6b10204d8f90dd56a8ce2b82322d43d916104b291610676565b60405180910390a25b816001600160a01b03167ff7e58a63a036e3a7ef7921f83b6ae47930cf5c293dd3bfe7a857c6863409046d826040516102269190610676565b336104fd6102ab565b6001600160a01b0316146105235760405162461bcd60e51b81526004016101c9906107e7565b6001600160a01b0381166105495760405162461bcd60e51b81526004016101c9906106d5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60026020526000908152604090205460ff1681565b80356001600160a01b03811681146105d057600080fd5b919050565b6000602082840312156105e6578081fd5b6105ef826105b9565b9392505050565b60008060408385031215610608578081fd5b610611836105b9565b915061061f602084016105b9565b90509250929050565b6000806040838503121561063a578182fd5b610643836105b9565b915060208301358015158114610657578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b60208082526034908201527f41646472657373206d7573742062652077686974656c697374656420746f207260408201527332b1b2b4bb329030903a3930b739b0b1ba34b7b760611b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526035908201527f41646472657373206d7573742062652077686974656c697374656420746f20696040820152743734ba34b0ba329030903a3930b739b0b1ba34b7b760591b606082015260800190565b6020808252601390820152721059191c995cdcc8189b1858dadb1a5cdd1959606a1b604082015260600190565b6020808252602a908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015269206f722073797374656d60b01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea26469706673582212203543db6b6683f77762eabfc30e1932e5e4a95cf7f32d08f806fbad607798fae764736f6c63430008000033
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80639281aa0b116100665780639281aa0b14610111578063c1d8ef0214610124578063d01dd6d214610137578063f2fde38b1461014a578063fe575a871461015d5761009e565b806334cdcf26146100a35780633af32abf146100cc578063416fe85c146100df578063715018a6146100f45780638da5cb5b146100fc575b600080fd5b6100b66100b13660046105d5565b610170565b6040516100c39190610676565b60405180910390f35b6100b66100da3660046105d5565b610185565b6100f26100ed366004610628565b61019a565b005b6100f2610232565b6101046102ab565b6040516100c39190610662565b6100f261011f366004610628565b6102ba565b6100b66101323660046105f6565b610390565b6100f2610145366004610628565b610409565b6100f26101583660046105d5565b6104f4565b6100b661016b3660046105d5565b6105a4565b60036020526000908152604090205460ff1681565b60016020526000908152604090205460ff1681565b336101a36102ab565b6001600160a01b0316146101d25760405162461bcd60e51b81526004016101c9906107e7565b60405180910390fd5b6001600160a01b03821660008181526003602052604090819020805460ff1916841515179055517f80e56673511ab7e754ebf2506b0b3793e855c14df2b6ae5f49023485fb22800d90610226908490610676565b60405180910390a25050565b3361023b6102ab565b6001600160a01b0316146102615760405162461bcd60e51b81526004016101c9906107e7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b3360009081526003602052604090205460ff16806102e75750336102dc6102ab565b6001600160a01b0316145b6103035760405162461bcd60e51b81526004016101c99061079d565b6001600160a01b03821660009081526002602052604090205460ff161561033c5760405162461bcd60e51b81526004016101c990610770565b6001600160a01b03821660008181526001602052604090819020805460ff1916841515179055517f5a25e09a5dba33161281055e015f1279b6b10204d8f90dd56a8ce2b82322d43d90610226908490610676565b6001600160a01b03821660009081526001602052604081205460ff166103c85760405162461bcd60e51b81526004016101c99061071b565b6001600160a01b03821660009081526001602052604090205460ff166104005760405162461bcd60e51b81526004016101c990610681565b50600192915050565b336104126102ab565b6001600160a01b0316146104385760405162461bcd60e51b81526004016101c9906107e7565b6001600160a01b0382166000908152600260205260409020805460ff191682158015919091179091556104bb576001600160a01b038216600081815260016020526040808220805460ff19169055517f5a25e09a5dba33161281055e015f1279b6b10204d8f90dd56a8ce2b82322d43d916104b291610676565b60405180910390a25b816001600160a01b03167ff7e58a63a036e3a7ef7921f83b6ae47930cf5c293dd3bfe7a857c6863409046d826040516102269190610676565b336104fd6102ab565b6001600160a01b0316146105235760405162461bcd60e51b81526004016101c9906107e7565b6001600160a01b0381166105495760405162461bcd60e51b81526004016101c9906106d5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60026020526000908152604090205460ff1681565b80356001600160a01b03811681146105d057600080fd5b919050565b6000602082840312156105e6578081fd5b6105ef826105b9565b9392505050565b60008060408385031215610608578081fd5b610611836105b9565b915061061f602084016105b9565b90509250929050565b6000806040838503121561063a578182fd5b610643836105b9565b915060208301358015158114610657578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b60208082526034908201527f41646472657373206d7573742062652077686974656c697374656420746f207260408201527332b1b2b4bb329030903a3930b739b0b1ba34b7b760611b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526035908201527f41646472657373206d7573742062652077686974656c697374656420746f20696040820152743734ba34b0ba329030903a3930b739b0b1ba34b7b760591b606082015260800190565b6020808252601390820152721059191c995cdcc8189b1858dadb1a5cdd1959606a1b604082015260600190565b6020808252602a908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015269206f722073797374656d60b01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea26469706673582212203543db6b6683f77762eabfc30e1932e5e4a95cf7f32d08f806fbad607798fae764736f6c63430008000033