Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- EVMFSSubscription
- Optimization enabled
- true
- Compiler version
- v0.8.28+commit.7893614a
- Optimization runs
- 200
- EVM Version
- prague
- Verified at
- 2026-03-10T21:51:55.697434Z
Constructor Arguments
0x000000000000000000000000de984be08167cc4b47ce70be71b18cbe95d986ce
Arg [0] (address) : 0xde984be08167cc4b47ce70be71b18cbe95d986ce
contracts/EVMFSSubscription.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "./IEVMFSSubscription.sol";
import "./EVMFSSubscriptionSVG.sol";
/**
* @title EVMFSSubscription — ERC-1155 subscription NFTs for EVMFS
*
* Three plan tiers (infinite supply, minted on purchase):
* Token 0 — Monthly (0.002 ETH, 30 days)
* Token 1 — Yearly (0.02 ETH, 365 days)
* Token 2 — Lifetime (0.2 ETH, forever)
*
* Subscriptions stack: buying two monthly subs gives 60 days.
* ETH is forwarded to the immutable `beneficiary` immediately — no
* accumulation, no withdraw(), no admin keys. Fully permissionless.
*/
contract EVMFSSubscription is ERC1155, IEVMFSSubscription {
// ── Plan IDs ─────────────────────────────────────────────
uint256 public constant MONTHLY = 0;
uint256 public constant YEARLY = 1;
uint256 public constant LIFETIME = 2;
// ── Immutable config ─────────────────────────────────────
address public immutable beneficiary;
// ── Plan parameters ──────────────────────────────────────
mapping(uint256 => uint256) public planPrice;
mapping(uint256 => uint256) public planDuration;
// ── Subscription state ───────────────────────────────────
mapping(address => uint256) private _expiry;
// ── Events ───────────────────────────────────────────────
event SubscriptionPurchased(
address indexed buyer,
uint256 indexed planId,
uint256 newExpiry
);
// ── Errors ───────────────────────────────────────────────
error InvalidPlan();
error InsufficientPayment();
error TransferFailed();
error ZeroBeneficiary();
constructor(address _beneficiary) ERC1155("") {
if (_beneficiary == address(0)) revert ZeroBeneficiary();
beneficiary = _beneficiary;
planPrice[MONTHLY] = 0.002 ether;
planPrice[YEARLY] = 0.02 ether;
planPrice[LIFETIME] = 0.2 ether;
planDuration[MONTHLY] = 30 days;
planDuration[YEARLY] = 365 days;
planDuration[LIFETIME] = type(uint256).max;
}
// ── Purchase ─────────────────────────────────────────────
/**
* @notice Buy a subscription plan. Mints 1 ERC-1155 token as proof of
* purchase and extends the caller's subscription expiry.
* @param planId 0 = Monthly, 1 = Yearly, 2 = Lifetime.
*/
function purchase(uint256 planId) external payable {
uint256 price = planPrice[planId];
if (price == 0) revert InvalidPlan();
if (msg.value < price) revert InsufficientPayment();
// Mint proof-of-purchase token (permanent, even after expiry)
_mint(msg.sender, planId, 1, "");
// Extend subscription
uint256 duration = planDuration[planId];
uint256 newExpiry;
if (duration == type(uint256).max) {
newExpiry = type(uint256).max;
} else {
// Stack from current expiry if still active, otherwise from now
uint256 base = _expiry[msg.sender] >= block.timestamp
? _expiry[msg.sender]
: block.timestamp;
newExpiry = base + duration;
}
_expiry[msg.sender] = newExpiry;
emit SubscriptionPurchased(msg.sender, planId, newExpiry);
// Forward payment to beneficiary
(bool ok, ) = beneficiary.call{value: price}("");
if (!ok) revert TransferFailed();
// Refund overpayment
uint256 excess = msg.value - price;
if (excess > 0) {
(bool refundOk, ) = msg.sender.call{value: excess}("");
if (!refundOk) revert TransferFailed();
}
}
// ── Metadata ─────────────────────────────────────────────
/**
* @notice On-chain SVG metadata for each plan tier.
* Plan 0 = Monthly, 1 = Yearly, 2 = Lifetime.
* Invalid IDs return the Lifetime art as a safe fallback.
*/
function uri(uint256 id) public pure override returns (string memory) {
return EVMFSSubscriptionSVG.tokenURI(id > 2 ? 2 : id);
}
// ── Views ────────────────────────────────────────────────
/// @inheritdoc IEVMFSSubscription
function hasActiveSubscription(address account) external view override returns (bool) {
return _expiry[account] >= block.timestamp;
}
/// @inheritdoc IEVMFSSubscription
function subscriptionExpiry(address account) external view override returns (uint256) {
return _expiry[account];
}
}
../../lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-721.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
../../lib/openzeppelin-contracts/contracts/token/ERC1155/ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.24;
import {IERC1155} from "./IERC1155.sol";
import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol";
import {ERC1155Utils} from "./utils/ERC1155Utils.sol";
import {Context} from "../../utils/Context.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {Arrays} from "../../utils/Arrays.sol";
import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*/
abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors {
using Arrays for uint256[];
using Arrays for address[];
mapping(uint256 id => mapping(address account => uint256)) private _balances;
mapping(address account => mapping(address operator => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256 /* id */) public view virtual returns (string memory) {
return _uri;
}
/// @inheritdoc IERC1155
function balanceOf(address account, uint256 id) public view virtual returns (uint256) {
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
) public view virtual returns (uint256[] memory) {
if (accounts.length != ids.length) {
revert ERC1155InvalidArrayLength(ids.length, accounts.length);
}
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i));
}
return batchBalances;
}
/// @inheritdoc IERC1155
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
/// @inheritdoc IERC1155
function isApprovedForAll(address account, address operator) public view virtual returns (bool) {
return _operatorApprovals[account][operator];
}
/// @inheritdoc IERC1155
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
_checkAuthorized(_msgSender(), from);
_safeTransferFrom(from, to, id, value, data);
}
/// @inheritdoc IERC1155
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) public virtual {
_checkAuthorized(_msgSender(), from);
_safeBatchTransferFrom(from, to, ids, values, data);
}
/// @dev Checks if `operator` is authorized to transfer tokens owned by `owner`. Reverts with {ERC1155MissingApprovalForAll} if not.
function _checkAuthorized(address operator, address owner) internal view virtual {
if (owner != operator && !isApprovedForAll(owner, operator)) {
revert ERC1155MissingApprovalForAll(operator, owner);
}
}
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
* (or `to`) is the zero address.
*
* Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received}
* or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
* - `ids` and `values` must have the same length.
*
* NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.
*/
function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual {
if (ids.length != values.length) {
revert ERC1155InvalidArrayLength(ids.length, values.length);
}
address operator = _msgSender();
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids.unsafeMemoryAccess(i);
uint256 value = values.unsafeMemoryAccess(i);
if (from != address(0)) {
uint256 fromBalance = _balances[id][from];
if (fromBalance < value) {
revert ERC1155InsufficientBalance(from, fromBalance, value, id);
}
unchecked {
// Overflow not possible: value <= fromBalance
_balances[id][from] = fromBalance - value;
}
}
if (to != address(0)) {
_balances[id][to] += value;
}
}
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
emit TransferSingle(operator, from, to, id, value);
} else {
emit TransferBatch(operator, from, to, ids, values);
}
}
/**
* @dev Version of {_update} that performs the token acceptance check by calling
* {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
* contains code (eg. is a smart contract at the moment of execution).
*
* IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
* update to the contract state after this function would break the check-effect-interaction pattern. Consider
* overriding {_update} instead.
*
* NOTE: This version is kept for backward compatibility. We recommend calling the alternative version with a boolean
* flag in order to achieve better control over which hook to call.
*/
function _updateWithAcceptanceCheck(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal virtual {
_updateWithAcceptanceCheck(from, to, ids, values, data, ids.length != 1);
}
/**
* @dev Version of {_update} that performs the token acceptance check by calling
* {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
* contains code (eg. is a smart contract at the moment of execution).
*
* IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
* update to the contract state after this function would break the check-effect-interaction pattern. Consider
* overriding {_update} instead.
*/
function _updateWithAcceptanceCheck(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data,
bool batch
) internal virtual {
_update(from, to, ids, values);
if (to != address(0)) {
address operator = _msgSender();
if (batch) {
ERC1155Utils.checkOnERC1155BatchReceived(operator, from, to, ids, values, data);
} else {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
ERC1155Utils.checkOnERC1155Received(operator, from, to, id, value, data);
}
}
}
/**
* @dev Transfers a `value` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, to, ids, values, data, false);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
* - `ids` and `values` must have the same length.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, to, ids, values, data, true);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the values in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(address(0), to, ids, values, data, false);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
_updateWithAcceptanceCheck(address(0), to, ids, values, data, true);
}
/**
* @dev Destroys a `value` amount of tokens of type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
*/
function _burn(address from, uint256 id, uint256 value) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, address(0), ids, values, "", false);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
* - `ids` and `values` must have the same length.
*/
function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, address(0), ids, values, "", true);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `operator` cannot be the zero address.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (owner == address(0)) {
revert ERC1155InvalidApprover(address(0));
}
if (operator == address(0)) {
revert ERC1155InvalidOperator(address(0));
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Creates an array in memory with only one value for each of the elements provided.
*/
function _asSingletonArrays(
uint256 element1,
uint256 element2
) private pure returns (uint256[] memory array1, uint256[] memory array2) {
assembly ("memory-safe") {
// Load the free memory pointer
array1 := mload(0x40)
// Set array length to 1
mstore(array1, 1)
// Store the single element at the next word after the length (where content starts)
mstore(add(array1, 0x20), element1)
// Repeat for next array locating it right after the first array
array2 := add(array1, 0x40)
mstore(array2, 1)
mstore(add(array2, 0x20), element2)
// Update the free memory pointer by pointing after the second array
mstore(0x40, add(array2, 0x40))
}
}
}
../../lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/IERC1155.sol)
pragma solidity >=0.6.2;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC-1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[ERC].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the zero address.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {IERC1155Receiver-onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}
../../lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity >=0.6.2;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Interface that must be implemented by smart contracts in order to receive
* ERC-1155 token transfers.
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC-1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC-1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
../../lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity >=0.6.2;
import {IERC1155} from "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[ERC].
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
../../lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/utils/ERC1155Utils.sol)
pragma solidity ^0.8.20;
import {IERC1155Receiver} from "../IERC1155Receiver.sol";
import {IERC1155Errors} from "../../../interfaces/draft-IERC6093.sol";
/**
* @dev Library that provide common ERC-1155 utility functions.
*
* See https://eips.ethereum.org/EIPS/eip-1155[ERC-1155].
*
* _Available since v5.1._
*/
library ERC1155Utils {
/**
* @dev Performs an acceptance check for the provided `operator` by calling {IERC1155Receiver-onERC1155Received}
* on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
*
* The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
* Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept
* the transfer.
*/
function checkOnERC1155Received(
address operator,
address from,
address to,
uint256 id,
uint256 value,
bytes memory data
) internal {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
// Tokens rejected
revert IERC1155Errors.ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-IERC1155Receiver implementer
revert IERC1155Errors.ERC1155InvalidReceiver(to);
} else {
assembly ("memory-safe") {
revert(add(reason, 0x20), mload(reason))
}
}
}
}
}
/**
* @dev Performs a batch acceptance check for the provided `operator` by calling {IERC1155Receiver-onERC1155BatchReceived}
* on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
*
* The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
* Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept
* the transfer.
*/
function checkOnERC1155BatchReceived(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
// Tokens rejected
revert IERC1155Errors.ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-IERC1155Receiver implementer
revert IERC1155Errors.ERC1155InvalidReceiver(to);
} else {
assembly ("memory-safe") {
revert(add(reason, 0x20), mload(reason))
}
}
}
}
}
}
../../lib/openzeppelin-contracts/contracts/utils/Arrays.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (utils/Arrays.sol)
// This file was procedurally generated from scripts/generate/templates/Arrays.js.
pragma solidity ^0.8.24;
import {Comparators} from "./Comparators.sol";
import {SlotDerivation} from "./SlotDerivation.sol";
import {StorageSlot} from "./StorageSlot.sol";
import {Math} from "./math/Math.sol";
/**
* @dev Collection of functions related to array types.
*/
library Arrays {
using SlotDerivation for bytes32;
using StorageSlot for bytes32;
/**
* @dev Sort an array of uint256 (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
uint256[] memory array,
function(uint256, uint256) pure returns (bool) comp
) internal pure returns (uint256[] memory) {
_quickSort(_begin(array), _end(array), comp);
return array;
}
/**
* @dev Variant of {sort} that sorts an array of uint256 in increasing order.
*/
function sort(uint256[] memory array) internal pure returns (uint256[] memory) {
sort(array, Comparators.lt);
return array;
}
/**
* @dev Sort an array of address (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
address[] memory array,
function(address, address) pure returns (bool) comp
) internal pure returns (address[] memory) {
sort(_castToUint256Array(array), _castToUint256Comp(comp));
return array;
}
/**
* @dev Variant of {sort} that sorts an array of address in increasing order.
*/
function sort(address[] memory array) internal pure returns (address[] memory) {
sort(_castToUint256Array(array), Comparators.lt);
return array;
}
/**
* @dev Sort an array of bytes32 (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
bytes32[] memory array,
function(bytes32, bytes32) pure returns (bool) comp
) internal pure returns (bytes32[] memory) {
sort(_castToUint256Array(array), _castToUint256Comp(comp));
return array;
}
/**
* @dev Variant of {sort} that sorts an array of bytes32 in increasing order.
*/
function sort(bytes32[] memory array) internal pure returns (bytes32[] memory) {
sort(_castToUint256Array(array), Comparators.lt);
return array;
}
/**
* @dev Performs a quick sort of a segment of memory. The segment sorted starts at `begin` (inclusive), and stops
* at end (exclusive). Sorting follows the `comp` comparator.
*
* Invariant: `begin <= end`. This is the case when initially called by {sort} and is preserved in subcalls.
*
* IMPORTANT: Memory locations between `begin` and `end` are not validated/zeroed. This function should
* be used only if the limits are within a memory array.
*/
function _quickSort(uint256 begin, uint256 end, function(uint256, uint256) pure returns (bool) comp) private pure {
unchecked {
if (end - begin < 0x40) return;
// Use first element as pivot
uint256 pivot = _mload(begin);
// Position where the pivot should be at the end of the loop
uint256 pos = begin;
for (uint256 it = begin + 0x20; it < end; it += 0x20) {
if (comp(_mload(it), pivot)) {
// If the value stored at the iterator's position comes before the pivot, we increment the
// position of the pivot and move the value there.
pos += 0x20;
_swap(pos, it);
}
}
_swap(begin, pos); // Swap pivot into place
_quickSort(begin, pos, comp); // Sort the left side of the pivot
_quickSort(pos + 0x20, end, comp); // Sort the right side of the pivot
}
}
/**
* @dev Pointer to the memory location of the first element of `array`.
*/
function _begin(uint256[] memory array) private pure returns (uint256 ptr) {
assembly ("memory-safe") {
ptr := add(array, 0x20)
}
}
/**
* @dev Pointer to the memory location of the first memory word (32bytes) after `array`. This is the memory word
* that comes just after the last element of the array.
*/
function _end(uint256[] memory array) private pure returns (uint256 ptr) {
unchecked {
return _begin(array) + array.length * 0x20;
}
}
/**
* @dev Load memory word (as a uint256) at location `ptr`.
*/
function _mload(uint256 ptr) private pure returns (uint256 value) {
assembly {
value := mload(ptr)
}
}
/**
* @dev Swaps the elements memory location `ptr1` and `ptr2`.
*/
function _swap(uint256 ptr1, uint256 ptr2) private pure {
assembly {
let value1 := mload(ptr1)
let value2 := mload(ptr2)
mstore(ptr1, value2)
mstore(ptr2, value1)
}
}
/// @dev Helper: low level cast address memory array to uint256 memory array
function _castToUint256Array(address[] memory input) private pure returns (uint256[] memory output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast bytes32 memory array to uint256 memory array
function _castToUint256Array(bytes32[] memory input) private pure returns (uint256[] memory output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast address comp function to uint256 comp function
function _castToUint256Comp(
function(address, address) pure returns (bool) input
) private pure returns (function(uint256, uint256) pure returns (bool) output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast bytes32 comp function to uint256 comp function
function _castToUint256Comp(
function(bytes32, bytes32) pure returns (bool) input
) private pure returns (function(uint256, uint256) pure returns (bool) output) {
assembly {
output := input
}
}
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* NOTE: The `array` is expected to be sorted in ascending order, and to
* contain no repeated elements.
*
* IMPORTANT: Deprecated. This implementation behaves as {lowerBound} but lacks
* support for repeated elements in the array. The {lowerBound} function should
* be used instead.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Searches an `array` sorted in ascending order and returns the first
* index that contains a value greater or equal than `element`. If no such index
* exists (i.e. all values in the array are strictly less than `element`), the array
* length is returned. Time complexity O(log n).
*
* See C++'s https://en.cppreference.com/w/cpp/algorithm/lower_bound[lower_bound].
*/
function lowerBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value < element) {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
} else {
high = mid;
}
}
return low;
}
/**
* @dev Searches an `array` sorted in ascending order and returns the first
* index that contains a value strictly greater than `element`. If no such index
* exists (i.e. all values in the array are strictly less than `element`), the array
* length is returned. Time complexity O(log n).
*
* See C++'s https://en.cppreference.com/w/cpp/algorithm/upper_bound[upper_bound].
*/
function upperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
}
}
return low;
}
/**
* @dev Same as {lowerBound}, but with an array in memory.
*/
function lowerBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeMemoryAccess(array, mid) < element) {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
} else {
high = mid;
}
}
return low;
}
/**
* @dev Same as {upperBound}, but with an array in memory.
*/
function upperBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeMemoryAccess(array, mid) > element) {
high = mid;
} else {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
}
}
return low;
}
/**
* @dev Copies the content of `array`, from `start` (included) to the end of `array` into a new address array in
* memory.
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
*/
function slice(address[] memory array, uint256 start) internal pure returns (address[] memory) {
return slice(array, start, array.length);
}
/**
* @dev Copies the content of `array`, from `start` (included) to `end` (excluded) into a new address array in
* memory. The `end` argument is truncated to the length of the `array`.
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
*/
function slice(address[] memory array, uint256 start, uint256 end) internal pure returns (address[] memory) {
// sanitize
end = Math.min(end, array.length);
start = Math.min(start, end);
// allocate and copy
address[] memory result = new address[](end - start);
assembly ("memory-safe") {
mcopy(add(result, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20))
}
return result;
}
/**
* @dev Copies the content of `array`, from `start` (included) to the end of `array` into a new bytes32 array in
* memory.
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
*/
function slice(bytes32[] memory array, uint256 start) internal pure returns (bytes32[] memory) {
return slice(array, start, array.length);
}
/**
* @dev Copies the content of `array`, from `start` (included) to `end` (excluded) into a new bytes32 array in
* memory. The `end` argument is truncated to the length of the `array`.
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
*/
function slice(bytes32[] memory array, uint256 start, uint256 end) internal pure returns (bytes32[] memory) {
// sanitize
end = Math.min(end, array.length);
start = Math.min(start, end);
// allocate and copy
bytes32[] memory result = new bytes32[](end - start);
assembly ("memory-safe") {
mcopy(add(result, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20))
}
return result;
}
/**
* @dev Copies the content of `array`, from `start` (included) to the end of `array` into a new uint256 array in
* memory.
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
*/
function slice(uint256[] memory array, uint256 start) internal pure returns (uint256[] memory) {
return slice(array, start, array.length);
}
/**
* @dev Copies the content of `array`, from `start` (included) to `end` (excluded) into a new uint256 array in
* memory. The `end` argument is truncated to the length of the `array`.
*
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
*/
function slice(uint256[] memory array, uint256 start, uint256 end) internal pure returns (uint256[] memory) {
// sanitize
end = Math.min(end, array.length);
start = Math.min(start, end);
// allocate and copy
uint256[] memory result = new uint256[](end - start);
assembly ("memory-safe") {
mcopy(add(result, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20))
}
return result;
}
/**
* @dev Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array,
* and shrinks the array length accordingly, effectively overwriting the array with array[start:].
*
* NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead.
*/
function splice(address[] memory array, uint256 start) internal pure returns (address[] memory) {
return splice(array, start, array.length);
}
/**
* @dev Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array,
* and shrinks the array length accordingly, effectively overwriting the array with array[start:end]. The
* `end` argument is truncated to the length of the `array`.
*
* NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead.
*/
function splice(address[] memory array, uint256 start, uint256 end) internal pure returns (address[] memory) {
// sanitize
end = Math.min(end, array.length);
start = Math.min(start, end);
// move and resize
assembly ("memory-safe") {
mcopy(add(array, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20))
mstore(array, sub(end, start))
}
return array;
}
/**
* @dev Replaces elements in `array` starting at `pos` with all elements from `replacement`.
*
* Parameters are clamped to valid ranges (e.g. `pos` is clamped to `[0, array.length]`).
* If `pos >= array.length`, no replacement occurs and the array is returned unchanged.
*
* NOTE: This function modifies the provided array in place.
*/
function replace(
address[] memory array,
uint256 pos,
address[] memory replacement
) internal pure returns (address[] memory) {
return replace(array, pos, replacement, 0, replacement.length);
}
/**
* @dev Replaces elements in `array` starting at `pos` with elements from `replacement` starting at `offset`.
* Copies at most `length` elements from `replacement` to `array`.
*
* Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, array.length]`, `offset` is
* clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,
* array.length - pos)`). If `pos >= array.length` or `offset >= replacement.length`, no replacement occurs
* and the array is returned unchanged.
*
* NOTE: This function modifies the provided array in place.
*/
function replace(
address[] memory array,
uint256 pos,
address[] memory replacement,
uint256 offset,
uint256 length
) internal pure returns (address[] memory) {
// sanitize
pos = Math.min(pos, array.length);
offset = Math.min(offset, replacement.length);
length = Math.min(length, Math.min(replacement.length - offset, array.length - pos));
// replace
assembly ("memory-safe") {
mcopy(
add(add(array, 0x20), mul(pos, 0x20)),
add(add(replacement, 0x20), mul(offset, 0x20)),
mul(length, 0x20)
)
}
return array;
}
/**
* @dev Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array,
* and shrinks the array length accordingly, effectively overwriting the array with array[start:].
*
* NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead.
*/
function splice(bytes32[] memory array, uint256 start) internal pure returns (bytes32[] memory) {
return splice(array, start, array.length);
}
/**
* @dev Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array,
* and shrinks the array length accordingly, effectively overwriting the array with array[start:end]. The
* `end` argument is truncated to the length of the `array`.
*
* NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead.
*/
function splice(bytes32[] memory array, uint256 start, uint256 end) internal pure returns (bytes32[] memory) {
// sanitize
end = Math.min(end, array.length);
start = Math.min(start, end);
// move and resize
assembly ("memory-safe") {
mcopy(add(array, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20))
mstore(array, sub(end, start))
}
return array;
}
/**
* @dev Replaces elements in `array` starting at `pos` with all elements from `replacement`.
*
* Parameters are clamped to valid ranges (e.g. `pos` is clamped to `[0, array.length]`).
* If `pos >= array.length`, no replacement occurs and the array is returned unchanged.
*
* NOTE: This function modifies the provided array in place.
*/
function replace(
bytes32[] memory array,
uint256 pos,
bytes32[] memory replacement
) internal pure returns (bytes32[] memory) {
return replace(array, pos, replacement, 0, replacement.length);
}
/**
* @dev Replaces elements in `array` starting at `pos` with elements from `replacement` starting at `offset`.
* Copies at most `length` elements from `replacement` to `array`.
*
* Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, array.length]`, `offset` is
* clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,
* array.length - pos)`). If `pos >= array.length` or `offset >= replacement.length`, no replacement occurs
* and the array is returned unchanged.
*
* NOTE: This function modifies the provided array in place.
*/
function replace(
bytes32[] memory array,
uint256 pos,
bytes32[] memory replacement,
uint256 offset,
uint256 length
) internal pure returns (bytes32[] memory) {
// sanitize
pos = Math.min(pos, array.length);
offset = Math.min(offset, replacement.length);
length = Math.min(length, Math.min(replacement.length - offset, array.length - pos));
// replace
assembly ("memory-safe") {
mcopy(
add(add(array, 0x20), mul(pos, 0x20)),
add(add(replacement, 0x20), mul(offset, 0x20)),
mul(length, 0x20)
)
}
return array;
}
/**
* @dev Moves the content of `array`, from `start` (included) to the end of `array` to the start of that array,
* and shrinks the array length accordingly, effectively overwriting the array with array[start:].
*
* NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead.
*/
function splice(uint256[] memory array, uint256 start) internal pure returns (uint256[] memory) {
return splice(array, start, array.length);
}
/**
* @dev Moves the content of `array`, from `start` (included) to `end` (excluded) to the start of that array,
* and shrinks the array length accordingly, effectively overwriting the array with array[start:end]. The
* `end` argument is truncated to the length of the `array`.
*
* NOTE: This function modifies the provided array in place. If you need to preserve the original array, use {slice} instead.
*/
function splice(uint256[] memory array, uint256 start, uint256 end) internal pure returns (uint256[] memory) {
// sanitize
end = Math.min(end, array.length);
start = Math.min(start, end);
// move and resize
assembly ("memory-safe") {
mcopy(add(array, 0x20), add(add(array, 0x20), mul(start, 0x20)), mul(sub(end, start), 0x20))
mstore(array, sub(end, start))
}
return array;
}
/**
* @dev Replaces elements in `array` starting at `pos` with all elements from `replacement`.
*
* Parameters are clamped to valid ranges (e.g. `pos` is clamped to `[0, array.length]`).
* If `pos >= array.length`, no replacement occurs and the array is returned unchanged.
*
* NOTE: This function modifies the provided array in place.
*/
function replace(
uint256[] memory array,
uint256 pos,
uint256[] memory replacement
) internal pure returns (uint256[] memory) {
return replace(array, pos, replacement, 0, replacement.length);
}
/**
* @dev Replaces elements in `array` starting at `pos` with elements from `replacement` starting at `offset`.
* Copies at most `length` elements from `replacement` to `array`.
*
* Parameters are clamped to valid ranges (i.e. `pos` is clamped to `[0, array.length]`, `offset` is
* clamped to `[0, replacement.length]`, and `length` is clamped to `min(length, replacement.length - offset,
* array.length - pos)`). If `pos >= array.length` or `offset >= replacement.length`, no replacement occurs
* and the array is returned unchanged.
*
* NOTE: This function modifies the provided array in place.
*/
function replace(
uint256[] memory array,
uint256 pos,
uint256[] memory replacement,
uint256 offset,
uint256 length
) internal pure returns (uint256[] memory) {
// sanitize
pos = Math.min(pos, array.length);
offset = Math.min(offset, replacement.length);
length = Math.min(length, Math.min(replacement.length - offset, array.length - pos));
// replace
assembly ("memory-safe") {
mcopy(
add(add(array, 0x20), mul(pos, 0x20)),
add(add(replacement, 0x20), mul(offset, 0x20)),
mul(length, 0x20)
)
}
return array;
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getUint256Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes[] storage arr, uint256 pos) internal pure returns (StorageSlot.BytesSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getBytesSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(string[] storage arr, uint256 pos) internal pure returns (StorageSlot.StringSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getStringSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(bytes32[] memory arr, uint256 pos) internal pure returns (bytes32 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(bytes[] memory arr, uint256 pos) internal pure returns (bytes memory res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(string[] memory arr, uint256 pos) internal pure returns (string memory res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, or initialize elements if length is increased.
*/
function unsafeSetLength(address[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, or initialize elements if length is increased.
*/
function unsafeSetLength(bytes32[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, or initialize elements if length is increased.
*/
function unsafeSetLength(uint256[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, or initialize elements if length is increased.
*/
function unsafeSetLength(bytes[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, or initialize elements if length is increased.
*/
function unsafeSetLength(string[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
}
../../lib/openzeppelin-contracts/contracts/utils/Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (utils/Base64.sol)
pragma solidity ^0.8.20;
import {SafeCast} from "./math/SafeCast.sol";
/**
* @dev Provides a set of functions to operate with Base64 strings.
*/
library Base64 {
using SafeCast for bool;
error InvalidBase64Char(bytes1);
/**
* @dev Converts a `bytes` to its Base64 `string` representation.
*/
function encode(bytes memory data) internal pure returns (string memory) {
return string(_encode(data, false));
}
/**
* @dev Converts a `bytes` to its Base64Url `string` representation.
* Output is not padded with `=` as specified in https://www.rfc-editor.org/rfc/rfc4648[rfc4648].
*/
function encodeURL(bytes memory data) internal pure returns (string memory) {
return string(_encode(data, true));
}
/**
* @dev Converts a Base64 `string` to the `bytes` it represents.
*
* * Supports padded and unpadded inputs.
* * Supports both encoding ({encode} and {encodeURL}) seamlessly.
* * Reverts with {InvalidBase64Char} if the input contains an invalid character.
*/
function decode(string memory data) internal pure returns (bytes memory) {
return _decode(bytes(data));
}
/**
* @dev Internal table-agnostic encoding
*
* Padding is enabled when using the Base64 table, and disabled when using the Base64Url table.
* See sections 4 and 5 of https://datatracker.ietf.org/doc/html/rfc4648
*/
function _encode(bytes memory data, bool urlAndFilenameSafe) private pure returns (bytes memory result) {
/**
* Inspired by Brecht Devos (Brechtpd) implementation - MIT license
* https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
*/
if (data.length == 0) return "";
// Padding is enabled by default, but disabled when the "urlAndFilenameSafe" alphabet is used
//
// If padding is enabled, the final length should be `bytes` data length divided by 3 rounded up and then
// multiplied by 4 so that it leaves room for padding the last chunk
// - `data.length + 2` -> Prepare for division rounding up
// - `/ 3` -> Number of 3-bytes chunks (rounded up)
// - `4 *` -> 4 characters for each chunk
// This is equivalent to: 4 * Math.ceil(data.length / 3)
//
// If padding is disabled, the final length should be `bytes` data length multiplied by 4/3 rounded up as
// opposed to when padding is required to fill the last chunk.
// - `4 * data.length` -> 4 characters for each chunk
// - ` + 2` -> Prepare for division rounding up
// - `/ 3` -> Number of 3-bytes chunks (rounded up)
// This is equivalent to: Math.ceil((4 * data.length) / 3)
uint256 resultLength = urlAndFilenameSafe ? (4 * data.length + 2) / 3 : 4 * ((data.length + 2) / 3);
assembly ("memory-safe") {
result := mload(0x40)
// Store the encoding table in the scratch space (and fmp ptr) to avoid memory allocation
//
// Base64 (ascii) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 + /
// Base64 (hex) 4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f
// Base64Url (ascii) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 - _
// Base64Url (hex) 4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f
// xor (hex) 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000670
mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef")
mstore(0x3f, xor("ghijklmnopqrstuvwxyz0123456789+/", mul(urlAndFilenameSafe, 0x670)))
// Prepare result pointer, jump over length
let resultPtr := add(result, 0x20)
let resultEnd := add(resultPtr, resultLength)
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(and(shr(18, input), 0x3F)))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(and(shr(12, input), 0x3F)))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(and(shr(6, input), 0x3F)))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(and(input, 0x3F)))
resultPtr := add(resultPtr, 1) // Advance
}
// Reset the value that was cached
mstore(afterPtr, afterCache)
if iszero(urlAndFilenameSafe) {
// 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)
}
}
// Store result length and update FMP to reserve allocated space
mstore(result, resultLength)
mstore(0x40, resultEnd)
}
}
/**
* @dev Internal decoding
*/
function _decode(bytes memory data) private pure returns (bytes memory result) {
bytes4 errorSelector = InvalidBase64Char.selector;
uint256 dataLength = data.length;
if (dataLength == 0) return "";
uint256 resultLength = (dataLength / 4) * 3;
if (dataLength % 4 == 0) {
resultLength -= (data[dataLength - 1] == "=").toUint() + (data[dataLength - 2] == "=").toUint();
} else {
resultLength += (dataLength % 4) - 1;
}
assembly ("memory-safe") {
result := mload(0x40)
// Temporarily store the reverse lookup table between in memory. This spans from 0x00 to 0x50, Using:
// - all 64bytes of scratch space
// - part of the FMP (at location 0x40)
mstore(0x30, 0x2425262728292a2b2c2d2e2f30313233)
mstore(0x20, 0x0a0b0c0d0e0f10111213141516171819ffffffff3fff1a1b1c1d1e1f20212223)
mstore(0x00, 0x3eff3eff3f3435363738393a3b3c3dffffff00ffffff00010203040506070809)
// Prepare result pointer, jump over length
let dataPtr := data
let resultPtr := add(result, 0x20)
let endPtr := add(resultPtr, resultLength)
// In some cases, the last iteration will read bytes after the end of the data. We cache the value, and
// set it to "==" (fake padding) to make sure no dirty bytes are read in that section.
let afterPtr := add(add(data, 0x20), dataLength)
let afterCache := mload(afterPtr)
mstore(afterPtr, shl(240, 0x3d3d))
// loop while not everything is decoded
for {} lt(resultPtr, endPtr) {} {
dataPtr := add(dataPtr, 4)
// Read a 4 bytes chunk of data
let input := mload(dataPtr)
// Decode each byte in the chunk as a 6 bit block, and align them to form a block of 3 bytes
let a := sub(byte(28, input), 43)
// slither-disable-next-line incorrect-shift
if iszero(and(shl(a, 1), 0xffffffd0ffffffc47ff5)) {
mstore(0, errorSelector)
mstore(4, shl(248, add(a, 43)))
revert(0, 0x24)
}
let b := sub(byte(29, input), 43)
// slither-disable-next-line incorrect-shift
if iszero(and(shl(b, 1), 0xffffffd0ffffffc47ff5)) {
mstore(0, errorSelector)
mstore(4, shl(248, add(b, 43)))
revert(0, 0x24)
}
let c := sub(byte(30, input), 43)
// slither-disable-next-line incorrect-shift
if iszero(and(shl(c, 1), 0xffffffd0ffffffc47ff5)) {
mstore(0, errorSelector)
mstore(4, shl(248, add(c, 43)))
revert(0, 0x24)
}
let d := sub(byte(31, input), 43)
// slither-disable-next-line incorrect-shift
if iszero(and(shl(d, 1), 0xffffffd0ffffffc47ff5)) {
mstore(0, errorSelector)
mstore(4, shl(248, add(d, 43)))
revert(0, 0x24)
}
mstore(
resultPtr,
or(
or(shl(250, byte(0, mload(a))), shl(244, byte(0, mload(b)))),
or(shl(238, byte(0, mload(c))), shl(232, byte(0, mload(d))))
)
)
resultPtr := add(resultPtr, 3)
}
// Reset the value that was cached
mstore(afterPtr, afterCache)
// Store result length and update FMP to reserve allocated space
mstore(result, resultLength)
mstore(0x40, endPtr)
}
}
}
../../lib/openzeppelin-contracts/contracts/utils/Comparators.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Comparators.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides a set of functions to compare values.
*
* _Available since v5.1._
*/
library Comparators {
function lt(uint256 a, uint256 b) internal pure returns (bool) {
return a < b;
}
function gt(uint256 a, uint256 b) internal pure returns (bool) {
return a > b;
}
}
../../lib/openzeppelin-contracts/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
../../lib/openzeppelin-contracts/contracts/utils/Panic.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
pragma solidity ^0.8.20;
/**
* @dev Helper library for emitting standardized panic codes.
*
* ```solidity
* contract Example {
* using Panic for uint256;
*
* // Use any of the declared internal constants
* function foo() { Panic.GENERIC.panic(); }
*
* // Alternatively
* function foo() { Panic.panic(Panic.GENERIC); }
* }
* ```
*
* Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
*
* _Available since v5.1._
*/
// slither-disable-next-line unused-state
library Panic {
/// @dev generic / unspecified error
uint256 internal constant GENERIC = 0x00;
/// @dev used by the assert() builtin
uint256 internal constant ASSERT = 0x01;
/// @dev arithmetic underflow or overflow
uint256 internal constant UNDER_OVERFLOW = 0x11;
/// @dev division or modulo by zero
uint256 internal constant DIVISION_BY_ZERO = 0x12;
/// @dev enum conversion error
uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
/// @dev invalid encoding in storage
uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
/// @dev empty array pop
uint256 internal constant EMPTY_ARRAY_POP = 0x31;
/// @dev array out of bounds access
uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
/// @dev resource error (too large allocation or too large array)
uint256 internal constant RESOURCE_ERROR = 0x41;
/// @dev calling invalid internal function
uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;
/// @dev Reverts with a panic code. Recommended to use with
/// the internal constants with predefined codes.
function panic(uint256 code) internal pure {
assembly ("memory-safe") {
mstore(0x00, 0x4e487b71)
mstore(0x20, code)
revert(0x1c, 0x24)
}
}
}
../../lib/openzeppelin-contracts/contracts/utils/SlotDerivation.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/SlotDerivation.sol)
// This file was procedurally generated from scripts/generate/templates/SlotDerivation.js.
pragma solidity ^0.8.20;
/**
* @dev Library for computing storage (and transient storage) locations from namespaces and deriving slots
* corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by
* the solidity language / compiler.
*
* See https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays[Solidity docs for mappings and dynamic arrays.].
*
* Example usage:
* ```solidity
* contract Example {
* // Add the library methods
* using StorageSlot for bytes32;
* using SlotDerivation for *;
*
* // Declare a namespace
* string private constant _NAMESPACE = "<namespace>"; // eg. OpenZeppelin.Slot
*
* function setValueInNamespace(uint256 key, address newValue) internal {
* _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value = newValue;
* }
*
* function getValueInNamespace(uint256 key) internal view returns (address) {
* return _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value;
* }
* }
* ```
*
* TIP: Consider using this library along with {StorageSlot}.
*
* NOTE: This library provides a way to manipulate storage locations in a non-standard way. Tooling for checking
* upgrade safety will ignore the slots accessed through this library.
*
* _Available since v5.1._
*/
library SlotDerivation {
/**
* @dev Derive an ERC-7201 slot from a string (namespace).
*/
function erc7201Slot(string memory namespace) internal pure returns (bytes32 slot) {
assembly ("memory-safe") {
mstore(0x00, sub(keccak256(add(namespace, 0x20), mload(namespace)), 1))
slot := and(keccak256(0x00, 0x20), not(0xff))
}
}
/**
* @dev Add an offset to a slot to get the n-th element of a structure or an array.
*/
function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) {
unchecked {
return bytes32(uint256(slot) + pos);
}
}
/**
* @dev Derive the location of the first element in an array from the slot where the length is stored.
*/
function deriveArray(bytes32 slot) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, slot)
result := keccak256(0x00, 0x20)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, address key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, and(key, shr(96, not(0))))
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bool key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, iszero(iszero(key)))
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bytes32 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, uint256 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, int256 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, string memory key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
let length := mload(key)
let begin := add(key, 0x20)
let end := add(begin, length)
let cache := mload(end)
mstore(end, slot)
result := keccak256(begin, add(length, 0x20))
mstore(end, cache)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bytes memory key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
let length := mload(key)
let begin := add(key, 0x20)
let end := add(begin, length)
let cache := mload(end)
mstore(end, slot)
result := keccak256(begin, add(length, 0x20))
mstore(end, cache)
}
}
}
../../lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}
../../lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 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 ERC165 is IERC165 {
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
../../lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* 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[ERC 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);
}
../../lib/openzeppelin-contracts/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Return the 512-bit addition of two uint256.
*
* The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.
*/
function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
assembly ("memory-safe") {
low := add(a, b)
high := lt(low, a)
}
}
/**
* @dev Return the 512-bit multiplication of two uint256.
*
* The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.
*/
function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
// 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use
// the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = high * 2²⁵⁶ + low.
assembly ("memory-safe") {
let mm := mulmod(a, b, not(0))
low := mul(a, b)
high := sub(sub(mm, low), lt(mm, low))
}
}
/**
* @dev Returns the addition of two unsigned integers, with a success flag (no overflow).
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
success = c >= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a - b;
success = c <= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a * b;
assembly ("memory-safe") {
// Only true when the multiplication doesn't overflow
// (c / a == b) || (a == 0)
success := or(eq(div(c, a), b), iszero(a))
}
// equivalent to: success ? c : 0
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the division of two unsigned integers, with a success flag (no division by zero).
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `DIV` opcode returns zero when the denominator is 0.
result := div(a, b)
}
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `MOD` opcode returns zero when the denominator is 0.
result := mod(a, b)
}
}
}
/**
* @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryAdd(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.
*/
function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {
(, uint256 result) = trySub(a, b);
return result;
}
/**
* @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryMul(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute
* one branch when needed, making this function more expensive.
*/
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
// branchless ternary works because:
// b ^ (a ^ b) == a
// b ^ 0 == b
return b ^ ((a ^ b) * SafeCast.toUint(condition));
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a > b, a, b);
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(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) {
unchecked {
// (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.
Panic.panic(Panic.DIVISION_BY_ZERO);
}
// The following calculation ensures accurate ceiling division without overflow.
// Since a is non-zero, (a - 1) / b will not overflow.
// The largest possible result occurs when (a - 1) / b is type(uint256).max,
// but the largest value we can obtain is type(uint256).max - 1, which happens
// when a = type(uint256).max and b = 1.
unchecked {
return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
}
}
/**
* @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
*
* 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 {
(uint256 high, uint256 low) = mul512(x, y);
// Handle non-overflow cases, 256 by 256 division.
if (high == 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 low / denominator;
}
// Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
if (denominator <= high) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [high low].
uint256 remainder;
assembly ("memory-safe") {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
high := sub(high, gt(remainder, low))
low := sub(low, 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 ("memory-safe") {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [high low] by twos.
low := div(low, twos)
// Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from high into low.
low |= high * twos;
// Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
// that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv ≡ 1 mod 2⁴.
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⁸
inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
inverse *= 2 - denominator * inverse; // inverse mod 2³²
inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶
// 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²⁵⁶. Since the preconditions guarantee that the outcome is
// less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high
// is no longer required.
result = low * inverse;
return result;
}
}
/**
* @dev 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) {
return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
}
/**
* @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.
*/
function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {
unchecked {
(uint256 high, uint256 low) = mul512(x, y);
if (high >= 1 << n) {
Panic.panic(Panic.UNDER_OVERFLOW);
}
return (high << (256 - n)) | (low >> n);
}
}
/**
* @dev Calculates x * y >> n with full precision, following the selected rounding direction.
*/
function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {
return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);
}
/**
* @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
*
* If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
* If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
*
* If the input value is not inversible, 0 is returned.
*
* NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
* inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
*/
function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
unchecked {
if (n == 0) return 0;
// The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
// Used to compute integers x and y such that: ax + ny = gcd(a, n).
// When the gcd is 1, then the inverse of a modulo n exists and it's x.
// ax + ny = 1
// ax = 1 + (-y)n
// ax ≡ 1 (mod n) # x is the inverse of a modulo n
// If the remainder is 0 the gcd is n right away.
uint256 remainder = a % n;
uint256 gcd = n;
// Therefore the initial coefficients are:
// ax + ny = gcd(a, n) = n
// 0a + 1n = n
int256 x = 0;
int256 y = 1;
while (remainder != 0) {
uint256 quotient = gcd / remainder;
(gcd, remainder) = (
// The old remainder is the next gcd to try.
remainder,
// Compute the next remainder.
// Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
// where gcd is at most n (capped to type(uint256).max)
gcd - remainder * quotient
);
(x, y) = (
// Increment the coefficient of a.
y,
// Decrement the coefficient of n.
// Can overflow, but the result is casted to uint256 so that the
// next value of y is "wrapped around" to a value between 0 and n - 1.
x - y * int256(quotient)
);
}
if (gcd != 1) return 0; // No inverse exists.
return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
}
}
/**
* @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
*
* From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
* prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
* `a**(p-2)` is the modular multiplicative inverse of a in Fp.
*
* NOTE: this function does NOT check that `p` is a prime greater than `2`.
*/
function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
unchecked {
return Math.modExp(a, p - 2, p);
}
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
*
* Requirements:
* - modulus can't be zero
* - underlying staticcall to precompile must succeed
*
* IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
* sure the chain you're using it on supports the precompiled contract for modular exponentiation
* at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
* the underlying function will succeed given the lack of a revert, but the result may be incorrectly
* interpreted as 0.
*/
function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
(bool success, uint256 result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
* It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
* to operate modulo 0 or if the underlying precompile reverted.
*
* IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
* you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
* https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
* of a revert, but the result may be incorrectly interpreted as 0.
*/
function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
if (m == 0) return (false, 0);
assembly ("memory-safe") {
let ptr := mload(0x40)
// | Offset | Content | Content (Hex) |
// |-----------|------------|--------------------------------------------------------------------|
// | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x60:0x7f | value of b | 0x<.............................................................b> |
// | 0x80:0x9f | value of e | 0x<.............................................................e> |
// | 0xa0:0xbf | value of m | 0x<.............................................................m> |
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), b)
mstore(add(ptr, 0x80), e)
mstore(add(ptr, 0xa0), m)
// Given the result < m, it's guaranteed to fit in 32 bytes,
// so we can use the memory scratch space located at offset 0.
success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
result := mload(0x00)
}
}
/**
* @dev Variant of {modExp} that supports inputs of arbitrary length.
*/
function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
(bool success, bytes memory result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Variant of {tryModExp} that supports inputs of arbitrary length.
*/
function tryModExp(
bytes memory b,
bytes memory e,
bytes memory m
) internal view returns (bool success, bytes memory result) {
if (_zeroBytes(m)) return (false, new bytes(0));
uint256 mLen = m.length;
// Encode call args in result and move the free memory pointer
result = abi.encodePacked(b.length, e.length, mLen, b, e, m);
assembly ("memory-safe") {
let dataPtr := add(result, 0x20)
// Write result on top of args to avoid allocating extra memory.
success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
// Overwrite the length.
// result.length > returndatasize() is guaranteed because returndatasize() == m.length
mstore(result, mLen)
// Set the memory pointer after the returned data.
mstore(0x40, add(dataPtr, mLen))
}
}
/**
* @dev Returns whether the provided byte array is zero.
*/
function _zeroBytes(bytes memory buffer) private pure returns (bool) {
uint256 chunk;
for (uint256 i = 0; i < buffer.length; i += 0x20) {
// See _unsafeReadBytesOffset from utils/Bytes.sol
assembly ("memory-safe") {
chunk := mload(add(add(buffer, 0x20), i))
}
if (chunk >> (8 * saturatingSub(i + 0x20, buffer.length)) != 0) {
return false;
}
}
return true;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* This method is based on Newton's method for computing square roots; the algorithm is restricted to only
* using integer operations.
*/
function sqrt(uint256 a) internal pure returns (uint256) {
unchecked {
// Take care of easy edge cases when a == 0 or a == 1
if (a <= 1) {
return a;
}
// In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
// sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
// the current value as `ε_n = | x_n - sqrt(a) |`.
//
// For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
// of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
// bigger than any uint256.
//
// By noticing that
// `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
// we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
// to the msb function.
uint256 aa = a;
uint256 xn = 1;
if (aa >= (1 << 128)) {
aa >>= 128;
xn <<= 64;
}
if (aa >= (1 << 64)) {
aa >>= 64;
xn <<= 32;
}
if (aa >= (1 << 32)) {
aa >>= 32;
xn <<= 16;
}
if (aa >= (1 << 16)) {
aa >>= 16;
xn <<= 8;
}
if (aa >= (1 << 8)) {
aa >>= 8;
xn <<= 4;
}
if (aa >= (1 << 4)) {
aa >>= 4;
xn <<= 2;
}
if (aa >= (1 << 2)) {
xn <<= 1;
}
// We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
//
// We can refine our estimation by noticing that the middle of that interval minimizes the error.
// If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
// This is going to be our x_0 (and ε_0)
xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)
// From here, Newton's method give us:
// x_{n+1} = (x_n + a / x_n) / 2
//
// One should note that:
// x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
// = ((x_n² + a) / (2 * x_n))² - a
// = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
// = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
// = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
// = (x_n² - a)² / (2 * x_n)²
// = ((x_n² - a) / (2 * x_n))²
// ≥ 0
// Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
//
// This gives us the proof of quadratic convergence of the sequence:
// ε_{n+1} = | x_{n+1} - sqrt(a) |
// = | (x_n + a / x_n) / 2 - sqrt(a) |
// = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
// = | (x_n - sqrt(a))² / (2 * x_n) |
// = | ε_n² / (2 * x_n) |
// = ε_n² / | (2 * x_n) |
//
// For the first iteration, we have a special case where x_0 is known:
// ε_1 = ε_0² / | (2 * x_0) |
// ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
// ≤ 2**(2*e-4) / (3 * 2**(e-1))
// ≤ 2**(e-3) / 3
// ≤ 2**(e-3-log2(3))
// ≤ 2**(e-4.5)
//
// For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
// ε_{n+1} = ε_n² / | (2 * x_n) |
// ≤ (2**(e-k))² / (2 * 2**(e-1))
// ≤ 2**(2*e-2*k) / 2**e
// ≤ 2**(e-2*k)
xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above
xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5
xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9
xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18
xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36
xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72
// Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
// ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
// sqrt(a) or sqrt(a) + 1.
return xn - SafeCast.toUint(xn > a / xn);
}
}
/**
* @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// If upper 8 bits of 16-bit half set, add 8 to result
r |= SafeCast.toUint((x >> r) > 0xff) << 3;
// If upper 4 bits of 8-bit half set, add 4 to result
r |= SafeCast.toUint((x >> r) > 0xf) << 2;
// Shifts value right by the current result and use it as an index into this lookup table:
//
// | x (4 bits) | index | table[index] = MSB position |
// |------------|---------|-----------------------------|
// | 0000 | 0 | table[0] = 0 |
// | 0001 | 1 | table[1] = 0 |
// | 0010 | 2 | table[2] = 1 |
// | 0011 | 3 | table[3] = 1 |
// | 0100 | 4 | table[4] = 2 |
// | 0101 | 5 | table[5] = 2 |
// | 0110 | 6 | table[6] = 2 |
// | 0111 | 7 | table[7] = 2 |
// | 1000 | 8 | table[8] = 3 |
// | 1001 | 9 | table[9] = 3 |
// | 1010 | 10 | table[10] = 3 |
// | 1011 | 11 | table[11] = 3 |
// | 1100 | 12 | table[12] = 3 |
// | 1101 | 13 | table[13] = 3 |
// | 1110 | 14 | table[14] = 3 |
// | 1111 | 15 | table[15] = 3 |
//
// The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the first 16 bytes (most significant half).
assembly ("memory-safe") {
r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))
}
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
}
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
}
}
/**
* @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 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8
return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
}
}
/**
* @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;
}
/**
* @dev Counts the number of leading zero bits in a uint256.
*/
function clz(uint256 x) internal pure returns (uint256) {
return ternary(x == 0, 256, 255 - log2(x));
}
}
../../lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.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/bool 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 a uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in a 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 A 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);
}
/**
* @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
*/
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}
contracts/EVMFSSubscriptionSVG.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/utils/Base64.sol";
/**
* @dev On-chain SVG/metadata generator for EVMFSSubscription ERC-1155 tokens.
*
* Three tiers with increasingly premium visuals:
* 0 — Monthly (steel blue, static, single orb)
* 1 — Yearly (violet/amber, animated border text, dual orbs)
* 2 — Lifetime (prismatic, animated border text + rotating sparkle, triple orbs)
*/
library EVMFSSubscriptionSVG {
// ── Public entry point ────────────────────────────────────────────────────
/// @notice Returns a data:application/json;base64,… URI for the given plan ID.
function tokenURI(uint256 planId) internal pure returns (string memory) {
bytes memory svg = _svg(planId);
bytes memory json = abi.encodePacked(
'{"name":"EVMFS ', _name(planId), ' Subscription",'
'"description":"On-chain storage subscription pass for the EVMFS network. '
'Grants fee-free write access while active.",'
'"attributes":['
'{"trait_type":"Plan","value":"', _name(planId), '"},'
'{"trait_type":"Price","value":"', _price(planId), ' ETH"}'
'],'
'"image":"data:image/svg+xml;base64,', Base64.encode(svg), '"}'
);
return string(abi.encodePacked(
'data:application/json;base64,', Base64.encode(json)
));
}
// ── Plan metadata helpers ─────────────────────────────────────────────────
function _name(uint256 planId) private pure returns (string memory) {
if (planId == 0) return "Monthly";
if (planId == 1) return "Yearly";
return "Lifetime";
}
function _price(uint256 planId) private pure returns (string memory) {
if (planId == 0) return "0.002";
if (planId == 1) return "0.02";
return "0.2";
}
// ── SVG dispatcher ────────────────────────────────────────────────────────
function _svg(uint256 planId) private pure returns (bytes memory) {
if (planId == 0) return _monthly();
if (planId == 1) return _yearly();
return abi.encodePacked(_lifetimeA(), _lifetimeB());
}
// ── MONTHLY — Steel Blue ──────────────────────────────────────────────────
// Entry-level: clean, minimal, single glow orb, corner tech accents.
function _monthly() private pure returns (bytes memory) {
return abi.encodePacked(
'<svg width="290" height="500" viewBox="0 0 290 500" xmlns="http://www.w3.org/2000/svg">',
'<defs>',
'<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">',
'<stop offset="0%" stop-color="#0a0e1a"/>',
'<stop offset="100%" stop-color="#0d1327"/>',
'</linearGradient>',
'<filter id="glow" x="-60%" y="-60%" width="220%" height="220%">',
'<feGaussianBlur stdDeviation="38"/>',
'</filter>',
'<clipPath id="c"><rect width="290" height="500" rx="42" ry="42"/></clipPath>',
'</defs>',
'<g clip-path="url(#c)">',
// Background
'<rect width="290" height="500" fill="url(#bg)"/>',
// Single soft blue orb
'<circle cx="145" cy="222" r="118" fill="#3b82f6" opacity="0.22" filter="url(#glow)"/>',
// Outer border ring
'<rect x="1" y="1" width="288" height="498" rx="42" ry="42"'
' fill="none" stroke="#3b82f6" stroke-width="1.5" stroke-opacity="0.25"/>',
// Corner bracket accents (top-left, top-right, bottom-left, bottom-right)
'<path d="M20 55 L20 22 L53 22" fill="none" stroke="#3b82f6" stroke-width="1.2" stroke-opacity="0.5"/>',
'<path d="M237 22 L270 22 L270 55" fill="none" stroke="#3b82f6" stroke-width="1.2" stroke-opacity="0.5"/>',
'<path d="M20 445 L20 478 L53 478" fill="none" stroke="#3b82f6" stroke-width="1.2" stroke-opacity="0.5"/>',
'<path d="M237 478 L270 478 L270 445" fill="none" stroke="#3b82f6" stroke-width="1.2" stroke-opacity="0.5"/>',
// Hexagon icon — small, centered top
'<polygon points="145,64 173,80 173,112 145,128 117,112 117,80"'
' fill="none" stroke="#3b82f6" stroke-width="1.5" stroke-opacity="0.7"/>',
'<circle cx="145" cy="96" r="6" fill="#3b82f6" opacity="0.9"/>',
// Brand label
'<text x="145" y="154" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="11"'
' fill="#3b82f6" fill-opacity="0.7" letter-spacing="4">EVMFS</text>',
// Plan title
'<text x="145" y="242" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="26"'
' fill="white" font-weight="bold" letter-spacing="3">MONTHLY</text>',
'<text x="145" y="265" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="10"'
' fill="rgba(255,255,255,0.35)" letter-spacing="4">STORAGE PASS</text>',
// Divider
'<line x1="60" y1="292" x2="230" y2="292"'
' stroke="rgba(59,130,246,0.3)" stroke-width="1"/>',
// Price badge
'<rect x="96" y="312" width="98" height="30" rx="7" fill="#1e3a8a" fill-opacity="0.65"/>',
'<text x="145" y="332" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="13" fill="#93c5fd">0.002 ETH</text>',
// Duration
'<text x="145" y="384" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="10"'
' fill="rgba(255,255,255,0.28)" letter-spacing="2">30 DAYS</text>',
// Bottom label
'<text x="145" y="466" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="9"'
' fill="rgba(255,255,255,0.18)" letter-spacing="4">EVMFS NETWORK</text>',
'</g>',
'</svg>'
);
}
// ── YEARLY — Violet / Amber ───────────────────────────────────────────────
// Mid-tier: dual colour orbs, animated scrolling border text.
function _yearly() private pure returns (bytes memory) {
return abi.encodePacked(
'<svg width="290" height="500" viewBox="0 0 290 500" xmlns="http://www.w3.org/2000/svg">',
'<defs>',
'<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">',
'<stop offset="0%" stop-color="#0d0b1e"/>',
'<stop offset="100%" stop-color="#120d24"/>',
'</linearGradient>',
'<filter id="f" x="-90%" y="-90%" width="280%" height="280%">',
'<feGaussianBlur stdDeviation="46"/>',
'</filter>',
'<clipPath id="c"><rect width="290" height="500" rx="42" ry="42"/></clipPath>',
'<path id="tp" d="M40 12 H250 Q278 12 278 40 V460 Q278 488 250 488 H40 Q12 488 12 460 V40 Q12 12 40 12"/>',
'</defs>',
'<g clip-path="url(#c)">',
'<rect width="290" height="500" fill="url(#bg)"/>',
// Orb 1 — violet (upper-left)
'<circle cx="68" cy="196" r="126" fill="#7c3aed" opacity="0.28" filter="url(#f)"/>',
// Orb 2 — amber (lower-right)
'<circle cx="222" cy="298" r="116" fill="#d97706" opacity="0.22" filter="url(#f)"/>',
// Outer border
'<rect x="1" y="1" width="288" height="498" rx="42" ry="42"'
' fill="none" stroke="rgba(124,58,237,0.4)" stroke-width="1.5"/>',
// Animated border text
_borderText("EVMFS STORAGE NETWORK * YEARLY SUBSCRIPTION * "),
// Corner accents — violet top, amber bottom
'<path d="M20 55 L20 22 L53 22" fill="none" stroke="#7c3aed" stroke-width="1.2" stroke-opacity="0.55"/>',
'<path d="M237 22 L270 22 L270 55" fill="none" stroke="#7c3aed" stroke-width="1.2" stroke-opacity="0.55"/>',
'<path d="M20 445 L20 478 L53 478" fill="none" stroke="#d97706" stroke-width="1.2" stroke-opacity="0.5"/>',
'<path d="M237 478 L270 478 L270 445" fill="none" stroke="#d97706" stroke-width="1.2" stroke-opacity="0.5"/>',
// Hex icon — violet outline, amber core
'<polygon points="145,58 178,76 178,114 145,132 112,114 112,76"'
' fill="none" stroke="#7c3aed" stroke-width="1.5" stroke-opacity="0.75"/>',
'<circle cx="145" cy="95" r="7" fill="#d97706" opacity="0.9"/>',
'<circle cx="145" cy="95" r="13" fill="none" stroke="#d97706" stroke-opacity="0.35" stroke-width="1.5"/>',
// Brand
'<text x="145" y="154" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="11"'
' fill="#7c3aed" fill-opacity="0.85" letter-spacing="4">EVMFS</text>',
// Title
'<text x="145" y="240" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="26"'
' fill="white" font-weight="bold" letter-spacing="3">YEARLY</text>',
'<text x="145" y="263" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="10"'
' fill="rgba(255,255,255,0.35)" letter-spacing="4">STORAGE PASS</text>',
// Amber divider
'<line x1="55" y1="290" x2="235" y2="290"'
' stroke="rgba(217,119,6,0.35)" stroke-width="1"/>',
// Price badge — amber tones
'<rect x="90" y="311" width="110" height="30" rx="7" fill="#78350f" fill-opacity="0.65"/>',
'<text x="145" y="331" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="13" fill="#fcd34d">0.02 ETH</text>',
// Duration
'<text x="145" y="383" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="10"'
' fill="rgba(255,255,255,0.28)" letter-spacing="2">365 DAYS</text>',
// Bottom
'<text x="145" y="466" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="9"'
' fill="rgba(255,255,255,0.18)" letter-spacing="4">EVMFS NETWORK</text>',
'</g>',
'</svg>'
);
}
// ── LIFETIME — Prismatic / Galaxy ─────────────────────────────────────────
// Top-tier: three large orbs, double-border, animated text, rotating sparkle.
// Split into two functions to stay within Solidity stack limits.
function _lifetimeA() private pure returns (bytes memory) {
return abi.encodePacked(
'<svg width="290" height="500" viewBox="0 0 290 500" xmlns="http://www.w3.org/2000/svg">',
'<defs>',
'<linearGradient id="bg" x1="0" y1="0" x2="0.3" y2="1">',
'<stop offset="0%" stop-color="#050510"/>',
'<stop offset="100%" stop-color="#090520"/>',
'</linearGradient>',
// Heavy blur for the two large orbs
'<filter id="fa" x="-100%" y="-100%" width="300%" height="300%">',
'<feGaussianBlur stdDeviation="52"/>',
'</filter>',
// Slightly tighter blur for the third accent orb
'<filter id="fb" x="-80%" y="-80%" width="260%" height="260%">',
'<feGaussianBlur stdDeviation="42"/>',
'</filter>',
'<clipPath id="c"><rect width="290" height="500" rx="42" ry="42"/></clipPath>',
'<path id="tp" d="M40 12 H250 Q278 12 278 40 V460 Q278 488 250 488 H40 Q12 488 12 460 V40 Q12 12 40 12"/>',
'</defs>',
'<g clip-path="url(#c)">',
'<rect width="290" height="500" fill="url(#bg)"/>',
// Orb 1 — cyan (upper-left)
'<circle cx="48" cy="170" r="136" fill="#06b6d4" opacity="0.26" filter="url(#fa)"/>',
// Orb 2 — purple (upper-right)
'<circle cx="242" cy="242" r="130" fill="#a855f7" opacity="0.24" filter="url(#fa)"/>',
// Orb 3 — amber (lower-center)
'<circle cx="128" cy="338" r="112" fill="#f59e0b" opacity="0.22" filter="url(#fb)"/>',
// Outer border — gold
'<rect x="1" y="1" width="288" height="498" rx="42" ry="42"'
' fill="none" stroke="rgba(245,158,11,0.38)" stroke-width="1.5"/>',
// Inner thin ring — gives the "double frame" luxury feel
'<rect x="4" y="4" width="282" height="492" rx="39" ry="39"'
' fill="none" stroke="rgba(245,158,11,0.10)" stroke-width="1"/>',
// Animated border text
_borderText("EVMFS STORAGE NETWORK * LIFETIME SUBSCRIPTION * ")
);
}
function _lifetimeB() private pure returns (bytes memory) {
return abi.encodePacked(
// Corner accents — all gold, slightly thicker than lower tiers
'<path d="M20 55 L20 22 L53 22" fill="none" stroke="#f59e0b" stroke-width="1.5" stroke-opacity="0.6"/>',
'<path d="M237 22 L270 22 L270 55" fill="none" stroke="#f59e0b" stroke-width="1.5" stroke-opacity="0.6"/>',
'<path d="M20 445 L20 478 L53 478" fill="none" stroke="#f59e0b" stroke-width="1.5" stroke-opacity="0.6"/>',
'<path d="M237 478 L270 478 L270 445" fill="none" stroke="#f59e0b" stroke-width="1.5" stroke-opacity="0.6"/>',
// Hex icon — three concentric rings + filled core
'<polygon points="145,42 192,67 192,124 145,149 98,124 98,67"'
' fill="none" stroke="#f59e0b" stroke-width="0.5" stroke-opacity="0.22"/>',
'<polygon points="145,50 184,72 184,118 145,140 106,118 106,72"'
' fill="none" stroke="#f59e0b" stroke-width="2" stroke-opacity="0.65"/>',
'<polygon points="145,62 174,78 174,110 145,126 116,110 116,78"'
' fill="#f59e0b" fill-opacity="0.06"/>',
// Core gem with glow rings
'<circle cx="145" cy="95" r="22" fill="none" stroke="#f59e0b" stroke-opacity="0.12" stroke-width="1"/>',
'<circle cx="145" cy="95" r="15" fill="none" stroke="#f59e0b" stroke-opacity="0.3" stroke-width="1.5"/>',
'<circle cx="145" cy="95" r="8" fill="#f59e0b" opacity="0.95"/>',
// Brand
'<text x="145" y="162" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="11"'
' fill="#f59e0b" fill-opacity="0.85" letter-spacing="4">EVMFS</text>',
// Title
'<text x="145" y="246" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="26"'
' fill="white" font-weight="bold" letter-spacing="3">LIFETIME</text>',
'<text x="145" y="269" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="10"'
' fill="rgba(255,255,255,0.35)" letter-spacing="4">STORAGE PASS</text>',
// Gold divider with centre diamond pip
'<line x1="40" y1="296" x2="126" y2="296" stroke="rgba(245,158,11,0.4)" stroke-width="1"/>',
'<polygon points="145,291 150,296 145,301 140,296" fill="#f59e0b" fill-opacity="0.6"/>',
'<line x1="164" y1="296" x2="250" y2="296" stroke="rgba(245,158,11,0.4)" stroke-width="1"/>',
// Price badge — gold outline
'<rect x="87" y="316" width="116" height="30" rx="7" fill="#78350f" fill-opacity="0.7"/>',
'<rect x="87" y="316" width="116" height="30" rx="7"'
' fill="none" stroke="rgba(245,158,11,0.4)" stroke-width="0.75"/>',
'<text x="145" y="336" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="13" fill="#fcd34d">0.2 ETH</text>',
// Duration
'<text x="145" y="384" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="10"'
' fill="rgba(255,255,255,0.28)" letter-spacing="2">PERPETUAL</text>',
// Bottom
'<text x="145" y="466" text-anchor="middle"'
' font-family="Courier New,monospace" font-size="9"'
' fill="rgba(255,255,255,0.18)" letter-spacing="4">EVMFS NETWORK</text>',
// Rotating 8-point sparkle — bottom-right corner
'<g transform="translate(226,416)">',
'<path fill="#f59e0b" opacity="0.88"'
' d="M11 0L12.4 8.2L18.5 2.6L13.8 9.8L22 11L13.8 12.2L18.5 19.4L12.4 13.8L11 22'
'L9.6 13.8L3.5 19.4L8.2 12.2L0 11L8.2 9.8L3.5 2.6L9.6 8.2Z">',
'<animateTransform attributeName="transform" type="rotate"'
' from="0 11 11" to="360 11 11" dur="10s" repeatCount="indefinite"/>',
'</path>',
'</g>',
'</g>',
'</svg>'
);
}
// ── Shared helpers ────────────────────────────────────────────────────────
/**
* @dev Generates a two-pass animated <text> that loops content along the
* card border path (#tp). Two overlapping textPaths ensure seamless
* looping: one starts at 0 %, the other at -100 %, both advance to 100 %.
*/
function _borderText(string memory content) private pure returns (bytes memory) {
return abi.encodePacked(
'<text font-family="Courier New,monospace" font-size="10"'
' fill="rgba(255,255,255,0.32)" letter-spacing="2">',
'<textPath startOffset="-100%" href="#tp">', content,
'<animate attributeName="startOffset"'
' from="0%" to="100%" dur="30s" repeatCount="indefinite"/>',
'</textPath>',
'<textPath startOffset="0%" href="#tp">', content,
'<animate attributeName="startOffset"'
' from="0%" to="100%" dur="30s" repeatCount="indefinite"/>',
'</textPath>',
'</text>'
);
}
}
contracts/IEVMFSSubscription.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @title IEVMFSSubscription — minimal interface for EVMFS premium checks
/// @notice EVMFS.sol queries this to decide whether to charge the block-write premium.
interface IEVMFSSubscription {
/// @notice Returns true if `account` has an active (non-expired) subscription.
function hasActiveSubscription(address account) external view returns (bool);
/// @notice Returns the expiry timestamp for `account`.
/// 0 = never subscribed, type(uint256).max = lifetime.
function subscriptionExpiry(address account) external view returns (uint256);
}
Compiler Settings
{"viaIR":true,"remappings":["@openzeppelin/contracts/=../../lib/openzeppelin-contracts/contracts/","forge-std/=../../lib/forge-std/src/","erc4626-tests/=/Users/Onix.Martinez/BlockProjects/web3-twitter/new_monorepo/lib/openzeppelin-contracts/lib/erc4626-tests/","halmos-cheatcodes/=/Users/Onix.Martinez/BlockProjects/web3-twitter/new_monorepo/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=/Users/Onix.Martinez/BlockProjects/web3-twitter/new_monorepo/lib/openzeppelin-contracts/contracts/"],"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"libraries":{},"evmVersion":"prague"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_beneficiary","internalType":"address"}]},{"type":"error","name":"ERC1155InsufficientBalance","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint256","name":"needed","internalType":"uint256"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"error","name":"ERC1155InvalidApprover","inputs":[{"type":"address","name":"approver","internalType":"address"}]},{"type":"error","name":"ERC1155InvalidArrayLength","inputs":[{"type":"uint256","name":"idsLength","internalType":"uint256"},{"type":"uint256","name":"valuesLength","internalType":"uint256"}]},{"type":"error","name":"ERC1155InvalidOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"error","name":"ERC1155InvalidReceiver","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"error","name":"ERC1155InvalidSender","inputs":[{"type":"address","name":"sender","internalType":"address"}]},{"type":"error","name":"ERC1155MissingApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"InsufficientPayment","inputs":[]},{"type":"error","name":"InvalidPlan","inputs":[]},{"type":"error","name":"TransferFailed","inputs":[]},{"type":"error","name":"ZeroBeneficiary","inputs":[]},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"SubscriptionPurchased","inputs":[{"type":"address","name":"buyer","internalType":"address","indexed":true},{"type":"uint256","name":"planId","internalType":"uint256","indexed":true},{"type":"uint256","name":"newExpiry","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TransferBatch","inputs":[{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256[]","name":"ids","internalType":"uint256[]","indexed":false},{"type":"uint256[]","name":"values","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"event","name":"TransferSingle","inputs":[{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"id","internalType":"uint256","indexed":false},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"URI","inputs":[{"type":"string","name":"value","internalType":"string","indexed":false},{"type":"uint256","name":"id","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"LIFETIME","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MONTHLY","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"YEARLY","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"id","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"balanceOfBatch","inputs":[{"type":"address[]","name":"accounts","internalType":"address[]"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"beneficiary","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasActiveSubscription","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"planDuration","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"planPrice","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"purchase","inputs":[{"type":"uint256","name":"planId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeBatchTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"},{"type":"uint256[]","name":"values","internalType":"uint256[]"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"id","internalType":"uint256"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"subscriptionExpiry","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"uri","inputs":[{"type":"uint256","name":"id","internalType":"uint256"}]}]
Contract Creation Code
0x60a0604052346101bf57604051601f61441838819003918201601f19168301916001600160401b038311848410176101ab578084926020946040528339810103126101bf57516001600160a01b0381168082036101bf5760405160208101906001600160401b038211818310176101ab575f9160405252600254600181811c911680156101a1575b602082101461018d57601f8111610145575b506020905f60025515610136576004916080525f80526003815266071afd498d000060405f205560015f526003815266470de4df82000060405f205560025f52600381526702c68af0bb14000060405f20555f805281815262278d0060405f205560015f528181526301e1338060405f205560025f52525f1960405f205560405161425490816101c482396080518181816106ac0152610aae0152f35b63776cceeb60e01b5f5260045ffd5b60025f52601f0160051c7f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace908101905b8181106101825750610099565b5f8155600101610175565b634e487b7160e01b5f52602260045260245ffd5b90607f1690610087565b634e487b7160e01b5f52604160045260245ffd5b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c8062fdd58e1461012357806301ffc9a71461011e5780630e89341c1461011957806319fe14ce146101145780632eb2c2d61461010f57806338af3eed1461010a5780634e1273f414610105578063602e7df91461010057806360a85ef5146100fb578063a22cb465146100f6578063b95be6fb146100f1578063bebe4a57146100ec578063c1746443146100e7578063d3c576d8146100e2578063e985e9c5146100dd578063efef39a1146100d85763f242432a146100d3575f80fd5b610b6c565b610a06565b6109aa565b61098f565b610974565b610939565b61090f565b610842565b61080a565b6107e0565b61071f565b610697565b610608565b6104dc565b61026c565b6101c6565b61016c565b600435906001600160a01b038216820361013e57565b5f80fd5b602435906001600160a01b038216820361013e57565b35906001600160a01b038216820361013e57565b3461013e57604036600319011261013e5760206101ab61018a610128565b6024355f525f835260405f209060018060a01b03165f5260205260405f2090565b54604051908152f35b6001600160e01b031981160361013e57565b3461013e57602036600319011261013e5760206004356101e5816101b4565b63ffffffff60e01b16636cdb3d1360e11b8114908115610223575b8115610212575b506040519015158152f35b6301ffc9a760e01b1490505f610207565b6303a24d0760e21b81149150610200565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b906020610269928181520190610234565b90565b3461013e57602036600319011261013e5760043560028111156104c457506104c061046c6104b461047f61030c61047a60025b61046c61045e6102ae836110fa565b9261041b6104216102be83611ad5565b9561041b6103e76102e06102da6102d488611ad5565b97611b52565b93613c74565b9560b06040519c8d9b8c60206e03d913730b6b2911d1122ab26a3299608d1b910152602f8d0190610f48565b7f20537562736372697074696f6e222c226465736372697074696f6e223a224f6e81527f2d636861696e2073746f7261676520737562736372697074696f6e207061737360208201527f20666f72207468652045564d4653206e6574776f726b2e204772616e7473206660408201527f65652d6672656520777269746520616363657373207768696c6520616374697660608201527f652e222c2261747472696275746573223a5b7b2274726169745f74797065223a60808201526f11283630b71116113b30b63ab2911d1160811b60a08201520190610f48565b7f227d2c7b2274726169745f74797065223a225072696365222c2276616c7565228152611d1160f11b602082015260220190565b90610f48565b7f20455448227d5d2c22696d616765223a22646174613a696d6167652f7376672b81526a1e1b5b0ed8985cd94d8d0b60aa1b6020820152602b0190565b61227d60f01b815260020190565b03601f19810183528261050a565b613c74565b6040517f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000006020820152928391603d830161041b565b60405191829182610258565b0390f35b61046c6104b461047f61030c61047a6104c09561029f565b3461013e575f36600319011261013e5760206040515f8152f35b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761052c57604052565b6104f6565b67ffffffffffffffff811161052c5760051b60200190565b9080601f8301121561013e57813561056081610531565b9261056e604051948561050a565b81845260208085019260051b82010192831161013e57602001905b8282106105965750505090565b8135815260209182019101610589565b67ffffffffffffffff811161052c57601f01601f191660200190565b81601f8201121561013e578035906105d9826105a6565b926105e7604051948561050a565b8284526020838301011161013e57815f926020809301838601378301015290565b3461013e5760a036600319011261013e57610621610128565b610629610142565b9060443567ffffffffffffffff811161013e5761064a903690600401610549565b60643567ffffffffffffffff811161013e5761066a903690600401610549565b906084359367ffffffffffffffff851161013e5761068f6106959536906004016105c2565b93610c36565b005b3461013e575f36600319011261013e576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b90602080835192838152019201905f5b8181106106f85750505090565b82518452602093840193909201916001016106eb565b9060206102699281815201906106db565b3461013e57604036600319011261013e5760043567ffffffffffffffff811161013e573660238201121561013e5780600401359061075c82610531565b9161076a604051938461050a565b8083526024602084019160051b8301019136831161013e57602401905b8282106107c8578360243567ffffffffffffffff811161013e576104c0916107b66107bc923690600401610549565b90610e10565b6040519182918261070e565b602080916107d584610158565b815201910190610787565b3461013e57602036600319011261013e576004355f526004602052602060405f2054604051908152f35b3461013e57602036600319011261013e576001600160a01b0361082b610128565b165f526005602052602060405f2054604051908152f35b3461013e57604036600319011261013e5761085b610128565b602435801515810361013e5733156108fc576001600160a01b0382169182156108ea57816108a76108b892335f52600160205260405f209060018060a01b03165f5260205260405f2090565b9060ff801983541691151516179055565b604051901515815233907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b62ced3e160e81b5f525f60045260245ffd5b631f18c42760e11b5f525f60045260245ffd5b3461013e57602036600319011261013e576004355f526003602052602060405f2054604051908152f35b3461013e57602036600319011261013e576001600160a01b0361095a610128565b165f526005602052602060405f2054604051904211158152f35b3461013e575f36600319011261013e57602060405160018152f35b3461013e575f36600319011261013e57602060405160028152f35b3461013e57604036600319011261013e57602060ff6109fa6109ca610128565b6109d2610142565b6001600160a01b039182165f9081526001865260408082209290931681526020919091522090565b54166040519015158152f35b602036600319011261013e57600435610a27815f52600360205260405f2090565b54908115610b5d57813410610b4e57610a48610a41610ec4565b8233610fc0565b610a5a815f52600460205260405f2090565b545f198103610b1557505f195b335f81815260056020908152604091829020849055905192835290917f6d458fa94cc5b30d7877bed127c2029f98bc0cbc4634dc7789b6bc804fbdae039190a35f808080847f00000000000000000000000000000000000000000000000000000000000000005af1610ad7610f0c565b5015610b0657610ae79034610f3b565b80610aee57005b5f80808093335af1610afe610f0c565b5015610b0657005b6312171d8360e31b5f5260045ffd5b335f908152600560205260409020610b439190544211610b4857335f90815260056020526040902054610eff565b610a67565b42610eff565b63cd1c886760e01b5f5260045ffd5b6321f2425960e01b5f5260045ffd5b3461013e5760a036600319011261013e57610b85610128565b610b8d610142565b604435906064359260843567ffffffffffffffff811161013e57610bb59036906004016105c2565b92610bc08233610f5a565b6001600160a01b03831615610c23576001600160a01b03821615610c115761069594610c0960405192600184526020840152604083019160018352606084015260808301604052565b929091611bc6565b626a0d4560e21b5f525f60045260245ffd5b632bfa23e760e11b5f525f60045260245ffd5b92919094610c448433610f5a565b6001600160a01b038616948515610c23576001600160a01b038516958615610c11578351855190818103610dd35750505f5b8451811015610d40578060051b6020808288010151918801015190610cbb89610ca6835f525f60205260405f2090565b9060018060a01b03165f5260205260405f2090565b54828110610d0957610cf98c610ca685948d610ceb60019998610d01970391610ca6845f525f60205260405f2090565b555f525f60205260405f2090565b918254610eff565b905501610c76565b6040516303dee4c560e01b81526001600160a01b038b16600482015260248101919091526044810183905260648101829052608490fd5b50610d979697929795919560018551145f14610d995760208581015187820151604080519283529282015233917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6291a45b33613f4f565b565b6040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb339180610dcb8a8a83613d93565b0390a4610d91565b635b05999160e01b5f5260045260245260445ffd5b8051821015610dfc5760209160051b010190565b634e487b7160e01b5f52603260045260245ffd5b91909180518351808203610eaf575050805190610e2c82610531565b91610e3a604051938461050a565b808352610e49601f1991610531565b013660208401375f5b8151811015610ea85780610e9760019260051b60208082870101519189010151905f918252602082815260408084206001600160a01b03909316845291905290205490565b610ea18286610de8565b5201610e52565b5090925050565b635b05999160e01b5f5260045260245260445ffd5b60405190610ed360208361050a565b5f8252565b634e487b7160e01b5f52601160045260245ffd5b9060028201809211610efa57565b610ed8565b91908201809211610efa57565b3d15610f36573d90610f1d826105a6565b91610f2b604051938461050a565b82523d5f602084013e565b606090565b91908203918211610efa57565b805191908290602001825e015f815290565b6001600160a01b0391821691811690828214159081610f92575b50610f7d575050565b63711bec9160e11b5f5260045260245260445ffd5b5f8481526001602090815260408083206001600160a01b0390941683529290522060ff91505416155f610f74565b91926001600160a01b0383169290918315610c23576001610ffe60405192600184526020840152604083019160018352606084015260808301604052565b9290948551845190818103610dd35750505f5b865181101561104f578087611047610cf987610ca660208060019860051b8097010151958c010151945f525f60205260405f2090565b905501611011565b5092909460208091610d979660018251145f146110bf575f838301517fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f626110ae8689015160405191829133958360209093929193604081019481520152565b0390a45b0151910151915f33613e06565b5f6040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb3391806110f28a8883613d93565b0390a46110b2565b8015611138576001146111305761041b610269611115612ade565b61046c611120613004565b6040519485936020850190610f48565b610269612074565b506040518061114960208201611d82565b651e3232b3399f60d11b815260060161116190611df7565b7f3c73746f70206f66667365743d223025222073746f702d636f6c6f723d22233081526730983298b091179f60c11b60208201527f3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d226028820152691198321899991b91179f60b11b6048820152605201701e17b634b732b0b923b930b234b2b73a1f60791b81526011017f3c66696c7465722069643d22676c6f772220783d222d3630252220793d222d3681527f3025222077696474683d223232302522206865696768743d2232323025223e006020820152603f017f3c6665476175737369616e426c757220737464446576696174696f6e3d22333881526211179f60e91b6020820152602301681e17b334b63a32b91f60b91b815260090161128490611e3d565b661e17b232b3399f60c91b8152600701761e339031b634b816b830ba341e913ab9361411b194911f60491b81526017016112bd90611ea1565b7f3c636972636c652063783d22313435222063793d223232322220723d2231313881527f222066696c6c3d222333623832663622206f7061636974793d22302e323222206020820152743334b63a32b91e913ab9361411b3b637bb9491179f60591b60408201526055017f3c7265637420783d22312220793d2231222077696474683d223238382220686581527f696768743d22343938222072783d223432222072793d223432222066696c6c3d60208201527f226e6f6e6522207374726f6b653d222333623832663622207374726f6b652d7760408201527f696474683d22312e3522207374726f6b652d6f7061636974793d22302e323522606082015261179f60f11b60808201526082017f3c7061746820643d224d3230203535204c3230203232204c353320323222206681527f696c6c3d226e6f6e6522207374726f6b653d222333623832663622207374726f60208201527f6b652d77696474683d22312e3222207374726f6b652d6f7061636974793d2230604082015264171a91179f60d91b60608201526065017f3c7061746820643d224d323337203232204c323730203232204c32373020353581527f222066696c6c3d226e6f6e6522207374726f6b653d222333623832663622207360208201525f5160206141bf5f395f51905f526040820152671e9118171a91179f60c11b60608201526068017f3c7061746820643d224d323020343435204c323020343738204c35332034373881527f222066696c6c3d226e6f6e6522207374726f6b653d222333623832663622207360208201525f5160206141bf5f395f51905f526040820152671e9118171a91179f60c11b60608201526068017f3c7061746820643d224d32333720343738204c32373020343738204c3237302081527f343435222066696c6c3d226e6f6e6522207374726f6b653d222333623832663660208201527f22207374726f6b652d77696474683d22312e3222207374726f6b652d6f70616360408201526a34ba3c9e9118171a91179f60a91b6060820152606b017f3c706f6c79676f6e20706f696e74733d223134352c3634203137332c3830203181527f37332c313132203134352c313238203131372c313132203131372c383022206660208201527f696c6c3d226e6f6e6522207374726f6b653d222333623832663622207374726f60408201527f6b652d77696474683d22312e3522207374726f6b652d6f7061636974793d2230606082015264171b91179f60d91b60808201526085017f3c636972636c652063783d22313435222063793d2239362220723d223622206681527f696c6c3d222333623832663622206f7061636974793d22302e39222f3e0000006020820152603d017f3c7465787420783d223134352220793d223135342220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231312220666960408201527f6c6c3d2223336238326636222066696c6c2d6f7061636974793d22302e37222060608201527f6c65747465722d73706163696e673d2234223e45564d46533c2f746578743e006080820152609f017f3c7465787420783d223134352220793d223234322220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2232362220666960408201527f6c6c3d2277686974652220666f6e742d7765696768743d22626f6c6422206c6560608201527f747465722d73706163696e673d2233223e4d4f4e54484c593c2f746578743e006080820152609f017f3c7465787420783d223134352220793d223236352220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e33352922206c65747460608201527f65722d73706163696e673d2234223e53544f5241474520504153533c2f7465786080820152613a1f60f11b60a082015260a2017f3c6c696e652078313d223630222079313d22323932222078323d22323330222081527f79323d2232393222207374726f6b653d22726762612835392c3133302c32343660208201527f2c302e332922207374726f6b652d77696474683d2231222f3e0000000000000060408201526059017f3c7265637420783d2239362220793d22333132222077696474683d223938222081527f6865696768743d223330222072783d2237222066696c6c3d222331653361386160208201527f222066696c6c2d6f7061636974793d22302e3635222f3e00000000000000000060408201526057017f3c7465787420783d223134352220793d223333322220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231332220666960408201527f6c6c3d2223393363356664223e302e303032204554483c2f746578743e0000006060820152607d017f3c7465787420783d223134352220793d223338342220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e32382922206c65747460608201527f65722d73706163696e673d2232223e333020444159533c2f746578743e0000006080820152609d015b611aa690611ee3565b631e17b39f60e11b8152600401651e17b9bb339f60d11b81526006015b03601f1981018252610269908261050a565b8015611b2c57600114611b0857604051611af060408261050a565b60088152674c69666574696d6560c01b602082015290565b604051611b1660408261050a565b6006815265596561726c7960d01b602082015290565b50604051611b3b60408261050a565b60078152664d6f6e74686c7960c81b602082015290565b8015611ba257600114611b8057604051611b6d60408261050a565b600381526218171960e91b602082015290565b604051611b8e60408261050a565b60048152631817181960e11b602082015290565b50604051611bb160408261050a565b6005815264181718181960d91b602082015290565b9493929091938451825190818103610dd35750506001600160a01b038681169586151595918516801515939192905f5b8451811015611ccf578060051b90898988602080868b010151958c01015192611c4e575b93600194611c2c575b50505001611bf6565b611c4491610ca6610cf9925f525f60205260405f2090565b90555f8981611c23565b50509091611c678d610ca6835f525f60205260405f2090565b54828110611c98578291898f611c8f600197968f950391610ca6855f525f60205260405f2090565b55909450611c1a565b6040516303dee4c560e01b81526001600160a01b038f16600482015260248101919091526044810183905260648101829052608490fd5b5091989593929790965060018851145f14611d485760208881015186820151604080519283529282015233917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6291a45b611d2b575b5050505050565b602080611d3e9601519201519233613e06565b5f80808080611d24565b6040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb339180611d7a898d83613d93565b0390a4611d1f565b7f3c7376672077696474683d2232393022206865696768743d223530302220766981527f6577426f783d2230203020323930203530302220786d6c6e733d22687474703a60208201527f2f2f7777772e77332e6f72672f323030302f737667223e000000000000000000604082015260570190565b7f3c6c696e6561724772616469656e742069643d226267222078313d2230222079815273189e911811103c191e911811103c991e9118911f60611b602082015260340190565b7f3c636c6970506174682069643d2263223e3c726563742077696474683d22323981527f3022206865696768743d22353030222072783d223432222072793d223432222f60208201526b1f1e17b1b634b82830ba341f60a11b6040820152604c0190565b7f3c726563742077696474683d2232393022206865696768743d2235303022206681526f34b6361e913ab9361411b1339491179f60811b602082015260300190565b7f3c7465787420783d223134352220793d223436362220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2239222066696c60408201527f6c3d2272676261283235352c3235352c3235352c302e31382922206c6574746560608201527f722d73706163696e673d2234223e45564d4653204e4554574f524b3c2f7465786080820152613a1f60f11b60a082015260a20190565b60405190611fab60608361050a565b602e82526d02aa129a1a924a82a24a7a71015160951b6040837f45564d46532053544f52414745204e4554574f524b202a20594541524c59205360208201520152565b7f3c706174682069643d2274702220643d224d343020313220483235302051323781527f382031322032373820343020563436302051323738203438382032353020343860208201527f38204834302051313220343838203132203436302056343020513132203132206040820152671a1810189911179f60c11b606082015260680190565b61207c611f9c565b61208590613fed565b60405180916020820161209790611d82565b651e3232b3399f60d11b81526006016120af90611df7565b7f3c73746f70206f66667365743d223025222073746f702d636f6c6f723d22233081526732183118b291179f60c11b60208201526028017f3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d228152691198991832191a11179f60b11b6020820152602a01701e17b634b732b0b923b930b234b2b73a1f60791b81526011017f3c66696c7465722069643d22662220783d222d3930252220793d222d3930252281527f2077696474683d223238302522206865696768743d2232383025223e000000006020820152603c017f3c6665476175737369616e426c757220737464446576696174696f6e3d22343681526211179f60e91b6020820152602301681e17b334b63a32b91f60b91b81526009016121d290611e3d565b6121db90611fee565b661e17b232b3399f60c91b8152600701761e339031b634b816b830ba341e913ab9361411b194911f60491b815260170161221490611ea1565b7f3c636972636c652063783d223638222063793d223139362220723d223132362281527f2066696c6c3d222337633361656422206f7061636974793d22302e323822206660208201527034b63a32b91e913ab9361411b31491179f60791b60408201526051017f3c636972636c652063783d22323232222063793d223239382220723d2231313681527f222066696c6c3d222364393737303622206f7061636974793d22302e323222206020820152713334b63a32b91e913ab9361411b31491179f60711b60408201526052017f3c7265637420783d22312220793d2231222077696474683d223238382220686581527f696768743d22343938222072783d223432222072793d223432222066696c6c3d60208201527f226e6f6e6522207374726f6b653d2272676261283132342c35382c3233372c3060408201527f2e342922207374726f6b652d77696474683d22312e35222f3e00000000000000606082015260790161238291610f48565b7f3c7061746820643d224d3230203535204c3230203232204c353320323222206681527f696c6c3d226e6f6e6522207374726f6b653d222337633361656422207374726f60208201527f6b652d77696474683d22312e3222207374726f6b652d6f7061636974793d2230604082015265171a9a91179f60d11b60608201526066017f3c7061746820643d224d323337203232204c323730203232204c32373020353581527f222066696c6c3d226e6f6e6522207374726f6b653d222337633361656422207360208201525f5160206141bf5f395f51905f526040820152681e9118171a9a91179f60b91b60608201526069017f3c7061746820643d224d323020343435204c323020343738204c35332034373881527f222066696c6c3d226e6f6e6522207374726f6b653d222364393737303622207360208201525f5160206141bf5f395f51905f526040820152671e9118171a91179f60c11b60608201526068017f3c7061746820643d224d32333720343738204c32373020343738204c3237302081527f343435222066696c6c3d226e6f6e6522207374726f6b653d222364393737303660208201527f22207374726f6b652d77696474683d22312e3222207374726f6b652d6f70616360408201526a34ba3c9e9118171a91179f60a91b6060820152606b017f3c706f6c79676f6e20706f696e74733d223134352c3538203137382c3736203181527f37382c313134203134352c313332203131322c313134203131322c373622206660208201527f696c6c3d226e6f6e6522207374726f6b653d222337633361656422207374726f60408201527f6b652d77696474683d22312e3522207374726f6b652d6f7061636974793d2230606082015265171b9a91179f60d11b60808201526086017f3c636972636c652063783d22313435222063793d2239352220723d223722206681527f696c6c3d222364393737303622206f7061636974793d22302e39222f3e0000006020820152603d017f3c636972636c652063783d22313435222063793d2239352220723d223133222081527f66696c6c3d226e6f6e6522207374726f6b653d2223643937373036222073747260208201527f6f6b652d6f7061636974793d22302e333522207374726f6b652d77696474683d6040820152661118971a91179f60c91b60608201526067017f3c7465787420783d223134352220793d223135342220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231312220666960408201527f6c6c3d2223376333616564222066696c6c2d6f7061636974793d22302e38352260608201527f206c65747465722d73706163696e673d2234223e45564d46533c2f746578743e608082015260a0017f3c7465787420783d223134352220793d223234302220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2232362220666960408201527f6c6c3d2277686974652220666f6e742d7765696768743d22626f6c6422206c6560608201527f747465722d73706163696e673d2233223e594541524c593c2f746578743e00006080820152609e017f3c7465787420783d223134352220793d223236332220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e33352922206c65747460608201527f65722d73706163696e673d2234223e53544f5241474520504153533c2f7465786080820152613a1f60f11b60a082015260a2017f3c6c696e652078313d223535222079313d22323930222078323d22323335222081527f79323d2232393022207374726f6b653d2272676261283231372c3131392c362c60208201527f302e33352922207374726f6b652d77696474683d2231222f3e0000000000000060408201526059017f3c7265637420783d2239302220793d22333131222077696474683d223131302281527f206865696768743d223330222072783d2237222066696c6c3d2223373833353060208201527f66222066696c6c2d6f7061636974793d22302e3635222f3e000000000000000060408201526058017f3c7465787420783d223134352220793d223333312220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231332220666960408201527f6c6c3d2223666364333464223e302e3032204554483c2f746578743e000000006060820152607c017f3c7465787420783d223134352220793d223338332220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e32382922206c65747460608201527f65722d73706163696e673d2232223e33363520444159533c2f746578743e00006080820152609e01611a9d565b604051612aec60608261050a565b603081527f45564d46532053544f52414745204e4554574f524b202a204c49464554494d4560208201526f01029aaa129a1a924a82a24a7a71015160851b6040820152612b3890613fed565b604051809160208201612b4a90611d82565b651e3232b3399f60d11b81526006017f3c6c696e6561724772616469656e742069643d226267222078313d2230222079815275189e911811103c191e9118171991103c991e9118911f60511b60208201526036017f3c73746f70206f66667365743d223025222073746f702d636f6c6f723d2223308152671a981a989811179f60c11b60208201526028017f3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d2281526911981c981a991811179f60b11b6020820152602a01701e17b634b732b0b923b930b234b2b73a1f60791b81526011017f3c66696c7465722069643d2266612220783d222d313030252220793d222d313081527f3025222077696474683d223330302522206865696768743d2233303025223e006020820152603f017f3c6665476175737369616e426c757220737464446576696174696f6e3d22353281526211179f60e91b6020820152602301681e17b334b63a32b91f60b91b81526009017f3c66696c7465722069643d2266622220783d222d3830252220793d222d38302581527f222077696474683d223236302522206865696768743d2232363025223e0000006020820152603d017f3c6665476175737369616e426c757220737464446576696174696f6e3d22343281526211179f60e91b6020820152602301681e17b334b63a32b91f60b91b8152600901612d5190611e3d565b612d5a90611fee565b661e17b232b3399f60c91b8152600701761e339031b634b816b830ba341e913ab9361411b194911f60491b8152601701612d9390611ea1565b7f3c636972636c652063783d22343822202063793d223137302220723d2231333681527f222066696c6c3d222330366236643422206f7061636974793d22302e323622206020820152723334b63a32b91e913ab9361411b3309491179f60691b60408201526053017f3c636972636c652063783d22323432222063793d223234322220723d2231333081527f222066696c6c3d222361383535663722206f7061636974793d22302e323422206020820152723334b63a32b91e913ab9361411b3309491179f60691b60408201526053017f3c636972636c652063783d22313238222063793d223333382220723d2231313281527f222066696c6c3d222366353965306222206f7061636974793d22302e323222206020820152723334b63a32b91e913ab9361411b3311491179f60691b60408201526053017f3c7265637420783d22312220793d2231222077696474683d223238382220686581527f696768743d22343938222072783d223432222072793d223432222066696c6c3d60208201527f226e6f6e6522207374726f6b653d2272676261283234352c3135382c31312c3060408201527f2e33382922207374726f6b652d77696474683d22312e35222f3e0000000000006060820152607a017f3c7265637420783d22342220793d2234222077696474683d223238322220686581527f696768743d22343932222072783d223339222072793d223339222066696c6c3d60208201527f226e6f6e6522207374726f6b653d2272676261283234352c3135382c31312c3060408201527f2e31302922207374726f6b652d77696474683d2231222f3e00000000000000006060820152607801611ac391610f48565b604080517f3c7061746820643d224d3230203535204c3230203232204c353320323222206660208201527f696c6c3d226e6f6e6522207374726f6b653d222366353965306222207374726f918101919091527f6b652d77696474683d22312e3522207374726f6b652d6f7061636974793d2230606082015264171b11179f60d91b60808201527f3c7061746820643d224d323337203232204c323730203232204c32373020353560858201527f222066696c6c3d226e6f6e6522207374726f6b653d222366353965306222207360a58201527f74726f6b652d77696474683d22312e3522207374726f6b652d6f70616369747960c5820152671e9118171b11179f60c11b60e58201528060ed81017f3c7061746820643d224d323020343435204c323020343738204c35332034373881527f222066696c6c3d226e6f6e6522207374726f6b653d222366353965306222207360208201527f74726f6b652d77696474683d22312e3522207374726f6b652d6f7061636974796040820152671e9118171b11179f60c11b60608201526068017f3c7061746820643d224d32333720343738204c32373020343738204c3237302081527f343435222066696c6c3d226e6f6e6522207374726f6b653d222366353965306260208201527f22207374726f6b652d77696474683d22312e3522207374726f6b652d6f70616360408201526a34ba3c9e9118171b11179f60a91b6060820152606b017f3c706f6c79676f6e20706f696e74733d223134352c3432203139322c3637203181527f39322c313234203134352c3134392039382c3132342039382c3637222066696c60208201527f6c3d226e6f6e6522207374726f6b653d222366353965306222207374726f6b6560408201527f2d77696474683d22302e3522207374726f6b652d6f7061636974793d22302e326060820152631911179f60e11b60808201526084017f3c706f6c79676f6e20706f696e74733d223134352c3530203138342c3732203181527f38342c313138203134352c313430203130362c313138203130362c373222206660208201527f696c6c3d226e6f6e6522207374726f6b653d222366353965306222207374726f60408201527f6b652d77696474683d223222207374726f6b652d6f7061636974793d22302e366060820152631a91179f60e11b60808201526084017f3c706f6c79676f6e20706f696e74733d223134352c3632203137342c3738203181527f37342c313130203134352c313236203131362c313130203131362c373822206660208201527f696c6c3d2223663539653062222066696c6c2d6f7061636974793d22302e303660408201526211179f60e91b60608201526063017f3c636972636c652063783d22313435222063793d2239352220723d223232222081527f66696c6c3d226e6f6e6522207374726f6b653d2223663539653062222073747260208201527f6f6b652d6f7061636974793d22302e313222207374726f6b652d77696474683d604082015264111891179f60d91b60608201526065017f3c636972636c652063783d22313435222063793d2239352220723d223135222081527f66696c6c3d226e6f6e6522207374726f6b653d2223663539653062222073747260208201527f6f6b652d6f7061636974793d22302e332220207374726f6b652d77696474683d6040820152661118971a91179f60c91b60608201526067017f3c636972636c652063783d22313435222063793d2239352220723d223822202081527f66696c6c3d222366353965306222206f7061636974793d22302e3935222f3e006020820152603f017f3c7465787420783d223134352220793d223136322220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231312220666960408201527f6c6c3d2223663539653062222066696c6c2d6f7061636974793d22302e38352260608201527f206c65747465722d73706163696e673d2234223e45564d46533c2f746578743e608082015260a0017f3c7465787420783d223134352220793d223234362220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2232362220666960408201527f6c6c3d2277686974652220666f6e742d7765696768743d22626f6c6422206c6560608201527f747465722d73706163696e673d2233223e4c49464554494d453c2f746578743e608082015260a0017f3c7465787420783d223134352220793d223236392220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e33352922206c65747460608201527f65722d73706163696e673d2234223e53544f5241474520504153533c2f7465786080820152613a1f60f11b60a082015260a2017f3c6c696e652078313d22343022202079313d22323936222078323d223132362281527f2079323d2232393622207374726f6b653d2272676261283234352c3135382c3160208201527f312c302e342922207374726f6b652d77696474683d2231222f3e0000000000006040820152605a017f3c706f6c79676f6e20706f696e74733d223134352c323931203135302c32393681527f203134352c333031203134302c323936222066696c6c3d222366353965306222602082015274103334b63616b7b830b1b4ba3c9e9118171b11179f60591b60408201526055017f3c6c696e652078313d22313634222079313d22323936222078323d223235302281527f2079323d2232393622207374726f6b653d2272676261283234352c3135382c3160208201527f312c302e342922207374726f6b652d77696474683d2231222f3e0000000000006040820152605a017f3c7265637420783d2238372220793d22333136222077696474683d223131362281527f206865696768743d223330222072783d2237222066696c6c3d2223373833353060208201527f66222066696c6c2d6f7061636974793d22302e37222f3e00000000000000000060408201526057017f3c7265637420783d2238372220793d22333136222077696474683d223131362281527f206865696768743d223330222072783d2237222066696c6c3d226e6f6e65222060208201527f7374726f6b653d2272676261283234352c3135382c31312c302e3429222073746040820152723937b5b296bbb4b23a341e9118171b9a91179f60691b60608201526073017f3c7465787420783d223134352220793d223333362220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231332220666960408201527f6c6c3d2223666364333464223e302e32204554483c2f746578743e00000000006060820152607b017f3c7465787420783d223134352220793d223338342220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e32382922206c65747460608201527f65722d73706163696e673d2232223e50455250455455414c3c2f746578743e006080820152609f01613a9e90611ee3565b7f3c67207472616e73666f726d3d227472616e736c617465283232362c34313629815261111f60f11b60208201526022017f3c706174682066696c6c3d222366353965306222206f7061636974793d22302e81527f38382220643d224d313120304c31322e3420382e324c31382e3520322e364c3160208201527f332e3820392e384c32322031314c31332e382031322e324c31382e352031392e60408201527f344c31322e342031332e384c31312032324c392e362031332e384c332e35203160608201527f392e344c382e322031322e324c302031314c382e3220392e384c332e3520322e60808201526b1b261c971b101c17192d111f60a11b60a082015260ac017f3c616e696d6174655472616e73666f726d206174747269627574654e616d653d81527f227472616e73666f726d2220747970653d22726f74617465222066726f6d3d2260208201527f302031312031312220746f3d2233363020313120313122206475723d2231307360408201527f2220726570656174436f756e743d22696e646566696e697465222f3e000000006060820152607c01661e17b830ba341f60c91b8152600701631e17b39f60e11b8152600401611aa6565b600281901b91906001600160fe1b03811603610efa57565b90815115613d8957613c98613c93613c8c8451610eec565b6003900490565b613c5c565b90604051917f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f527f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f603f52602083018480518101602081018051915f82525b808910613d4d5750602095969750906003929152510680600114613d3857600214613d2b575b50808452830101604052565b603d905f1901535f613d1f565b50603d90815f1982015360011901535f613d1f565b939760036004910198603f8a51818160121c165183538181600c1c16516001840153818160061c16516002840153165160038201530193613cf9565b9050610269610ec4565b9091613daa610269936040845260408401906106db565b9160208184039101526106db565b9081602091031261013e5751610269816101b4565b6001600160a01b039182168152911660208201526040810191909152606081019190915260a06080820181905261026992910190610234565b9091949293853b613e1a575b505050505050565b602093613e3c91604051968795869563f23a6e6160e01b875260048701613dcd565b03815f6001600160a01b0387165af15f9181613ecb575b50613e8d5750613e61610f0c565b8051919082613e8657632bfa23e760e11b5f526001600160a01b03821660045260245ffd5b6020915001fd5b6001600160e01b031916630dc5919f60e01b01613eb057505f8080808080613e12565b632bfa23e760e11b5f526001600160a01b031660045260245ffd5b613eee91925060203d602011613ef5575b613ee6818361050a565b810190613db8565b905f613e53565b503d613edc565b6001600160a01b0391821681529116602082015260a0604082018190526102699491939192613f419291613f3391908601906106db565b9084820360608601526106db565b916080818403910152610234565b9091949293853b613f6257505050505050565b602093613f8491604051968795869563bc197c8160e01b875260048701613efc565b03815f6001600160a01b0387165af15f9181613fcc575b50613fa95750613e61610f0c565b6001600160e01b0319166343e6837f60e01b01613eb057505f8080808080613e12565b613fe691925060203d602011613ef557613ee6818361050a565b905f613f9b565b6102696140d49161046c6141ab6141946040519586947f3c7465787420666f6e742d66616d696c793d22436f7572696572204e65772c6d60208701527f6f6e6f73706163652220666f6e742d73697a653d223130222066696c6c3d227260408701527f676261283235352c3235352c3235352c302e33322922206c65747465722d737060608701526930b1b4b7339e9119111f60b11b60808701527f3c74657874506174682073746172744f66667365743d222d3130302522206872608a8701526832b31e9111ba38111f60b91b60aa8701526026600b6141496140d460b38a0185610f48565b7f3c616e696d617465206174747269627574654e616d653d2273746172744f666681527f736574222066726f6d3d2230252220746f3d223130302522206475723d22333060208201527f732220726570656174436f756e743d22696e646566696e697465222f3e0000006040820152605d0190565b6a1e17ba32bc3a2830ba341f60a91b8152017f3c74657874506174682073746172744f66667365743d2230252220687265663d8152651111ba38111f60d11b60208201520190610f48565b6a1e17ba32bc3a2830ba341f60a91b8152600b0190565b661e17ba32bc3a1f60c91b81526007019056fe74726f6b652d77696474683d22312e3222207374726f6b652d6f706163697479723d226d6964646c652220666f6e742d66616d696c793d22436f7572696572204e65772c6d6f6e6f73706163652220666f6e742d73697a653d22313022206669a2646970667358221220089b58998d336b87bd9d028161ac5edb7f5955c960e7537af7d5efc0fd4529dc64736f6c634300081c0033000000000000000000000000de984be08167cc4b47ce70be71b18cbe95d986ce
Deployed ByteCode
0x60806040526004361015610011575f80fd5b5f3560e01c8062fdd58e1461012357806301ffc9a71461011e5780630e89341c1461011957806319fe14ce146101145780632eb2c2d61461010f57806338af3eed1461010a5780634e1273f414610105578063602e7df91461010057806360a85ef5146100fb578063a22cb465146100f6578063b95be6fb146100f1578063bebe4a57146100ec578063c1746443146100e7578063d3c576d8146100e2578063e985e9c5146100dd578063efef39a1146100d85763f242432a146100d3575f80fd5b610b6c565b610a06565b6109aa565b61098f565b610974565b610939565b61090f565b610842565b61080a565b6107e0565b61071f565b610697565b610608565b6104dc565b61026c565b6101c6565b61016c565b600435906001600160a01b038216820361013e57565b5f80fd5b602435906001600160a01b038216820361013e57565b35906001600160a01b038216820361013e57565b3461013e57604036600319011261013e5760206101ab61018a610128565b6024355f525f835260405f209060018060a01b03165f5260205260405f2090565b54604051908152f35b6001600160e01b031981160361013e57565b3461013e57602036600319011261013e5760206004356101e5816101b4565b63ffffffff60e01b16636cdb3d1360e11b8114908115610223575b8115610212575b506040519015158152f35b6301ffc9a760e01b1490505f610207565b6303a24d0760e21b81149150610200565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b906020610269928181520190610234565b90565b3461013e57602036600319011261013e5760043560028111156104c457506104c061046c6104b461047f61030c61047a60025b61046c61045e6102ae836110fa565b9261041b6104216102be83611ad5565b9561041b6103e76102e06102da6102d488611ad5565b97611b52565b93613c74565b9560b06040519c8d9b8c60206e03d913730b6b2911d1122ab26a3299608d1b910152602f8d0190610f48565b7f20537562736372697074696f6e222c226465736372697074696f6e223a224f6e81527f2d636861696e2073746f7261676520737562736372697074696f6e207061737360208201527f20666f72207468652045564d4653206e6574776f726b2e204772616e7473206660408201527f65652d6672656520777269746520616363657373207768696c6520616374697660608201527f652e222c2261747472696275746573223a5b7b2274726169745f74797065223a60808201526f11283630b71116113b30b63ab2911d1160811b60a08201520190610f48565b7f227d2c7b2274726169745f74797065223a225072696365222c2276616c7565228152611d1160f11b602082015260220190565b90610f48565b7f20455448227d5d2c22696d616765223a22646174613a696d6167652f7376672b81526a1e1b5b0ed8985cd94d8d0b60aa1b6020820152602b0190565b61227d60f01b815260020190565b03601f19810183528261050a565b613c74565b6040517f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000006020820152928391603d830161041b565b60405191829182610258565b0390f35b61046c6104b461047f61030c61047a6104c09561029f565b3461013e575f36600319011261013e5760206040515f8152f35b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761052c57604052565b6104f6565b67ffffffffffffffff811161052c5760051b60200190565b9080601f8301121561013e57813561056081610531565b9261056e604051948561050a565b81845260208085019260051b82010192831161013e57602001905b8282106105965750505090565b8135815260209182019101610589565b67ffffffffffffffff811161052c57601f01601f191660200190565b81601f8201121561013e578035906105d9826105a6565b926105e7604051948561050a565b8284526020838301011161013e57815f926020809301838601378301015290565b3461013e5760a036600319011261013e57610621610128565b610629610142565b9060443567ffffffffffffffff811161013e5761064a903690600401610549565b60643567ffffffffffffffff811161013e5761066a903690600401610549565b906084359367ffffffffffffffff851161013e5761068f6106959536906004016105c2565b93610c36565b005b3461013e575f36600319011261013e576040517f000000000000000000000000de984be08167cc4b47ce70be71b18cbe95d986ce6001600160a01b03168152602090f35b90602080835192838152019201905f5b8181106106f85750505090565b82518452602093840193909201916001016106eb565b9060206102699281815201906106db565b3461013e57604036600319011261013e5760043567ffffffffffffffff811161013e573660238201121561013e5780600401359061075c82610531565b9161076a604051938461050a565b8083526024602084019160051b8301019136831161013e57602401905b8282106107c8578360243567ffffffffffffffff811161013e576104c0916107b66107bc923690600401610549565b90610e10565b6040519182918261070e565b602080916107d584610158565b815201910190610787565b3461013e57602036600319011261013e576004355f526004602052602060405f2054604051908152f35b3461013e57602036600319011261013e576001600160a01b0361082b610128565b165f526005602052602060405f2054604051908152f35b3461013e57604036600319011261013e5761085b610128565b602435801515810361013e5733156108fc576001600160a01b0382169182156108ea57816108a76108b892335f52600160205260405f209060018060a01b03165f5260205260405f2090565b9060ff801983541691151516179055565b604051901515815233907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b62ced3e160e81b5f525f60045260245ffd5b631f18c42760e11b5f525f60045260245ffd5b3461013e57602036600319011261013e576004355f526003602052602060405f2054604051908152f35b3461013e57602036600319011261013e576001600160a01b0361095a610128565b165f526005602052602060405f2054604051904211158152f35b3461013e575f36600319011261013e57602060405160018152f35b3461013e575f36600319011261013e57602060405160028152f35b3461013e57604036600319011261013e57602060ff6109fa6109ca610128565b6109d2610142565b6001600160a01b039182165f9081526001865260408082209290931681526020919091522090565b54166040519015158152f35b602036600319011261013e57600435610a27815f52600360205260405f2090565b54908115610b5d57813410610b4e57610a48610a41610ec4565b8233610fc0565b610a5a815f52600460205260405f2090565b545f198103610b1557505f195b335f81815260056020908152604091829020849055905192835290917f6d458fa94cc5b30d7877bed127c2029f98bc0cbc4634dc7789b6bc804fbdae039190a35f808080847f000000000000000000000000de984be08167cc4b47ce70be71b18cbe95d986ce5af1610ad7610f0c565b5015610b0657610ae79034610f3b565b80610aee57005b5f80808093335af1610afe610f0c565b5015610b0657005b6312171d8360e31b5f5260045ffd5b335f908152600560205260409020610b439190544211610b4857335f90815260056020526040902054610eff565b610a67565b42610eff565b63cd1c886760e01b5f5260045ffd5b6321f2425960e01b5f5260045ffd5b3461013e5760a036600319011261013e57610b85610128565b610b8d610142565b604435906064359260843567ffffffffffffffff811161013e57610bb59036906004016105c2565b92610bc08233610f5a565b6001600160a01b03831615610c23576001600160a01b03821615610c115761069594610c0960405192600184526020840152604083019160018352606084015260808301604052565b929091611bc6565b626a0d4560e21b5f525f60045260245ffd5b632bfa23e760e11b5f525f60045260245ffd5b92919094610c448433610f5a565b6001600160a01b038616948515610c23576001600160a01b038516958615610c11578351855190818103610dd35750505f5b8451811015610d40578060051b6020808288010151918801015190610cbb89610ca6835f525f60205260405f2090565b9060018060a01b03165f5260205260405f2090565b54828110610d0957610cf98c610ca685948d610ceb60019998610d01970391610ca6845f525f60205260405f2090565b555f525f60205260405f2090565b918254610eff565b905501610c76565b6040516303dee4c560e01b81526001600160a01b038b16600482015260248101919091526044810183905260648101829052608490fd5b50610d979697929795919560018551145f14610d995760208581015187820151604080519283529282015233917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6291a45b33613f4f565b565b6040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb339180610dcb8a8a83613d93565b0390a4610d91565b635b05999160e01b5f5260045260245260445ffd5b8051821015610dfc5760209160051b010190565b634e487b7160e01b5f52603260045260245ffd5b91909180518351808203610eaf575050805190610e2c82610531565b91610e3a604051938461050a565b808352610e49601f1991610531565b013660208401375f5b8151811015610ea85780610e9760019260051b60208082870101519189010151905f918252602082815260408084206001600160a01b03909316845291905290205490565b610ea18286610de8565b5201610e52565b5090925050565b635b05999160e01b5f5260045260245260445ffd5b60405190610ed360208361050a565b5f8252565b634e487b7160e01b5f52601160045260245ffd5b9060028201809211610efa57565b610ed8565b91908201809211610efa57565b3d15610f36573d90610f1d826105a6565b91610f2b604051938461050a565b82523d5f602084013e565b606090565b91908203918211610efa57565b805191908290602001825e015f815290565b6001600160a01b0391821691811690828214159081610f92575b50610f7d575050565b63711bec9160e11b5f5260045260245260445ffd5b5f8481526001602090815260408083206001600160a01b0390941683529290522060ff91505416155f610f74565b91926001600160a01b0383169290918315610c23576001610ffe60405192600184526020840152604083019160018352606084015260808301604052565b9290948551845190818103610dd35750505f5b865181101561104f578087611047610cf987610ca660208060019860051b8097010151958c010151945f525f60205260405f2090565b905501611011565b5092909460208091610d979660018251145f146110bf575f838301517fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f626110ae8689015160405191829133958360209093929193604081019481520152565b0390a45b0151910151915f33613e06565b5f6040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb3391806110f28a8883613d93565b0390a46110b2565b8015611138576001146111305761041b610269611115612ade565b61046c611120613004565b6040519485936020850190610f48565b610269612074565b506040518061114960208201611d82565b651e3232b3399f60d11b815260060161116190611df7565b7f3c73746f70206f66667365743d223025222073746f702d636f6c6f723d22233081526730983298b091179f60c11b60208201527f3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d226028820152691198321899991b91179f60b11b6048820152605201701e17b634b732b0b923b930b234b2b73a1f60791b81526011017f3c66696c7465722069643d22676c6f772220783d222d3630252220793d222d3681527f3025222077696474683d223232302522206865696768743d2232323025223e006020820152603f017f3c6665476175737369616e426c757220737464446576696174696f6e3d22333881526211179f60e91b6020820152602301681e17b334b63a32b91f60b91b815260090161128490611e3d565b661e17b232b3399f60c91b8152600701761e339031b634b816b830ba341e913ab9361411b194911f60491b81526017016112bd90611ea1565b7f3c636972636c652063783d22313435222063793d223232322220723d2231313881527f222066696c6c3d222333623832663622206f7061636974793d22302e323222206020820152743334b63a32b91e913ab9361411b3b637bb9491179f60591b60408201526055017f3c7265637420783d22312220793d2231222077696474683d223238382220686581527f696768743d22343938222072783d223432222072793d223432222066696c6c3d60208201527f226e6f6e6522207374726f6b653d222333623832663622207374726f6b652d7760408201527f696474683d22312e3522207374726f6b652d6f7061636974793d22302e323522606082015261179f60f11b60808201526082017f3c7061746820643d224d3230203535204c3230203232204c353320323222206681527f696c6c3d226e6f6e6522207374726f6b653d222333623832663622207374726f60208201527f6b652d77696474683d22312e3222207374726f6b652d6f7061636974793d2230604082015264171a91179f60d91b60608201526065017f3c7061746820643d224d323337203232204c323730203232204c32373020353581527f222066696c6c3d226e6f6e6522207374726f6b653d222333623832663622207360208201525f5160206141bf5f395f51905f526040820152671e9118171a91179f60c11b60608201526068017f3c7061746820643d224d323020343435204c323020343738204c35332034373881527f222066696c6c3d226e6f6e6522207374726f6b653d222333623832663622207360208201525f5160206141bf5f395f51905f526040820152671e9118171a91179f60c11b60608201526068017f3c7061746820643d224d32333720343738204c32373020343738204c3237302081527f343435222066696c6c3d226e6f6e6522207374726f6b653d222333623832663660208201527f22207374726f6b652d77696474683d22312e3222207374726f6b652d6f70616360408201526a34ba3c9e9118171a91179f60a91b6060820152606b017f3c706f6c79676f6e20706f696e74733d223134352c3634203137332c3830203181527f37332c313132203134352c313238203131372c313132203131372c383022206660208201527f696c6c3d226e6f6e6522207374726f6b653d222333623832663622207374726f60408201527f6b652d77696474683d22312e3522207374726f6b652d6f7061636974793d2230606082015264171b91179f60d91b60808201526085017f3c636972636c652063783d22313435222063793d2239362220723d223622206681527f696c6c3d222333623832663622206f7061636974793d22302e39222f3e0000006020820152603d017f3c7465787420783d223134352220793d223135342220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231312220666960408201527f6c6c3d2223336238326636222066696c6c2d6f7061636974793d22302e37222060608201527f6c65747465722d73706163696e673d2234223e45564d46533c2f746578743e006080820152609f017f3c7465787420783d223134352220793d223234322220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2232362220666960408201527f6c6c3d2277686974652220666f6e742d7765696768743d22626f6c6422206c6560608201527f747465722d73706163696e673d2233223e4d4f4e54484c593c2f746578743e006080820152609f017f3c7465787420783d223134352220793d223236352220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e33352922206c65747460608201527f65722d73706163696e673d2234223e53544f5241474520504153533c2f7465786080820152613a1f60f11b60a082015260a2017f3c6c696e652078313d223630222079313d22323932222078323d22323330222081527f79323d2232393222207374726f6b653d22726762612835392c3133302c32343660208201527f2c302e332922207374726f6b652d77696474683d2231222f3e0000000000000060408201526059017f3c7265637420783d2239362220793d22333132222077696474683d223938222081527f6865696768743d223330222072783d2237222066696c6c3d222331653361386160208201527f222066696c6c2d6f7061636974793d22302e3635222f3e00000000000000000060408201526057017f3c7465787420783d223134352220793d223333322220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231332220666960408201527f6c6c3d2223393363356664223e302e303032204554483c2f746578743e0000006060820152607d017f3c7465787420783d223134352220793d223338342220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e32382922206c65747460608201527f65722d73706163696e673d2232223e333020444159533c2f746578743e0000006080820152609d015b611aa690611ee3565b631e17b39f60e11b8152600401651e17b9bb339f60d11b81526006015b03601f1981018252610269908261050a565b8015611b2c57600114611b0857604051611af060408261050a565b60088152674c69666574696d6560c01b602082015290565b604051611b1660408261050a565b6006815265596561726c7960d01b602082015290565b50604051611b3b60408261050a565b60078152664d6f6e74686c7960c81b602082015290565b8015611ba257600114611b8057604051611b6d60408261050a565b600381526218171960e91b602082015290565b604051611b8e60408261050a565b60048152631817181960e11b602082015290565b50604051611bb160408261050a565b6005815264181718181960d91b602082015290565b9493929091938451825190818103610dd35750506001600160a01b038681169586151595918516801515939192905f5b8451811015611ccf578060051b90898988602080868b010151958c01015192611c4e575b93600194611c2c575b50505001611bf6565b611c4491610ca6610cf9925f525f60205260405f2090565b90555f8981611c23565b50509091611c678d610ca6835f525f60205260405f2090565b54828110611c98578291898f611c8f600197968f950391610ca6855f525f60205260405f2090565b55909450611c1a565b6040516303dee4c560e01b81526001600160a01b038f16600482015260248101919091526044810183905260648101829052608490fd5b5091989593929790965060018851145f14611d485760208881015186820151604080519283529282015233917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6291a45b611d2b575b5050505050565b602080611d3e9601519201519233613e06565b5f80808080611d24565b6040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb339180611d7a898d83613d93565b0390a4611d1f565b7f3c7376672077696474683d2232393022206865696768743d223530302220766981527f6577426f783d2230203020323930203530302220786d6c6e733d22687474703a60208201527f2f2f7777772e77332e6f72672f323030302f737667223e000000000000000000604082015260570190565b7f3c6c696e6561724772616469656e742069643d226267222078313d2230222079815273189e911811103c191e911811103c991e9118911f60611b602082015260340190565b7f3c636c6970506174682069643d2263223e3c726563742077696474683d22323981527f3022206865696768743d22353030222072783d223432222072793d223432222f60208201526b1f1e17b1b634b82830ba341f60a11b6040820152604c0190565b7f3c726563742077696474683d2232393022206865696768743d2235303022206681526f34b6361e913ab9361411b1339491179f60811b602082015260300190565b7f3c7465787420783d223134352220793d223436362220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2239222066696c60408201527f6c3d2272676261283235352c3235352c3235352c302e31382922206c6574746560608201527f722d73706163696e673d2234223e45564d4653204e4554574f524b3c2f7465786080820152613a1f60f11b60a082015260a20190565b60405190611fab60608361050a565b602e82526d02aa129a1a924a82a24a7a71015160951b6040837f45564d46532053544f52414745204e4554574f524b202a20594541524c59205360208201520152565b7f3c706174682069643d2274702220643d224d343020313220483235302051323781527f382031322032373820343020563436302051323738203438382032353020343860208201527f38204834302051313220343838203132203436302056343020513132203132206040820152671a1810189911179f60c11b606082015260680190565b61207c611f9c565b61208590613fed565b60405180916020820161209790611d82565b651e3232b3399f60d11b81526006016120af90611df7565b7f3c73746f70206f66667365743d223025222073746f702d636f6c6f723d22233081526732183118b291179f60c11b60208201526028017f3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d228152691198991832191a11179f60b11b6020820152602a01701e17b634b732b0b923b930b234b2b73a1f60791b81526011017f3c66696c7465722069643d22662220783d222d3930252220793d222d3930252281527f2077696474683d223238302522206865696768743d2232383025223e000000006020820152603c017f3c6665476175737369616e426c757220737464446576696174696f6e3d22343681526211179f60e91b6020820152602301681e17b334b63a32b91f60b91b81526009016121d290611e3d565b6121db90611fee565b661e17b232b3399f60c91b8152600701761e339031b634b816b830ba341e913ab9361411b194911f60491b815260170161221490611ea1565b7f3c636972636c652063783d223638222063793d223139362220723d223132362281527f2066696c6c3d222337633361656422206f7061636974793d22302e323822206660208201527034b63a32b91e913ab9361411b31491179f60791b60408201526051017f3c636972636c652063783d22323232222063793d223239382220723d2231313681527f222066696c6c3d222364393737303622206f7061636974793d22302e323222206020820152713334b63a32b91e913ab9361411b31491179f60711b60408201526052017f3c7265637420783d22312220793d2231222077696474683d223238382220686581527f696768743d22343938222072783d223432222072793d223432222066696c6c3d60208201527f226e6f6e6522207374726f6b653d2272676261283132342c35382c3233372c3060408201527f2e342922207374726f6b652d77696474683d22312e35222f3e00000000000000606082015260790161238291610f48565b7f3c7061746820643d224d3230203535204c3230203232204c353320323222206681527f696c6c3d226e6f6e6522207374726f6b653d222337633361656422207374726f60208201527f6b652d77696474683d22312e3222207374726f6b652d6f7061636974793d2230604082015265171a9a91179f60d11b60608201526066017f3c7061746820643d224d323337203232204c323730203232204c32373020353581527f222066696c6c3d226e6f6e6522207374726f6b653d222337633361656422207360208201525f5160206141bf5f395f51905f526040820152681e9118171a9a91179f60b91b60608201526069017f3c7061746820643d224d323020343435204c323020343738204c35332034373881527f222066696c6c3d226e6f6e6522207374726f6b653d222364393737303622207360208201525f5160206141bf5f395f51905f526040820152671e9118171a91179f60c11b60608201526068017f3c7061746820643d224d32333720343738204c32373020343738204c3237302081527f343435222066696c6c3d226e6f6e6522207374726f6b653d222364393737303660208201527f22207374726f6b652d77696474683d22312e3222207374726f6b652d6f70616360408201526a34ba3c9e9118171a91179f60a91b6060820152606b017f3c706f6c79676f6e20706f696e74733d223134352c3538203137382c3736203181527f37382c313134203134352c313332203131322c313134203131322c373622206660208201527f696c6c3d226e6f6e6522207374726f6b653d222337633361656422207374726f60408201527f6b652d77696474683d22312e3522207374726f6b652d6f7061636974793d2230606082015265171b9a91179f60d11b60808201526086017f3c636972636c652063783d22313435222063793d2239352220723d223722206681527f696c6c3d222364393737303622206f7061636974793d22302e39222f3e0000006020820152603d017f3c636972636c652063783d22313435222063793d2239352220723d223133222081527f66696c6c3d226e6f6e6522207374726f6b653d2223643937373036222073747260208201527f6f6b652d6f7061636974793d22302e333522207374726f6b652d77696474683d6040820152661118971a91179f60c91b60608201526067017f3c7465787420783d223134352220793d223135342220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231312220666960408201527f6c6c3d2223376333616564222066696c6c2d6f7061636974793d22302e38352260608201527f206c65747465722d73706163696e673d2234223e45564d46533c2f746578743e608082015260a0017f3c7465787420783d223134352220793d223234302220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2232362220666960408201527f6c6c3d2277686974652220666f6e742d7765696768743d22626f6c6422206c6560608201527f747465722d73706163696e673d2233223e594541524c593c2f746578743e00006080820152609e017f3c7465787420783d223134352220793d223236332220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e33352922206c65747460608201527f65722d73706163696e673d2234223e53544f5241474520504153533c2f7465786080820152613a1f60f11b60a082015260a2017f3c6c696e652078313d223535222079313d22323930222078323d22323335222081527f79323d2232393022207374726f6b653d2272676261283231372c3131392c362c60208201527f302e33352922207374726f6b652d77696474683d2231222f3e0000000000000060408201526059017f3c7265637420783d2239302220793d22333131222077696474683d223131302281527f206865696768743d223330222072783d2237222066696c6c3d2223373833353060208201527f66222066696c6c2d6f7061636974793d22302e3635222f3e000000000000000060408201526058017f3c7465787420783d223134352220793d223333312220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231332220666960408201527f6c6c3d2223666364333464223e302e3032204554483c2f746578743e000000006060820152607c017f3c7465787420783d223134352220793d223338332220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e32382922206c65747460608201527f65722d73706163696e673d2232223e33363520444159533c2f746578743e00006080820152609e01611a9d565b604051612aec60608261050a565b603081527f45564d46532053544f52414745204e4554574f524b202a204c49464554494d4560208201526f01029aaa129a1a924a82a24a7a71015160851b6040820152612b3890613fed565b604051809160208201612b4a90611d82565b651e3232b3399f60d11b81526006017f3c6c696e6561724772616469656e742069643d226267222078313d2230222079815275189e911811103c191e9118171991103c991e9118911f60511b60208201526036017f3c73746f70206f66667365743d223025222073746f702d636f6c6f723d2223308152671a981a989811179f60c11b60208201526028017f3c73746f70206f66667365743d2231303025222073746f702d636f6c6f723d2281526911981c981a991811179f60b11b6020820152602a01701e17b634b732b0b923b930b234b2b73a1f60791b81526011017f3c66696c7465722069643d2266612220783d222d313030252220793d222d313081527f3025222077696474683d223330302522206865696768743d2233303025223e006020820152603f017f3c6665476175737369616e426c757220737464446576696174696f6e3d22353281526211179f60e91b6020820152602301681e17b334b63a32b91f60b91b81526009017f3c66696c7465722069643d2266622220783d222d3830252220793d222d38302581527f222077696474683d223236302522206865696768743d2232363025223e0000006020820152603d017f3c6665476175737369616e426c757220737464446576696174696f6e3d22343281526211179f60e91b6020820152602301681e17b334b63a32b91f60b91b8152600901612d5190611e3d565b612d5a90611fee565b661e17b232b3399f60c91b8152600701761e339031b634b816b830ba341e913ab9361411b194911f60491b8152601701612d9390611ea1565b7f3c636972636c652063783d22343822202063793d223137302220723d2231333681527f222066696c6c3d222330366236643422206f7061636974793d22302e323622206020820152723334b63a32b91e913ab9361411b3309491179f60691b60408201526053017f3c636972636c652063783d22323432222063793d223234322220723d2231333081527f222066696c6c3d222361383535663722206f7061636974793d22302e323422206020820152723334b63a32b91e913ab9361411b3309491179f60691b60408201526053017f3c636972636c652063783d22313238222063793d223333382220723d2231313281527f222066696c6c3d222366353965306222206f7061636974793d22302e323222206020820152723334b63a32b91e913ab9361411b3311491179f60691b60408201526053017f3c7265637420783d22312220793d2231222077696474683d223238382220686581527f696768743d22343938222072783d223432222072793d223432222066696c6c3d60208201527f226e6f6e6522207374726f6b653d2272676261283234352c3135382c31312c3060408201527f2e33382922207374726f6b652d77696474683d22312e35222f3e0000000000006060820152607a017f3c7265637420783d22342220793d2234222077696474683d223238322220686581527f696768743d22343932222072783d223339222072793d223339222066696c6c3d60208201527f226e6f6e6522207374726f6b653d2272676261283234352c3135382c31312c3060408201527f2e31302922207374726f6b652d77696474683d2231222f3e00000000000000006060820152607801611ac391610f48565b604080517f3c7061746820643d224d3230203535204c3230203232204c353320323222206660208201527f696c6c3d226e6f6e6522207374726f6b653d222366353965306222207374726f918101919091527f6b652d77696474683d22312e3522207374726f6b652d6f7061636974793d2230606082015264171b11179f60d91b60808201527f3c7061746820643d224d323337203232204c323730203232204c32373020353560858201527f222066696c6c3d226e6f6e6522207374726f6b653d222366353965306222207360a58201527f74726f6b652d77696474683d22312e3522207374726f6b652d6f70616369747960c5820152671e9118171b11179f60c11b60e58201528060ed81017f3c7061746820643d224d323020343435204c323020343738204c35332034373881527f222066696c6c3d226e6f6e6522207374726f6b653d222366353965306222207360208201527f74726f6b652d77696474683d22312e3522207374726f6b652d6f7061636974796040820152671e9118171b11179f60c11b60608201526068017f3c7061746820643d224d32333720343738204c32373020343738204c3237302081527f343435222066696c6c3d226e6f6e6522207374726f6b653d222366353965306260208201527f22207374726f6b652d77696474683d22312e3522207374726f6b652d6f70616360408201526a34ba3c9e9118171b11179f60a91b6060820152606b017f3c706f6c79676f6e20706f696e74733d223134352c3432203139322c3637203181527f39322c313234203134352c3134392039382c3132342039382c3637222066696c60208201527f6c3d226e6f6e6522207374726f6b653d222366353965306222207374726f6b6560408201527f2d77696474683d22302e3522207374726f6b652d6f7061636974793d22302e326060820152631911179f60e11b60808201526084017f3c706f6c79676f6e20706f696e74733d223134352c3530203138342c3732203181527f38342c313138203134352c313430203130362c313138203130362c373222206660208201527f696c6c3d226e6f6e6522207374726f6b653d222366353965306222207374726f60408201527f6b652d77696474683d223222207374726f6b652d6f7061636974793d22302e366060820152631a91179f60e11b60808201526084017f3c706f6c79676f6e20706f696e74733d223134352c3632203137342c3738203181527f37342c313130203134352c313236203131362c313130203131362c373822206660208201527f696c6c3d2223663539653062222066696c6c2d6f7061636974793d22302e303660408201526211179f60e91b60608201526063017f3c636972636c652063783d22313435222063793d2239352220723d223232222081527f66696c6c3d226e6f6e6522207374726f6b653d2223663539653062222073747260208201527f6f6b652d6f7061636974793d22302e313222207374726f6b652d77696474683d604082015264111891179f60d91b60608201526065017f3c636972636c652063783d22313435222063793d2239352220723d223135222081527f66696c6c3d226e6f6e6522207374726f6b653d2223663539653062222073747260208201527f6f6b652d6f7061636974793d22302e332220207374726f6b652d77696474683d6040820152661118971a91179f60c91b60608201526067017f3c636972636c652063783d22313435222063793d2239352220723d223822202081527f66696c6c3d222366353965306222206f7061636974793d22302e3935222f3e006020820152603f017f3c7465787420783d223134352220793d223136322220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231312220666960408201527f6c6c3d2223663539653062222066696c6c2d6f7061636974793d22302e38352260608201527f206c65747465722d73706163696e673d2234223e45564d46533c2f746578743e608082015260a0017f3c7465787420783d223134352220793d223234362220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2232362220666960408201527f6c6c3d2277686974652220666f6e742d7765696768743d22626f6c6422206c6560608201527f747465722d73706163696e673d2233223e4c49464554494d453c2f746578743e608082015260a0017f3c7465787420783d223134352220793d223236392220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e33352922206c65747460608201527f65722d73706163696e673d2234223e53544f5241474520504153533c2f7465786080820152613a1f60f11b60a082015260a2017f3c6c696e652078313d22343022202079313d22323936222078323d223132362281527f2079323d2232393622207374726f6b653d2272676261283234352c3135382c3160208201527f312c302e342922207374726f6b652d77696474683d2231222f3e0000000000006040820152605a017f3c706f6c79676f6e20706f696e74733d223134352c323931203135302c32393681527f203134352c333031203134302c323936222066696c6c3d222366353965306222602082015274103334b63616b7b830b1b4ba3c9e9118171b11179f60591b60408201526055017f3c6c696e652078313d22313634222079313d22323936222078323d223235302281527f2079323d2232393622207374726f6b653d2272676261283234352c3135382c3160208201527f312c302e342922207374726f6b652d77696474683d2231222f3e0000000000006040820152605a017f3c7265637420783d2238372220793d22333136222077696474683d223131362281527f206865696768743d223330222072783d2237222066696c6c3d2223373833353060208201527f66222066696c6c2d6f7061636974793d22302e37222f3e00000000000000000060408201526057017f3c7265637420783d2238372220793d22333136222077696474683d223131362281527f206865696768743d223330222072783d2237222066696c6c3d226e6f6e65222060208201527f7374726f6b653d2272676261283234352c3135382c31312c302e3429222073746040820152723937b5b296bbb4b23a341e9118171b9a91179f60691b60608201526073017f3c7465787420783d223134352220793d223333362220746578742d616e63686f81525f5160206141df5f395f51905f5260208201527f4e65772c6d6f6e6f73706163652220666f6e742d73697a653d2231332220666960408201527f6c6c3d2223666364333464223e302e32204554483c2f746578743e00000000006060820152607b017f3c7465787420783d223134352220793d223338342220746578742d616e63686f81525f5160206141df5f395f51905f5260208201525f5160206141ff5f395f51905f5260408201527f6c6c3d2272676261283235352c3235352c3235352c302e32382922206c65747460608201527f65722d73706163696e673d2232223e50455250455455414c3c2f746578743e006080820152609f01613a9e90611ee3565b7f3c67207472616e73666f726d3d227472616e736c617465283232362c34313629815261111f60f11b60208201526022017f3c706174682066696c6c3d222366353965306222206f7061636974793d22302e81527f38382220643d224d313120304c31322e3420382e324c31382e3520322e364c3160208201527f332e3820392e384c32322031314c31332e382031322e324c31382e352031392e60408201527f344c31322e342031332e384c31312032324c392e362031332e384c332e35203160608201527f392e344c382e322031322e324c302031314c382e3220392e384c332e3520322e60808201526b1b261c971b101c17192d111f60a11b60a082015260ac017f3c616e696d6174655472616e73666f726d206174747269627574654e616d653d81527f227472616e73666f726d2220747970653d22726f74617465222066726f6d3d2260208201527f302031312031312220746f3d2233363020313120313122206475723d2231307360408201527f2220726570656174436f756e743d22696e646566696e697465222f3e000000006060820152607c01661e17b830ba341f60c91b8152600701631e17b39f60e11b8152600401611aa6565b600281901b91906001600160fe1b03811603610efa57565b90815115613d8957613c98613c93613c8c8451610eec565b6003900490565b613c5c565b90604051917f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f527f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f603f52602083018480518101602081018051915f82525b808910613d4d5750602095969750906003929152510680600114613d3857600214613d2b575b50808452830101604052565b603d905f1901535f613d1f565b50603d90815f1982015360011901535f613d1f565b939760036004910198603f8a51818160121c165183538181600c1c16516001840153818160061c16516002840153165160038201530193613cf9565b9050610269610ec4565b9091613daa610269936040845260408401906106db565b9160208184039101526106db565b9081602091031261013e5751610269816101b4565b6001600160a01b039182168152911660208201526040810191909152606081019190915260a06080820181905261026992910190610234565b9091949293853b613e1a575b505050505050565b602093613e3c91604051968795869563f23a6e6160e01b875260048701613dcd565b03815f6001600160a01b0387165af15f9181613ecb575b50613e8d5750613e61610f0c565b8051919082613e8657632bfa23e760e11b5f526001600160a01b03821660045260245ffd5b6020915001fd5b6001600160e01b031916630dc5919f60e01b01613eb057505f8080808080613e12565b632bfa23e760e11b5f526001600160a01b031660045260245ffd5b613eee91925060203d602011613ef5575b613ee6818361050a565b810190613db8565b905f613e53565b503d613edc565b6001600160a01b0391821681529116602082015260a0604082018190526102699491939192613f419291613f3391908601906106db565b9084820360608601526106db565b916080818403910152610234565b9091949293853b613f6257505050505050565b602093613f8491604051968795869563bc197c8160e01b875260048701613efc565b03815f6001600160a01b0387165af15f9181613fcc575b50613fa95750613e61610f0c565b6001600160e01b0319166343e6837f60e01b01613eb057505f8080808080613e12565b613fe691925060203d602011613ef557613ee6818361050a565b905f613f9b565b6102696140d49161046c6141ab6141946040519586947f3c7465787420666f6e742d66616d696c793d22436f7572696572204e65772c6d60208701527f6f6e6f73706163652220666f6e742d73697a653d223130222066696c6c3d227260408701527f676261283235352c3235352c3235352c302e33322922206c65747465722d737060608701526930b1b4b7339e9119111f60b11b60808701527f3c74657874506174682073746172744f66667365743d222d3130302522206872608a8701526832b31e9111ba38111f60b91b60aa8701526026600b6141496140d460b38a0185610f48565b7f3c616e696d617465206174747269627574654e616d653d2273746172744f666681527f736574222066726f6d3d2230252220746f3d223130302522206475723d22333060208201527f732220726570656174436f756e743d22696e646566696e697465222f3e0000006040820152605d0190565b6a1e17ba32bc3a2830ba341f60a91b8152017f3c74657874506174682073746172744f66667365743d2230252220687265663d8152651111ba38111f60d11b60208201520190610f48565b6a1e17ba32bc3a2830ba341f60a91b8152600b0190565b661e17ba32bc3a1f60c91b81526007019056fe74726f6b652d77696474683d22312e3222207374726f6b652d6f706163697479723d226d6964646c652220666f6e742d66616d696c793d22436f7572696572204e65772c6d6f6e6f73706163652220666f6e742d73697a653d22313022206669a2646970667358221220089b58998d336b87bd9d028161ac5edb7f5955c960e7537af7d5efc0fd4529dc64736f6c634300081c0033