Source Code
Overview
S Balance
More Info
ContractCreator
Multichain Info
N/A
| Transaction Hash |
Method
|
Block
|
From
|
To
|
Amount
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
| Parent Transaction Hash | Block | From | To | Amount | ||
|---|---|---|---|---|---|---|
| 10272969 | 3 days ago | 0 S |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
SonicRegistrarV2
Compiler Version
v0.8.33+commit.64118f21
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
/*
Version 2.0 - Enhanced Registrar with Bulk Operations
*/
pragma solidity ^0.8.20;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
/**
* @title SonicRegistrarV2
* @notice Handles domain registration and renewal with bulk operations
*/
contract SonicRegistrarV2 is
Initializable,
OwnableUpgradeable,
ReentrancyGuardUpgradeable,
UUPSUpgradeable
{
// ========== PRICING CONSTANTS ==========
uint256 public constant THREECHAR = 15 ether;
uint256 public constant FOURCHAR = 10 ether;
uint256 public constant FIVECHAR = 7.5 ether;
uint256 public constant SIXPLUSCHAR = 5 ether;
uint256 public constant YEAR = 365 days;
uint256 public constant MAX_REGISTRATION_YEARS = 5;
// ========== DISCOUNT TIERS ==========
struct DiscountTier {
uint256 yearCount;
uint256 discount; // Basis points (e.g., 500 = 5%)
}
DiscountTier[] public discountTiers;
// ========== STATE ==========
ISonicRegistryV2 public registry;
// ========== EVENTS ==========
event DomainRegistered(
string indexed name,
address indexed owner,
uint256 price,
uint256 yearCount,
uint256 tokenId
);
event DomainRenewed(
string indexed name,
uint256 indexed tokenId,
uint256 price,
uint256 yearCount
);
event BulkRegistration(address indexed owner, uint256 count, uint256 totalPrice);
event BulkRenewal(address indexed owner, uint256 count, uint256 totalPrice);
event PaymentWithdrawn(address indexed to, uint256 amount);
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
function initialize(address _registry) public initializer {
__Ownable_init(msg.sender);
__ReentrancyGuard_init();
__UUPSUpgradeable_init();
registry = ISonicRegistryV2(_registry);
// Setup discount tiers
discountTiers.push(DiscountTier({yearCount: 2, discount: 500})); // 5% off
discountTiers.push(DiscountTier({yearCount: 3, discount: 1000})); // 10% off
discountTiers.push(DiscountTier({yearCount: 4, discount: 1500})); // 15% off
discountTiers.push(DiscountTier({yearCount: 5, discount: 2000})); // 20% off
}
// ========== PRICING ==========
function getBasePrice(string memory name) public pure returns (uint256) {
uint256 length = bytes(name).length;
if (length == 3) return THREECHAR;
if (length == 4) return FOURCHAR;
if (length == 5) return FIVECHAR;
return SIXPLUSCHAR;
}
function getDiscount(uint256 yearCount) public view returns (uint256) {
if (yearCount == 1) return 0;
for (uint256 i = 0; i < discountTiers.length; i++) {
if (discountTiers[i].yearCount == yearCount) {
return discountTiers[i].discount;
}
}
return 0;
}
function calculatePrice(string memory name, uint256 yearCount)
public
view
returns (uint256)
{
require(
yearCount > 0 && yearCount <= MAX_REGISTRATION_YEARS,
"Invalid year count"
);
uint256 basePrice = getBasePrice(name);
uint256 totalBasePrice = basePrice * yearCount;
uint256 discount = getDiscount(yearCount);
if (discount == 0) return totalBasePrice;
uint256 discountAmount = (totalBasePrice * discount) / 10000;
return totalBasePrice - discountAmount;
}
// ========== REGISTRATION ==========
function register(string calldata name, uint256 yearCount)
external
payable
nonReentrant
{
require(isValidName(name), "Invalid name");
require(registry.available(name), "Name taken");
require(
yearCount > 0 && yearCount <= MAX_REGISTRATION_YEARS,
"Invalid year count"
);
uint256 price = calculatePrice(name, yearCount);
require(msg.value == price, "Incorrect payment");
uint256 tokenId = registry.register(name, msg.sender, yearCount * YEAR);
emit DomainRegistered(name, msg.sender, price, yearCount, tokenId);
}
/**
* @notice Register multiple domains at once
* @dev All domains must be available and payment must be exact
* @param names Array of domain names
* @param yearCounts Array of year counts for each domain
*/
function registerBulk(
string[] calldata names,
uint256[] calldata yearCounts
) external payable nonReentrant {
require(names.length == yearCounts.length, "Array length mismatch");
require(names.length > 0, "Empty arrays");
require(names.length <= 20, "Too many domains"); // Gas limit protection
uint256 totalPrice = 0;
// Calculate total price and validate
for (uint256 i = 0; i < names.length; i++) {
require(isValidName(names[i]), "Invalid name");
require(registry.available(names[i]), "Name taken");
require(
yearCounts[i] > 0 && yearCounts[i] <= MAX_REGISTRATION_YEARS,
"Invalid year count"
);
totalPrice += calculatePrice(names[i], yearCounts[i]);
}
require(msg.value == totalPrice, "Incorrect payment");
// Register all domains
for (uint256 i = 0; i < names.length; i++) {
uint256 tokenId = registry.register(
names[i],
msg.sender,
yearCounts[i] * YEAR
);
emit DomainRegistered(
names[i],
msg.sender,
calculatePrice(names[i], yearCounts[i]),
yearCounts[i],
tokenId
);
}
emit BulkRegistration(msg.sender, names.length, totalPrice);
}
// ========== RENEWAL ==========
function renew(string calldata name, uint256 yearCount)
external
payable
nonReentrant
{
uint256 tokenId = registry.nameToTokenId(name);
require(tokenId != 0, "Domain not found");
require(
yearCount > 0 && yearCount <= MAX_REGISTRATION_YEARS,
"Invalid year count"
);
uint256 price = calculatePrice(name, yearCount);
require(msg.value == price, "Incorrect payment");
registry.extend(tokenId, yearCount * YEAR);
emit DomainRenewed(name, tokenId, price, yearCount);
}
/**
* @notice Renew multiple domains at once
* @dev Useful for portfolio management
* @param tokenIds Array of token IDs to renew
* @param yearCounts Array of year counts for each domain
*/
function renewBulk(
uint256[] calldata tokenIds,
uint256[] calldata yearCounts
) external payable nonReentrant {
require(tokenIds.length == yearCounts.length, "Array length mismatch");
require(tokenIds.length > 0, "Empty arrays");
require(tokenIds.length <= 20, "Too many domains"); // Gas limit protection
uint256 totalPrice = 0;
// Calculate total price and validate
for (uint256 i = 0; i < tokenIds.length; i++) {
string memory name = registry.tokenIdToName(tokenIds[i]);
require(bytes(name).length > 0, "Domain not found");
require(
yearCounts[i] > 0 && yearCounts[i] <= MAX_REGISTRATION_YEARS,
"Invalid year count"
);
totalPrice += calculatePrice(name, yearCounts[i]);
}
require(msg.value == totalPrice, "Incorrect payment");
// Renew all domains
for (uint256 i = 0; i < tokenIds.length; i++) {
string memory name = registry.tokenIdToName(tokenIds[i]);
uint256 price = calculatePrice(name, yearCounts[i]);
registry.extend(tokenIds[i], yearCounts[i] * YEAR);
emit DomainRenewed(name, tokenIds[i], price, yearCounts[i]);
}
emit BulkRenewal(msg.sender, tokenIds.length, totalPrice);
}
function getRenewalPrice(string calldata name, uint256 yearCount)
external
view
returns (uint256)
{
require(registry.nameToTokenId(name) != 0, "Domain not found");
return calculatePrice(name, yearCount);
}
/**
* @notice Calculate total price for bulk registration
* @param names Array of domain names
* @param yearCounts Array of year counts
* @return totalPrice Total cost in wei
*/
function calculateBulkPrice(
string[] calldata names,
uint256[] calldata yearCounts
) external view returns (uint256 totalPrice) {
require(names.length == yearCounts.length, "Array length mismatch");
for (uint256 i = 0; i < names.length; i++) {
totalPrice += calculatePrice(names[i], yearCounts[i]);
}
}
// ========== NAME VALIDATION ==========
function isValidName(string memory name) public pure returns (bool) {
bytes memory nameBytes = bytes(name);
uint256 length = nameBytes.length;
if (length < 3 || length > 64) return false;
if (!isLetter(nameBytes[0])) return false;
for (uint i = 0; i < length; i++) {
if (!isValidChar(nameBytes[i])) return false;
if (i > 0 && nameBytes[i] == "-" && nameBytes[i - 1] == "-")
return false;
}
if (nameBytes[length - 1] == "-") return false;
return true;
}
function isLetter(bytes1 char) internal pure returns (bool) {
return (char >= 0x61 && char <= 0x7A); // a-z
}
function isNumber(bytes1 char) internal pure returns (bool) {
return (char >= 0x30 && char <= 0x39); // 0-9
}
function isValidChar(bytes1 char) internal pure returns (bool) {
return isLetter(char) || isNumber(char) || char == 0x2D; // a-z, 0-9, -
}
// ========== ADMIN ==========
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, "No balance");
(bool success, ) = msg.sender.call{value: balance}("");
require(success, "Withdrawal failed");
emit PaymentWithdrawn(msg.sender, balance);
}
function setRegistry(address _registry) external onlyOwner {
registry = ISonicRegistryV2(_registry);
}
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
receive() external payable {}
}
interface ISonicRegistryV2 {
function register(string memory name, address owner, uint256 duration)
external
returns (uint256);
function extend(uint256 tokenId, uint256 duration) external;
function available(string memory name) external view returns (bool);
function nameToTokenId(string memory name) external view returns (uint256);
function tokenIdToName(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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.
*
* The initial owner is set to the address provided by the deployer. 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
/// @custom:storage-location erc7201:openzeppelin.storage.Ownable
struct OwnableStorage {
address _owner;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;
function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
assembly {
$.slot := OwnableStorageLocation
}
}
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
function __Ownable_init(address initialOwner) internal onlyInitializing {
__Ownable_init_unchained(initialOwner);
}
function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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) {
OwnableStorage storage $ = _getOwnableStorage();
return $._owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
OwnableStorage storage $ = _getOwnableStorage();
address oldOwner = $._owner;
$._owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reinitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.
*
* NOTE: Consider following the ERC-7201 formula to derive storage locations.
*/
function _initializableStorageSlot() internal pure virtual returns (bytes32) {
return INITIALIZABLE_STORAGE;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
bytes32 slot = _initializableStorageSlot();
assembly {
$.slot := slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.22;
import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*/
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
address private immutable __self = address(this);
/**
* @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
* and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
* while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
* If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
* be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
* during an upgrade.
*/
string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";
/**
* @dev The call is from an unauthorized context.
*/
error UUPSUnauthorizedCallContext();
/**
* @dev The storage `slot` is unsupported as a UUID.
*/
error UUPSUnsupportedProxiableUUID(bytes32 slot);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
_checkProxy();
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
_checkNotDelegated();
_;
}
function __UUPSUpgradeable_init() internal onlyInitializing {
}
function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
}
/**
* @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual notDelegated returns (bytes32) {
return ERC1967Utils.IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data);
}
/**
* @dev Reverts if the execution is not performed via delegatecall or the execution
* context is not of a proxy with an ERC-1967 compliant implementation pointing to self.
*/
function _checkProxy() internal view virtual {
if (
address(this) == __self || // Must be called through delegatecall
ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
) {
revert UUPSUnauthorizedCallContext();
}
}
/**
* @dev Reverts if the execution is performed via delegatecall.
* See {notDelegated}.
*/
function _checkNotDelegated() internal view virtual {
if (address(this) != __self) {
// Must not be called through delegatecall
revert UUPSUnauthorizedCallContext();
}
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
/**
* @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
*
* As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
* is expected to be the implementation slot in ERC-1967.
*
* Emits an {IERC1967-Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
revert UUPSUnsupportedProxiableUUID(slot);
}
ERC1967Utils.upgradeToAndCall(newImplementation, data);
} catch {
// The implementation is not UUPS
revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
/// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
struct ReentrancyGuardStorage {
uint256 _status;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
assembly {
$.slot := ReentrancyGuardStorageLocation
}
}
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
$._status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// On the first call to nonReentrant, _status will be NOT_ENTERED
if ($._status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
$._status = ENTERED;
}
function _nonReentrantAfter() private {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
$._status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
return $._status == ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC1822.sol)
pragma solidity >=0.4.16;
/**
* @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1967.sol)
pragma solidity >=0.4.11;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*/
interface IERC1967 {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (proxy/beacon/IBeacon.sol)
pragma solidity >=0.4.16;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {UpgradeableBeacon} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (proxy/ERC1967/ERC1967Utils.sol)
pragma solidity ^0.8.21;
import {IBeacon} from "../beacon/IBeacon.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";
/**
* @dev This library provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
*/
library ERC1967Utils {
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev The `implementation` of the proxy is invalid.
*/
error ERC1967InvalidImplementation(address implementation);
/**
* @dev The `admin` of the proxy is invalid.
*/
error ERC1967InvalidAdmin(address admin);
/**
* @dev The `beacon` of the proxy is invalid.
*/
error ERC1967InvalidBeacon(address beacon);
/**
* @dev An upgrade function sees `msg.value > 0` that may be lost.
*/
error ERC1967NonPayable();
/**
* @dev Returns the current implementation address.
*/
function getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the ERC-1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
if (newImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(newImplementation);
}
StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Performs implementation upgrade with additional setup call if data is nonempty.
* This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
* to avoid stuck value in the contract.
*
* Emits an {IERC1967-Upgraded} event.
*/
function upgradeToAndCall(address newImplementation, bytes memory data) internal {
_setImplementation(newImplementation);
emit IERC1967.Upgraded(newImplementation);
if (data.length > 0) {
Address.functionDelegateCall(newImplementation, data);
} else {
_checkNonPayable();
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
* the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the ERC-1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
if (newAdmin == address(0)) {
revert ERC1967InvalidAdmin(address(0));
}
StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {IERC1967-AdminChanged} event.
*/
function changeAdmin(address newAdmin) internal {
emit IERC1967.AdminChanged(getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
*/
// solhint-disable-next-line private-vars-leading-underscore
bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the ERC-1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
if (newBeacon.code.length == 0) {
revert ERC1967InvalidBeacon(newBeacon);
}
StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;
address beaconImplementation = IBeacon(newBeacon).implementation();
if (beaconImplementation.code.length == 0) {
revert ERC1967InvalidImplementation(beaconImplementation);
}
}
/**
* @dev Change the beacon and trigger a setup call if data is nonempty.
* This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
* to avoid stuck value in the contract.
*
* Emits an {IERC1967-BeaconUpgraded} event.
*
* CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
* it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
* efficiency.
*/
function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
_setBeacon(newBeacon);
emit IERC1967.BeaconUpgraded(newBeacon);
if (data.length > 0) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
} else {
_checkNonPayable();
}
}
/**
* @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
* if an upgrade doesn't perform an initialization call.
*/
function _checkNonPayable() private {
if (msg.value > 0) {
revert ERC1967NonPayable();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, bytes memory returndata) = recipient.call{value: amount}("");
if (!success) {
_revert(returndata);
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly ("memory-safe") {
revert(add(returndata, 0x20), mload(returndata))
}
} else {
revert Errors.FailedCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
}
}Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalPrice","type":"uint256"}],"name":"BulkRegistration","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalPrice","type":"uint256"}],"name":"BulkRenewal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"name","type":"string"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"yearCount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"DomainRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"name","type":"string"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"yearCount","type":"uint256"}],"name":"DomainRenewed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","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":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"FIVECHAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FOURCHAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REGISTRATION_YEARS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SIXPLUSCHAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"THREECHAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string[]","name":"names","type":"string[]"},{"internalType":"uint256[]","name":"yearCounts","type":"uint256[]"}],"name":"calculateBulkPrice","outputs":[{"internalType":"uint256","name":"totalPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"yearCount","type":"uint256"}],"name":"calculatePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"discountTiers","outputs":[{"internalType":"uint256","name":"yearCount","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"getBasePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"yearCount","type":"uint256"}],"name":"getDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"yearCount","type":"uint256"}],"name":"getRenewalPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"isValidName","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"yearCount","type":"uint256"}],"name":"register","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string[]","name":"names","type":"string[]"},{"internalType":"uint256[]","name":"yearCounts","type":"uint256[]"}],"name":"registerBulk","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract ISonicRegistryV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"yearCount","type":"uint256"}],"name":"renew","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"yearCounts","type":"uint256[]"}],"name":"renewBulk","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60a080604052346100ea57306080527ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460ff8160401c166100d9576002600160401b03196001600160401b03821601610073575b604051611f0090816100f0823960805181818161104501526110ea0152f35b6001600160401b0319166001600160401b039081177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005581527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a13880610054565b63f92ee8a960e01b60005260046000fd5b600080fdfe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806305f784c4146113f35780631e30397f146113b45780632336dbe4146113965780633b10faf5146113585780633ccfd60b146112885780634f1ef2861461109c57806352d1902d14611032578063603e93371461100f578063715018a614610fa55780637b10399914610f7c5780638391454014610f5d57806385e486c814610f4157806387b7fae214610c725780638da5cb5b14610c3c5780638f5d9e6e14610c1957806396431e8214610b7057806398d816ac14610b4d578063a91ee0dc14610b0a578063aa415eef14610ae7578063acf1a8411461095b578063ad3cb1cc146108fd578063c4d66de8146106df578063dae037ee146103ec578063ea87152b146101f6578063f2fde38b146101cd578063f3c341851461018b5763fa84dc2f0361000e5734610186576020366003190112610186576004356000548110156101865761017260409161162b565b506001815491015482519182526020820152f35b600080fd5b34610186576020366003190112610186576004356001600160401b038111610186576101c56101c06020923690600401611581565b611cbb565b604051908152f35b34610186576020366003190112610186576100196101e961159f565b6101f1611d29565b611c45565b6101ff366115b5565b90610208611d5f565b61022361021e61021936848761154a565b61172e565b611b8b565b60015460405163aeb8ce9b60e01b81526020600482018190526001600160a01b0390921694918180610259602482018787611b11565b0381885afa801561039057610276916000916103bd575b50611bde565b8215918215806103b2575b61028a906118df565b61029e8461029936848661154a565b611933565b946102aa863414611ad1565b6301e133808502938585046301e1338014171561039c576102e960209160009560405196878094819363d393c87160e01b835233898b60048601611c17565b03925af19182156103905760009261034e575b600080516020611eab83398151915293508160405192839283376000908201908152039020604080519586526020860194909452928401523392606090a36001600080516020611e6b83398151915255005b91506020833d602011610388575b816103696020938361150e565b8101031261018657600080516020611eab8339815191529251916102fc565b3d915061035c565b6040513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b506005841115610281565b6103df915060203d6020116103e5575b6103d7818361150e565b810190611bc6565b86610270565b503d6103cd565b6103f53661148d565b909192610400611d5f565b61040b82851461167b565b6104168415156119ba565b61042360148511156119f5565b6001546000939084906001600160a01b03165b8682106105e957505061044a843414611ad1565b60005b85811061049b57858560405191825260208201527f8c9589a0881a9774f33437859c85a770c135e3c7e84f9ce6ac4b4b75dbcf8fb460403392a26001600080516020611e6b83398151915255005b6001546001600160a01b0316906104b38188866116bf565b90926104c0838887611700565b35906301e133808202918083046301e13380149015171561039c576105039460006020946040519788958694859363d393c87160e01b8552339160048601611c17565b03925af1918215610390578488916000946105a0575b50600080516020611eab833981519152600194610560856102998b61055761054e84610546818c8c6116bf565b9b909a6116bf565b9490928d611700565b3592369161154a565b9361056c868b8a611700565b359360008260405193849384378201908152039020604080519586526020860194909452928401523392606090a30161044d565b92939150506020823d82116105e1575b816105bd6020938361150e565b810103126105de575051908684600080516020611eab833981519152610519565b80fd5b3d91506105b0565b909461063a9061060a61021e6102196106038a8c8a6116bf565b369161154a565b6020610617888a886116bf565b60405163aeb8ce9b60e01b81526004810184905294859283926024840191611b11565b0381865afa9081156103905761065d61069e926001946000916106c15750611bde565b610668888887611700565b351515806106a6575b61067a906118df565b61069861029961068b8a8c8a6116bf565b91906105578c8c8b611700565b90611710565b950190610436565b5061067a60056106b78a8a89611700565b3511159050610671565b6106d9915060203d81116103e5576103d7818361150e565b8b610270565b34610186576020366003190112610186576106f861159f565b600080516020611e8b833981519152549060ff8260401c1615916001600160401b038116801590816108f5575b60011490816108eb575b1590816108e2575b506108d15767ffffffffffffffff198116600117600080516020611e8b83398151915255826108a4575b5061076a611d9b565b610772611d9b565b61077b33611c45565b610783611d9b565b61078b611d9b565b6001600080516020611e6b833981519152556107a5611d9b565b60018060a01b03166bffffffffffffffffffffffff60a01b60015416176001556107e56040516107d4816114dd565b600281526101f46020820152611b32565b6108056040516107f4816114dd565b600381526103e86020820152611b32565b610825604051610814816114dd565b600481526105dc6020820152611b32565b610845604051610834816114dd565b600581526107d06020820152611b32565b61084b57005b68ff000000000000000019600080516020611e8b8339815191525416600080516020611e8b833981519152557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b68ffffffffffffffffff19166801000000000000000117600080516020611e8b8339815191525582610761565b63f92ee8a960e01b60005260046000fd5b90501584610737565b303b15915061072f565b849150610725565b346101865760003660031901126101865761094d6040805161091f828261150e565b6005815260208101640352e302e360dc1b815282519384926020845251809281602086015285850190611608565b601f01601f19168101030190f35b610964366115b5565b909161096e611d5f565b60018060a01b03600154169060405193633740049560e21b855260206004860152602085806109a1602482018587611b11565b0381865afa94851561039057600095610ab3575b506109c1851515611a92565b831590811580610aa8575b6109d5906118df565b6109e48561029936848761154a565b916109f0833414611ad1565b6301e133808602908682046301e1338014171561039c57843b156101865760009460448692604051978893849263c89258db60e01b84528c600485015260248401525af1928315610390577fde064de66ae71b963b6799e2a2fce64f7551fbaf4545d498f8756e7090e2e46394604094610a97575b5081845192839283378101600081520390209382519182526020820152a36001600080516020611e6b83398151915255005b6000610aa29161150e565b87610a65565b5060058511156109cc565b90946020823d602011610adf575b81610ace6020938361150e565b810103126105de57505193856109b5565b3d9150610ac1565b34610186576000366003190112610186576020604051678ac7230489e800008152f35b3461018657602036600319011261018657610b2361159f565b610b2b611d29565b600180546001600160a01b0319166001600160a01b0392909216919091179055005b34610186576000366003190112610186576020604051674563918244f400008152f35b3461018657610b7e366115b5565b600154604051633740049560e21b8152602060048201819052929392909182906001600160a01b03168180610bb760248201888b611b11565b03915afa90811561039057600091610be0575b60206101c5856102998887610603881515611a92565b90506020929192813d602011610c11575b81610bfe6020938361150e565b8101031261018657519091906020610bca565b3d9150610bf1565b3461018657600036600319011261018657602060405167d02ab486cedc00008152f35b3461018657600036600319011261018657600080516020611e2b833981519152546040516001600160a01b039091168152602090f35b610c7b3661148d565b610c8793919293611d5f565b610c9281851461167b565b610c9d8415156119ba565b610caa60148511156119f5565b6001546000939084906001600160a01b03165b868210610e85575050610cd1843414611ad1565b60005b858110610d2257858560405191825260208201527f549796789b5a5fdfa7acdf1943ce93ef5ab4f43b61fcde8a4e531594d4bd029160403392a26001600080516020611e6b83398151915255005b6001546001600160a01b031690610d3a818887611700565b60405163da2bfdb160e01b815290356004820152600081602481865afa90811561039057600091610e64575b50610d7c610d75838787611700565b3582611933565b90610d88838a89611700565b35610d94848888611700565b356301e133808102908082046301e13380149015171561039c57853b1561018657604460009283604051988994859363c89258db60e01b8552600485015260248401525af193841561039057600194610e53575b507fde064de66ae71b963b6799e2a2fce64f7551fbaf4545d498f8756e7090e2e4636040610e17858c8b611700565b3593610e3c610e27878b8b611700565b35946020845192828480945193849201611608565b81010390209382519182526020820152a301610cd4565b6000610e5e9161150e565b89610de8565b610e7f913d8091833e610e77818361150e565b810190611a34565b88610d66565b9094610e92868887611700565b60405163da2bfdb160e01b81529035600482015290600082602481865afa90811561039057610698610f0592600194600091610f28575b50610ed681511515611a92565b610ee18a8989611700565b35151580610f0d575b610ef3906118df565b610efe8a8989611700565b3590611933565b950190610cbd565b50610ef36005610f1e8c8b8b611700565b3511159050610eea565b610f3b913d8091833e610e77818361150e565b8b610ec9565b3461018657600036600319011261018657602060405160058152f35b346101865760003660031901126101865760206040516301e133808152f35b34610186576000366003190112610186576001546040516001600160a01b039091168152602090f35b3461018657600036600319011261018657610fbe611d29565b600080516020611e2b83398151915280546001600160a01b031981169091556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101865760003660031901126101865760206040516768155a43676e00008152f35b34610186576000366003190112610186577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316300361108b576020604051600080516020611e4b8339815191528152f35b63703e46dd60e11b60005260046000fd5b6040366003190112610186576110b061159f565b6024356001600160401b0381116101865736602382011215610186576110e090369060248160040135910161154a565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016308114908115611265575b5061108b57611122611d29565b6040516352d1902d60e01b81526001600160a01b0383169290602081600481875afa60009181611231575b506111675783634c9c8ce360e01b60005260045260246000fd5b80600080516020611e4b83398151915285920361121d5750813b1561120957600080516020611e4b83398151915280546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28151156111ef5760008083602061001995519101845af46111e961198a565b91611dc9565b5050346111f857005b63b398979f60e01b60005260046000fd5b634c9c8ce360e01b60005260045260246000fd5b632a87526960e21b60005260045260246000fd5b9091506020813d60201161125d575b8161124d6020938361150e565b810103126101865751908561114d565b3d9150611240565b600080516020611e4b833981519152546001600160a01b03161415905083611115565b34610186576000366003190112610186576112a1611d29565b47801561132657600080808084335af16112b961198a565b50156112ed576040519081527f84511ecc081974f18e7f3e0dcc19db078b55bbd3852ddd0dd85b3aebb7bf94c260203392a2005b60405162461bcd60e51b815260206004820152601160248201527015da5d1a191c985dd85b0819985a5b1959607a1b6044820152606490fd5b60405162461bcd60e51b815260206004820152600a6024820152694e6f2062616c616e636560b01b6044820152606490fd5b34610186576040366003190112610186576004356001600160401b038111610186576101c561138d6020923690600401611581565b60243590611933565b346101865760203660031901126101865760206101c560043561188e565b34610186576020366003190112610186576004356001600160401b038111610186576113e96102196020923690600401611581565b6040519015158152f35b34610186576114013661148d565b9192600092909161141382861461167b565b6000945b80861061142957602085604051908152f35b909192936114516001916106986102996114448a878b6116bf565b91906105578c8b8b611700565b95019493929190611417565b9181601f84011215610186578235916001600160401b038311610186576020808501948460051b01011161018657565b6040600319820112610186576004356001600160401b03811161018657816114b79160040161145d565b92909291602435906001600160401b038211610186576114d99160040161145d565b9091565b604081019081106001600160401b038211176114f857604052565b634e487b7160e01b600052604160045260246000fd5b90601f801991011681019081106001600160401b038211176114f857604052565b6001600160401b0381116114f857601f01601f191660200190565b9291926115568261152f565b91611564604051938461150e565b829481845281830111610186578281602093846000960137010152565b9080601f830112156101865781602061159c9335910161154a565b90565b600435906001600160a01b038216820361018657565b906040600319830112610186576004356001600160401b0381116101865782602382011215610186578060040135926001600160401b038411610186576024848301011161018657602401919060243590565b60005b83811061161b5750506000910152565b818101518382015260200161160b565b60005481101561166557600080805260019190911b7f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630191565b634e487b7160e01b600052603260045260246000fd5b1561168257565b60405162461bcd60e51b8152602060048201526015602482015274082e4e4c2f240d8cadccee8d040dad2e6dac2e8c6d605b1b6044820152606490fd5b91908110156116655760051b81013590601e19813603018212156101865701908135916001600160401b038311610186576020018236038113610186579190565b91908110156116655760051b0190565b9190820180921161039c57565b908151811015611665570160200190565b805190600382108015611884575b61187d57811561166557602081015161175e906001600160f81b031916611d05565b1561187d5760005b8281106117a55750600019820191821161039c57602d60f81b916001600160f81b031991611794919061171d565b5116146117a057600190565b600090565b6001600160f81b03196117b8828461171d565b51166117c381611d05565b908115611859575b811561184b575b50156117f3578015158061182a575b806117fb575b6117f357600101611766565b505050600090565b50600019810181811161039c57602d60f81b906001600160f81b031990611822908561171d565b5116146117e7565b50602d60f81b6001600160f81b0319611843838561171d565b5116146117e1565b602d60f81b149050386117d2565b9050600360fc1b8110158061186f575b906117cb565b50603960f81b811115611869565b5050600090565b506040821161173c565b600181146118d9576000908154915b8281106118ac57505050600090565b816118b68261162b565b5054146118c55760010161189d565b600192506118d3915061162b565b50015490565b50600090565b156118e657565b60405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a59081e59585c8818dbdd5b9d60721b6044820152606490fd5b8181029291811591840414171561039c57565b6119558261195061195b938215158061197f575b6101c0906118df565b611920565b9161188e565b801561197b5761196e6127109183611920565b04810390811161039c5790565b5090565b506005831115611947565b3d156119b5573d9061199b8261152f565b916119a9604051938461150e565b82523d6000602084013e565b606090565b156119c157565b60405162461bcd60e51b815260206004820152600c60248201526b456d7074792061727261797360a01b6044820152606490fd5b156119fc57565b60405162461bcd60e51b815260206004820152601060248201526f546f6f206d616e7920646f6d61696e7360801b6044820152606490fd5b602081830312610186578051906001600160401b038211610186570181601f82011215610186578051611a668161152f565b92611a74604051948561150e565b818452602082840101116101865761159c9160208085019101611608565b15611a9957565b60405162461bcd60e51b815260206004820152601060248201526f111bdb585a5b881b9bdd08199bdd5b9960821b6044820152606490fd5b15611ad857565b60405162461bcd60e51b8152602060048201526011602482015270125b98dbdc9c9958dd081c185e5b595b9d607a1b6044820152606490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b600054680100000000000000008110156114f8576001810160005560008054821015611b77578080526020902060019190911b01906020816001925184550151910155565b634e487b7160e01b81526032600452602490fd5b15611b9257565b60405162461bcd60e51b815260206004820152600c60248201526b496e76616c6964206e616d6560a01b6044820152606490fd5b90816020910312610186575180151581036101865790565b15611be557565b60405162461bcd60e51b815260206004820152600a6024820152692730b6b2903a30b5b2b760b11b6044820152606490fd5b90611c319060409396959496606084526060840191611b11565b6001600160a01b0390951660208201520152565b6001600160a01b03168015611ca557600080516020611e2b83398151915280546001600160a01b0319811683179091556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b631e4fbdf760e01b600052600060045260246000fd5b5160038114611cf85760048114611ceb57600514611cdf57674563918244f4000090565b6768155a43676e000090565b50678ac7230489e8000090565b5067d02ab486cedc000090565b60ff60f81b16606160f81b8110159081611d1d575090565b603d60f91b1015919050565b600080516020611e2b833981519152546001600160a01b03163303611d4a57565b63118cdaa760e01b6000523360045260246000fd5b6002600080516020611e6b8339815191525414611d8a576002600080516020611e6b83398151915255565b633ee5aeb560e01b60005260046000fd5b60ff600080516020611e8b8339815191525460401c1615611db857565b631afcd79f60e31b60005260046000fd5b90611def5750805115611dde57602081519101fd5b63d6bda27560e01b60005260046000fd5b81511580611e21575b611e00575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b15611df856fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00103ef2b580bb52b75be4bad57526f7e61f418fce0695737e314decb597bf74aca26469706673582212208cc17d948d4961acf151acf89d4a6f83df1329795f4ed7038cce55cbf0d2bf8764736f6c63430008210033
Deployed Bytecode
0x6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806305f784c4146113f35780631e30397f146113b45780632336dbe4146113965780633b10faf5146113585780633ccfd60b146112885780634f1ef2861461109c57806352d1902d14611032578063603e93371461100f578063715018a614610fa55780637b10399914610f7c5780638391454014610f5d57806385e486c814610f4157806387b7fae214610c725780638da5cb5b14610c3c5780638f5d9e6e14610c1957806396431e8214610b7057806398d816ac14610b4d578063a91ee0dc14610b0a578063aa415eef14610ae7578063acf1a8411461095b578063ad3cb1cc146108fd578063c4d66de8146106df578063dae037ee146103ec578063ea87152b146101f6578063f2fde38b146101cd578063f3c341851461018b5763fa84dc2f0361000e5734610186576020366003190112610186576004356000548110156101865761017260409161162b565b506001815491015482519182526020820152f35b600080fd5b34610186576020366003190112610186576004356001600160401b038111610186576101c56101c06020923690600401611581565b611cbb565b604051908152f35b34610186576020366003190112610186576100196101e961159f565b6101f1611d29565b611c45565b6101ff366115b5565b90610208611d5f565b61022361021e61021936848761154a565b61172e565b611b8b565b60015460405163aeb8ce9b60e01b81526020600482018190526001600160a01b0390921694918180610259602482018787611b11565b0381885afa801561039057610276916000916103bd575b50611bde565b8215918215806103b2575b61028a906118df565b61029e8461029936848661154a565b611933565b946102aa863414611ad1565b6301e133808502938585046301e1338014171561039c576102e960209160009560405196878094819363d393c87160e01b835233898b60048601611c17565b03925af19182156103905760009261034e575b600080516020611eab83398151915293508160405192839283376000908201908152039020604080519586526020860194909452928401523392606090a36001600080516020611e6b83398151915255005b91506020833d602011610388575b816103696020938361150e565b8101031261018657600080516020611eab8339815191529251916102fc565b3d915061035c565b6040513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b506005841115610281565b6103df915060203d6020116103e5575b6103d7818361150e565b810190611bc6565b86610270565b503d6103cd565b6103f53661148d565b909192610400611d5f565b61040b82851461167b565b6104168415156119ba565b61042360148511156119f5565b6001546000939084906001600160a01b03165b8682106105e957505061044a843414611ad1565b60005b85811061049b57858560405191825260208201527f8c9589a0881a9774f33437859c85a770c135e3c7e84f9ce6ac4b4b75dbcf8fb460403392a26001600080516020611e6b83398151915255005b6001546001600160a01b0316906104b38188866116bf565b90926104c0838887611700565b35906301e133808202918083046301e13380149015171561039c576105039460006020946040519788958694859363d393c87160e01b8552339160048601611c17565b03925af1918215610390578488916000946105a0575b50600080516020611eab833981519152600194610560856102998b61055761054e84610546818c8c6116bf565b9b909a6116bf565b9490928d611700565b3592369161154a565b9361056c868b8a611700565b359360008260405193849384378201908152039020604080519586526020860194909452928401523392606090a30161044d565b92939150506020823d82116105e1575b816105bd6020938361150e565b810103126105de575051908684600080516020611eab833981519152610519565b80fd5b3d91506105b0565b909461063a9061060a61021e6102196106038a8c8a6116bf565b369161154a565b6020610617888a886116bf565b60405163aeb8ce9b60e01b81526004810184905294859283926024840191611b11565b0381865afa9081156103905761065d61069e926001946000916106c15750611bde565b610668888887611700565b351515806106a6575b61067a906118df565b61069861029961068b8a8c8a6116bf565b91906105578c8c8b611700565b90611710565b950190610436565b5061067a60056106b78a8a89611700565b3511159050610671565b6106d9915060203d81116103e5576103d7818361150e565b8b610270565b34610186576020366003190112610186576106f861159f565b600080516020611e8b833981519152549060ff8260401c1615916001600160401b038116801590816108f5575b60011490816108eb575b1590816108e2575b506108d15767ffffffffffffffff198116600117600080516020611e8b83398151915255826108a4575b5061076a611d9b565b610772611d9b565b61077b33611c45565b610783611d9b565b61078b611d9b565b6001600080516020611e6b833981519152556107a5611d9b565b60018060a01b03166bffffffffffffffffffffffff60a01b60015416176001556107e56040516107d4816114dd565b600281526101f46020820152611b32565b6108056040516107f4816114dd565b600381526103e86020820152611b32565b610825604051610814816114dd565b600481526105dc6020820152611b32565b610845604051610834816114dd565b600581526107d06020820152611b32565b61084b57005b68ff000000000000000019600080516020611e8b8339815191525416600080516020611e8b833981519152557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b68ffffffffffffffffff19166801000000000000000117600080516020611e8b8339815191525582610761565b63f92ee8a960e01b60005260046000fd5b90501584610737565b303b15915061072f565b849150610725565b346101865760003660031901126101865761094d6040805161091f828261150e565b6005815260208101640352e302e360dc1b815282519384926020845251809281602086015285850190611608565b601f01601f19168101030190f35b610964366115b5565b909161096e611d5f565b60018060a01b03600154169060405193633740049560e21b855260206004860152602085806109a1602482018587611b11565b0381865afa94851561039057600095610ab3575b506109c1851515611a92565b831590811580610aa8575b6109d5906118df565b6109e48561029936848761154a565b916109f0833414611ad1565b6301e133808602908682046301e1338014171561039c57843b156101865760009460448692604051978893849263c89258db60e01b84528c600485015260248401525af1928315610390577fde064de66ae71b963b6799e2a2fce64f7551fbaf4545d498f8756e7090e2e46394604094610a97575b5081845192839283378101600081520390209382519182526020820152a36001600080516020611e6b83398151915255005b6000610aa29161150e565b87610a65565b5060058511156109cc565b90946020823d602011610adf575b81610ace6020938361150e565b810103126105de57505193856109b5565b3d9150610ac1565b34610186576000366003190112610186576020604051678ac7230489e800008152f35b3461018657602036600319011261018657610b2361159f565b610b2b611d29565b600180546001600160a01b0319166001600160a01b0392909216919091179055005b34610186576000366003190112610186576020604051674563918244f400008152f35b3461018657610b7e366115b5565b600154604051633740049560e21b8152602060048201819052929392909182906001600160a01b03168180610bb760248201888b611b11565b03915afa90811561039057600091610be0575b60206101c5856102998887610603881515611a92565b90506020929192813d602011610c11575b81610bfe6020938361150e565b8101031261018657519091906020610bca565b3d9150610bf1565b3461018657600036600319011261018657602060405167d02ab486cedc00008152f35b3461018657600036600319011261018657600080516020611e2b833981519152546040516001600160a01b039091168152602090f35b610c7b3661148d565b610c8793919293611d5f565b610c9281851461167b565b610c9d8415156119ba565b610caa60148511156119f5565b6001546000939084906001600160a01b03165b868210610e85575050610cd1843414611ad1565b60005b858110610d2257858560405191825260208201527f549796789b5a5fdfa7acdf1943ce93ef5ab4f43b61fcde8a4e531594d4bd029160403392a26001600080516020611e6b83398151915255005b6001546001600160a01b031690610d3a818887611700565b60405163da2bfdb160e01b815290356004820152600081602481865afa90811561039057600091610e64575b50610d7c610d75838787611700565b3582611933565b90610d88838a89611700565b35610d94848888611700565b356301e133808102908082046301e13380149015171561039c57853b1561018657604460009283604051988994859363c89258db60e01b8552600485015260248401525af193841561039057600194610e53575b507fde064de66ae71b963b6799e2a2fce64f7551fbaf4545d498f8756e7090e2e4636040610e17858c8b611700565b3593610e3c610e27878b8b611700565b35946020845192828480945193849201611608565b81010390209382519182526020820152a301610cd4565b6000610e5e9161150e565b89610de8565b610e7f913d8091833e610e77818361150e565b810190611a34565b88610d66565b9094610e92868887611700565b60405163da2bfdb160e01b81529035600482015290600082602481865afa90811561039057610698610f0592600194600091610f28575b50610ed681511515611a92565b610ee18a8989611700565b35151580610f0d575b610ef3906118df565b610efe8a8989611700565b3590611933565b950190610cbd565b50610ef36005610f1e8c8b8b611700565b3511159050610eea565b610f3b913d8091833e610e77818361150e565b8b610ec9565b3461018657600036600319011261018657602060405160058152f35b346101865760003660031901126101865760206040516301e133808152f35b34610186576000366003190112610186576001546040516001600160a01b039091168152602090f35b3461018657600036600319011261018657610fbe611d29565b600080516020611e2b83398151915280546001600160a01b031981169091556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346101865760003660031901126101865760206040516768155a43676e00008152f35b34610186576000366003190112610186577f000000000000000000000000db47e9cecd0479a6259ba9bbc3fecae50b3a4f7e6001600160a01b0316300361108b576020604051600080516020611e4b8339815191528152f35b63703e46dd60e11b60005260046000fd5b6040366003190112610186576110b061159f565b6024356001600160401b0381116101865736602382011215610186576110e090369060248160040135910161154a565b6001600160a01b037f000000000000000000000000db47e9cecd0479a6259ba9bbc3fecae50b3a4f7e16308114908115611265575b5061108b57611122611d29565b6040516352d1902d60e01b81526001600160a01b0383169290602081600481875afa60009181611231575b506111675783634c9c8ce360e01b60005260045260246000fd5b80600080516020611e4b83398151915285920361121d5750813b1561120957600080516020611e4b83398151915280546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28151156111ef5760008083602061001995519101845af46111e961198a565b91611dc9565b5050346111f857005b63b398979f60e01b60005260046000fd5b634c9c8ce360e01b60005260045260246000fd5b632a87526960e21b60005260045260246000fd5b9091506020813d60201161125d575b8161124d6020938361150e565b810103126101865751908561114d565b3d9150611240565b600080516020611e4b833981519152546001600160a01b03161415905083611115565b34610186576000366003190112610186576112a1611d29565b47801561132657600080808084335af16112b961198a565b50156112ed576040519081527f84511ecc081974f18e7f3e0dcc19db078b55bbd3852ddd0dd85b3aebb7bf94c260203392a2005b60405162461bcd60e51b815260206004820152601160248201527015da5d1a191c985dd85b0819985a5b1959607a1b6044820152606490fd5b60405162461bcd60e51b815260206004820152600a6024820152694e6f2062616c616e636560b01b6044820152606490fd5b34610186576040366003190112610186576004356001600160401b038111610186576101c561138d6020923690600401611581565b60243590611933565b346101865760203660031901126101865760206101c560043561188e565b34610186576020366003190112610186576004356001600160401b038111610186576113e96102196020923690600401611581565b6040519015158152f35b34610186576114013661148d565b9192600092909161141382861461167b565b6000945b80861061142957602085604051908152f35b909192936114516001916106986102996114448a878b6116bf565b91906105578c8b8b611700565b95019493929190611417565b9181601f84011215610186578235916001600160401b038311610186576020808501948460051b01011161018657565b6040600319820112610186576004356001600160401b03811161018657816114b79160040161145d565b92909291602435906001600160401b038211610186576114d99160040161145d565b9091565b604081019081106001600160401b038211176114f857604052565b634e487b7160e01b600052604160045260246000fd5b90601f801991011681019081106001600160401b038211176114f857604052565b6001600160401b0381116114f857601f01601f191660200190565b9291926115568261152f565b91611564604051938461150e565b829481845281830111610186578281602093846000960137010152565b9080601f830112156101865781602061159c9335910161154a565b90565b600435906001600160a01b038216820361018657565b906040600319830112610186576004356001600160401b0381116101865782602382011215610186578060040135926001600160401b038411610186576024848301011161018657602401919060243590565b60005b83811061161b5750506000910152565b818101518382015260200161160b565b60005481101561166557600080805260019190911b7f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630191565b634e487b7160e01b600052603260045260246000fd5b1561168257565b60405162461bcd60e51b8152602060048201526015602482015274082e4e4c2f240d8cadccee8d040dad2e6dac2e8c6d605b1b6044820152606490fd5b91908110156116655760051b81013590601e19813603018212156101865701908135916001600160401b038311610186576020018236038113610186579190565b91908110156116655760051b0190565b9190820180921161039c57565b908151811015611665570160200190565b805190600382108015611884575b61187d57811561166557602081015161175e906001600160f81b031916611d05565b1561187d5760005b8281106117a55750600019820191821161039c57602d60f81b916001600160f81b031991611794919061171d565b5116146117a057600190565b600090565b6001600160f81b03196117b8828461171d565b51166117c381611d05565b908115611859575b811561184b575b50156117f3578015158061182a575b806117fb575b6117f357600101611766565b505050600090565b50600019810181811161039c57602d60f81b906001600160f81b031990611822908561171d565b5116146117e7565b50602d60f81b6001600160f81b0319611843838561171d565b5116146117e1565b602d60f81b149050386117d2565b9050600360fc1b8110158061186f575b906117cb565b50603960f81b811115611869565b5050600090565b506040821161173c565b600181146118d9576000908154915b8281106118ac57505050600090565b816118b68261162b565b5054146118c55760010161189d565b600192506118d3915061162b565b50015490565b50600090565b156118e657565b60405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a59081e59585c8818dbdd5b9d60721b6044820152606490fd5b8181029291811591840414171561039c57565b6119558261195061195b938215158061197f575b6101c0906118df565b611920565b9161188e565b801561197b5761196e6127109183611920565b04810390811161039c5790565b5090565b506005831115611947565b3d156119b5573d9061199b8261152f565b916119a9604051938461150e565b82523d6000602084013e565b606090565b156119c157565b60405162461bcd60e51b815260206004820152600c60248201526b456d7074792061727261797360a01b6044820152606490fd5b156119fc57565b60405162461bcd60e51b815260206004820152601060248201526f546f6f206d616e7920646f6d61696e7360801b6044820152606490fd5b602081830312610186578051906001600160401b038211610186570181601f82011215610186578051611a668161152f565b92611a74604051948561150e565b818452602082840101116101865761159c9160208085019101611608565b15611a9957565b60405162461bcd60e51b815260206004820152601060248201526f111bdb585a5b881b9bdd08199bdd5b9960821b6044820152606490fd5b15611ad857565b60405162461bcd60e51b8152602060048201526011602482015270125b98dbdc9c9958dd081c185e5b595b9d607a1b6044820152606490fd5b908060209392818452848401376000828201840152601f01601f1916010190565b600054680100000000000000008110156114f8576001810160005560008054821015611b77578080526020902060019190911b01906020816001925184550151910155565b634e487b7160e01b81526032600452602490fd5b15611b9257565b60405162461bcd60e51b815260206004820152600c60248201526b496e76616c6964206e616d6560a01b6044820152606490fd5b90816020910312610186575180151581036101865790565b15611be557565b60405162461bcd60e51b815260206004820152600a6024820152692730b6b2903a30b5b2b760b11b6044820152606490fd5b90611c319060409396959496606084526060840191611b11565b6001600160a01b0390951660208201520152565b6001600160a01b03168015611ca557600080516020611e2b83398151915280546001600160a01b0319811683179091556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b631e4fbdf760e01b600052600060045260246000fd5b5160038114611cf85760048114611ceb57600514611cdf57674563918244f4000090565b6768155a43676e000090565b50678ac7230489e8000090565b5067d02ab486cedc000090565b60ff60f81b16606160f81b8110159081611d1d575090565b603d60f91b1015919050565b600080516020611e2b833981519152546001600160a01b03163303611d4a57565b63118cdaa760e01b6000523360045260246000fd5b6002600080516020611e6b8339815191525414611d8a576002600080516020611e6b83398151915255565b633ee5aeb560e01b60005260046000fd5b60ff600080516020611e8b8339815191525460401c1615611db857565b631afcd79f60e31b60005260046000fd5b90611def5750805115611dde57602081519101fd5b63d6bda27560e01b60005260046000fd5b81511580611e21575b611e00575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b15611df856fe9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00103ef2b580bb52b75be4bad57526f7e61f418fce0695737e314decb597bf74aca26469706673582212208cc17d948d4961acf151acf89d4a6f83df1329795f4ed7038cce55cbf0d2bf8764736f6c63430008210033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.