Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- PunkForbiddenTlds
- Optimization enabled
- true
- Compiler version
- v0.8.4+commit.c7e474f2
- Optimization runs
- 200
- Verified at
- 2022-02-25T11:20:01.680474Z
contracts/PunkForbiddenTlds.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
contract PunkForbiddenTlds is Ownable {
// The purpose of this contract is to hold a registry TLD names that are either forbidden or have been already created/used.
// There may be multiple Punk TLD Factory contracts and they need a joint registry of used or forbidden TLDs.
mapping (string => bool) public forbidden; // forbidden TLDs
mapping (address => bool) public factoryAddresses; // list of TLD factories that are allowed to add forbidden TLDs
event ForbiddenTldAdded(address indexed sender, string indexed tldName);
event ForbiddenTldRemoved(address indexed sender, string indexed tldName);
event FactoryAddressAdded(address indexed sender, address indexed fAddress);
event FactoryAddressRemoved(address indexed sender, address indexed fAddress);
modifier onlyFactory {
require(factoryAddresses[msg.sender] == true, "Caller is not a factory address.");
_;
}
constructor() {
forbidden[".eth"] = true;
forbidden[".com"] = true;
forbidden[".org"] = true;
forbidden[".net"] = true;
}
// PUBLIC
function isTldForbidden(string memory _name) public view returns (bool) {
return forbidden[_name];
}
// FACTORY
function addForbiddenTld(string memory _name) public onlyFactory {
forbidden[_name] = true;
emit ForbiddenTldAdded(msg.sender, _name);
}
// OWNER
function ownerAddForbiddenTld(string memory _name) public onlyOwner {
forbidden[_name] = true;
emit ForbiddenTldAdded(msg.sender, _name);
}
function removeForbiddenTld(string memory _name) public onlyOwner {
forbidden[_name] = false;
emit ForbiddenTldRemoved(msg.sender, _name);
}
function addFactoryAddress(address _fAddr) public onlyOwner {
factoryAddresses[_fAddr] = true;
emit FactoryAddressAdded(msg.sender, _fAddr);
}
function removeFactoryAddress(address _fAddr) public onlyOwner {
factoryAddresses[_fAddr] = false;
emit FactoryAddressRemoved(msg.sender, _fAddr);
}
}
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 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() == _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);
}
}
@openzeppelin/contracts/utils/Context.sol
// 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;
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"FactoryAddressAdded","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"address","name":"fAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"FactoryAddressRemoved","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"address","name":"fAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ForbiddenTldAdded","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"string","name":"tldName","internalType":"string","indexed":true}],"anonymous":false},{"type":"event","name":"ForbiddenTldRemoved","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"string","name":"tldName","internalType":"string","indexed":true}],"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":"function","stateMutability":"nonpayable","outputs":[],"name":"addFactoryAddress","inputs":[{"type":"address","name":"_fAddr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addForbiddenTld","inputs":[{"type":"string","name":"_name","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"factoryAddresses","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"forbidden","inputs":[{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTldForbidden","inputs":[{"type":"string","name":"_name","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"ownerAddForbiddenTld","inputs":[{"type":"string","name":"_name","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeFactoryAddress","inputs":[{"type":"address","name":"_fAddr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeForbiddenTld","inputs":[{"type":"string","name":"_name","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b5061001a336100c6565b600180604051610034906305ccae8d60e31b815260040190565b90815260408051918290036020018220805493151560ff19948516179055632e636f6d60e01b825260016004808401829052825193849003602490810185208054871684179055632e6f726760e01b8552848201839052835194859003810185208054871684179055630b9b995d60e21b85529084018290529151928390039091019091208054909216179055610116565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61072d806101256000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b14610134578063a051d9c31461014f578063b098c04b14610162578063d1c4069414610175578063f119d73b14610198578063f2fde38b146101ab57600080fd5b80630fda4464146100ae57806318c0c695146100f1578063715018a61461010657806377ad04861461010e5780638a39a47c14610121575b600080fd5b6100dc6100bc3660046105c9565b805160208183018101805160018252928201919093012091525460ff1681565b60405190151581526020015b60405180910390f35b6101046100ff36600461059b565b6101be565b005b61010461023e565b61010461011c3660046105c9565b610274565b61010461012f3660046105c9565b610311565b6000546040516001600160a01b0390911681526020016100e8565b61010461015d36600461059b565b6103e7565b6101046101703660046105c9565b61045b565b6100dc61018336600461059b565b60026020526000908152604090205460ff1681565b6100dc6101a63660046105c9565b610485565b6101046101b936600461059b565b6104b0565b6000546001600160a01b031633146101f15760405162461bcd60e51b81526004016101e8906106ac565b60405180910390fd5b6001600160a01b038116600081815260026020526040808220805460ff191660011790555133917f5928fa36137089d200461b1b8492840afb1c250ed4dc142dc2bc16f9ca40748991a350565b6000546001600160a01b031633146102685760405162461bcd60e51b81526004016101e8906106ac565b610272600061054b565b565b6000546001600160a01b0316331461029e5760405162461bcd60e51b81526004016101e8906106ac565b60006001826040516102b09190610673565b908152604051908190036020018120805492151560ff19909316929092179091556102dc908290610673565b6040519081900381209033907ff167cd6644294b01272a80ea13791e118f410640cea456201e08cb47a5a789e890600090a350565b3360009081526002602052604090205460ff1615156001146103755760405162461bcd60e51b815260206004820181905260248201527f43616c6c6572206973206e6f74206120666163746f727920616464726573732e60448201526064016101e8565b600180826040516103869190610673565b908152604051908190036020018120805492151560ff19909316929092179091556103b2908290610673565b6040519081900381209033907f4fe79af0983ce37f1523f605d861214d7dfbe0fcc1f26a928d444514b952898390600090a350565b6000546001600160a01b031633146104115760405162461bcd60e51b81526004016101e8906106ac565b6001600160a01b038116600081815260026020526040808220805460ff191690555133917fbc52ee828ce29bbdf8f0453396660543267e66d5695f8573521ee42b95cf643d91a350565b6000546001600160a01b031633146103755760405162461bcd60e51b81526004016101e8906106ac565b60006001826040516104979190610673565b9081526040519081900360200190205460ff1692915050565b6000546001600160a01b031633146104da5760405162461bcd60e51b81526004016101e8906106ac565b6001600160a01b03811661053f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101e8565b6105488161054b565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156105ac578081fd5b81356001600160a01b03811681146105c2578182fd5b9392505050565b6000602082840312156105da578081fd5b813567ffffffffffffffff808211156105f1578283fd5b818401915084601f830112610604578283fd5b813581811115610616576106166106e1565b604051601f8201601f19908116603f0116810190838211818310171561063e5761063e6106e1565b81604052828152876020848701011115610656578586fd5b826020860160208301379182016020019490945295945050505050565b60008251815b818110156106935760208186018101518583015201610679565b818111156106a15782828501525b509190910192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052604160045260246000fdfea264697066735822122004228a91f2c39c6ab54e943e33aac6d9dd82d4b322f3937c4ca7e397f897d1f964736f6c63430008040033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b14610134578063a051d9c31461014f578063b098c04b14610162578063d1c4069414610175578063f119d73b14610198578063f2fde38b146101ab57600080fd5b80630fda4464146100ae57806318c0c695146100f1578063715018a61461010657806377ad04861461010e5780638a39a47c14610121575b600080fd5b6100dc6100bc3660046105c9565b805160208183018101805160018252928201919093012091525460ff1681565b60405190151581526020015b60405180910390f35b6101046100ff36600461059b565b6101be565b005b61010461023e565b61010461011c3660046105c9565b610274565b61010461012f3660046105c9565b610311565b6000546040516001600160a01b0390911681526020016100e8565b61010461015d36600461059b565b6103e7565b6101046101703660046105c9565b61045b565b6100dc61018336600461059b565b60026020526000908152604090205460ff1681565b6100dc6101a63660046105c9565b610485565b6101046101b936600461059b565b6104b0565b6000546001600160a01b031633146101f15760405162461bcd60e51b81526004016101e8906106ac565b60405180910390fd5b6001600160a01b038116600081815260026020526040808220805460ff191660011790555133917f5928fa36137089d200461b1b8492840afb1c250ed4dc142dc2bc16f9ca40748991a350565b6000546001600160a01b031633146102685760405162461bcd60e51b81526004016101e8906106ac565b610272600061054b565b565b6000546001600160a01b0316331461029e5760405162461bcd60e51b81526004016101e8906106ac565b60006001826040516102b09190610673565b908152604051908190036020018120805492151560ff19909316929092179091556102dc908290610673565b6040519081900381209033907ff167cd6644294b01272a80ea13791e118f410640cea456201e08cb47a5a789e890600090a350565b3360009081526002602052604090205460ff1615156001146103755760405162461bcd60e51b815260206004820181905260248201527f43616c6c6572206973206e6f74206120666163746f727920616464726573732e60448201526064016101e8565b600180826040516103869190610673565b908152604051908190036020018120805492151560ff19909316929092179091556103b2908290610673565b6040519081900381209033907f4fe79af0983ce37f1523f605d861214d7dfbe0fcc1f26a928d444514b952898390600090a350565b6000546001600160a01b031633146104115760405162461bcd60e51b81526004016101e8906106ac565b6001600160a01b038116600081815260026020526040808220805460ff191690555133917fbc52ee828ce29bbdf8f0453396660543267e66d5695f8573521ee42b95cf643d91a350565b6000546001600160a01b031633146103755760405162461bcd60e51b81526004016101e8906106ac565b60006001826040516104979190610673565b9081526040519081900360200190205460ff1692915050565b6000546001600160a01b031633146104da5760405162461bcd60e51b81526004016101e8906106ac565b6001600160a01b03811661053f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101e8565b6105488161054b565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156105ac578081fd5b81356001600160a01b03811681146105c2578182fd5b9392505050565b6000602082840312156105da578081fd5b813567ffffffffffffffff808211156105f1578283fd5b818401915084601f830112610604578283fd5b813581811115610616576106166106e1565b604051601f8201601f19908116603f0116810190838211818310171561063e5761063e6106e1565b81604052828152876020848701011115610656578586fd5b826020860160208301379182016020019490945295945050505050565b60008251815b818110156106935760208186018101518583015201610679565b818111156106a15782828501525b509190910192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052604160045260246000fdfea264697066735822122004228a91f2c39c6ab54e943e33aac6d9dd82d4b322f3937c4ca7e397f897d1f964736f6c63430008040033