Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
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:
NeuMetadataV2
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 100000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.28;
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {Series, TokenMetadata, INeuMetadataV2} from "../interfaces/INeuMetadataV2.sol";
import {NeuLogoV2} from "./LogoV2.sol";
import {Bytes8Utils} from "../lib/Utils.sol";
using Bytes8Utils for bytes8;
using Strings for uint256;
using SafeCast for uint256;
contract NeuMetadataV2 is
Initializable,
AccessControlUpgradeable,
UUPSUpgradeable,
INeuMetadataV2
{
uint256 private constant VERSION = 2;
bytes32 public constant NEU_ROLE = keccak256("NEU_ROLE");
bytes32 public constant STORAGE_ROLE = keccak256("STORAGE_ROLE");
bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
uint256 private constant REFUND_WINDOW = 7 days;
string _traitMetadataURI;
mapping(uint256 => TokenMetadata) private _tokenMetadata;
Series[] private _series;
uint16[] private _availableSeries;
NeuLogoV2 private _logo;
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
function initialize(
address defaultAdmin,
address upgrader,
address operator,
address neuContract,
address logoContract
) public initializer {
__AccessControl_init();
__UUPSUpgradeable_init();
_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);
_grantRole(UPGRADER_ROLE, upgrader);
_grantRole(OPERATOR_ROLE, operator);
_grantRole(NEU_ROLE, neuContract);
_logo = NeuLogoV2(logoContract);
emit InitializedMetadata(VERSION, defaultAdmin, upgrader, operator, neuContract, logoContract);
}
function createTokenMetadata(uint16 seriesIndex, uint256 originalPrice) external onlyRole(NEU_ROLE) returns (
uint256 tokenId,
bool governance
) {
require(seriesIndex < _series.length, "Invalid series index");
require(_series[seriesIndex].mintedTokens < _series[seriesIndex].maxTokens, "Series has been fully minted");
tokenId = _series[seriesIndex].firstToken + _series[seriesIndex].mintedTokens;
_setTokenMetadata(tokenId, TokenMetadata({
originalPriceInGwei: uint64(originalPrice / 1e9),
sponsorPoints: 0,
mintedAt: uint40(block.timestamp)
}));
_series[seriesIndex].mintedTokens++;
if (_series[seriesIndex].mintedTokens == _series[seriesIndex].maxTokens) {
_removeAvailableSeries(seriesIndex);
}
governance = _givesGovernanceAccess(seriesIndex);
}
function deleteTokenMetadata(uint256 tokenId) external onlyRole(NEU_ROLE) {
require(_metadataExists(tokenId), "Token metadata does not exist");
uint16 seriesIndex = _seriesOfToken(tokenId);
_series[seriesIndex].burntTokens++;
delete _tokenMetadata[tokenId];
emit TokenMetadataDeleted(tokenId);
}
function setTraitMetadataURI(string calldata uri) external onlyRole(NEU_ROLE) {
_setTraitMetadataURI(uri);
}
function tokenURI(uint256 tokenId) external view returns (string memory) {
return string.concat(
"data:application/json;base64,",
Base64.encode(_makeJsonMetadata(tokenId))
);
}
function isUserMinted(uint256 tokenId) external view returns (bool) {
// slither-disable-next-line timestamp (block miner cannot set timestamp in the past of previous block, so mintedAt == 0 can only mean the token does not exist)
return _metadataExists(tokenId) && _tokenMetadata[tokenId].originalPriceInGwei > 0;
}
function getTraitValue(uint256 tokenId, bytes32 traitKey) external view returns (bytes32) {
return _getTraitValue(tokenId, traitKey);
}
function getTraitValues(uint256 tokenId, bytes32[] calldata traitKeys) external view returns (bytes32[] memory traitValues) {
uint256 length = traitKeys.length;
traitValues = new bytes32[](length);
for (uint256 i = 0; i < length; ) {
bytes32 traitKey = traitKeys[i];
traitValues[i] = _getTraitValue(tokenId, traitKey);
unchecked {
++i;
}
}
}
function getTraitMetadataURI() external view returns (string memory) {
// Return the trait metadata URI.
return _traitMetadataURI;
}
function addSeries(bytes8 name, uint64 priceInGwei, uint32 firstToken, uint32 maxTokens, uint16 fgColorRGB565, uint16 bgColorRGB565, uint16 accentColorRGB565, bool makeAvailable) external onlyRole(OPERATOR_ROLE) returns (uint16) {
uint16 seriesIndex = uint16(_series.length);
uint256 maxToken = firstToken + maxTokens - 1;
uint256 seriesLength = _series.length;
for (uint16 i = 0; i < seriesLength; i++) {
require(_series[i].name != name, "Series name already exists");
require(maxToken < _series[i].firstToken || firstToken >= _series[i].firstToken + _series[i].maxTokens, "Series overlaps with existing");
}
_series.push(Series({
name: name,
priceInGwei: priceInGwei,
firstToken: firstToken,
maxTokens: maxTokens,
mintedTokens: 0,
burntTokens: 0,
fgColorRGB565: fgColorRGB565,
bgColorRGB565: bgColorRGB565,
accentColorRGB565: accentColorRGB565
}));
if (makeAvailable) {
_availableSeries.push(seriesIndex);
}
emit SeriesAdded(seriesIndex, name, priceInGwei, firstToken, maxTokens, fgColorRGB565, bgColorRGB565, accentColorRGB565, makeAvailable);
return seriesIndex;
}
function getSeries(uint16 seriesIndex) external view returns (
bytes8 name,
uint256 priceInGwei,
uint256 firstToken,
uint256 maxTokens,
uint256 mintedTokens,
uint256 burntTokens,
bool isAvailable,
string memory logoSvg
) {
require(seriesIndex < _series.length, "Invalid series index");
Series memory series = _series[seriesIndex];
name = series.name;
priceInGwei = series.priceInGwei;
firstToken = series.firstToken;
maxTokens = series.maxTokens;
mintedTokens = series.mintedTokens;
burntTokens = series.burntTokens;
isAvailable = _isSeriesAvailable(seriesIndex);
logoSvg = _logo.makeLogo(
_makeMaskedTokenId(series), series.name.toString(), series.fgColorRGB565, series.bgColorRGB565, series.accentColorRGB565);
}
function isSeriesAvailable(uint16 seriesIndex) external view returns (bool) {
return _isSeriesAvailable(seriesIndex);
}
function setSeriesAvailability(uint16 seriesIndex, bool available) external onlyRole(OPERATOR_ROLE) {
require(seriesIndex < _series.length, "Invalid series index");
if (available) {
Series memory series = _series[seriesIndex];
if (series.mintedTokens == series.maxTokens) {
revert("Series has been fully minted");
}
}
bool isAlreadyAvailable = _isSeriesAvailable(seriesIndex);
if (available && !isAlreadyAvailable) {
_availableSeries.push(seriesIndex);
emit SeriesAvailabilityUpdated(seriesIndex, available);
} else if (!available && isAlreadyAvailable) {
_removeAvailableSeries(seriesIndex);
emit SeriesAvailabilityUpdated(seriesIndex, available);
}
}
function getAvailableSeries() external view returns(uint16[] memory) {
return _availableSeries;
}
function setPriceInGwei(uint16 seriesIndex, uint64 price) external onlyRole(OPERATOR_ROLE) {
require(seriesIndex < _series.length, "Invalid series index");
_series[seriesIndex].priceInGwei = price;
emit SeriesPriceUpdated(seriesIndex, price);
}
function getSeriesMintingPrice(uint16 seriesIndex) external view returns (uint256) {
require(_isSeriesAvailable(seriesIndex), "Public minting not available");
return uint256(_series[seriesIndex].priceInGwei) * 1e9;
}
function sumAllRefundableTokensValue() external view returns (uint256) {
uint256 totalValue = 0;
uint256 seriesLength = _series.length;
for (uint16 s = 0; s < seriesLength; s++) {
for (uint256 i = _series[s].firstToken + _series[s].mintedTokens - 1; i >= _series[s].firstToken; i--) {
TokenMetadata memory metadata = _tokenMetadata[i];
if (!_metadataExists(i)) {
// Token has been burned
continue;
}
// slither-disable-next-line timestamp (with a granularity of days for refunds, we can tolerate miner manipulation)
if (block.timestamp - metadata.mintedAt > REFUND_WINDOW) {
// All tokens before this one in the series are also expired
break;
}
totalValue += metadata.originalPriceInGwei;
}
}
return totalValue * 1e9;
}
function getRefundAmount(uint256 tokenId) external view returns (uint256) {
TokenMetadata memory metadata = _tokenMetadata[tokenId];
require(metadata.originalPriceInGwei > 0, "Token is not refundable");
// slither-disable-next-line timestamp (with a granularity of days for refunds, we can tolerate miner manipulation)
require(block.timestamp - metadata.mintedAt < REFUND_WINDOW, "Refund window has passed");
return metadata.originalPriceInGwei * 1e9;
}
function setLogoContract(address logoContract) external onlyRole(OPERATOR_ROLE) {
_logo = NeuLogoV2(logoContract);
emit LogoUpdated(logoContract);
}
function _setTokenMetadata(
uint256 tokenId,
TokenMetadata memory metadata
) internal {
// This function is to be called only on token mint. Won't emit TraitUpdated event.
_tokenMetadata[tokenId] = metadata;
emit TokenMetadataUpdated(tokenId, metadata);
}
function increaseSponsorPoints(uint256 tokenId, uint256 sponsorPointsIncrease) external onlyRole(NEU_ROLE) returns (uint256) {
TokenMetadata memory metadata = _tokenMetadata[tokenId];
uint256 newSponsorPoints = metadata.sponsorPoints + sponsorPointsIncrease;
_tokenMetadata[tokenId] = TokenMetadata({
originalPriceInGwei: metadata.originalPriceInGwei,
sponsorPoints: newSponsorPoints.toUint64(),
mintedAt: metadata.mintedAt
});
emit TraitUpdated(bytes32("points"), tokenId, bytes32(newSponsorPoints));
return newSponsorPoints;
}
function isGovernanceToken(uint256 tokenId) external view returns (bool) {
// This doesn't check if token has been minted, just if its ID belongs to the range of a governance series
uint16 seriesIndex = _seriesOfToken(tokenId);
return _givesGovernanceAccess(seriesIndex);
}
function _isSeriesAvailable(uint16 seriesIndex) private view returns (bool) {
uint256 availableSeriesLength = _availableSeries.length;
for (uint256 i = 0; i < availableSeriesLength; i++) {
if (_availableSeries[i] == seriesIndex) {
return true;
}
}
return false;
}
function _removeAvailableSeries(uint16 seriesIndex) private {
for (uint256 i = 0; i < _availableSeries.length; i++) {
if (_availableSeries[i] == seriesIndex) {
_availableSeries[i] = _availableSeries[_availableSeries.length - 1];
_availableSeries.pop();
return;
}
}
}
function _getTraitValue(uint256 tokenId, bytes32 traitKey) private view returns (bytes32) {
TokenMetadata memory metadata = _tokenMetadata[tokenId];
if (traitKey == "points") {
return bytes32(uint256(metadata.sponsorPoints));
} else {
revert("Trait key not found");
}
}
function _makeJsonMetadata(uint256 tokenId) internal view returns (bytes memory) {
TokenMetadata memory metadata = _tokenMetadata[tokenId];
uint16 seriesIndex = _seriesOfToken(tokenId);
Series memory series = _series[seriesIndex];
string memory governance = _givesGovernanceAccess(seriesIndex) ? "Yes" : "No";
string memory seriesName = series.name.toString();
string memory tokenName = string.concat(tokenId.toString(), ' ', seriesName);
string memory logoSvg = Base64.encode(bytes(_logo.makeLogo(
tokenId.toString(), seriesName, series.fgColorRGB565, series.bgColorRGB565, series.accentColorRGB565)));
return bytes(string.concat(
'{"description": "Neulock Password Manager membership NFT - neulock.app", "name": "NEU #',
tokenName,
'", "image": "data:image/svg+xml;base64,',
logoSvg,
'", "attributes": [{"trait_type": "Series", "value": "',
seriesName,
'"},{"trait_type": "Governance Access", "value": "',
governance,
'"},{"trait_type": "Series Max Supply", "value": ',
uint256(series.maxTokens).toString(),
'},{"trait_type": "Mint Date", "display_type": "date", "value": ',
uint256(metadata.mintedAt).toString(),
'}]}'
));
}
function _seriesOfToken(uint256 tokenId) private view returns (uint16) {
uint256 seriesLength = _series.length;
for (uint16 i = 0; i < seriesLength; i++) {
if (tokenId >= _series[i].firstToken && tokenId < _series[i].firstToken + _series[i].maxTokens) {
return i;
}
}
revert("Token does not belong to any series");
}
function _makeMaskedTokenId(Series memory series) private pure returns (string memory) {
uint256 lastToken = series.firstToken + series.maxTokens - 1;
bytes memory lastTokenBytes = bytes(lastToken.toString());
bytes memory firstTokenBytes = bytes(uint256(series.firstToken).toString());
bool stoppedMatching = firstTokenBytes.length != lastTokenBytes.length;
bytes memory result = new bytes(lastTokenBytes.length);
for (uint256 i = 0; i < result.length; i++) {
if (!stoppedMatching && firstTokenBytes.length > i && lastTokenBytes[i] == firstTokenBytes[i]) {
result[i] = lastTokenBytes[i];
} else {
stoppedMatching = true;
result[i] = "x";
}
}
return string(result);
}
function _metadataExists(uint256 tokenId) private view returns (bool) {
// slither-disable-next-line timestamp (block miner cannot set timestamp in the past of previous block, so mintedAt == 0 can only mean the token does not exist)
return _tokenMetadata[tokenId].mintedAt != 0;
}
function _givesGovernanceAccess(uint16 seriesIndex) private view returns (bool) {
// Tokens whose name do not start with "WAGMI" give governance access
bytes32 wagmiNamePrefix = "WAGMI";
for (uint256 i = 0; i < 5; i++) {
if (_series[seriesIndex].name[i] != wagmiNamePrefix[i]) {
return true;
}
}
return false;
}
function _setTraitMetadataURI(string memory uri) internal {
// Set the new trait metadata URI.
_traitMetadataURI = uri;
emit MetadataURIUpdated(uri);
}
function _authorizeUpgrade(address newImplementation)
internal
onlyRole(UPGRADER_ROLE)
override
{}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
struct AccessControlStorage {
mapping(bytes32 role => RoleData) _roles;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;
function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
assembly {
$.slot := AccessControlStorageLocation
}
}
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
return $._roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
AccessControlStorage storage $ = _getAccessControlStorage();
return $._roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
AccessControlStorage storage $ = _getAccessControlStorage();
bytes32 previousAdminRole = getRoleAdmin(role);
$._roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (!hasRole(role, account)) {
$._roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (hasRole(role, account)) {
$._roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.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 reininitialization) 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 Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.20;
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 ERC1967) 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 ERC1167 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 ERC1822 {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 ERC1967-compliant implementation pointing to self.
* See {_onlyProxy}.
*/
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 ERC1967.
*
* 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.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165Upgradeable is Initializable, IERC165 {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.20;
/**
* @dev ERC1822: 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.0.0) (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.20;
/**
* @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.0.0) (proxy/ERC1967/ERC1967Utils.sol)
pragma solidity ^0.8.20;
import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*/
library ERC1967Utils {
// We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
// This will be fixed in Solidity 0.8.21. At that point we should remove these events.
/**
* @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);
/**
* @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 EIP1967 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 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 EIP1967) 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 EIP1967 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 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 EIP1967 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 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.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @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 AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @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
* {FailedInnerCall} 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 AddressInsufficientBalance(address(this));
}
(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 {FailedInnerCall}) 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 {FailedInnerCall} 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 {FailedInnerCall}.
*/
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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.2) (utils/Base64.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides a set of functions to operate with Base64 strings.
*/
library Base64 {
/**
* @dev Base64 Encoding/Decoding Table
*/
string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/**
* @dev Converts a `bytes` to its Bytes64 `string` representation.
*/
function encode(bytes memory data) internal pure returns (string memory) {
/**
* Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
* https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
*/
if (data.length == 0) return "";
// Loads the table into memory
string memory table = _TABLE;
// Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
// and split into 4 numbers of 6 bits.
// The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
// - `data.length + 2` -> Round up
// - `/ 3` -> Number of 3-bytes chunks
// - `4 *` -> 4 characters for each chunk
string memory result = new string(4 * ((data.length + 2) / 3));
/// @solidity memory-safe-assembly
assembly {
// Prepare the lookup table (skip the first "length" byte)
let tablePtr := add(table, 1)
// Prepare result pointer, jump over length
let resultPtr := add(result, 0x20)
let dataPtr := data
let endPtr := add(data, mload(data))
// In some cases, the last iteration will read bytes after the end of the data. We cache the value, and
// set it to zero to make sure no dirty bytes are read in that section.
let afterPtr := add(endPtr, 0x20)
let afterCache := mload(afterPtr)
mstore(afterPtr, 0x00)
// Run over the input, 3 bytes at a time
for {
} lt(dataPtr, endPtr) {
} {
// Advance 3 bytes
dataPtr := add(dataPtr, 3)
let input := mload(dataPtr)
// To write each character, shift the 3 byte (24 bits) chunk
// 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
// and apply logical AND with 0x3F to bitmask the least significant 6 bits.
// Use this as an index into the lookup table, mload an entire word
// so the desired character is in the least significant byte, and
// mstore8 this least significant byte into the result and continue.
mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
}
// Reset the value that was cached
mstore(afterPtr, afterCache)
// When data `bytes` is not exactly 3 bytes long
// it is padded with `=` characters at the end
switch mod(mload(data), 3)
case 1 {
mstore8(sub(resultPtr, 1), 0x3d)
mstore8(sub(resultPtr, 2), 0x3d)
}
case 2 {
mstore8(sub(resultPtr, 1), 0x3d)
}
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.20;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeCast {
/**
* @dev Value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedIntToUint(int256 value);
/**
* @dev Value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
/**
* @dev An uint value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedUintToInt(uint256 value);
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.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 ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* 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;
* }
* }
* ```
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
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) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.28;
import {INeuLogoV2} from "../interfaces/ILogoV2.sol";
contract NeuLogoV2 is INeuLogoV2 {
string constant private _BEFORE_FOREGROUND_COLOR = '<svg width="500" height="500" viewBox="0 0 500 500" zoomAndPan="magnify" preserveAspectRatio="xMidYMid" version="1.0" xmlns="http://www.w3.org/2000/svg"><style>.f { fill: #';
string constant private _BEFORE_BACKGROUND_COLOR = '; } .b { fill: #';
string constant private _BEFORE_ACCENT_COLOR = '; } .a { fill: #';
string constant private _BEFORE_TOKEN_ID = '; }</style><rect class="b" x="0" y="0" width="500" height="500" /><g transform="scale(0.8) translate(50 10)"><path class="f" d="M 250,23 47,359 l 203,118 203,-118 z" /><path class="a" d="m 250,177 a 53,53 0 0 0 -53,53 53,53 0 0 0 38,50.82812 V 388 l 15,14 13.96484,-13.03516 L 254,379 v -13 l 7.5,-7.5 -7.5,-7.5 v -13 l 7.5,-7.5 -7.5,-7.5 v -9 l 11,-11 V 280.82812 A 53,53 0 0 0 303,230 53,53 0 0 0 250,177 Z m 0,27 a 16,16 0 0 1 16,16 16,16 0 0 1 -16,16 16,16 0 0 1 -16,-16 16,16 0 0 1 16,-16 z" /></g><rect class="f" x="0" y="440" width="500" height="500" /><style>@font-face {font-family: MajorMono; src: url(data:font/woff2;utf-8;base64,d09GMgABAAAAABXYABEAAAAALnwAABV6AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhwbIByBSgZgAFQISgmcFREICrBUqwELVgABNgIkA4EoBCAFhRIHIAyBMhsnKrMRUVM35VwUJXE0Kfs/JHBDJryG2rMkrqvTmDD4xi3NkM0UR71fobcoTARFQTJUfB9ds+/IxC7aLTlpveYXCswEl8J9yKB5bIQksxbltKpHkuPMSE6WWAHCJWUBAzIHmLyABwzOHhL8gMXDt/P1YyzLuq67xAIc6m6wgUxkNgN12kmWKQZWCOwwlvTNM26lbepvS/kBLV7n29A+GUKSk08KUlMyqnKA3DRJjlzfNe1V+QFv/Qfd3jFeS9haXrtzdbI/zPVpV/U1PJ+2lIsqYQW+8lPZsxsgw4Z0ZAQpKPnWV9QuanXV05oSU2XpfAkmIkuW8+Bbpp4ylSl50N7OEw57Vd3o/r96I/6OQKr0aozip7l67XuT5ANgGYQBtBWusrpqdrKzycwkWbrcJZdP+XhA2aP01hSB5P+cErCQxELXVblaDZ2AIAwE08Sc9owBNoRAVjt6/Pa3pt9gTbq/lRRBRJrwEJC0084ed7cHAqAiFKtCDjpF61D7M+NYaz0ytu0xYYcMAJbVlZO27HYL2J07uhuGe7GSIkPZ7CvTEVl8TB2JbUPVxMyBzSgcPru9LYmHfxhkMEOql6F09zV1Q6+0WC1Zy4zygZIhDRpDMhkboT7xU2F3kQ2M/Ew4ZPYH/4UCsBPMA2D3x8apFpnpagBQQtEclJBR3vfsxuPQTeZD1mVinjyPz2ay+9n9StcJGcujpaQNLp24CUI72Fqvi1KgwyRkbLtZugad3w/WF1CsX62rrWtBaBxZhrKx810++yhbH1f7P1DRIPMUd77Tld3sBPT0P/SDHwSRzX+wLzdRrn94Zru0HuNE8ocHqKf/mmhyOtYzYy34Arba70BkG10FAZU6qaBQq7ZCgrSX0tq9KdcjoMToCl3ruVKf2kJ5dCGYBmUvtbCLi452OoyO6uSJhbLX2evTh08ESnVdkIJedApe+/PQ8USFAUtIQUSvKB84x75YI63w/wKWf3StZHEwHqAUb5E8HPz0iUmTPyuvL45ClBVWXx2rxyAFxamlJfkBpchIjqjgfw+ZSD5PC6REPMlKu0x9kQUsghhC2kNAHZNj8NaDZ7Wwe9tIUqotHad/royJq/0ny0kIbQqQGLn2EN5GONWFChkyEJinVlC551HNoZkz1gZIrVBsTRVEW1GHTjBsrI5Rnb0F0JrHyAP7EFBy/5IvpqOMZuqwvO/jnkkHwWuwQRDXHhIGEq7G+ipUoHOxA3UxaC9JN6cC4qMEHU4gI0hFHVToEE2TNsf/mJw85+pmUQOqxn6+qRQ6fVW2A7dgvQaMI3uRY3IISejdhmAeZZDjJq2lK8g7o5vKLsJaAZKTTn/4U2L1LZN8gDjaAmw2mqxLa1mksuetURsWrE45KLRTOOPEFS7yGhEcbvTOTW3mAu4BvkU3rvBQmhbJlH9MTnPc8BglH+lIH0EzfWwe+cLG/fASa6IXJwiW7/vNw2XZ2FwLthuiwOex7YchkObwIoynjborzgrdFGRDBckrWWxXC3OXz0Vk7A6svlP4cQwJaM6Zm5aAw1FGRe7mKBx1TNz3sAUYbH0Iwf4PSWn9lkeYKqDlyOObkwG2OSyDVieE5iRC2m1maxqe3BHnHAjNIWP7EyjhfJevi7svQgVHQRQjpAmBDKGQJRLkCIM8kaFAFCgSFUpEgzLRF3WhTkij1M0jr1Kv8jVmLljRwwzn+sde+8Mb+uc9VMEUToy2Z+auW5xpqipqVEwlVJ1qUE2qRbWpDvWlZQNIE7QwTEYyVXq6Vb1ppWOFgeemRmAYDAdmszFERsfApUs1LenF/ZgTpTEcJvnF0mLPFr9bF+NBkdP6wL8OBjpT2xxz8rIZ5IPWC+eYQidT5EWQ0ONo25aC/6EZQnzRpTJLkZn3yALSyEj3AGztd6hiifpBU7HqFkM4Tk2vUahwl9o0gzhmWtbz+cj6tiT+zKTetLlulcj63QWZ3ADwr3RTZj6YXbKLKYcYXDzPAxNp8uq1DzsNUvNaiWKOkm7kUWJJi0t/yXS+YkJbns8Fl27bU5QcUwc6jPaiCNWcpbz8tWkNjLFVZKa2iBmTWWXcHSV9mFSYD591mJaMkuIQ6qQo4WyjFFKR0FsRx7uM7AmZYwjLf2AUcyEFnk6PIMcOjbcLg5AbX84o0GbpevhelRTJHoIJtFM5jn1zJHmQ6Wk3730tjVpjLaXo5DJsWfHdidbvYPIOPNpA5xMlzd+9g70JPN/Q6iIrdVIW3NsmoFIDSF12mn7PHAQvTajLKIWLxN7vHfzA7J38Idsxpr7FW7AJYT3vg53IlZKF1znMq26UilkzYsODKnhoOhn0joRpbtzMO/urNFLrEu/kQ5TUtLv049yf/xGjAGbmsEvYDRtdMjZUfBt0hEeLsAlAxOMdLX2rJTfEGj8+caKYr3SY3faduxGLwX552vIMBWRTZqni52Ad4cXGwItKLcMcN6AqL+HNZTjsiyWxP/kUsM1gOSGoGEXASkKyiozbickQOEcR0EUo6U6+C8BWjR6NwDuagD6NpJ+GEKkmRGoIkVpCsk4elpF6LCMNWEYasUw2kXEHacYd2GKeQKtGqk0nNLR2NLQONLRONLQuNLRuNLQeNLReNLr7khdQ7DzVf1C+2LToA7hZDlrczHDLiqHkBSLDsEHaiEEw2oQSjjiml+C4XuJMfOMWmETCTTjFsTBtEMw0oZQXzuqlOKeX4rxeigGO4IBBcNAgcQjDN+JhfSMe0TfiUX0jHuMIjhsEJwxadjL5lLi/7RFU1pyS2fzYnqiIfPWLfUtS0N4SlKLL86/Ua2GBQJYFB82oRO+VCcgH6WJA0QE4AISD+BsAMEggMFDJWI944LJsn8iTSPzFkWh62qWlmiNa7SbwZPVjXa7aNLF4sa2tWOGbGfblIWFqKF8sRLheNaSYJa66NtwN3QJT1S7RwV2qyf2a7w/m3xa/8Pb0rnu6l6poJws+SIF3hTdwzsTJuF8gzVKZdvK+Fe95R5x873qUSE1d4SfevUYUKOmJ3gTg1wgqqAiBn4QAxQYqewOywmX6flSnQWUvfl3Yz1nwvkHKitvtwivedSth3mRLEyeNcaEIvZkkZC6lxsBlAZXOMacm5Ykf9vvi3Xdd4uo+IyWVqfFk6libaG7hrSa4IhQhaxDT4b1+IXPFw31H2cJzMbXKmlsKee/LdwPGMTapmUtTWgzPc07ExKKXlkwPbq6qJ961B5Sc9OV+toIxLTKXu3Mj3wS+1s/JXdEc/IJnwHNvDgP3lth3/CPY1gi0zL9x1flOZ6nniMEes2PgzWuuMagyV1SqE8xqQlo41VOu6+gS7bxzrJr7PLxW1Phdwumta2u1QaW55Yys+/q5GZdax9a294WDulTqc3JH/VFs21B3aIH1zetlBE3K40bSlxIuEH2u2+1e8dh7gLm8N7PFN7D0LM6vkgbzNcKkfthcM0kwAQ5OKjVIzWEjH2O1aCdHissL3G/E5F2e+7DdFNjq/7hSV0CviC6R1fYf1Cbzg9DyCGBMP9+nT7wiTr52mAJPnuMnXj6AT/pHmv9uzla2ahM8nxbcKkvc3ORuNInRwhwNLvx5xo+PUuAxcfIRzD/Mn7zZ/svcSoFb+ImbUHs3132Lr3nqrv0m7rzQgstmJo1gNnn4ojwPn+OYNkyK8q0rg4JYiGMYHjW4j6vGlc0hPHfjz8b9QN/LFe4GdxbLEHGX34/V0Yn+7l95HE9Lx3AiRaAM641oDemlaoqsMJvLyWWkqbzcTFpK1cZ0LdJbFZYsIPA0DEvDl0XuoMvxk2pJc21HB/mcwTEebbdTb+Pp66+VtoJ+BUdHNUIj5yi8ohrp7vAIqYVaE2hjW0cRLTZvqspC1vs0e5FVlaQnluRme+jk6450maRfh2uztJk4lqlrNuK5mRriVxbB+AXjbVAY6wDjOSOETNM5k8GXhgupF+AwnE89f1UOQ6AO/VB8OY09xvUrUFsyuhGQqAmPFyo0aRiWZSgTQ/AyH1N1udniN4W+fv0aOmnixOnM/kXnzq0HBzbXAVOfgrgUHC6f1n1cBw5IfdDMeDxZH+lwfnr9xj5j3fPb9ar9x6pIsoqaRRV0OhNF/Ur9/IVnZuIE4eh4IWIWkb0Q8yZwjNDlyrQpBq0u65zJ9Bk+q6sMqiiFXPxStirVZ+2UHitf2LxDGQKK9yChU6QTYuUmNSui+Z9i+YwbE59Hx+YcnODL9iGqiRQNFVpoHLzpG3PN+w+/37ujJ/PV3Khm1MrnW1GpPCQgTf+kzOYekugi14mlcmsqx6jLlmoSCJBJ7FFchTBkolQr4Obbx3oN8B4QOE6pxzDCluGu8S1R4OlGUIvDklBTcL6VREXUCKp/ZCMN3acmU7uD0kbDBhxLS8PwMLE3bPMeoshgaeHH0j1r+0pzbPimpLvpXbRzXCVs5zHltDIzvlr11qmkBV3WSNiDegVxP8k/yzm9lM0xdH3DuKIi+lvWlyxmvzlFGNt/zm423eVqz3XoCldSTgEZfFutTEpSqtWOijOp//966M3/Jh0O37DaykOFgaggUNhaa2tQ8IUmw5AhnRJlKkQULBQGi5Bpl+AE+BkR2ATTl9VN3VPgTriwmEbKlcumWCyKAxJRaKhIIgv1ENrFHjzL/j3dxkeg8dedo2EKLLhh9FNxw0RKRUK8QqmUVKaVCMq32fgoCoo3FuWxfb0EnzlY0CkHPChACrbDdi/w7LDIFnot2jEXcod0sgFPnSRTJhIEKJ6oWhotwILzoFRk8nHnCQN5qF0qRQNHW6h/En+tc86D7Qd6lrkpExTyeKXAXubdv6x9F1YLUb5VtLCuaEvZ3+BTl8IZCJ8KJuoXKZFESnFjEh3DodhsJmlhstgkk0myOWxLzkpTEi6VREZKpJV9mIcYjENMBqNObenlzeF4c7mOgsoj/tSkdj4QSrFUyKuDck1ud9RnWbpWE26VVNDcsde2jrkGIdUArSP3N0H7fDJwHIzYvRWpLflT//9am/R+gP/pf5PerlXSMPgVhCGHZzDBeSwBdrhGf8QM1d/gP9BL/3/LGfDRw4vJ688iRCBG3wD0LySSAzyKUALFLaYVT6ZvHjbiyhx1KzNm300RRsrZTOIaj9s3qrAGMODJKHKkcmEofuqSDE9CP/cWHX2FJ8VJJOYvkRX+AlHED1T5A+yDBqAPkPbCo2jmtu0G4toAEqY6DT2fhH7hbg4nqHFXXDiEKXkQGwMfVs4Py8e0geO+51xLLK4s7mrE2xEceQKJkcCEpGZXDatAGhRU6lMXSTLVg3gEdPIZTvEwPV7bUSe9JZ2YuAIwrF5qB3Kz2i80VFp9g80PIA8aXTcMWoMPAPbGWxx1fKwuSIdfCIve9GRn/Ez0jx88n4TRZ9hMomZN42kwhxIx801UO6mU7GFA8u8Lx1uSA4suwxJLCBapHIv1MAC1bqzyxKTWkIZAHEkgzqBP+GM8CFIehqYmjVlDKaNDBmfxE/noB+l/SfRb/T0fLCgBFvTUfkHyGnbfIPOhmOwNWcxjBc/Uel86meED1vPCCRz3wjhQeCChz7owjMGldqyVR6NvhC2Aec5UTTf7rcqXua+Q43kJs5FvllvYoOmiFxqPWag+Gff0zZzHocihEUIw+FUysHkUeGEbO1F/Y1ioTfE9/w6+6TNbmlfIYhGzFGDfN4S2hPmhLLDoy1M8JCGsPIMUjouyDB7YKUATJhKeT9ADninyED2ORWJzBq5twU8mvDCf73IGELakuunpW6varI7lsYVz/Ws1Od0WH5G4DwxFIWrOYOtGQYsZMgUG59uFMeSu2W0mjAeXxnFMOqcgIEL4VZ7jU65Fbr4YYot/XsuTcFZVyPnFoFj1qlzlQXrcDhUxm6WU4sBRFBJlZW+go+xiw26A0AZl11Q3lHMY7KUhfFGGy5E2D0cKtjpCqzWph+zQ9Sk9sslyBEXA7oLpL7O//S4JE9dOQIZBWiFzAojTLPOM5clbNLS+WoR+eD7TjVAZOxXz6LseAXaEQxBvK8zCHR7BkVX63oW+6S2IdcuaSReyzE1w5/vvEHYdqqFVnj3DbHigb4RqhB7eiCyQeTKqDsg2AwhaJDeg3sEc8yH9WqGfPVHIQvb4CdfZ7XYzBjJcEi6+y8QGUvr00hgrjboAFu3gKI5KWstgO+BGYvgw244YKj55M2cXziNce4s1bNKgzI1ZCeQtxYLg6dTt6AzOxEGH7stnT51TNyyCD+9GAPN+AfCTxwaGLNKAQNGXLubjTRAHbc3QgDtzIQKxmxjTzDcfkzxc30bAJ94SOLKXnX1Ym1doos5j7FqphzVK6+YladsRWqdm3fqPHMenpN2VAnBmf7mzCI3hKe24zv03M4cexKgHHHhTLCMmYVLdQ8YxZhrqDL8UMzvo/kxgVQuq+SwGDI2ayj3dQO151jvirNE9q/VIM5dk912oRBZRGbpAeZuA3cDBC5VV/NCoG4lRBaoctYqsafeSis8nwXs94OZObzObtBqVEkYc9DTuQjAO3kAWBmRsMHoWhFzn0SWZ360cTaw8A+EAZ0sZjhVWjZrCPdXvQkOn6shCceX70aV8SAKNbzO21rdrRUzLxvclB7e0A7cnUQL+i6KBGDHmspl/pqLoNQ+kHl0qn2+JJiBV8jr5VPghpPgcOBE4zaZBgEdXlPkyYSAADMiZl8+pCyv+zd5J3wPAe9vkho/6Nx/49e+MFWHviRsZQtcHAAF/jVS230bA9Wx75KY1Mb7GcofAzTiHddiJB/Ak7sPWvZ6N5diLl6IXG90qWqxwp9hdb4YbMR73Yzn241E8Ay9xT6d3j/3gacal7V74X6F170QmGzymUWG7iT0BOOZYBqk5BL5NWQ4VU4PA1oRowa0ZHHh7awnbfLm1jOwUv7WC26j6xduQHnZs1affhEEd2rQbpsuULkM+hHnClta9GnSy1GA+sU/v5rpyg6KTVE0s4WYjo2qnEUNWxfOiVvTvwkJpfdSmg5gc0ShVk1Q9LRSiL7R3a9HKWQyzqSn2SHR7qlOSoEVo6KjCft1E/YRKLdqMHFDZnilV+lNYpPw+3GP3bPGwqqOoTiIFHXuZJ6XXkUsLCKqD9sS6FkoHJWrVAJfos6rDZIbCURmsMF/CrjVFN92wCgejHOkIt2NmPsfxKEM2QoPJjob1HmKr6t2qFoQN4YAhxzbouWwjRUJRldAcVuseZAII69/94PlKzwKhM7xB8ufote0FhGy5C6sDiV997ynLYXbG69kxW2FbU+iWhzTIAIOwIGZjk00P+QAkwDgTOlbhCYpjn2toJq0F92soa2CsNQtxdY8HtXmQzGk8Nc+yJvueKltkY47E+8k6HJRPX2BF7SU322BUAAAA);}</style><text class="b" font-family="MajorMono" font-weight="400" x="250" y="480" font-size="28" text-anchor="middle">neu #';
string constant private _BEFORE_SERIES_NAME = ' ';
string constant private _TAIL = '</text></svg>';
// Adapted from https://ethereum.stackexchange.com/a/126928
function _byteToHex(uint8 b) private pure returns (string memory) {
bytes memory _base = "0123456789abcdef";
bytes memory converted = new bytes(2);
converted[0] = _base[b / 16];
converted[1] = _base[b % 16];
return string(converted);
}
function _rgb565ToHex(uint16 color) private pure returns (string memory) {
uint8 r = uint8((color & 0xF800) >> 8);
uint8 g = uint8((color & 0x07E0) >> 3);
uint8 b = uint8((color & 0x001F) << 3);
return string(string.concat(
_byteToHex(r),
_byteToHex(g),
_byteToHex(b)
));
}
function _toLowerCase(string memory str) private pure returns (string memory) {
bytes memory bStr = bytes(str);
for (uint i = 0; i < bStr.length; i++) {
if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) {
bStr[i] = bytes1(uint8(bStr[i]) + 32);
}
}
return string(bStr);
}
function makeLogo(string calldata tokenId, string calldata seriesName, uint16 foregroundColor, uint16 backgroundColor, uint16 accentColor) external pure returns (string memory) {
string memory part1 = string(string.concat(
_BEFORE_FOREGROUND_COLOR,
_rgb565ToHex(foregroundColor),
_BEFORE_BACKGROUND_COLOR,
_rgb565ToHex(backgroundColor)
));
string memory part2 = string(string.concat(
_BEFORE_ACCENT_COLOR,
_rgb565ToHex(accentColor),
_BEFORE_TOKEN_ID
));
string memory part3 = string(string.concat(
tokenId,
_BEFORE_SERIES_NAME,
_toLowerCase(seriesName), // We're using a lowercase-only font
_TAIL
));
return string(string.concat(
part1,
part2,
part3
));
}
}// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.28;
interface INeuLogoV1 {
function makeLogo(string calldata tokenId, string calldata seriesName, uint16 foregroundColor, uint16 backgroundColor, uint16 accentColor) external view returns (string memory);
}// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.28;
import {INeuLogoV1} from "../interfaces/ILogoV1.sol";
interface INeuLogoV2 is INeuLogoV1 {
function makeLogo(string calldata tokenId, string calldata seriesName, uint16 foregroundColor, uint16 backgroundColor, uint16 accentColor) external pure returns (string memory);
}// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.28;
interface INeuMetadataV1 {
function addSeries(bytes8 name, uint64 priceInGwei, uint32 firstToken, uint32 maxTokens, uint16 fgColorRGB565, uint16 bgColorRGB565, uint16 accentColorRGB565, bool makeAvailable) external returns (uint16);
function createTokenMetadata ( uint16 seriesIndex, uint256 originalPrice ) external returns ( uint256 tokenId, bool governance );
function deleteTokenMetadata ( uint256 tokenId ) external;
function getAvailableSeries ( ) external view returns ( uint16[] memory );
function getRefundAmount ( uint256 tokenId ) external view returns ( uint256 );
function getSeries ( uint16 seriesIndex ) external view returns ( bytes8 name, uint256 priceInGwei, uint256 firstToken, uint256 maxTokens, uint256 mintedTokens, uint256 burntTokens, bool isAvailable, string memory logoSvg );
function getSeriesMintingPrice ( uint16 seriesIndex ) external view returns ( uint256 );
function getTraitMetadataURI ( ) external view returns ( string memory );
function getTraitValue ( uint256 tokenId, bytes32 traitKey ) external view returns ( bytes32 );
function getTraitValues ( uint256 tokenId, bytes32[] calldata traitKeys ) external view returns ( bytes32[] memory traitValues );
function increaseSponsorPoints ( uint256 tokenId, uint256 sponsorPointsIncrease ) external returns ( uint256 );
function isSeriesAvailable ( uint16 seriesIndex ) external view returns ( bool );
function isUserMinted(uint256 tokenId) external view returns (bool);
function setLogoContract(address logoContract) external;
function setPriceInGwei ( uint16 seriesIndex, uint64 price ) external;
function setSeriesAvailability ( uint16 seriesIndex, bool available ) external;
function setTraitMetadataURI ( string calldata uri ) external;
function sumAllRefundableTokensValue ( ) external view returns ( uint256 );
function tokenURI ( uint256 tokenId ) external view returns ( string memory );
}// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.28;
import {INeuMetadataV1} from "./INeuMetadataV1.sol";
struct Series {
bytes8 name;
uint64 priceInGwei;
uint32 firstToken;
uint32 maxTokens;
uint32 mintedTokens;
uint32 burntTokens;
uint16 fgColorRGB565;
uint16 bgColorRGB565;
uint16 accentColorRGB565;
}
struct TokenMetadata {
uint64 originalPriceInGwei;
uint64 sponsorPoints;
uint40 mintedAt;
}
interface INeuMetadataV2 is INeuMetadataV1 {
event InitializedMetadata(uint256 version, address defaultAdmin, address upgrader, address operator, address neuContract, address logoContract);
event TokenMetadataUpdated(uint256 indexed tokenId, TokenMetadata metadata);
event TokenMetadataDeleted(uint256 indexed tokenId);
event MetadataURIUpdated(string uri);
event TraitUpdated(bytes32 indexed traitName, uint256 tokenId, bytes32 traitValue);
event SeriesAdded(uint16 indexed seriesIndex, bytes8 indexed name, uint64 priceInGwei, uint32 firstToken, uint32 maxTokens, uint16 fgColorRGB565, uint16 bgColorRGB565, uint16 accentColorRGB565, bool makeAvailable);
event SeriesAvailabilityUpdated(uint16 indexed seriesIndex, bool available);
event SeriesPriceUpdated(uint16 indexed seriesIndex, uint64 priceInGwei);
event LogoUpdated(address logoContract);
function isGovernanceToken(uint256 tokenId) external view returns (bool);
}// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.28;
library Bytes8Utils {
function toString(bytes8 data) internal pure returns (string memory) {
uint8 i = 0;
while(i < 8 && data[i] != 0) {
i++;
}
bytes memory bytesArray = new bytes(i);
for (i = 0; i < 8 && data[i] != 0; i++) {
bytesArray[i] = data[i];
}
return string(bytesArray);
}
}{
"optimizer": {
"enabled": true,
"runs": 100000
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"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":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"version","type":"uint256"},{"indexed":false,"internalType":"address","name":"defaultAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"upgrader","type":"address"},{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"neuContract","type":"address"},{"indexed":false,"internalType":"address","name":"logoContract","type":"address"}],"name":"InitializedMetadata","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"logoContract","type":"address"}],"name":"LogoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"MetadataURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"seriesIndex","type":"uint16"},{"indexed":true,"internalType":"bytes8","name":"name","type":"bytes8"},{"indexed":false,"internalType":"uint64","name":"priceInGwei","type":"uint64"},{"indexed":false,"internalType":"uint32","name":"firstToken","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"maxTokens","type":"uint32"},{"indexed":false,"internalType":"uint16","name":"fgColorRGB565","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"bgColorRGB565","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"accentColorRGB565","type":"uint16"},{"indexed":false,"internalType":"bool","name":"makeAvailable","type":"bool"}],"name":"SeriesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"seriesIndex","type":"uint16"},{"indexed":false,"internalType":"bool","name":"available","type":"bool"}],"name":"SeriesAvailabilityUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"seriesIndex","type":"uint16"},{"indexed":false,"internalType":"uint64","name":"priceInGwei","type":"uint64"}],"name":"SeriesPriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenMetadataDeleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint64","name":"originalPriceInGwei","type":"uint64"},{"internalType":"uint64","name":"sponsorPoints","type":"uint64"},{"internalType":"uint40","name":"mintedAt","type":"uint40"}],"indexed":false,"internalType":"struct TokenMetadata","name":"metadata","type":"tuple"}],"name":"TokenMetadataUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"traitName","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"traitValue","type":"bytes32"}],"name":"TraitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NEU_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STORAGE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes8","name":"name","type":"bytes8"},{"internalType":"uint64","name":"priceInGwei","type":"uint64"},{"internalType":"uint32","name":"firstToken","type":"uint32"},{"internalType":"uint32","name":"maxTokens","type":"uint32"},{"internalType":"uint16","name":"fgColorRGB565","type":"uint16"},{"internalType":"uint16","name":"bgColorRGB565","type":"uint16"},{"internalType":"uint16","name":"accentColorRGB565","type":"uint16"},{"internalType":"bool","name":"makeAvailable","type":"bool"}],"name":"addSeries","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"seriesIndex","type":"uint16"},{"internalType":"uint256","name":"originalPrice","type":"uint256"}],"name":"createTokenMetadata","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"governance","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"deleteTokenMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAvailableSeries","outputs":[{"internalType":"uint16[]","name":"","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRefundAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"seriesIndex","type":"uint16"}],"name":"getSeries","outputs":[{"internalType":"bytes8","name":"name","type":"bytes8"},{"internalType":"uint256","name":"priceInGwei","type":"uint256"},{"internalType":"uint256","name":"firstToken","type":"uint256"},{"internalType":"uint256","name":"maxTokens","type":"uint256"},{"internalType":"uint256","name":"mintedTokens","type":"uint256"},{"internalType":"uint256","name":"burntTokens","type":"uint256"},{"internalType":"bool","name":"isAvailable","type":"bool"},{"internalType":"string","name":"logoSvg","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"seriesIndex","type":"uint16"}],"name":"getSeriesMintingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTraitMetadataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"}],"name":"getTraitValue","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32[]","name":"traitKeys","type":"bytes32[]"}],"name":"getTraitValues","outputs":[{"internalType":"bytes32[]","name":"traitValues","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"sponsorPointsIncrease","type":"uint256"}],"name":"increaseSponsorPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"defaultAdmin","type":"address"},{"internalType":"address","name":"upgrader","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"neuContract","type":"address"},{"internalType":"address","name":"logoContract","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isGovernanceToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"seriesIndex","type":"uint16"}],"name":"isSeriesAvailable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isUserMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"logoContract","type":"address"}],"name":"setLogoContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"seriesIndex","type":"uint16"},{"internalType":"uint64","name":"price","type":"uint64"}],"name":"setPriceInGwei","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"seriesIndex","type":"uint16"},{"internalType":"bool","name":"available","type":"bool"}],"name":"setSeriesAvailability","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setTraitMetadataURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sumAllRefundableTokensValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]Contract Creation Code
60a06040523060805234801561001457600080fd5b5061001d610022565b6100d4565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100725760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100d15780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516150cb6100fd600039600081816131060152818161312f015261336d01526150cb6000f3fe6080604052600436106102345760003560e01c80637427160511610138578063c87b56dd116100b0578063db5c339b1161007f578063f5b541a611610064578063f5b541a614610742578063f72c0d8b14610776578063f80ecba3146107aa57600080fd5b8063db5c339b1461070d578063de475bf91461072d57600080fd5b8063c87b56dd14610679578063d474ea5814610699578063d547741f146106b9578063d58a3448146106d957600080fd5b8063ac77320411610107578063add77524116100ec578063add775241461060f578063b9e576b11461062f578063ba7e15bd1461064457600080fd5b8063ac77320414610599578063ad3cb1cc146105b957600080fd5b806374271605146104d257806391d14854146104f2578063a217fddf14610564578063a28eec871461057957600080fd5b806336568abe116101cb5780634f1ef2861161019a578063559c2a981161017f578063559c2a981461045e578063566eea1b1461047e57806356dcac881461049e57600080fd5b80634f1ef2861461043657806352d1902d1461044957600080fd5b806336568abe1461038d57806339ce4540146103ad5780633ccec20c146103e15780633e96e7311461041457600080fd5b80632094a036116102075780632094a036146102de578063248a9ca3146102fe5780632da7b0e61461034d5780632f2ff15d1461036d57600080fd5b806301ffc9a71461023957806304cd52941461026e578063064fa71d1461029c5780631459457a146102bc575b600080fd5b34801561024557600080fd5b506102596102543660046141cd565b6107d7565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b5061028e61028936600461420f565b610870565b604051908152602001610265565b3480156102a857600080fd5b506102596102b736600461420f565b6109e1565b3480156102c857600080fd5b506102dc6102d7366004614251565b6109ff565b005b3480156102ea57600080fd5b506102dc6102f93660046142b6565b610cb7565b34801561030a57600080fd5b5061028e61031936600461420f565b60009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b34801561035957600080fd5b506102dc610368366004614354565b610d25565b34801561037957600080fd5b506102dc610388366004614387565b610e64565b34801561039957600080fd5b506102dc6103a8366004614387565b610eae565b3480156103b957600080fd5b506103cd6103c83660046143aa565b610f07565b604051610265989796959493929190614433565b3480156103ed57600080fd5b506104016103fc3660046144c8565b6111dd565b60405161ffff9091168152602001610265565b34801561042057600080fd5b5061042961178d565b6040516102659190614586565b6102dc610444366004614691565b61180d565b34801561045557600080fd5b5061028e61182c565b34801561046a57600080fd5b5061028e6104793660046143aa565b61185b565b34801561048a57600080fd5b5061028e610499366004614722565b611918565b3480156104aa57600080fd5b5061028e7f2f27e3d0c9d5144be28e016e79de2f52d828d0070de5d6dfa31e6c5c94e8880081565b3480156104de57600080fd5b506102dc6104ed366004614744565b611afe565b3480156104fe57600080fd5b5061025961050d366004614387565b60009182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057057600080fd5b5061028e600081565b34801561058557600080fd5b5061028e610594366004614722565b611e5c565b3480156105a557600080fd5b506102dc6105b436600461476e565b611e68565b3480156105c557600080fd5b506106026040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516102659190614789565b34801561061b57600080fd5b5061025961062a3660046143aa565b611f0c565b34801561063b57600080fd5b5061028e611f17565b34801561065057600080fd5b5061066461065f36600461479c565b6120f9565b60408051928352901515602083015201610265565b34801561068557600080fd5b5061060261069436600461420f565b612477565b3480156106a557600080fd5b506102596106b436600461420f565b6124b0565b3480156106c557600080fd5b506102dc6106d4366004614387565b612502565b3480156106e557600080fd5b5061028e7f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831281565b34801561071957600080fd5b506102dc61072836600461420f565b612546565b34801561073957600080fd5b506106026126e8565b34801561074e57600080fd5b5061028e7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b34801561078257600080fd5b5061028e7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b3480156107b657600080fd5b506107ca6107c53660046147c6565b612771565b6040516102659190614847565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061086a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008181526001602090815260408083208151606081018352905467ffffffffffffffff80821680845268010000000000000000830490911694830194909452700100000000000000000000000000000000900464ffffffffff16918101919091529061093e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f546f6b656e206973206e6f7420726566756e6461626c6500000000000000000060448201526064015b60405180910390fd5b62093a80816040015164ffffffffff164261095991906148ae565b106109c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526566756e642077696e646f77206861732070617373656400000000000000006044820152606401610935565b80516109d090633b9aca006148c1565b67ffffffffffffffff169392505050565b6000806109ed8361281a565b90506109f8816129af565b9392505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff16600081158015610a4a5750825b905060008267ffffffffffffffff166001148015610a675750303b155b905081158015610a75575080155b15610aac576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001660011785558315610b0d5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b610b15612a98565b610b1d612a98565b610b2860008b612aa2565b50610b537f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e38a612aa2565b50610b7e7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92989612aa2565b50610ba97f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831288612aa2565b50600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88811691821790925560408051600281528d841660208201528c8416918101919091528a83166060820152918916608083015260a08201527f41371d953e27e22ad5469eff518e3838586b98b2ee0e49b10a255a6718e122a19060c00160405180910390a18315610cab5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b7f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d28312610ce181612bc3565b610d2083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612bd092505050565b505050565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929610d4f81612bc3565b60025461ffff841610610dbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642073657269657320696e6465780000000000000000000000006044820152606401610935565b8160028461ffff1681548110610dd657610dd66148e4565b60009182526020918290206002919091020180547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff166801000000000000000067ffffffffffffffff94851602179055604051918416825261ffff8516917f44d72fb87d2f691857df49a86aaabd2566273ba60f3d6061c28fa8975df99eeb910160405180910390a2505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610e9e81612bc3565b610ea88383612aa2565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610efd576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d208282612c17565b600080600080600080600060606002805490508961ffff1610610f86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642073657269657320696e6465780000000000000000000000006044820152606401610935565b600060028a61ffff1681548110610f9f57610f9f6148e4565b60009182526020918290206040805161012081018252600293909302909101805460c081811b7fffffffffffffffff0000000000000000000000000000000000000000000000001680865268010000000000000000830467ffffffffffffffff16968601879052700100000000000000000000000000000000830463ffffffff908116958701869052740100000000000000000000000000000000000000008404811660608801819052780100000000000000000000000000000000000000000000000085048216608089018190527c010000000000000000000000000000000000000000000000000000000090950490911660a0880181905260019095015461ffff80821694890194909452620100008104841660e089015264010000000090049092166101008701529e50949c50919a50929850965090945090506110e58a612cf5565b60045490935073ffffffffffffffffffffffffffffffffffffffff16632a7ae6f161110f83612d56565b835161113c907fffffffffffffffff00000000000000000000000000000000000000000000000016612f76565b8460c001518560e001518661010001516040518663ffffffff1660e01b815260040161116c959493929190614913565b600060405180830381865afa158015611189573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526111cf919081019061495e565b915050919395975091939597565b60007f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92961120981612bc3565b6002546000600161121a8a8c6149cc565b61122491906149e8565b60025463ffffffff91909116915060005b818161ffff161015611468578d77ffffffffffffffffffffffffffffffffffffffffffffffff191660028261ffff1681548110611274576112746148e4565b600091825260209091206002909102015460c01b7fffffffffffffffff0000000000000000000000000000000000000000000000001603611311576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536572696573206e616d6520616c7265616479206578697374730000000000006044820152606401610935565b60028161ffff1681548110611328576113286148e4565b6000918252602090912060029091020154700100000000000000000000000000000000900463ffffffff168310806113f0575060028161ffff1681548110611372576113726148e4565b906000526020600020906002020160000160149054906101000a900463ffffffff1660028261ffff16815481106113ab576113ab6148e4565b60009182526020909120600290910201546113e09190700100000000000000000000000000000000900463ffffffff166149cc565b63ffffffff168c63ffffffff1610155b611456576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f536572696573206f7665726c6170732077697468206578697374696e670000006044820152606401610935565b8061146081614a04565b915050611235565b5060026040518061012001604052808f77ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018e67ffffffffffffffff1681526020018d63ffffffff1681526020018c63ffffffff168152602001600063ffffffff168152602001600063ffffffff1681526020018b61ffff1681526020018a61ffff1681526020018961ffff16815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548167ffffffffffffffff021916908360c01c021790555060208201518160000160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060408201518160000160106101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160146101000a81548163ffffffff021916908363ffffffff16021790555060808201518160000160186101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001601c6101000a81548163ffffffff021916908363ffffffff16021790555060c08201518160010160006101000a81548161ffff021916908361ffff16021790555060e08201518160010160026101000a81548161ffff021916908361ffff1602179055506101008201518160010160046101000a81548161ffff021916908361ffff160217905550505085156116dd57600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b60108204018054600f9092166002026101000a61ffff81810219909316928616029190911790555b6040805167ffffffffffffffff8e16815263ffffffff808e1660208301528c169181019190915261ffff8a81166060830152898116608083015288811660a083015287151560c08301527fffffffffffffffff0000000000000000000000000000000000000000000000008f1691908516907fc46ca991884acd97b67ccae44e8d3f0ada8f306802983edb66ccb71c519ea0d19060e00160405180910390a350909b9a5050505050505050505050565b6060600380548060200260200160405190810160405280929190818152602001828054801561180357602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116117ca5790505b5050505050905090565b6118156130ee565b61181e826131f2565b611828828261321c565b5050565b6000611836613355565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b600061186682612cf5565b6118cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5075626c6963206d696e74696e67206e6f7420617661696c61626c65000000006044820152606401610935565b60028261ffff16815481106118e3576118e36148e4565b600091825260209091206002909102015461086a9068010000000000000000900467ffffffffffffffff16633b9aca00614a25565b60007f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831261194481612bc3565b60008481526001602090815260408083208151606081018352905467ffffffffffffffff808216835268010000000000000000820416938201849052700100000000000000000000000000000000900464ffffffffff169181019190915291906119af908690614a3c565b90506040518060600160405280836000015167ffffffffffffffff1681526020016119d9836133c4565b67ffffffffffffffff908116825260408086015164ffffffffff90811660209485015260008b815260018552829020855181549587015196840151909216700100000000000000000000000000000000027fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff96851668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000000000000000000090961692909416919091179390931793909316179055517f706f696e74730000000000000000000000000000000000000000000000000000907f8386f3b08e49490d0c5a9d2c401c091f13b01a17d75ce4a2f0f8f923b410ff7d90611aeb9089908590918252602082015260400190565b60405180910390a29250505b5092915050565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929611b2881612bc3565b60025461ffff841610611b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642073657269657320696e6465780000000000000000000000006044820152606401610935565b8115611d4d57600060028461ffff1681548110611bb657611bb66148e4565b60009182526020918290206040805161012081018252600293909302909101805460c081811b7fffffffffffffffff00000000000000000000000000000000000000000000000016855268010000000000000000820467ffffffffffffffff1695850195909552700100000000000000000000000000000000810463ffffffff90811693850193909352740100000000000000000000000000000000000000008104831660608501819052780100000000000000000000000000000000000000000000000082048416608086018190527c010000000000000000000000000000000000000000000000000000000090920490931660a085015260019091015461ffff80821695850195909552620100008104851660e085015264010000000090049093166101008301529092509003611d4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f53657269657320686173206265656e2066756c6c79206d696e746564000000006044820152606401610935565b505b6000611d5884612cf5565b9050828015611d65575080155b15611dfd5760038054600181018255600091909152601081047fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805461ffff8781166002600f909516949094026101000a84810291021990911617905560405184151581527fcc6e9bff2fb3049ce51e0ddb5b02a211a688dd2cd3b52c22ccec6e2f61477b169060200160405180910390a2610ea8565b82158015611e085750805b15610ea857611e1684613418565b8361ffff167fcc6e9bff2fb3049ce51e0ddb5b02a211a688dd2cd3b52c22ccec6e2f61477b1684604051611e4e911515815260200190565b60405180910390a250505050565b60006109f88383613551565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929611e9281612bc3565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040519081527f3d2ad470ac155133833dfcd09d1dac3c97488b53dcf79ead413dff86b6419ee89060200160405180910390a15050565b600061086a82612cf5565b6002546000908190815b818161ffff1610156120e3576000600160028361ffff1681548110611f4857611f486148e4565b906000526020600020906002020160000160189054906101000a900463ffffffff1660028461ffff1681548110611f8157611f816148e4565b6000918252602090912060029091020154611fb69190700100000000000000000000000000000000900463ffffffff166149cc565b611fc091906149e8565b63ffffffff1690505b60028261ffff1681548110611fe057611fe06148e4565b6000918252602090912060029091020154700100000000000000000000000000000000900463ffffffff1681106120d05760008181526001602081815260408084208151606081018352905467ffffffffffffffff80821683526801000000000000000082041682850152700100000000000000000000000000000000900464ffffffffff169181018290529385905291905261207d57506120be565b62093a80816040015164ffffffffff164261209891906148ae565b11156120a457506120d0565b80516120ba9067ffffffffffffffff1686614a3c565b9450505b806120c881614a4f565b915050611fc9565b50806120db81614a04565b915050611f21565b506120f282633b9aca00614a25565b9250505090565b6000807f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831261212681612bc3565b60025461ffff861610612195576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642073657269657320696e6465780000000000000000000000006044820152606401610935565b60028561ffff16815481106121ac576121ac6148e4565b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff1660028661ffff16815481106121eb576121eb6148e4565b60009182526020909120600290910201547801000000000000000000000000000000000000000000000000900463ffffffff1610612285576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f53657269657320686173206265656e2066756c6c79206d696e746564000000006044820152606401610935565b60028561ffff168154811061229c5761229c6148e4565b906000526020600020906002020160000160189054906101000a900463ffffffff1660028661ffff16815481106122d5576122d56148e4565b600091825260209091206002909102015461230a9190700100000000000000000000000000000000900463ffffffff166149cc565b63ffffffff169250612357836040518060600160405280633b9aca00886123319190614a84565b67ffffffffffffffff1681526000602082015264ffffffffff421660409091015261364d565b60028561ffff168154811061236e5761236e6148e4565b6000918252602090912060029091020180547801000000000000000000000000000000000000000000000000900463ffffffff169060186123ae83614abf565b91906101000a81548163ffffffff021916908363ffffffff1602179055505060028561ffff16815481106123e4576123e46148e4565b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff1660028661ffff1681548110612423576124236148e4565b60009182526020909120600290910201547801000000000000000000000000000000000000000000000000900463ffffffff16036124645761246485613418565b61246d856129af565b9150509250929050565b606061248a61248583613744565b613b08565b60405160200161249a9190614af7565b6040516020818303038152906040529050919050565b600081815260016020526040812054700100000000000000000000000000000000900464ffffffffff161515801561086a57505060009081526001602052604090205467ffffffffffffffff16151590565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015461253c81612bc3565b610ea88383612c17565b7f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831261257081612bc3565b600082815260016020526040902054700100000000000000000000000000000000900464ffffffffff16612600576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f546f6b656e206d6574616461746120646f6573206e6f742065786973740000006044820152606401610935565b600061260b8361281a565b905060028161ffff1681548110612624576126246148e4565b6000918252602090912060029091020180547c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690601c61266883614abf565b825463ffffffff9182166101009390930a92830291909202199091161790555060008381526001602052604080822080547fffffffffffffffffffffff0000000000000000000000000000000000000000001690555184917f160739d2267e4e888a988580a6f68efdec75c3dd9baf815db4616e8a406bddaa91a2505050565b6060600080546126f790614b3c565b80601f016020809104026020016040519081016040528092919081815260200182805461272390614b3c565b80156118035780601f1061274557610100808354040283529160200191611803565b820191906000526020600020905b81548152906001019060200180831161275357509395945050505050565b6060818067ffffffffffffffff81111561278d5761278d6145cd565b6040519080825280602002602001820160405280156127b6578160200160208202803683370190505b50915060005b818110156128115760008585838181106127d8576127d86148e4565b9050602002013590506127eb8782613551565b8483815181106127fd576127fd6148e4565b6020908102919091010152506001016127bc565b50509392505050565b600254600090815b818161ffff1610156129265760028161ffff1681548110612845576128456148e4565b6000918252602090912060029091020154700100000000000000000000000000000000900463ffffffff168410801590612908575060028161ffff1681548110612891576128916148e4565b906000526020600020906002020160000160149054906101000a900463ffffffff1660028261ffff16815481106128ca576128ca6148e4565b60009182526020909120600290910201546128ff9190700100000000000000000000000000000000900463ffffffff166149cc565b63ffffffff1684105b15612914579392505050565b8061291e81614a04565b915050612822565b506040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f546f6b656e20646f6573206e6f742062656c6f6e6720746f20616e792073657260448201527f69657300000000000000000000000000000000000000000000000000000000006064820152608401610935565b60007f5741474d49000000000000000000000000000000000000000000000000000000815b6005811015612a8e578181602081106129ef576129ef6148e4565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191660028561ffff1681548110612a2c57612a2c6148e4565b600091825260209091206002909102015460c01b8260088110612a5157612a516148e4565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612a86575060019392505050565b6001016129d4565b5060009392505050565b612aa0613c68565b565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff16612bb95760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055612b553390565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4600191505061086a565b600091505061086a565b612bcd8133613ccf565b50565b6000612bdc8282614bdd565b507fefafb90526da1636e1335eac0151301742fb755d986954c613b90e891778ba3981604051612c0c9190614789565b60405180910390a150565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff1615612bb95760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4600191505061086a565b600354600090815b81811015612a8e578361ffff1660038281548110612d1d57612d1d6148e4565b60009182526020909120601082040154600f9091166002026101000a900461ffff1603612d4e575060019392505050565b600101612cfd565b60606000600183606001518460400151612d7091906149cc565b612d7a91906149e8565b63ffffffff1690506000612d8d82613d76565b90506000612da4856040015163ffffffff16613d76565b9050600082518251141590506000835167ffffffffffffffff811115612dcc57612dcc6145cd565b6040519080825280601f01601f191660200182016040528015612df6576020820181803683370190505b50905060005b8151811015612f6b5782158015612e135750808451115b8015612e945750838181518110612e2c57612e2c6148e4565b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916858281518110612e6b57612e6b6148e4565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016145b15612efc57848181518110612eab57612eab6148e4565b602001015160f81c60f81b828281518110612ec857612ec86148e4565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612f63565b600192507f7800000000000000000000000000000000000000000000000000000000000000828281518110612f3357612f336148e4565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b600101612dfc565b509695505050505050565b606060005b60088160ff16108015612fc75750828160ff1660088110612f9e57612f9e6148e4565b1a60f81b7fff000000000000000000000000000000000000000000000000000000000000001615155b15612fde5780612fd681614cf6565b915050612f7b565b60008160ff1667ffffffffffffffff811115612ffc57612ffc6145cd565b6040519080825280601f01601f191660200182016040528015613026576020820181803683370190505b509050600091505b60088260ff1610801561307a5750838260ff1660088110613051576130516148e4565b1a60f81b7fff000000000000000000000000000000000000000000000000000000000000001615155b156109f857838260ff1660088110613094576130946148e4565b1a60f81b818360ff16815181106130ad576130ad6148e4565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350816130e681614cf6565b92505061302e565b3073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614806131bb57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166131a27f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614155b15612aa0576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361182881612bc3565b8173ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156132a1575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261329e91810190614d0c565b60015b6132ef576040517f4c9c8ce300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401610935565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc811461334b576040517faa1d49a400000000000000000000000000000000000000000000000000000000815260048101829052602401610935565b610d208383613e34565b3073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614612aa0576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600067ffffffffffffffff82111561341457604080517f6dfcc650000000000000000000000000000000000000000000000000000000008152600481019190915260248101839052604401610935565b5090565b60005b600354811015611828578161ffff166003828154811061343d5761343d6148e4565b60009182526020909120601082040154600f9091166002026101000a900461ffff16036135495760038054613474906001906148ae565b81548110613484576134846148e4565b90600052602060002090601091828204019190066002029054906101000a900461ffff16600382815481106134bb576134bb6148e4565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555060038054806134fb576134fb614d25565b60008281526020902060107fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90920191820401805461ffff6002600f8516026101000a021916905590555050565b60010161341b565b60008281526001602090815260408083208151606081018352905467ffffffffffffffff8082168352680100000000000000008204169382019390935270010000000000000000000000000000000090920464ffffffffff16908201527f706f696e747300000000000000000000000000000000000000000000000000008390036135eb576020015167ffffffffffffffff16905061086a565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616974206b6579206e6f7420666f756e64000000000000000000000000006044820152606401610935565b600082815260016020908152604091829020835181548584018051878701805167ffffffffffffffff9586167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090951685176801000000000000000093871693909302929092177fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff1670010000000000000000000000000000000064ffffffffff938416021790955586519283529051909216938101939093529051169181019190915282907f6e219db270f25f5c23d7947ba7ef24460f8fcee7b6ab1742167c6f38ac49e3b19060600160405180910390a25050565b6000818152600160209081526040808320815160608082018452915467ffffffffffffffff8082168352680100000000000000008204169482019490945270010000000000000000000000000000000090930464ffffffffff1691830191909152916137af8461281a565b9050600060028261ffff16815481106137ca576137ca6148e4565b600091825260208083206040805161012081018252600294909402909101805460c081811b7fffffffffffffffff00000000000000000000000000000000000000000000000016865268010000000000000000820467ffffffffffffffff1694860194909452700100000000000000000000000000000000810463ffffffff908116938601939093527401000000000000000000000000000000000000000081048316606086015278010000000000000000000000000000000000000000000000008104831660808601527c0100000000000000000000000000000000000000000000000000000000900490911660a08401526001015461ffff80821692840192909252620100008104821660e084015264010000000090041661010082015291506138f5836129af565b613934576040518060400160405280600281526020017f4e6f00000000000000000000000000000000000000000000000000000000000081525061396b565b6040518060400160405280600381526020017f59657300000000000000000000000000000000000000000000000000000000008152505b90506000613997836000015177ffffffffffffffffffffffffffffffffffffffffffffffff1916612f76565b905060006139a488613d76565b826040516020016139b6929190614d54565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052600454909150600090613aa99073ffffffffffffffffffffffffffffffffffffffff16632a7ae6f1613a158c613d76565b868960c001518a60e001518b61010001516040518663ffffffff1660e01b8152600401613a46959493929190614913565b600060405180830381865afa158015613a63573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612485919081019061495e565b905081818486613ac2896060015163ffffffff16613d76565b613ad68c6040015164ffffffffff16613d76565b604051602001613aeb96959493929190614dac565b604051602081830303815290604052975050505050505050919050565b60608151600003613b2757505060408051602081019091526000815290565b60006040518060600160405280604081526020016150566040913990506000600384516002613b569190614a3c565b613b609190614a84565b613b6b906004614a25565b67ffffffffffffffff811115613b8357613b836145cd565b6040519080825280601f01601f191660200182016040528015613bad576020820181803683370190505b50905060018201602082018586518701602081018051600082525b82841015613c23576003840193508351603f8160121c168701518653600186019550603f81600c1c168701518653600186019550603f8160061c168701518653600186019550603f8116870151865350600185019450613bc8565b9052505085516003900660018114613c425760028114613c5557613c5d565b603d6001830353603d6002830353613c5d565b603d60018303535b509195945050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff16612aa0576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611828576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610935565b60606000613d8383613e97565b600101905060008167ffffffffffffffff811115613da357613da36145cd565b6040519080825280601f01601f191660200182016040528015613dcd576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084613dd757509392505050565b613e3d82613f79565b60405173ffffffffffffffffffffffffffffffffffffffff8316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115613e8f57610d208282614048565b6118286140cb565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310613ee0577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310613f0c576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310613f2a57662386f26fc10000830492506010015b6305f5e1008310613f42576305f5e100830492506008015b6127108310613f5657612710830492506004015b60648310613f68576064830492506002015b600a831061086a5760010192915050565b8073ffffffffffffffffffffffffffffffffffffffff163b600003613fe2576040517f4c9c8ce300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610935565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60606000808473ffffffffffffffffffffffffffffffffffffffff16846040516140729190615039565b600060405180830381855af49150503d80600081146140ad576040519150601f19603f3d011682016040523d82523d6000602084013e6140b2565b606091505b50915091506140c2858383614103565b95945050505050565b3415612aa0576040517fb398979f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082614118576141138261418b565b6109f8565b815115801561413c575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611af7576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610935565b80511561419b5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602082840312156141df57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146109f857600080fd5b60006020828403121561422157600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461424c57600080fd5b919050565b600080600080600060a0868803121561426957600080fd5b61427286614228565b945061428060208701614228565b935061428e60408701614228565b925061429c60608701614228565b91506142aa60808701614228565b90509295509295909350565b600080602083850312156142c957600080fd5b823567ffffffffffffffff8111156142e057600080fd5b8301601f810185136142f157600080fd5b803567ffffffffffffffff81111561430857600080fd5b85602082840101111561431a57600080fd5b6020919091019590945092505050565b803561ffff8116811461424c57600080fd5b803567ffffffffffffffff8116811461424c57600080fd5b6000806040838503121561436757600080fd5b6143708361432a565b915061437e6020840161433c565b90509250929050565b6000806040838503121561439a57600080fd5b8235915061437e60208401614228565b6000602082840312156143bc57600080fd5b6109f88261432a565b60005b838110156143e05781810151838201526020016143c8565b50506000910152565b600081518084526144018160208601602086016143c5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b7fffffffffffffffff000000000000000000000000000000000000000000000000891681528760208201528660408201528560608201528460808201528360a082015282151560c082015261010060e082015260006144966101008301846143e9565b9a9950505050505050505050565b803563ffffffff8116811461424c57600080fd5b8035801515811461424c57600080fd5b600080600080600080600080610100898b0312156144e557600080fd5b88357fffffffffffffffff0000000000000000000000000000000000000000000000008116811461451557600080fd5b975061452360208a0161433c565b965061453160408a016144a4565b955061453f60608a016144a4565b945061454d60808a0161432a565b935061455b60a08a0161432a565b925061456960c08a0161432a565b915061457760e08a016144b8565b90509295985092959890939650565b602080825282518282018190526000918401906040840190835b818110156145c257835161ffff168352602093840193909201916001016145a0565b509095945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715614643576146436145cd565b604052919050565b600067ffffffffffffffff821115614665576146656145cd565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156146a457600080fd5b6146ad83614228565b9150602083013567ffffffffffffffff8111156146c957600080fd5b8301601f810185136146da57600080fd5b80356146ed6146e88261464b565b6145fc565b81815286602083850101111561470257600080fd5b816020840160208301376000602083830101528093505050509250929050565b6000806040838503121561473557600080fd5b50508035926020909101359150565b6000806040838503121561475757600080fd5b6147608361432a565b915061437e602084016144b8565b60006020828403121561478057600080fd5b6109f882614228565b6020815260006109f860208301846143e9565b600080604083850312156147af57600080fd5b6147b88361432a565b946020939093013593505050565b6000806000604084860312156147db57600080fd5b83359250602084013567ffffffffffffffff8111156147f957600080fd5b8401601f8101861361480a57600080fd5b803567ffffffffffffffff81111561482157600080fd5b8660208260051b840101111561483657600080fd5b939660209190910195509293505050565b602080825282518282018190526000918401906040840190835b818110156145c2578351835260209384019390920191600101614861565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561086a5761086a61487f565b67ffffffffffffffff8181168382160290811690818114611af757611af761487f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60a08152600061492660a08301886143e9565b828103602084015261493881886143e9565b61ffff968716604085015294861660608401525050921660809092019190915292915050565b60006020828403121561497057600080fd5b815167ffffffffffffffff81111561498757600080fd5b8201601f8101841361499857600080fd5b80516149a66146e88261464b565b8181528560208385010111156149bb57600080fd5b6140c28260208301602086016143c5565b63ffffffff818116838216019081111561086a5761086a61487f565b63ffffffff828116828216039081111561086a5761086a61487f565b600061ffff821661ffff8103614a1c57614a1c61487f565b60010192915050565b808202811582820484141761086a5761086a61487f565b8082018082111561086a5761086a61487f565b600081614a5e57614a5e61487f565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b600082614aba577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600063ffffffff821663ffffffff8103614a1c57614a1c61487f565b60008151614aed8185602086016143c5565b9290920192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251614b2f81601d8501602087016143c5565b91909101601d0192915050565b600181811c90821680614b5057607f821691505b602082108103614b89577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b601f821115610d2057806000526020600020601f840160051c81016020851015614bb65750805b601f840160051c820191505b81811015614bd65760008155600101614bc2565b5050505050565b815167ffffffffffffffff811115614bf757614bf76145cd565b614c0b81614c058454614b3c565b84614b8f565b6020601f821160018114614c5d5760008315614c275750848201515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600385901b1c1916600184901b178455614bd6565b6000848152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08516915b82811015614cab5787850151825560209485019460019092019101614c8b565b5084821015614ce757868401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b60f8161c191681555b50505050600190811b01905550565b600060ff821660ff8103614a1c57614a1c61487f565b600060208284031215614d1e57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008351614d668184602088016143c5565b7f20000000000000000000000000000000000000000000000000000000000000009083019081528351614da08160018401602088016143c5565b01600101949350505050565b7f7b226465736372697074696f6e223a20224e65756c6f636b2050617373776f7281527f64204d616e61676572206d656d62657273686970204e4654202d206e65756c6f60208201527f636b2e617070222c20226e616d65223a20224e45552023000000000000000000604082015260008751614e30816057850160208c016143c5565b7f222c2022696d616765223a2022646174613a696d6167652f7376672b786d6c3b6057918401918201527f6261736536342c0000000000000000000000000000000000000000000000000060778201528751614e9381607e840160208c016143c5565b6057818301019150507f222c202261747472696275746573223a205b7b2274726169745f74797065223a60278201527f2022536572696573222c202276616c7565223a202200000000000000000000006047820152615006615000614fb1614fab614f5c614f56614f07605c88018e614adb565b7f227d2c7b2274726169745f74797065223a2022476f7665726e616e636520416381527f63657373222c202276616c7565223a2022000000000000000000000000000000602082015260310190565b8b614adb565b7f227d2c7b2274726169745f74797065223a2022536572696573204d617820537581527f70706c79222c202276616c7565223a2000000000000000000000000000000000602082015260300190565b88614adb565b7f7d2c7b2274726169745f74797065223a20224d696e742044617465222c20226481527f6973706c61795f74797065223a202264617465222c202276616c7565223a20006020820152603f0190565b85614adb565b7f7d5d7d000000000000000000000000000000000000000000000000000000000081526003019998505050505050505050565b6000825161504b8184602087016143c5565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220e47c9318c6b06f7eaa93b0a6ccfcb874693525dcf44afec2f91dfb0ef2559f0a64736f6c634300081c0033
Deployed Bytecode
0x6080604052600436106102345760003560e01c80637427160511610138578063c87b56dd116100b0578063db5c339b1161007f578063f5b541a611610064578063f5b541a614610742578063f72c0d8b14610776578063f80ecba3146107aa57600080fd5b8063db5c339b1461070d578063de475bf91461072d57600080fd5b8063c87b56dd14610679578063d474ea5814610699578063d547741f146106b9578063d58a3448146106d957600080fd5b8063ac77320411610107578063add77524116100ec578063add775241461060f578063b9e576b11461062f578063ba7e15bd1461064457600080fd5b8063ac77320414610599578063ad3cb1cc146105b957600080fd5b806374271605146104d257806391d14854146104f2578063a217fddf14610564578063a28eec871461057957600080fd5b806336568abe116101cb5780634f1ef2861161019a578063559c2a981161017f578063559c2a981461045e578063566eea1b1461047e57806356dcac881461049e57600080fd5b80634f1ef2861461043657806352d1902d1461044957600080fd5b806336568abe1461038d57806339ce4540146103ad5780633ccec20c146103e15780633e96e7311461041457600080fd5b80632094a036116102075780632094a036146102de578063248a9ca3146102fe5780632da7b0e61461034d5780632f2ff15d1461036d57600080fd5b806301ffc9a71461023957806304cd52941461026e578063064fa71d1461029c5780631459457a146102bc575b600080fd5b34801561024557600080fd5b506102596102543660046141cd565b6107d7565b60405190151581526020015b60405180910390f35b34801561027a57600080fd5b5061028e61028936600461420f565b610870565b604051908152602001610265565b3480156102a857600080fd5b506102596102b736600461420f565b6109e1565b3480156102c857600080fd5b506102dc6102d7366004614251565b6109ff565b005b3480156102ea57600080fd5b506102dc6102f93660046142b6565b610cb7565b34801561030a57600080fd5b5061028e61031936600461420f565b60009081527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015490565b34801561035957600080fd5b506102dc610368366004614354565b610d25565b34801561037957600080fd5b506102dc610388366004614387565b610e64565b34801561039957600080fd5b506102dc6103a8366004614387565b610eae565b3480156103b957600080fd5b506103cd6103c83660046143aa565b610f07565b604051610265989796959493929190614433565b3480156103ed57600080fd5b506104016103fc3660046144c8565b6111dd565b60405161ffff9091168152602001610265565b34801561042057600080fd5b5061042961178d565b6040516102659190614586565b6102dc610444366004614691565b61180d565b34801561045557600080fd5b5061028e61182c565b34801561046a57600080fd5b5061028e6104793660046143aa565b61185b565b34801561048a57600080fd5b5061028e610499366004614722565b611918565b3480156104aa57600080fd5b5061028e7f2f27e3d0c9d5144be28e016e79de2f52d828d0070de5d6dfa31e6c5c94e8880081565b3480156104de57600080fd5b506102dc6104ed366004614744565b611afe565b3480156104fe57600080fd5b5061025961050d366004614387565b60009182527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057057600080fd5b5061028e600081565b34801561058557600080fd5b5061028e610594366004614722565b611e5c565b3480156105a557600080fd5b506102dc6105b436600461476e565b611e68565b3480156105c557600080fd5b506106026040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516102659190614789565b34801561061b57600080fd5b5061025961062a3660046143aa565b611f0c565b34801561063b57600080fd5b5061028e611f17565b34801561065057600080fd5b5061066461065f36600461479c565b6120f9565b60408051928352901515602083015201610265565b34801561068557600080fd5b5061060261069436600461420f565b612477565b3480156106a557600080fd5b506102596106b436600461420f565b6124b0565b3480156106c557600080fd5b506102dc6106d4366004614387565b612502565b3480156106e557600080fd5b5061028e7f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831281565b34801561071957600080fd5b506102dc61072836600461420f565b612546565b34801561073957600080fd5b506106026126e8565b34801561074e57600080fd5b5061028e7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b34801561078257600080fd5b5061028e7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b3480156107b657600080fd5b506107ca6107c53660046147c6565b612771565b6040516102659190614847565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061086a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008181526001602090815260408083208151606081018352905467ffffffffffffffff80821680845268010000000000000000830490911694830194909452700100000000000000000000000000000000900464ffffffffff16918101919091529061093e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f546f6b656e206973206e6f7420726566756e6461626c6500000000000000000060448201526064015b60405180910390fd5b62093a80816040015164ffffffffff164261095991906148ae565b106109c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526566756e642077696e646f77206861732070617373656400000000000000006044820152606401610935565b80516109d090633b9aca006148c1565b67ffffffffffffffff169392505050565b6000806109ed8361281a565b90506109f8816129af565b9392505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff16600081158015610a4a5750825b905060008267ffffffffffffffff166001148015610a675750303b155b905081158015610a75575080155b15610aac576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001660011785558315610b0d5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b610b15612a98565b610b1d612a98565b610b2860008b612aa2565b50610b537f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e38a612aa2565b50610b7e7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92989612aa2565b50610ba97f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831288612aa2565b50600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88811691821790925560408051600281528d841660208201528c8416918101919091528a83166060820152918916608083015260a08201527f41371d953e27e22ad5469eff518e3838586b98b2ee0e49b10a255a6718e122a19060c00160405180910390a18315610cab5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b7f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d28312610ce181612bc3565b610d2083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612bd092505050565b505050565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929610d4f81612bc3565b60025461ffff841610610dbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642073657269657320696e6465780000000000000000000000006044820152606401610935565b8160028461ffff1681548110610dd657610dd66148e4565b60009182526020918290206002919091020180547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff166801000000000000000067ffffffffffffffff94851602179055604051918416825261ffff8516917f44d72fb87d2f691857df49a86aaabd2566273ba60f3d6061c28fa8975df99eeb910160405180910390a2505050565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020526040902060010154610e9e81612bc3565b610ea88383612aa2565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610efd576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d208282612c17565b600080600080600080600060606002805490508961ffff1610610f86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642073657269657320696e6465780000000000000000000000006044820152606401610935565b600060028a61ffff1681548110610f9f57610f9f6148e4565b60009182526020918290206040805161012081018252600293909302909101805460c081811b7fffffffffffffffff0000000000000000000000000000000000000000000000001680865268010000000000000000830467ffffffffffffffff16968601879052700100000000000000000000000000000000830463ffffffff908116958701869052740100000000000000000000000000000000000000008404811660608801819052780100000000000000000000000000000000000000000000000085048216608089018190527c010000000000000000000000000000000000000000000000000000000090950490911660a0880181905260019095015461ffff80821694890194909452620100008104841660e089015264010000000090049092166101008701529e50949c50919a50929850965090945090506110e58a612cf5565b60045490935073ffffffffffffffffffffffffffffffffffffffff16632a7ae6f161110f83612d56565b835161113c907fffffffffffffffff00000000000000000000000000000000000000000000000016612f76565b8460c001518560e001518661010001516040518663ffffffff1660e01b815260040161116c959493929190614913565b600060405180830381865afa158015611189573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526111cf919081019061495e565b915050919395975091939597565b60007f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92961120981612bc3565b6002546000600161121a8a8c6149cc565b61122491906149e8565b60025463ffffffff91909116915060005b818161ffff161015611468578d77ffffffffffffffffffffffffffffffffffffffffffffffff191660028261ffff1681548110611274576112746148e4565b600091825260209091206002909102015460c01b7fffffffffffffffff0000000000000000000000000000000000000000000000001603611311576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536572696573206e616d6520616c7265616479206578697374730000000000006044820152606401610935565b60028161ffff1681548110611328576113286148e4565b6000918252602090912060029091020154700100000000000000000000000000000000900463ffffffff168310806113f0575060028161ffff1681548110611372576113726148e4565b906000526020600020906002020160000160149054906101000a900463ffffffff1660028261ffff16815481106113ab576113ab6148e4565b60009182526020909120600290910201546113e09190700100000000000000000000000000000000900463ffffffff166149cc565b63ffffffff168c63ffffffff1610155b611456576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f536572696573206f7665726c6170732077697468206578697374696e670000006044820152606401610935565b8061146081614a04565b915050611235565b5060026040518061012001604052808f77ffffffffffffffffffffffffffffffffffffffffffffffff191681526020018e67ffffffffffffffff1681526020018d63ffffffff1681526020018c63ffffffff168152602001600063ffffffff168152602001600063ffffffff1681526020018b61ffff1681526020018a61ffff1681526020018961ffff16815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548167ffffffffffffffff021916908360c01c021790555060208201518160000160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060408201518160000160106101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160146101000a81548163ffffffff021916908363ffffffff16021790555060808201518160000160186101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600001601c6101000a81548163ffffffff021916908363ffffffff16021790555060c08201518160010160006101000a81548161ffff021916908361ffff16021790555060e08201518160010160026101000a81548161ffff021916908361ffff1602179055506101008201518160010160046101000a81548161ffff021916908361ffff160217905550505085156116dd57600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b60108204018054600f9092166002026101000a61ffff81810219909316928616029190911790555b6040805167ffffffffffffffff8e16815263ffffffff808e1660208301528c169181019190915261ffff8a81166060830152898116608083015288811660a083015287151560c08301527fffffffffffffffff0000000000000000000000000000000000000000000000008f1691908516907fc46ca991884acd97b67ccae44e8d3f0ada8f306802983edb66ccb71c519ea0d19060e00160405180910390a350909b9a5050505050505050505050565b6060600380548060200260200160405190810160405280929190818152602001828054801561180357602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116117ca5790505b5050505050905090565b6118156130ee565b61181e826131f2565b611828828261321c565b5050565b6000611836613355565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b600061186682612cf5565b6118cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5075626c6963206d696e74696e67206e6f7420617661696c61626c65000000006044820152606401610935565b60028261ffff16815481106118e3576118e36148e4565b600091825260209091206002909102015461086a9068010000000000000000900467ffffffffffffffff16633b9aca00614a25565b60007f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831261194481612bc3565b60008481526001602090815260408083208151606081018352905467ffffffffffffffff808216835268010000000000000000820416938201849052700100000000000000000000000000000000900464ffffffffff169181019190915291906119af908690614a3c565b90506040518060600160405280836000015167ffffffffffffffff1681526020016119d9836133c4565b67ffffffffffffffff908116825260408086015164ffffffffff90811660209485015260008b815260018552829020855181549587015196840151909216700100000000000000000000000000000000027fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff96851668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000000000000000000090961692909416919091179390931793909316179055517f706f696e74730000000000000000000000000000000000000000000000000000907f8386f3b08e49490d0c5a9d2c401c091f13b01a17d75ce4a2f0f8f923b410ff7d90611aeb9089908590918252602082015260400190565b60405180910390a29250505b5092915050565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929611b2881612bc3565b60025461ffff841610611b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642073657269657320696e6465780000000000000000000000006044820152606401610935565b8115611d4d57600060028461ffff1681548110611bb657611bb66148e4565b60009182526020918290206040805161012081018252600293909302909101805460c081811b7fffffffffffffffff00000000000000000000000000000000000000000000000016855268010000000000000000820467ffffffffffffffff1695850195909552700100000000000000000000000000000000810463ffffffff90811693850193909352740100000000000000000000000000000000000000008104831660608501819052780100000000000000000000000000000000000000000000000082048416608086018190527c010000000000000000000000000000000000000000000000000000000090920490931660a085015260019091015461ffff80821695850195909552620100008104851660e085015264010000000090049093166101008301529092509003611d4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f53657269657320686173206265656e2066756c6c79206d696e746564000000006044820152606401610935565b505b6000611d5884612cf5565b9050828015611d65575080155b15611dfd5760038054600181018255600091909152601081047fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805461ffff8781166002600f909516949094026101000a84810291021990911617905560405184151581527fcc6e9bff2fb3049ce51e0ddb5b02a211a688dd2cd3b52c22ccec6e2f61477b169060200160405180910390a2610ea8565b82158015611e085750805b15610ea857611e1684613418565b8361ffff167fcc6e9bff2fb3049ce51e0ddb5b02a211a688dd2cd3b52c22ccec6e2f61477b1684604051611e4e911515815260200190565b60405180910390a250505050565b60006109f88383613551565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929611e9281612bc3565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091556040519081527f3d2ad470ac155133833dfcd09d1dac3c97488b53dcf79ead413dff86b6419ee89060200160405180910390a15050565b600061086a82612cf5565b6002546000908190815b818161ffff1610156120e3576000600160028361ffff1681548110611f4857611f486148e4565b906000526020600020906002020160000160189054906101000a900463ffffffff1660028461ffff1681548110611f8157611f816148e4565b6000918252602090912060029091020154611fb69190700100000000000000000000000000000000900463ffffffff166149cc565b611fc091906149e8565b63ffffffff1690505b60028261ffff1681548110611fe057611fe06148e4565b6000918252602090912060029091020154700100000000000000000000000000000000900463ffffffff1681106120d05760008181526001602081815260408084208151606081018352905467ffffffffffffffff80821683526801000000000000000082041682850152700100000000000000000000000000000000900464ffffffffff169181018290529385905291905261207d57506120be565b62093a80816040015164ffffffffff164261209891906148ae565b11156120a457506120d0565b80516120ba9067ffffffffffffffff1686614a3c565b9450505b806120c881614a4f565b915050611fc9565b50806120db81614a04565b915050611f21565b506120f282633b9aca00614a25565b9250505090565b6000807f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831261212681612bc3565b60025461ffff861610612195576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642073657269657320696e6465780000000000000000000000006044820152606401610935565b60028561ffff16815481106121ac576121ac6148e4565b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff1660028661ffff16815481106121eb576121eb6148e4565b60009182526020909120600290910201547801000000000000000000000000000000000000000000000000900463ffffffff1610612285576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f53657269657320686173206265656e2066756c6c79206d696e746564000000006044820152606401610935565b60028561ffff168154811061229c5761229c6148e4565b906000526020600020906002020160000160189054906101000a900463ffffffff1660028661ffff16815481106122d5576122d56148e4565b600091825260209091206002909102015461230a9190700100000000000000000000000000000000900463ffffffff166149cc565b63ffffffff169250612357836040518060600160405280633b9aca00886123319190614a84565b67ffffffffffffffff1681526000602082015264ffffffffff421660409091015261364d565b60028561ffff168154811061236e5761236e6148e4565b6000918252602090912060029091020180547801000000000000000000000000000000000000000000000000900463ffffffff169060186123ae83614abf565b91906101000a81548163ffffffff021916908363ffffffff1602179055505060028561ffff16815481106123e4576123e46148e4565b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff1660028661ffff1681548110612423576124236148e4565b60009182526020909120600290910201547801000000000000000000000000000000000000000000000000900463ffffffff16036124645761246485613418565b61246d856129af565b9150509250929050565b606061248a61248583613744565b613b08565b60405160200161249a9190614af7565b6040516020818303038152906040529050919050565b600081815260016020526040812054700100000000000000000000000000000000900464ffffffffff161515801561086a57505060009081526001602052604090205467ffffffffffffffff16151590565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800602052604090206001015461253c81612bc3565b610ea88383612c17565b7f95d4bc2dffead2f8c85023cc6927eae1b262c537650df2a0f5d7bfc294d2831261257081612bc3565b600082815260016020526040902054700100000000000000000000000000000000900464ffffffffff16612600576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f546f6b656e206d6574616461746120646f6573206e6f742065786973740000006044820152606401610935565b600061260b8361281a565b905060028161ffff1681548110612624576126246148e4565b6000918252602090912060029091020180547c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690601c61266883614abf565b825463ffffffff9182166101009390930a92830291909202199091161790555060008381526001602052604080822080547fffffffffffffffffffffff0000000000000000000000000000000000000000001690555184917f160739d2267e4e888a988580a6f68efdec75c3dd9baf815db4616e8a406bddaa91a2505050565b6060600080546126f790614b3c565b80601f016020809104026020016040519081016040528092919081815260200182805461272390614b3c565b80156118035780601f1061274557610100808354040283529160200191611803565b820191906000526020600020905b81548152906001019060200180831161275357509395945050505050565b6060818067ffffffffffffffff81111561278d5761278d6145cd565b6040519080825280602002602001820160405280156127b6578160200160208202803683370190505b50915060005b818110156128115760008585838181106127d8576127d86148e4565b9050602002013590506127eb8782613551565b8483815181106127fd576127fd6148e4565b6020908102919091010152506001016127bc565b50509392505050565b600254600090815b818161ffff1610156129265760028161ffff1681548110612845576128456148e4565b6000918252602090912060029091020154700100000000000000000000000000000000900463ffffffff168410801590612908575060028161ffff1681548110612891576128916148e4565b906000526020600020906002020160000160149054906101000a900463ffffffff1660028261ffff16815481106128ca576128ca6148e4565b60009182526020909120600290910201546128ff9190700100000000000000000000000000000000900463ffffffff166149cc565b63ffffffff1684105b15612914579392505050565b8061291e81614a04565b915050612822565b506040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f546f6b656e20646f6573206e6f742062656c6f6e6720746f20616e792073657260448201527f69657300000000000000000000000000000000000000000000000000000000006064820152608401610935565b60007f5741474d49000000000000000000000000000000000000000000000000000000815b6005811015612a8e578181602081106129ef576129ef6148e4565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191660028561ffff1681548110612a2c57612a2c6148e4565b600091825260209091206002909102015460c01b8260088110612a5157612a516148e4565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612a86575060019392505050565b6001016129d4565b5060009392505050565b612aa0613c68565b565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff16612bb95760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055612b553390565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4600191505061086a565b600091505061086a565b612bcd8133613ccf565b50565b6000612bdc8282614bdd565b507fefafb90526da1636e1335eac0151301742fb755d986954c613b90e891778ba3981604051612c0c9190614789565b60405180910390a150565b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020818152604080842073ffffffffffffffffffffffffffffffffffffffff8616855290915282205460ff1615612bb95760008481526020828152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4600191505061086a565b600354600090815b81811015612a8e578361ffff1660038281548110612d1d57612d1d6148e4565b60009182526020909120601082040154600f9091166002026101000a900461ffff1603612d4e575060019392505050565b600101612cfd565b60606000600183606001518460400151612d7091906149cc565b612d7a91906149e8565b63ffffffff1690506000612d8d82613d76565b90506000612da4856040015163ffffffff16613d76565b9050600082518251141590506000835167ffffffffffffffff811115612dcc57612dcc6145cd565b6040519080825280601f01601f191660200182016040528015612df6576020820181803683370190505b50905060005b8151811015612f6b5782158015612e135750808451115b8015612e945750838181518110612e2c57612e2c6148e4565b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916858281518110612e6b57612e6b6148e4565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016145b15612efc57848181518110612eab57612eab6148e4565b602001015160f81c60f81b828281518110612ec857612ec86148e4565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612f63565b600192507f7800000000000000000000000000000000000000000000000000000000000000828281518110612f3357612f336148e4565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b600101612dfc565b509695505050505050565b606060005b60088160ff16108015612fc75750828160ff1660088110612f9e57612f9e6148e4565b1a60f81b7fff000000000000000000000000000000000000000000000000000000000000001615155b15612fde5780612fd681614cf6565b915050612f7b565b60008160ff1667ffffffffffffffff811115612ffc57612ffc6145cd565b6040519080825280601f01601f191660200182016040528015613026576020820181803683370190505b509050600091505b60088260ff1610801561307a5750838260ff1660088110613051576130516148e4565b1a60f81b7fff000000000000000000000000000000000000000000000000000000000000001615155b156109f857838260ff1660088110613094576130946148e4565b1a60f81b818360ff16815181106130ad576130ad6148e4565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350816130e681614cf6565b92505061302e565b3073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007b247cb6e5fef6fc75fdf209a95843df81b7df911614806131bb57507f0000000000000000000000007b247cb6e5fef6fc75fdf209a95843df81b7df9173ffffffffffffffffffffffffffffffffffffffff166131a27f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614155b15612aa0576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361182881612bc3565b8173ffffffffffffffffffffffffffffffffffffffff166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156132a1575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261329e91810190614d0c565b60015b6132ef576040517f4c9c8ce300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401610935565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc811461334b576040517faa1d49a400000000000000000000000000000000000000000000000000000000815260048101829052602401610935565b610d208383613e34565b3073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007b247cb6e5fef6fc75fdf209a95843df81b7df911614612aa0576040517fe07c8dba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600067ffffffffffffffff82111561341457604080517f6dfcc650000000000000000000000000000000000000000000000000000000008152600481019190915260248101839052604401610935565b5090565b60005b600354811015611828578161ffff166003828154811061343d5761343d6148e4565b60009182526020909120601082040154600f9091166002026101000a900461ffff16036135495760038054613474906001906148ae565b81548110613484576134846148e4565b90600052602060002090601091828204019190066002029054906101000a900461ffff16600382815481106134bb576134bb6148e4565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555060038054806134fb576134fb614d25565b60008281526020902060107fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90920191820401805461ffff6002600f8516026101000a021916905590555050565b60010161341b565b60008281526001602090815260408083208151606081018352905467ffffffffffffffff8082168352680100000000000000008204169382019390935270010000000000000000000000000000000090920464ffffffffff16908201527f706f696e747300000000000000000000000000000000000000000000000000008390036135eb576020015167ffffffffffffffff16905061086a565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616974206b6579206e6f7420666f756e64000000000000000000000000006044820152606401610935565b600082815260016020908152604091829020835181548584018051878701805167ffffffffffffffff9586167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090951685176801000000000000000093871693909302929092177fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff1670010000000000000000000000000000000064ffffffffff938416021790955586519283529051909216938101939093529051169181019190915282907f6e219db270f25f5c23d7947ba7ef24460f8fcee7b6ab1742167c6f38ac49e3b19060600160405180910390a25050565b6000818152600160209081526040808320815160608082018452915467ffffffffffffffff8082168352680100000000000000008204169482019490945270010000000000000000000000000000000090930464ffffffffff1691830191909152916137af8461281a565b9050600060028261ffff16815481106137ca576137ca6148e4565b600091825260208083206040805161012081018252600294909402909101805460c081811b7fffffffffffffffff00000000000000000000000000000000000000000000000016865268010000000000000000820467ffffffffffffffff1694860194909452700100000000000000000000000000000000810463ffffffff908116938601939093527401000000000000000000000000000000000000000081048316606086015278010000000000000000000000000000000000000000000000008104831660808601527c0100000000000000000000000000000000000000000000000000000000900490911660a08401526001015461ffff80821692840192909252620100008104821660e084015264010000000090041661010082015291506138f5836129af565b613934576040518060400160405280600281526020017f4e6f00000000000000000000000000000000000000000000000000000000000081525061396b565b6040518060400160405280600381526020017f59657300000000000000000000000000000000000000000000000000000000008152505b90506000613997836000015177ffffffffffffffffffffffffffffffffffffffffffffffff1916612f76565b905060006139a488613d76565b826040516020016139b6929190614d54565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052600454909150600090613aa99073ffffffffffffffffffffffffffffffffffffffff16632a7ae6f1613a158c613d76565b868960c001518a60e001518b61010001516040518663ffffffff1660e01b8152600401613a46959493929190614913565b600060405180830381865afa158015613a63573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612485919081019061495e565b905081818486613ac2896060015163ffffffff16613d76565b613ad68c6040015164ffffffffff16613d76565b604051602001613aeb96959493929190614dac565b604051602081830303815290604052975050505050505050919050565b60608151600003613b2757505060408051602081019091526000815290565b60006040518060600160405280604081526020016150566040913990506000600384516002613b569190614a3c565b613b609190614a84565b613b6b906004614a25565b67ffffffffffffffff811115613b8357613b836145cd565b6040519080825280601f01601f191660200182016040528015613bad576020820181803683370190505b50905060018201602082018586518701602081018051600082525b82841015613c23576003840193508351603f8160121c168701518653600186019550603f81600c1c168701518653600186019550603f8160061c168701518653600186019550603f8116870151865350600185019450613bc8565b9052505085516003900660018114613c425760028114613c5557613c5d565b603d6001830353603d6002830353613c5d565b603d60018303535b509195945050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff16612aa0576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281527f02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268006020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16611828576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610935565b60606000613d8383613e97565b600101905060008167ffffffffffffffff811115613da357613da36145cd565b6040519080825280601f01601f191660200182016040528015613dcd576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084613dd757509392505050565b613e3d82613f79565b60405173ffffffffffffffffffffffffffffffffffffffff8316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115613e8f57610d208282614048565b6118286140cb565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310613ee0577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310613f0c576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310613f2a57662386f26fc10000830492506010015b6305f5e1008310613f42576305f5e100830492506008015b6127108310613f5657612710830492506004015b60648310613f68576064830492506002015b600a831061086a5760010192915050565b8073ffffffffffffffffffffffffffffffffffffffff163b600003613fe2576040517f4c9c8ce300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610935565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60606000808473ffffffffffffffffffffffffffffffffffffffff16846040516140729190615039565b600060405180830381855af49150503d80600081146140ad576040519150601f19603f3d011682016040523d82523d6000602084013e6140b2565b606091505b50915091506140c2858383614103565b95945050505050565b3415612aa0576040517fb398979f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082614118576141138261418b565b6109f8565b815115801561413c575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611af7576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610935565b80511561419b5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602082840312156141df57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146109f857600080fd5b60006020828403121561422157600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461424c57600080fd5b919050565b600080600080600060a0868803121561426957600080fd5b61427286614228565b945061428060208701614228565b935061428e60408701614228565b925061429c60608701614228565b91506142aa60808701614228565b90509295509295909350565b600080602083850312156142c957600080fd5b823567ffffffffffffffff8111156142e057600080fd5b8301601f810185136142f157600080fd5b803567ffffffffffffffff81111561430857600080fd5b85602082840101111561431a57600080fd5b6020919091019590945092505050565b803561ffff8116811461424c57600080fd5b803567ffffffffffffffff8116811461424c57600080fd5b6000806040838503121561436757600080fd5b6143708361432a565b915061437e6020840161433c565b90509250929050565b6000806040838503121561439a57600080fd5b8235915061437e60208401614228565b6000602082840312156143bc57600080fd5b6109f88261432a565b60005b838110156143e05781810151838201526020016143c8565b50506000910152565b600081518084526144018160208601602086016143c5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b7fffffffffffffffff000000000000000000000000000000000000000000000000891681528760208201528660408201528560608201528460808201528360a082015282151560c082015261010060e082015260006144966101008301846143e9565b9a9950505050505050505050565b803563ffffffff8116811461424c57600080fd5b8035801515811461424c57600080fd5b600080600080600080600080610100898b0312156144e557600080fd5b88357fffffffffffffffff0000000000000000000000000000000000000000000000008116811461451557600080fd5b975061452360208a0161433c565b965061453160408a016144a4565b955061453f60608a016144a4565b945061454d60808a0161432a565b935061455b60a08a0161432a565b925061456960c08a0161432a565b915061457760e08a016144b8565b90509295985092959890939650565b602080825282518282018190526000918401906040840190835b818110156145c257835161ffff168352602093840193909201916001016145a0565b509095945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715614643576146436145cd565b604052919050565b600067ffffffffffffffff821115614665576146656145cd565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080604083850312156146a457600080fd5b6146ad83614228565b9150602083013567ffffffffffffffff8111156146c957600080fd5b8301601f810185136146da57600080fd5b80356146ed6146e88261464b565b6145fc565b81815286602083850101111561470257600080fd5b816020840160208301376000602083830101528093505050509250929050565b6000806040838503121561473557600080fd5b50508035926020909101359150565b6000806040838503121561475757600080fd5b6147608361432a565b915061437e602084016144b8565b60006020828403121561478057600080fd5b6109f882614228565b6020815260006109f860208301846143e9565b600080604083850312156147af57600080fd5b6147b88361432a565b946020939093013593505050565b6000806000604084860312156147db57600080fd5b83359250602084013567ffffffffffffffff8111156147f957600080fd5b8401601f8101861361480a57600080fd5b803567ffffffffffffffff81111561482157600080fd5b8660208260051b840101111561483657600080fd5b939660209190910195509293505050565b602080825282518282018190526000918401906040840190835b818110156145c2578351835260209384019390920191600101614861565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561086a5761086a61487f565b67ffffffffffffffff8181168382160290811690818114611af757611af761487f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60a08152600061492660a08301886143e9565b828103602084015261493881886143e9565b61ffff968716604085015294861660608401525050921660809092019190915292915050565b60006020828403121561497057600080fd5b815167ffffffffffffffff81111561498757600080fd5b8201601f8101841361499857600080fd5b80516149a66146e88261464b565b8181528560208385010111156149bb57600080fd5b6140c28260208301602086016143c5565b63ffffffff818116838216019081111561086a5761086a61487f565b63ffffffff828116828216039081111561086a5761086a61487f565b600061ffff821661ffff8103614a1c57614a1c61487f565b60010192915050565b808202811582820484141761086a5761086a61487f565b8082018082111561086a5761086a61487f565b600081614a5e57614a5e61487f565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b600082614aba577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600063ffffffff821663ffffffff8103614a1c57614a1c61487f565b60008151614aed8185602086016143c5565b9290920192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251614b2f81601d8501602087016143c5565b91909101601d0192915050565b600181811c90821680614b5057607f821691505b602082108103614b89577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b601f821115610d2057806000526020600020601f840160051c81016020851015614bb65750805b601f840160051c820191505b81811015614bd65760008155600101614bc2565b5050505050565b815167ffffffffffffffff811115614bf757614bf76145cd565b614c0b81614c058454614b3c565b84614b8f565b6020601f821160018114614c5d5760008315614c275750848201515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600385901b1c1916600184901b178455614bd6565b6000848152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08516915b82811015614cab5787850151825560209485019460019092019101614c8b565b5084821015614ce757868401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b60f8161c191681555b50505050600190811b01905550565b600060ff821660ff8103614a1c57614a1c61487f565b600060208284031215614d1e57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008351614d668184602088016143c5565b7f20000000000000000000000000000000000000000000000000000000000000009083019081528351614da08160018401602088016143c5565b01600101949350505050565b7f7b226465736372697074696f6e223a20224e65756c6f636b2050617373776f7281527f64204d616e61676572206d656d62657273686970204e4654202d206e65756c6f60208201527f636b2e617070222c20226e616d65223a20224e45552023000000000000000000604082015260008751614e30816057850160208c016143c5565b7f222c2022696d616765223a2022646174613a696d6167652f7376672b786d6c3b6057918401918201527f6261736536342c0000000000000000000000000000000000000000000000000060778201528751614e9381607e840160208c016143c5565b6057818301019150507f222c202261747472696275746573223a205b7b2274726169745f74797065223a60278201527f2022536572696573222c202276616c7565223a202200000000000000000000006047820152615006615000614fb1614fab614f5c614f56614f07605c88018e614adb565b7f227d2c7b2274726169745f74797065223a2022476f7665726e616e636520416381527f63657373222c202276616c7565223a2022000000000000000000000000000000602082015260310190565b8b614adb565b7f227d2c7b2274726169745f74797065223a2022536572696573204d617820537581527f70706c79222c202276616c7565223a2000000000000000000000000000000000602082015260300190565b88614adb565b7f7d2c7b2274726169745f74797065223a20224d696e742044617465222c20226481527f6973706c61795f74797065223a202264617465222c202276616c7565223a20006020820152603f0190565b85614adb565b7f7d5d7d000000000000000000000000000000000000000000000000000000000081526003019998505050505050505050565b6000825161504b8184602087016143c5565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220e47c9318c6b06f7eaa93b0a6ccfcb874693525dcf44afec2f91dfb0ef2559f0a64736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.