Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ClaimableERC721
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 10000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
import {Module} from "../../../Module.sol";
import {Role} from "../../../Role.sol";
import {IInstallationCallback} from "../../../interface/IInstallationCallback.sol";
import {OwnableRoles} from "@solady/auth/OwnableRoles.sol";
import {MerkleProofLib} from "@solady/utils/MerkleProofLib.sol";
import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol";
import {BeforeMintCallbackERC721} from "../../../callback/BeforeMintCallbackERC721.sol";
import {BeforeMintWithSignatureCallbackERC721} from "../../../callback/BeforeMintWithSignatureCallbackERC721.sol";
library ClaimableStorage {
/// @custom:storage-location erc7201:token.minting.claimable.erc721
bytes32 public constant CLAIMABLE_STORAGE_POSITION =
keccak256(abi.encode(uint256(keccak256("token.minting.claimable.erc721")) - 1)) & ~bytes32(uint256(0xff));
struct Data {
// UID => whether it has been used
mapping(bytes32 => bool) uidUsed;
// address => how many tokens have been minted
mapping(address => uint256) totalMinted;
// sale config: primary sale recipient
ClaimableERC721.SaleConfig saleConfig;
// claim condition
ClaimableERC721.ClaimCondition claimCondition;
}
function data() internal pure returns (Data storage data_) {
bytes32 position = CLAIMABLE_STORAGE_POSITION;
assembly {
data_.slot := position
}
}
}
contract ClaimableERC721 is
Module,
BeforeMintCallbackERC721,
BeforeMintWithSignatureCallbackERC721,
IInstallationCallback
{
/*//////////////////////////////////////////////////////////////
STRUCTS & ENUMS
//////////////////////////////////////////////////////////////*/
/**
* @notice Details for distributing the proceeds of a mint.
* @param primarySaleRecipient The address to which the total proceeds minus fees are sent.
*/
struct SaleConfig {
address primarySaleRecipient;
}
/**
* @notice Conditions under which tokens can be minted.
* @param availableSupply The total number of tokens that can be minted.
* @param allowlistMerkleRoot The allowlist of addresses who can mint tokens.
* @param pricePerUnit The price per token.
* @param currency The currency in which the price is denominated.
* @param startTimestamp The timestamp at which the minting window opens.
* @param endTimestamp The timestamp after which the minting window closes.
* @param auxData Use to store arbitrary data. i.e: merkle snapshot url
*/
struct ClaimCondition {
uint256 availableSupply;
bytes32 allowlistMerkleRoot;
uint256 pricePerUnit;
address currency;
uint256 maxMintPerWallet;
uint48 startTimestamp;
uint48 endTimestamp;
string auxData;
}
/**
* @notice The request struct signed by an authorized party to mint tokens.
*
* @param startTimestamp The timestamp at which the minting request is valid.
* @param endTimestamp The timestamp at which the minting request expires.
* @param currency The address of the currency used to pay for the minted tokens.
* @param pricePerUnit The price per unit of the minted tokens.
* @param uid A unique identifier for the minting request.
*/
struct ClaimSignatureParamsERC721 {
uint48 startTimestamp;
uint48 endTimestamp;
address currency;
uint256 maxMintPerWallet;
uint256 pricePerUnit;
bytes32 uid;
}
/**
* @notice The parameters sent to the `beforeMintERC20` callback function.
*/
struct ClaimParamsERC721 {
address currency;
uint256 pricePerUnit;
bytes32[] recipientAllowlistProof;
}
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
/// @dev Emitted when incorrect amount of native token is sent.
error ClaimableIncorrectNativeTokenSent();
/// @dev Emitted when the minting request does not match the expected values.
error ClaimableRequestMismatch();
/// @dev Emitted when the minting request has expired.
error ClaimableRequestOutOfTimeWindow();
/// @dev Emitted when the minting request UID has been reused.
error ClaimableRequestUidReused();
/// @dev Emitted when the minting request signature is unauthorized.
error ClaimableRequestUnauthorizedSignature();
/// @dev Emitted when the mint is attempted outside the minting window.
error ClaimableOutOfTimeWindow();
/// @dev Emitted when the mint is out of supply.
error ClaimableOutOfSupply();
/// @dev Emitted when the mint is priced at an unexpected price or currency.
error ClaimableIncorrectPriceOrCurrency();
/// @dev Emitted when the minter is not in the allowlist.
error ClaimableNotInAllowlist();
/// @dev Emitted when the minting request signature is unauthorized.
error ClaimableSignatureMintUnauthorized();
/// @dev Emitted when the max mint per wallet is exceeded.
error ClaimableMaxMintPerWalletExceeded();
/*//////////////////////////////////////////////////////////////
CONSTANTS
//////////////////////////////////////////////////////////////*/
address private constant NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/*//////////////////////////////////////////////////////////////
MODULE CONFIG
//////////////////////////////////////////////////////////////*/
/// @notice Returns all implemented callback and fallback functions.
function getModuleConfig() external pure override returns (ModuleConfig memory config) {
config.callbackFunctions = new CallbackFunction[](2);
config.fallbackFunctions = new FallbackFunction[](4);
config.callbackFunctions[0] = CallbackFunction(this.beforeMintERC721.selector);
config.callbackFunctions[1] = CallbackFunction(this.beforeMintWithSignatureERC721.selector);
config.fallbackFunctions[0] = FallbackFunction({selector: this.getSaleConfig.selector, permissionBits: 0});
config.fallbackFunctions[1] =
FallbackFunction({selector: this.setSaleConfig.selector, permissionBits: Role._MANAGER_ROLE});
config.fallbackFunctions[2] = FallbackFunction({selector: this.getClaimCondition.selector, permissionBits: 0});
config.fallbackFunctions[3] =
FallbackFunction({selector: this.setClaimCondition.selector, permissionBits: Role._MINTER_ROLE});
config.requiredInterfaces = new bytes4[](1);
config.requiredInterfaces[0] = 0x80ac58cd; // ERC721.
config.registerInstallationCallback = true;
}
/*//////////////////////////////////////////////////////////////
CALLBACK FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Callback function for the ERC721Core.mint function.
function beforeMintERC721(address _to, uint256 _startTokenId, uint256 _amount, bytes memory _data)
external
payable
virtual
override
returns (bytes memory)
{
ClaimParamsERC721 memory _params = abi.decode(_data, (ClaimParamsERC721));
_validateClaimCondition(_to, _amount, _params.currency, _params.pricePerUnit, _params.recipientAllowlistProof);
_distributeMintPrice(msg.sender, _params.currency, _amount * _params.pricePerUnit);
}
/// @notice Callback function for the ERC721Core.mint function.
function beforeMintWithSignatureERC721(
address _to,
uint256 _startTokenId,
uint256 _amount,
bytes memory _data,
address _signer
) external payable virtual override returns (bytes memory) {
if (!OwnableRoles(address(this)).hasAllRoles(_signer, Role._MINTER_ROLE)) {
revert ClaimableSignatureMintUnauthorized();
}
ClaimSignatureParamsERC721 memory _params = abi.decode(_data, (ClaimSignatureParamsERC721));
_validateClaimSignatureParams(_params, _to, _amount);
_distributeMintPrice(msg.sender, _params.currency, _amount * _params.pricePerUnit);
}
/// @dev Called by a Core into an Module during the installation of the Module.
function onInstall(bytes calldata data) external {
address primarySaleRecipient = abi.decode(data, (address));
_claimableStorage().saleConfig = SaleConfig(primarySaleRecipient);
}
/// @dev Called by a Core into an Module during the uninstallation of the Module.
function onUninstall(bytes calldata data) external {}
/*//////////////////////////////////////////////////////////////
Encode install / uninstall data
//////////////////////////////////////////////////////////////*/
/// @dev Returns bytes encoded install params, to be sent to `onInstall` function
function encodeBytesOnInstall(address primarySaleRecipient) external pure returns (bytes memory) {
return abi.encode(primarySaleRecipient);
}
/// @dev Returns bytes encoded uninstall params, to be sent to `onUninstall` function
function encodeBytesOnUninstall() external pure returns (bytes memory) {
return "";
}
/*//////////////////////////////////////////////////////////////
Encode mint params
//////////////////////////////////////////////////////////////*/
/// @dev Returns bytes encoded mint params, to be used in `beforeMint` fallback function
function encodeBytesBeforeMintERC721(ClaimParamsERC721 memory params) external pure returns (bytes memory) {
return abi.encode(params);
}
/// @dev Returns bytes encoded mint params, to be used in `beforeMint` fallback function
function encodeBytesBeforeMintWithSignatureERC721(ClaimSignatureParamsERC721 memory params)
external
pure
returns (bytes memory)
{
return abi.encode(params);
}
/*//////////////////////////////////////////////////////////////
FALLBACK FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Returns the sale configuration for a token.
function getSaleConfig() external view returns (address primarySaleRecipient) {
SaleConfig memory saleConfig = _claimableStorage().saleConfig;
return (saleConfig.primarySaleRecipient);
}
/// @notice Sets the sale configuration for a token.
function setSaleConfig(address _primarySaleRecipient) external {
_claimableStorage().saleConfig = SaleConfig(_primarySaleRecipient);
}
/// @notice Returns the claim condition for a token.
function getClaimCondition() external view returns (ClaimCondition memory claimCondition) {
return _claimableStorage().claimCondition;
}
/// @notice Sets the claim condition for a token.
function setClaimCondition(ClaimCondition memory _claimCondition) external {
_claimableStorage().claimCondition = _claimCondition;
}
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @dev Verifies a claim against the active claim condition.
function _validateClaimCondition(
address _recipient,
uint256 _amount,
address _currency,
uint256 _pricePerUnit,
bytes32[] memory _allowlistProof
) internal {
ClaimCondition memory condition = _claimableStorage().claimCondition;
if (block.timestamp < condition.startTimestamp || condition.endTimestamp <= block.timestamp) {
revert ClaimableOutOfTimeWindow();
}
if (_currency != condition.currency || _pricePerUnit != condition.pricePerUnit) {
revert ClaimableIncorrectPriceOrCurrency();
}
if (_amount > condition.availableSupply) {
revert ClaimableOutOfSupply();
}
if (_amount + _claimableStorage().totalMinted[_recipient] > condition.maxMintPerWallet) {
revert ClaimableMaxMintPerWalletExceeded();
}
if (condition.allowlistMerkleRoot != bytes32(0)) {
bool isAllowlisted = MerkleProofLib.verify(
_allowlistProof, condition.allowlistMerkleRoot, keccak256(abi.encodePacked(_recipient))
);
if (!isAllowlisted) {
revert ClaimableNotInAllowlist();
}
}
_claimableStorage().claimCondition.availableSupply -= _amount;
_claimableStorage().totalMinted[_recipient] += _amount;
}
/// @dev Verifies the claim request and signature.
function _validateClaimSignatureParams(ClaimSignatureParamsERC721 memory _req, address _recipient, uint256 _amount)
internal
{
if (block.timestamp < _req.startTimestamp || _req.endTimestamp <= block.timestamp) {
revert ClaimableRequestOutOfTimeWindow();
}
if (_claimableStorage().uidUsed[_req.uid]) {
revert ClaimableRequestUidReused();
}
if (_amount > _claimableStorage().claimCondition.availableSupply) {
revert ClaimableOutOfSupply();
}
if (_amount + _claimableStorage().totalMinted[_recipient] > _req.maxMintPerWallet) {
revert ClaimableMaxMintPerWalletExceeded();
}
_claimableStorage().uidUsed[_req.uid] = true;
_claimableStorage().claimCondition.availableSupply -= _amount;
_claimableStorage().totalMinted[_recipient] += _amount;
}
/// @dev Distributes the mint price to the primary sale recipient and the platform fee recipient.
function _distributeMintPrice(address _owner, address _currency, uint256 _price) internal {
if (_price == 0) {
if (msg.value > 0) {
revert ClaimableIncorrectNativeTokenSent();
}
return;
}
SaleConfig memory saleConfig = _claimableStorage().saleConfig;
if (_currency == NATIVE_TOKEN_ADDRESS) {
if (msg.value != _price) {
revert ClaimableIncorrectNativeTokenSent();
}
SafeTransferLib.safeTransferETH(saleConfig.primarySaleRecipient, _price);
} else {
if (msg.value > 0) {
revert ClaimableIncorrectNativeTokenSent();
}
SafeTransferLib.safeTransferFrom(_currency, _owner, saleConfig.primarySaleRecipient, _price);
}
}
function _claimableStorage() internal pure returns (ClaimableStorage.Data storage) {
return ClaimableStorage.data();
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Simple single owner authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
///
/// @dev Note:
/// This implementation does NOT auto-initialize the owner to `msg.sender`.
/// You MUST call the `_initializeOwner` in the constructor / initializer.
///
/// While the ownable portion follows
/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
/// the nomenclature for the 2-step ownership handover may be unique to this codebase.
abstract contract Ownable {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The caller is not authorized to call the function.
error Unauthorized();
/// @dev The `newOwner` cannot be the zero address.
error NewOwnerIsZeroAddress();
/// @dev The `pendingOwner` does not have a valid handover request.
error NoHandoverRequest();
/// @dev Cannot double-initialize.
error AlreadyInitialized();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ownership is transferred from `oldOwner` to `newOwner`.
/// This event is intentionally kept the same as OpenZeppelin's Ownable to be
/// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
/// despite it not being as lightweight as a single argument event.
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
/// @dev An ownership handover to `pendingOwner` has been requested.
event OwnershipHandoverRequested(address indexed pendingOwner);
/// @dev The ownership handover to `pendingOwner` has been canceled.
event OwnershipHandoverCanceled(address indexed pendingOwner);
/// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;
/// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;
/// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* STORAGE */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The owner slot is given by:
/// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
/// It is intentionally chosen to be a high value
/// to avoid collision with lower slots.
/// The choice of manual storage layout is to enable compatibility
/// with both regular and upgradeable contracts.
bytes32 internal constant _OWNER_SLOT =
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;
/// The ownership handover slot of `newOwner` is given by:
/// ```
/// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
/// let handoverSlot := keccak256(0x00, 0x20)
/// ```
/// It stores the expiry timestamp of the two-step ownership handover.
uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INTERNAL FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
function _guardInitializeOwner() internal pure virtual returns (bool guard) {}
/// @dev Initializes the owner directly without authorization guard.
/// This function must be called upon initialization,
/// regardless of whether the contract is upgradeable or not.
/// This is to enable generalization to both regular and upgradeable contracts,
/// and to save gas in case the initial owner is not the caller.
/// For performance reasons, this function will not check if there
/// is an existing owner.
function _initializeOwner(address newOwner) internal virtual {
if (_guardInitializeOwner()) {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
if sload(ownerSlot) {
mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
revert(0x1c, 0x04)
}
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Store the new value.
sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
}
} else {
/// @solidity memory-safe-assembly
assembly {
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Store the new value.
sstore(_OWNER_SLOT, newOwner)
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
}
}
}
/// @dev Sets the owner directly without authorization guard.
function _setOwner(address newOwner) internal virtual {
if (_guardInitializeOwner()) {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
// Store the new value.
sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
}
} else {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
// Store the new value.
sstore(ownerSlot, newOwner)
}
}
}
/// @dev Throws if the sender is not the owner.
function _checkOwner() internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// If the caller is not the stored owner, revert.
if iszero(eq(caller(), sload(_OWNER_SLOT))) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Returns how long a two-step ownership handover is valid for in seconds.
/// Override to return a different value if needed.
/// Made internal to conserve bytecode. Wrap it in a public function if needed.
function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
return 48 * 3600;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC UPDATE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Allows the owner to transfer the ownership to `newOwner`.
function transferOwnership(address newOwner) public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
if iszero(shl(96, newOwner)) {
mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
revert(0x1c, 0x04)
}
}
_setOwner(newOwner);
}
/// @dev Allows the owner to renounce their ownership.
function renounceOwnership() public payable virtual onlyOwner {
_setOwner(address(0));
}
/// @dev Request a two-step ownership handover to the caller.
/// The request will automatically expire in 48 hours (172800 seconds) by default.
function requestOwnershipHandover() public payable virtual {
unchecked {
uint256 expires = block.timestamp + _ownershipHandoverValidFor();
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to `expires`.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, caller())
sstore(keccak256(0x0c, 0x20), expires)
// Emit the {OwnershipHandoverRequested} event.
log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
}
}
}
/// @dev Cancels the two-step ownership handover to the caller, if any.
function cancelOwnershipHandover() public payable virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to 0.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, caller())
sstore(keccak256(0x0c, 0x20), 0)
// Emit the {OwnershipHandoverCanceled} event.
log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
}
}
/// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
/// Reverts if there is no existing ownership handover requested by `pendingOwner`.
function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to 0.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, pendingOwner)
let handoverSlot := keccak256(0x0c, 0x20)
// If the handover does not exist, or has expired.
if gt(timestamp(), sload(handoverSlot)) {
mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
revert(0x1c, 0x04)
}
// Set the handover slot to 0.
sstore(handoverSlot, 0)
}
_setOwner(pendingOwner);
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC READ FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the owner of the contract.
function owner() public view virtual returns (address result) {
/// @solidity memory-safe-assembly
assembly {
result := sload(_OWNER_SLOT)
}
}
/// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
function ownershipHandoverExpiresAt(address pendingOwner)
public
view
virtual
returns (uint256 result)
{
/// @solidity memory-safe-assembly
assembly {
// Compute the handover slot.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, pendingOwner)
// Load the handover slot.
result := sload(keccak256(0x0c, 0x20))
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* MODIFIERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Marks a function as only callable by the owner.
modifier onlyOwner() virtual {
_checkOwner();
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {Ownable} from "./Ownable.sol";
/// @notice Simple single owner and multiroles authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
/// @dev While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173)
/// for compatibility, the nomenclature for the 2-step ownership handover and roles
/// may be unique to this codebase.
abstract contract OwnableRoles is Ownable {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The `user`'s roles is updated to `roles`.
/// Each bit of `roles` represents whether the role is set.
event RolesUpdated(address indexed user, uint256 indexed roles);
/// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`.
uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE =
0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* STORAGE */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The role slot of `user` is given by:
/// ```
/// mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED))
/// let roleSlot := keccak256(0x00, 0x20)
/// ```
/// This automatically ignores the upper bits of the `user` in case
/// they are not clean, as well as keep the `keccak256` under 32-bytes.
///
/// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`.
uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INTERNAL FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Overwrite the roles directly without authorization guard.
function _setRoles(address user, uint256 roles) internal virtual {
/// @solidity memory-safe-assembly
assembly {
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, user)
// Store the new value.
sstore(keccak256(0x0c, 0x20), roles)
// Emit the {RolesUpdated} event.
log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
}
}
/// @dev Updates the roles directly without authorization guard.
/// If `on` is true, each set bit of `roles` will be turned on,
/// otherwise, each set bit of `roles` will be turned off.
function _updateRoles(address user, uint256 roles, bool on) internal virtual {
/// @solidity memory-safe-assembly
assembly {
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, user)
let roleSlot := keccak256(0x0c, 0x20)
// Load the current value.
let current := sload(roleSlot)
// Compute the updated roles if `on` is true.
let updated := or(current, roles)
// Compute the updated roles if `on` is false.
// Use `and` to compute the intersection of `current` and `roles`,
// `xor` it with `current` to flip the bits in the intersection.
if iszero(on) { updated := xor(current, and(current, roles)) }
// Then, store the new value.
sstore(roleSlot, updated)
// Emit the {RolesUpdated} event.
log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated)
}
}
/// @dev Grants the roles directly without authorization guard.
/// Each bit of `roles` represents the role to turn on.
function _grantRoles(address user, uint256 roles) internal virtual {
_updateRoles(user, roles, true);
}
/// @dev Removes the roles directly without authorization guard.
/// Each bit of `roles` represents the role to turn off.
function _removeRoles(address user, uint256 roles) internal virtual {
_updateRoles(user, roles, false);
}
/// @dev Throws if the sender does not have any of the `roles`.
function _checkRoles(uint256 roles) internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, caller())
// Load the stored value, and if the `and` intersection
// of the value and `roles` is zero, revert.
if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Throws if the sender is not the owner,
/// and does not have any of the `roles`.
/// Checks for ownership first, then lazily checks for roles.
function _checkOwnerOrRoles(uint256 roles) internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// If the caller is not the stored owner.
// Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, caller())
// Load the stored value, and if the `and` intersection
// of the value and `roles` is zero, revert.
if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
}
/// @dev Throws if the sender does not have any of the `roles`,
/// and is not the owner.
/// Checks for roles first, then lazily checks for ownership.
function _checkRolesOrOwner(uint256 roles) internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, caller())
// Load the stored value, and if the `and` intersection
// of the value and `roles` is zero, revert.
if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
// If the caller is not the stored owner.
// Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
}
/// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`.
/// This is meant for frontends like Etherscan, and is therefore not fully optimized.
/// Not recommended to be called on-chain.
/// Made internal to conserve bytecode. Wrap it in a public function if needed.
function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) {
/// @solidity memory-safe-assembly
assembly {
for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } {
// We don't need to mask the values of `ordinals`, as Solidity
// cleans dirty upper bits when storing variables into memory.
roles := or(shl(mload(add(ordinals, i)), 1), roles)
}
}
}
/// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap.
/// This is meant for frontends like Etherscan, and is therefore not fully optimized.
/// Not recommended to be called on-chain.
/// Made internal to conserve bytecode. Wrap it in a public function if needed.
function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) {
/// @solidity memory-safe-assembly
assembly {
// Grab the pointer to the free memory.
ordinals := mload(0x40)
let ptr := add(ordinals, 0x20)
let o := 0
// The absence of lookup tables, De Bruijn, etc., here is intentional for
// smaller bytecode, as this function is not meant to be called on-chain.
for { let t := roles } 1 {} {
mstore(ptr, o)
// `shr` 5 is equivalent to multiplying by 0x20.
// Push back into the ordinals array if the bit is set.
ptr := add(ptr, shl(5, and(t, 1)))
o := add(o, 1)
t := shr(o, roles)
if iszero(t) { break }
}
// Store the length of `ordinals`.
mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20))))
// Allocate the memory.
mstore(0x40, ptr)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC UPDATE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Allows the owner to grant `user` `roles`.
/// If the `user` already has a role, then it will be an no-op for the role.
function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
_grantRoles(user, roles);
}
/// @dev Allows the owner to remove `user` `roles`.
/// If the `user` does not have a role, then it will be an no-op for the role.
function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
_removeRoles(user, roles);
}
/// @dev Allow the caller to remove their own roles.
/// If the caller does not have a role, then it will be an no-op for the role.
function renounceRoles(uint256 roles) public payable virtual {
_removeRoles(msg.sender, roles);
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC READ FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the roles of `user`.
function rolesOf(address user) public view virtual returns (uint256 roles) {
/// @solidity memory-safe-assembly
assembly {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, user)
// Load the stored value.
roles := sload(keccak256(0x0c, 0x20))
}
}
/// @dev Returns whether `user` has any of `roles`.
function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) {
return rolesOf(user) & roles != 0;
}
/// @dev Returns whether `user` has all of `roles`.
function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) {
return rolesOf(user) & roles == roles;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* MODIFIERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Marks a function as only callable by an account with `roles`.
modifier onlyRoles(uint256 roles) virtual {
_checkRoles(roles);
_;
}
/// @dev Marks a function as only callable by the owner or by an account
/// with `roles`. Checks for ownership first, then lazily checks for roles.
modifier onlyOwnerOrRoles(uint256 roles) virtual {
_checkOwnerOrRoles(roles);
_;
}
/// @dev Marks a function as only callable by an account with `roles`
/// or the owner. Checks for roles first, then lazily checks for ownership.
modifier onlyRolesOrOwner(uint256 roles) virtual {
_checkRolesOrOwner(roles);
_;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ROLE CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// IYKYK
uint256 internal constant _ROLE_0 = 1 << 0;
uint256 internal constant _ROLE_1 = 1 << 1;
uint256 internal constant _ROLE_2 = 1 << 2;
uint256 internal constant _ROLE_3 = 1 << 3;
uint256 internal constant _ROLE_4 = 1 << 4;
uint256 internal constant _ROLE_5 = 1 << 5;
uint256 internal constant _ROLE_6 = 1 << 6;
uint256 internal constant _ROLE_7 = 1 << 7;
uint256 internal constant _ROLE_8 = 1 << 8;
uint256 internal constant _ROLE_9 = 1 << 9;
uint256 internal constant _ROLE_10 = 1 << 10;
uint256 internal constant _ROLE_11 = 1 << 11;
uint256 internal constant _ROLE_12 = 1 << 12;
uint256 internal constant _ROLE_13 = 1 << 13;
uint256 internal constant _ROLE_14 = 1 << 14;
uint256 internal constant _ROLE_15 = 1 << 15;
uint256 internal constant _ROLE_16 = 1 << 16;
uint256 internal constant _ROLE_17 = 1 << 17;
uint256 internal constant _ROLE_18 = 1 << 18;
uint256 internal constant _ROLE_19 = 1 << 19;
uint256 internal constant _ROLE_20 = 1 << 20;
uint256 internal constant _ROLE_21 = 1 << 21;
uint256 internal constant _ROLE_22 = 1 << 22;
uint256 internal constant _ROLE_23 = 1 << 23;
uint256 internal constant _ROLE_24 = 1 << 24;
uint256 internal constant _ROLE_25 = 1 << 25;
uint256 internal constant _ROLE_26 = 1 << 26;
uint256 internal constant _ROLE_27 = 1 << 27;
uint256 internal constant _ROLE_28 = 1 << 28;
uint256 internal constant _ROLE_29 = 1 << 29;
uint256 internal constant _ROLE_30 = 1 << 30;
uint256 internal constant _ROLE_31 = 1 << 31;
uint256 internal constant _ROLE_32 = 1 << 32;
uint256 internal constant _ROLE_33 = 1 << 33;
uint256 internal constant _ROLE_34 = 1 << 34;
uint256 internal constant _ROLE_35 = 1 << 35;
uint256 internal constant _ROLE_36 = 1 << 36;
uint256 internal constant _ROLE_37 = 1 << 37;
uint256 internal constant _ROLE_38 = 1 << 38;
uint256 internal constant _ROLE_39 = 1 << 39;
uint256 internal constant _ROLE_40 = 1 << 40;
uint256 internal constant _ROLE_41 = 1 << 41;
uint256 internal constant _ROLE_42 = 1 << 42;
uint256 internal constant _ROLE_43 = 1 << 43;
uint256 internal constant _ROLE_44 = 1 << 44;
uint256 internal constant _ROLE_45 = 1 << 45;
uint256 internal constant _ROLE_46 = 1 << 46;
uint256 internal constant _ROLE_47 = 1 << 47;
uint256 internal constant _ROLE_48 = 1 << 48;
uint256 internal constant _ROLE_49 = 1 << 49;
uint256 internal constant _ROLE_50 = 1 << 50;
uint256 internal constant _ROLE_51 = 1 << 51;
uint256 internal constant _ROLE_52 = 1 << 52;
uint256 internal constant _ROLE_53 = 1 << 53;
uint256 internal constant _ROLE_54 = 1 << 54;
uint256 internal constant _ROLE_55 = 1 << 55;
uint256 internal constant _ROLE_56 = 1 << 56;
uint256 internal constant _ROLE_57 = 1 << 57;
uint256 internal constant _ROLE_58 = 1 << 58;
uint256 internal constant _ROLE_59 = 1 << 59;
uint256 internal constant _ROLE_60 = 1 << 60;
uint256 internal constant _ROLE_61 = 1 << 61;
uint256 internal constant _ROLE_62 = 1 << 62;
uint256 internal constant _ROLE_63 = 1 << 63;
uint256 internal constant _ROLE_64 = 1 << 64;
uint256 internal constant _ROLE_65 = 1 << 65;
uint256 internal constant _ROLE_66 = 1 << 66;
uint256 internal constant _ROLE_67 = 1 << 67;
uint256 internal constant _ROLE_68 = 1 << 68;
uint256 internal constant _ROLE_69 = 1 << 69;
uint256 internal constant _ROLE_70 = 1 << 70;
uint256 internal constant _ROLE_71 = 1 << 71;
uint256 internal constant _ROLE_72 = 1 << 72;
uint256 internal constant _ROLE_73 = 1 << 73;
uint256 internal constant _ROLE_74 = 1 << 74;
uint256 internal constant _ROLE_75 = 1 << 75;
uint256 internal constant _ROLE_76 = 1 << 76;
uint256 internal constant _ROLE_77 = 1 << 77;
uint256 internal constant _ROLE_78 = 1 << 78;
uint256 internal constant _ROLE_79 = 1 << 79;
uint256 internal constant _ROLE_80 = 1 << 80;
uint256 internal constant _ROLE_81 = 1 << 81;
uint256 internal constant _ROLE_82 = 1 << 82;
uint256 internal constant _ROLE_83 = 1 << 83;
uint256 internal constant _ROLE_84 = 1 << 84;
uint256 internal constant _ROLE_85 = 1 << 85;
uint256 internal constant _ROLE_86 = 1 << 86;
uint256 internal constant _ROLE_87 = 1 << 87;
uint256 internal constant _ROLE_88 = 1 << 88;
uint256 internal constant _ROLE_89 = 1 << 89;
uint256 internal constant _ROLE_90 = 1 << 90;
uint256 internal constant _ROLE_91 = 1 << 91;
uint256 internal constant _ROLE_92 = 1 << 92;
uint256 internal constant _ROLE_93 = 1 << 93;
uint256 internal constant _ROLE_94 = 1 << 94;
uint256 internal constant _ROLE_95 = 1 << 95;
uint256 internal constant _ROLE_96 = 1 << 96;
uint256 internal constant _ROLE_97 = 1 << 97;
uint256 internal constant _ROLE_98 = 1 << 98;
uint256 internal constant _ROLE_99 = 1 << 99;
uint256 internal constant _ROLE_100 = 1 << 100;
uint256 internal constant _ROLE_101 = 1 << 101;
uint256 internal constant _ROLE_102 = 1 << 102;
uint256 internal constant _ROLE_103 = 1 << 103;
uint256 internal constant _ROLE_104 = 1 << 104;
uint256 internal constant _ROLE_105 = 1 << 105;
uint256 internal constant _ROLE_106 = 1 << 106;
uint256 internal constant _ROLE_107 = 1 << 107;
uint256 internal constant _ROLE_108 = 1 << 108;
uint256 internal constant _ROLE_109 = 1 << 109;
uint256 internal constant _ROLE_110 = 1 << 110;
uint256 internal constant _ROLE_111 = 1 << 111;
uint256 internal constant _ROLE_112 = 1 << 112;
uint256 internal constant _ROLE_113 = 1 << 113;
uint256 internal constant _ROLE_114 = 1 << 114;
uint256 internal constant _ROLE_115 = 1 << 115;
uint256 internal constant _ROLE_116 = 1 << 116;
uint256 internal constant _ROLE_117 = 1 << 117;
uint256 internal constant _ROLE_118 = 1 << 118;
uint256 internal constant _ROLE_119 = 1 << 119;
uint256 internal constant _ROLE_120 = 1 << 120;
uint256 internal constant _ROLE_121 = 1 << 121;
uint256 internal constant _ROLE_122 = 1 << 122;
uint256 internal constant _ROLE_123 = 1 << 123;
uint256 internal constant _ROLE_124 = 1 << 124;
uint256 internal constant _ROLE_125 = 1 << 125;
uint256 internal constant _ROLE_126 = 1 << 126;
uint256 internal constant _ROLE_127 = 1 << 127;
uint256 internal constant _ROLE_128 = 1 << 128;
uint256 internal constant _ROLE_129 = 1 << 129;
uint256 internal constant _ROLE_130 = 1 << 130;
uint256 internal constant _ROLE_131 = 1 << 131;
uint256 internal constant _ROLE_132 = 1 << 132;
uint256 internal constant _ROLE_133 = 1 << 133;
uint256 internal constant _ROLE_134 = 1 << 134;
uint256 internal constant _ROLE_135 = 1 << 135;
uint256 internal constant _ROLE_136 = 1 << 136;
uint256 internal constant _ROLE_137 = 1 << 137;
uint256 internal constant _ROLE_138 = 1 << 138;
uint256 internal constant _ROLE_139 = 1 << 139;
uint256 internal constant _ROLE_140 = 1 << 140;
uint256 internal constant _ROLE_141 = 1 << 141;
uint256 internal constant _ROLE_142 = 1 << 142;
uint256 internal constant _ROLE_143 = 1 << 143;
uint256 internal constant _ROLE_144 = 1 << 144;
uint256 internal constant _ROLE_145 = 1 << 145;
uint256 internal constant _ROLE_146 = 1 << 146;
uint256 internal constant _ROLE_147 = 1 << 147;
uint256 internal constant _ROLE_148 = 1 << 148;
uint256 internal constant _ROLE_149 = 1 << 149;
uint256 internal constant _ROLE_150 = 1 << 150;
uint256 internal constant _ROLE_151 = 1 << 151;
uint256 internal constant _ROLE_152 = 1 << 152;
uint256 internal constant _ROLE_153 = 1 << 153;
uint256 internal constant _ROLE_154 = 1 << 154;
uint256 internal constant _ROLE_155 = 1 << 155;
uint256 internal constant _ROLE_156 = 1 << 156;
uint256 internal constant _ROLE_157 = 1 << 157;
uint256 internal constant _ROLE_158 = 1 << 158;
uint256 internal constant _ROLE_159 = 1 << 159;
uint256 internal constant _ROLE_160 = 1 << 160;
uint256 internal constant _ROLE_161 = 1 << 161;
uint256 internal constant _ROLE_162 = 1 << 162;
uint256 internal constant _ROLE_163 = 1 << 163;
uint256 internal constant _ROLE_164 = 1 << 164;
uint256 internal constant _ROLE_165 = 1 << 165;
uint256 internal constant _ROLE_166 = 1 << 166;
uint256 internal constant _ROLE_167 = 1 << 167;
uint256 internal constant _ROLE_168 = 1 << 168;
uint256 internal constant _ROLE_169 = 1 << 169;
uint256 internal constant _ROLE_170 = 1 << 170;
uint256 internal constant _ROLE_171 = 1 << 171;
uint256 internal constant _ROLE_172 = 1 << 172;
uint256 internal constant _ROLE_173 = 1 << 173;
uint256 internal constant _ROLE_174 = 1 << 174;
uint256 internal constant _ROLE_175 = 1 << 175;
uint256 internal constant _ROLE_176 = 1 << 176;
uint256 internal constant _ROLE_177 = 1 << 177;
uint256 internal constant _ROLE_178 = 1 << 178;
uint256 internal constant _ROLE_179 = 1 << 179;
uint256 internal constant _ROLE_180 = 1 << 180;
uint256 internal constant _ROLE_181 = 1 << 181;
uint256 internal constant _ROLE_182 = 1 << 182;
uint256 internal constant _ROLE_183 = 1 << 183;
uint256 internal constant _ROLE_184 = 1 << 184;
uint256 internal constant _ROLE_185 = 1 << 185;
uint256 internal constant _ROLE_186 = 1 << 186;
uint256 internal constant _ROLE_187 = 1 << 187;
uint256 internal constant _ROLE_188 = 1 << 188;
uint256 internal constant _ROLE_189 = 1 << 189;
uint256 internal constant _ROLE_190 = 1 << 190;
uint256 internal constant _ROLE_191 = 1 << 191;
uint256 internal constant _ROLE_192 = 1 << 192;
uint256 internal constant _ROLE_193 = 1 << 193;
uint256 internal constant _ROLE_194 = 1 << 194;
uint256 internal constant _ROLE_195 = 1 << 195;
uint256 internal constant _ROLE_196 = 1 << 196;
uint256 internal constant _ROLE_197 = 1 << 197;
uint256 internal constant _ROLE_198 = 1 << 198;
uint256 internal constant _ROLE_199 = 1 << 199;
uint256 internal constant _ROLE_200 = 1 << 200;
uint256 internal constant _ROLE_201 = 1 << 201;
uint256 internal constant _ROLE_202 = 1 << 202;
uint256 internal constant _ROLE_203 = 1 << 203;
uint256 internal constant _ROLE_204 = 1 << 204;
uint256 internal constant _ROLE_205 = 1 << 205;
uint256 internal constant _ROLE_206 = 1 << 206;
uint256 internal constant _ROLE_207 = 1 << 207;
uint256 internal constant _ROLE_208 = 1 << 208;
uint256 internal constant _ROLE_209 = 1 << 209;
uint256 internal constant _ROLE_210 = 1 << 210;
uint256 internal constant _ROLE_211 = 1 << 211;
uint256 internal constant _ROLE_212 = 1 << 212;
uint256 internal constant _ROLE_213 = 1 << 213;
uint256 internal constant _ROLE_214 = 1 << 214;
uint256 internal constant _ROLE_215 = 1 << 215;
uint256 internal constant _ROLE_216 = 1 << 216;
uint256 internal constant _ROLE_217 = 1 << 217;
uint256 internal constant _ROLE_218 = 1 << 218;
uint256 internal constant _ROLE_219 = 1 << 219;
uint256 internal constant _ROLE_220 = 1 << 220;
uint256 internal constant _ROLE_221 = 1 << 221;
uint256 internal constant _ROLE_222 = 1 << 222;
uint256 internal constant _ROLE_223 = 1 << 223;
uint256 internal constant _ROLE_224 = 1 << 224;
uint256 internal constant _ROLE_225 = 1 << 225;
uint256 internal constant _ROLE_226 = 1 << 226;
uint256 internal constant _ROLE_227 = 1 << 227;
uint256 internal constant _ROLE_228 = 1 << 228;
uint256 internal constant _ROLE_229 = 1 << 229;
uint256 internal constant _ROLE_230 = 1 << 230;
uint256 internal constant _ROLE_231 = 1 << 231;
uint256 internal constant _ROLE_232 = 1 << 232;
uint256 internal constant _ROLE_233 = 1 << 233;
uint256 internal constant _ROLE_234 = 1 << 234;
uint256 internal constant _ROLE_235 = 1 << 235;
uint256 internal constant _ROLE_236 = 1 << 236;
uint256 internal constant _ROLE_237 = 1 << 237;
uint256 internal constant _ROLE_238 = 1 << 238;
uint256 internal constant _ROLE_239 = 1 << 239;
uint256 internal constant _ROLE_240 = 1 << 240;
uint256 internal constant _ROLE_241 = 1 << 241;
uint256 internal constant _ROLE_242 = 1 << 242;
uint256 internal constant _ROLE_243 = 1 << 243;
uint256 internal constant _ROLE_244 = 1 << 244;
uint256 internal constant _ROLE_245 = 1 << 245;
uint256 internal constant _ROLE_246 = 1 << 246;
uint256 internal constant _ROLE_247 = 1 << 247;
uint256 internal constant _ROLE_248 = 1 << 248;
uint256 internal constant _ROLE_249 = 1 << 249;
uint256 internal constant _ROLE_250 = 1 << 250;
uint256 internal constant _ROLE_251 = 1 << 251;
uint256 internal constant _ROLE_252 = 1 << 252;
uint256 internal constant _ROLE_253 = 1 << 253;
uint256 internal constant _ROLE_254 = 1 << 254;
uint256 internal constant _ROLE_255 = 1 << 255;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)
library MerkleProofLib {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* MERKLE PROOF VERIFICATION OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf)
internal
pure
returns (bool isValid)
{
/// @solidity memory-safe-assembly
assembly {
if mload(proof) {
// Initialize `offset` to the offset of `proof` elements in memory.
let offset := add(proof, 0x20)
// Left shift by 5 is equivalent to multiplying by 0x20.
let end := add(offset, shl(5, mload(proof)))
// Iterate over proof elements to compute root hash.
for {} 1 {} {
// Slot of `leaf` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(leaf, mload(offset)))
// Store elements to hash contiguously in scratch space.
// Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
mstore(scratch, leaf)
mstore(xor(scratch, 0x20), mload(offset))
// Reuse `leaf` to store the hash to reduce stack operations.
leaf := keccak256(0x00, 0x40)
offset := add(offset, 0x20)
if iszero(lt(offset, end)) { break }
}
}
isValid := eq(leaf, root)
}
}
/// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf)
internal
pure
returns (bool isValid)
{
/// @solidity memory-safe-assembly
assembly {
if proof.length {
// Left shift by 5 is equivalent to multiplying by 0x20.
let end := add(proof.offset, shl(5, proof.length))
// Initialize `offset` to the offset of `proof` in the calldata.
let offset := proof.offset
// Iterate over proof elements to compute root hash.
for {} 1 {} {
// Slot of `leaf` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(leaf, calldataload(offset)))
// Store elements to hash contiguously in scratch space.
// Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
mstore(scratch, leaf)
mstore(xor(scratch, 0x20), calldataload(offset))
// Reuse `leaf` to store the hash to reduce stack operations.
leaf := keccak256(0x00, 0x40)
offset := add(offset, 0x20)
if iszero(lt(offset, end)) { break }
}
}
isValid := eq(leaf, root)
}
}
/// @dev Returns whether all `leaves` exist in the Merkle tree with `root`,
/// given `proof` and `flags`.
///
/// Note:
/// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length`
/// will always return false.
/// - The sum of the lengths of `proof` and `leaves` must never overflow.
/// - Any non-zero word in the `flags` array is treated as true.
/// - The memory offset of `proof` must be non-zero
/// (i.e. `proof` is not pointing to the scratch space).
function verifyMultiProof(
bytes32[] memory proof,
bytes32 root,
bytes32[] memory leaves,
bool[] memory flags
) internal pure returns (bool isValid) {
// Rebuilds the root by consuming and producing values on a queue.
// The queue starts with the `leaves` array, and goes into a `hashes` array.
// After the process, the last element on the queue is verified
// to be equal to the `root`.
//
// The `flags` array denotes whether the sibling
// should be popped from the queue (`flag == true`), or
// should be popped from the `proof` (`flag == false`).
/// @solidity memory-safe-assembly
assembly {
// Cache the lengths of the arrays.
let leavesLength := mload(leaves)
let proofLength := mload(proof)
let flagsLength := mload(flags)
// Advance the pointers of the arrays to point to the data.
leaves := add(0x20, leaves)
proof := add(0x20, proof)
flags := add(0x20, flags)
// If the number of flags is correct.
for {} eq(add(leavesLength, proofLength), add(flagsLength, 1)) {} {
// For the case where `proof.length + leaves.length == 1`.
if iszero(flagsLength) {
// `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`.
isValid := eq(mload(xor(leaves, mul(xor(proof, leaves), proofLength))), root)
break
}
// The required final proof offset if `flagsLength` is not zero, otherwise zero.
let proofEnd := add(proof, shl(5, proofLength))
// We can use the free memory space for the queue.
// We don't need to allocate, since the queue is temporary.
let hashesFront := mload(0x40)
// Copy the leaves into the hashes.
// Sometimes, a little memory expansion costs less than branching.
// Should cost less, even with a high free memory offset of 0x7d00.
leavesLength := shl(5, leavesLength)
for { let i := 0 } iszero(eq(i, leavesLength)) { i := add(i, 0x20) } {
mstore(add(hashesFront, i), mload(add(leaves, i)))
}
// Compute the back of the hashes.
let hashesBack := add(hashesFront, leavesLength)
// This is the end of the memory for the queue.
// We recycle `flagsLength` to save on stack variables (sometimes save gas).
flagsLength := add(hashesBack, shl(5, flagsLength))
for {} 1 {} {
// Pop from `hashes`.
let a := mload(hashesFront)
// Pop from `hashes`.
let b := mload(add(hashesFront, 0x20))
hashesFront := add(hashesFront, 0x40)
// If the flag is false, load the next proof,
// else, pops from the queue.
if iszero(mload(flags)) {
// Loads the next proof.
b := mload(proof)
proof := add(proof, 0x20)
// Unpop from `hashes`.
hashesFront := sub(hashesFront, 0x20)
}
// Advance to the next flag.
flags := add(flags, 0x20)
// Slot of `a` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(a, b))
// Hash the scratch space and push the result onto the queue.
mstore(scratch, a)
mstore(xor(scratch, 0x20), b)
mstore(hashesBack, keccak256(0x00, 0x40))
hashesBack := add(hashesBack, 0x20)
if iszero(lt(hashesBack, flagsLength)) { break }
}
isValid :=
and(
// Checks if the last value in the queue is same as the root.
eq(mload(sub(hashesBack, 0x20)), root),
// And whether all the proofs are used, if required.
eq(proofEnd, proof)
)
break
}
}
}
/// @dev Returns whether all `leaves` exist in the Merkle tree with `root`,
/// given `proof` and `flags`.
///
/// Note:
/// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length`
/// will always return false.
/// - Any non-zero word in the `flags` array is treated as true.
/// - The calldata offset of `proof` must be non-zero
/// (i.e. `proof` is from a regular Solidity function with a 4-byte selector).
function verifyMultiProofCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32[] calldata leaves,
bool[] calldata flags
) internal pure returns (bool isValid) {
// Rebuilds the root by consuming and producing values on a queue.
// The queue starts with the `leaves` array, and goes into a `hashes` array.
// After the process, the last element on the queue is verified
// to be equal to the `root`.
//
// The `flags` array denotes whether the sibling
// should be popped from the queue (`flag == true`), or
// should be popped from the `proof` (`flag == false`).
/// @solidity memory-safe-assembly
assembly {
// If the number of flags is correct.
for {} eq(add(leaves.length, proof.length), add(flags.length, 1)) {} {
// For the case where `proof.length + leaves.length == 1`.
if iszero(flags.length) {
// `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`.
// forgefmt: disable-next-item
isValid := eq(
calldataload(
xor(leaves.offset, mul(xor(proof.offset, leaves.offset), proof.length))
),
root
)
break
}
// The required final proof offset if `flagsLength` is not zero, otherwise zero.
let proofEnd := add(proof.offset, shl(5, proof.length))
// We can use the free memory space for the queue.
// We don't need to allocate, since the queue is temporary.
let hashesFront := mload(0x40)
// Copy the leaves into the hashes.
// Sometimes, a little memory expansion costs less than branching.
// Should cost less, even with a high free memory offset of 0x7d00.
calldatacopy(hashesFront, leaves.offset, shl(5, leaves.length))
// Compute the back of the hashes.
let hashesBack := add(hashesFront, shl(5, leaves.length))
// This is the end of the memory for the queue.
// We recycle `flagsLength` to save on stack variables (sometimes save gas).
flags.length := add(hashesBack, shl(5, flags.length))
// We don't need to make a copy of `proof.offset` or `flags.offset`,
// as they are pass-by-value (this trick may not always save gas).
for {} 1 {} {
// Pop from `hashes`.
let a := mload(hashesFront)
// Pop from `hashes`.
let b := mload(add(hashesFront, 0x20))
hashesFront := add(hashesFront, 0x40)
// If the flag is false, load the next proof,
// else, pops from the queue.
if iszero(calldataload(flags.offset)) {
// Loads the next proof.
b := calldataload(proof.offset)
proof.offset := add(proof.offset, 0x20)
// Unpop from `hashes`.
hashesFront := sub(hashesFront, 0x20)
}
// Advance to the next flag offset.
flags.offset := add(flags.offset, 0x20)
// Slot of `a` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(a, b))
// Hash the scratch space and push the result onto the queue.
mstore(scratch, a)
mstore(xor(scratch, 0x20), b)
mstore(hashesBack, keccak256(0x00, 0x40))
hashesBack := add(hashesBack, 0x20)
if iszero(lt(hashesBack, flags.length)) { break }
}
isValid :=
and(
// Checks if the last value in the queue is same as the root.
eq(mload(sub(hashesBack, 0x20)), root),
// And whether all the proofs are used, if required.
eq(proofEnd, proof.offset)
)
break
}
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EMPTY CALLDATA HELPERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns an empty calldata bytes32 array.
function emptyProof() internal pure returns (bytes32[] calldata proof) {
/// @solidity memory-safe-assembly
assembly {
proof.length := 0
}
}
/// @dev Returns an empty calldata bytes32 array.
function emptyLeaves() internal pure returns (bytes32[] calldata leaves) {
/// @solidity memory-safe-assembly
assembly {
leaves.length := 0
}
}
/// @dev Returns an empty calldata bool array.
function emptyFlags() internal pure returns (bool[] calldata flags) {
/// @solidity memory-safe-assembly
assembly {
flags.length := 0
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol)
///
/// @dev Note:
/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
/// - For ERC20s, this implementation won't check that a token has code,
/// responsibility is delegated to the caller.
library SafeTransferLib {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ETH transfer has failed.
error ETHTransferFailed();
/// @dev The ERC20 `transferFrom` has failed.
error TransferFromFailed();
/// @dev The ERC20 `transfer` has failed.
error TransferFailed();
/// @dev The ERC20 `approve` has failed.
error ApproveFailed();
/// @dev The Permit2 operation has failed.
error Permit2Failed();
/// @dev The Permit2 amount must be less than `2**160 - 1`.
error Permit2AmountOverflow();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;
/// @dev Suggested gas stipend for contract receiving ETH to perform a few
/// storage reads and writes, but low enough to prevent griefing.
uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;
/// @dev The unique EIP-712 domain domain separator for the DAI token contract.
bytes32 internal constant DAI_DOMAIN_SEPARATOR =
0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7;
/// @dev The address for the WETH9 contract on Ethereum mainnet.
address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
/// @dev The canonical Permit2 address.
/// [Github](https://github.com/Uniswap/permit2)
/// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3)
address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ETH OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
//
// The regular variants:
// - Forwards all remaining gas to the target.
// - Reverts if the target reverts.
// - Reverts if the current contract has insufficient balance.
//
// The force variants:
// - Forwards with an optional gas stipend
// (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
// - If the target reverts, or if the gas stipend is exhausted,
// creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
// Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
// - Reverts if the current contract has insufficient balance.
//
// The try variants:
// - Forwards with a mandatory gas stipend.
// - Instead of reverting, returns whether the transfer succeeded.
/// @dev Sends `amount` (in wei) ETH to `to`.
function safeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Sends all the ETH in the current contract to `to`.
function safeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// Transfer all the ETH and check if it succeeded or not.
if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// forgefmt: disable-next-item
if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
}
}
/// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
function trySafeTransferAllETH(address to, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ERC20 OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for
/// the current contract to manage.
function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
///
/// The `from` account must have at least `amount` approved for the current contract to manage.
function trySafeTransferFrom(address token, address from, address to, uint256 amount)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
success :=
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
)
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends all of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have their entire balance approved for the current contract to manage.
function safeTransferAllFrom(address token, address from, address to)
internal
returns (uint256 amount)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransfer(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sends all of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransferAll(address token, address to) internal returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
mstore(0x20, address()) // Store the address of the current contract.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x14, to) // Store the `to` argument.
amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// Reverts upon failure.
function safeApprove(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
// Perform the approval, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
/// then retries the approval again (some tokens, e.g. USDT, requires this).
/// Reverts upon failure.
function safeApproveWithRetry(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
// Perform the approval, retrying upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x34, 0) // Store 0 for the `amount`.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
mstore(0x34, amount) // Store back the original `amount`.
// Retry the approval, reverting upon failure.
if iszero(
and(
or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
)
) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Returns the amount of ERC20 `token` owned by `account`.
/// Returns zero if the `token` does not exist.
function balanceOf(address token, address account) internal view returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, account) // Store the `account` argument.
mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
amount :=
mul( // The arguments of `mul` are evaluated from right to left.
mload(0x20),
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
)
)
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// If the initial attempt fails, try to use Permit2 to transfer the token.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for the current contract to manage.
function safeTransferFrom2(address token, address from, address to, uint256 amount) internal {
if (!trySafeTransferFrom(token, from, to, amount)) {
permit2TransferFrom(token, from, to, amount);
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2.
/// Reverts upon failure.
function permit2TransferFrom(address token, address from, address to, uint256 amount)
internal
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(add(m, 0x74), shr(96, shl(96, token)))
mstore(add(m, 0x54), amount)
mstore(add(m, 0x34), to)
mstore(add(m, 0x20), shl(96, from))
// `transferFrom(address,address,uint160,address)`.
mstore(m, 0x36c78516000000000000000000000000)
let p := PERMIT2
let exists := eq(chainid(), 1)
if iszero(exists) { exists := iszero(iszero(extcodesize(p))) }
if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) {
mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`.
revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04)
}
}
}
/// @dev Permit a user to spend a given amount of
/// another user's tokens via native EIP-2612 permit if possible, falling
/// back to Permit2 if native permit fails or is not implemented on the token.
function permit2(
address token,
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
bool success;
/// @solidity memory-safe-assembly
assembly {
for {} shl(96, xor(token, WETH9)) {} {
mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word.
// Gas stipend to limit gas burn for tokens that don't refund gas when
// an non-existing function is called. 5K should be enough for a SLOAD.
staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20)
)
) { break }
// After here, we can be sure that token is a contract.
let m := mload(0x40)
mstore(add(m, 0x34), spender)
mstore(add(m, 0x20), shl(96, owner))
mstore(add(m, 0x74), deadline)
if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) {
mstore(0x14, owner)
mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`.
mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20))
mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`.
// `nonces` is already at `add(m, 0x54)`.
// `1` is already stored at `add(m, 0x94)`.
mstore(add(m, 0xb4), and(0xff, v))
mstore(add(m, 0xd4), r)
mstore(add(m, 0xf4), s)
success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00)
break
}
mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`.
mstore(add(m, 0x54), amount)
mstore(add(m, 0x94), and(0xff, v))
mstore(add(m, 0xb4), r)
mstore(add(m, 0xd4), s)
success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00)
break
}
}
if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s);
}
/// @dev Simple permit on the Permit2 contract.
function simplePermit2(
address token,
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, 0x927da105) // `allowance(address,address,address)`.
{
let addressMask := shr(96, not(0))
mstore(add(m, 0x20), and(addressMask, owner))
mstore(add(m, 0x40), and(addressMask, token))
mstore(add(m, 0x60), and(addressMask, spender))
mstore(add(m, 0xc0), and(addressMask, spender))
}
let p := mul(PERMIT2, iszero(shr(160, amount)))
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`.
staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60)
)
) {
mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`.
revert(add(0x18, shl(2, iszero(p))), 0x04)
}
mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant).
// `owner` is already `add(m, 0x20)`.
// `token` is already at `add(m, 0x40)`.
mstore(add(m, 0x60), amount)
mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`.
// `nonce` is already at `add(m, 0xa0)`.
// `spender` is already at `add(m, 0xc0)`.
mstore(add(m, 0xe0), deadline)
mstore(add(m, 0x100), 0x100) // `signature` offset.
mstore(add(m, 0x120), 0x41) // `signature` length.
mstore(add(m, 0x140), r)
mstore(add(m, 0x160), s)
mstore(add(m, 0x180), shl(248, v))
if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) {
mstore(0x00, 0x6b836e6b) // `Permit2Failed()`.
revert(0x1c, 0x04)
}
}
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
import {IModule} from "./interface/IModule.sol";
abstract contract Module is IModule {
function getModuleConfig() external pure virtual returns (ModuleConfig memory);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
library Role {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* NAMED ROLE CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
uint256 internal constant _MINTER_ROLE = 1 << 0;
uint256 internal constant _MANAGER_ROLE = 1 << 1;
uint256 internal constant _INSTALLER_ROLE = 1 << 255;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ROLE CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
uint256 internal constant _ROLE_0 = 1 << 0;
uint256 internal constant _ROLE_1 = 1 << 1;
uint256 internal constant _ROLE_2 = 1 << 2;
uint256 internal constant _ROLE_3 = 1 << 3;
uint256 internal constant _ROLE_4 = 1 << 4;
uint256 internal constant _ROLE_5 = 1 << 5;
uint256 internal constant _ROLE_6 = 1 << 6;
uint256 internal constant _ROLE_7 = 1 << 7;
uint256 internal constant _ROLE_8 = 1 << 8;
uint256 internal constant _ROLE_9 = 1 << 9;
uint256 internal constant _ROLE_10 = 1 << 10;
uint256 internal constant _ROLE_11 = 1 << 11;
uint256 internal constant _ROLE_12 = 1 << 12;
uint256 internal constant _ROLE_13 = 1 << 13;
uint256 internal constant _ROLE_14 = 1 << 14;
uint256 internal constant _ROLE_15 = 1 << 15;
uint256 internal constant _ROLE_16 = 1 << 16;
uint256 internal constant _ROLE_17 = 1 << 17;
uint256 internal constant _ROLE_18 = 1 << 18;
uint256 internal constant _ROLE_19 = 1 << 19;
uint256 internal constant _ROLE_20 = 1 << 20;
uint256 internal constant _ROLE_21 = 1 << 21;
uint256 internal constant _ROLE_22 = 1 << 22;
uint256 internal constant _ROLE_23 = 1 << 23;
uint256 internal constant _ROLE_24 = 1 << 24;
uint256 internal constant _ROLE_25 = 1 << 25;
uint256 internal constant _ROLE_26 = 1 << 26;
uint256 internal constant _ROLE_27 = 1 << 27;
uint256 internal constant _ROLE_28 = 1 << 28;
uint256 internal constant _ROLE_29 = 1 << 29;
uint256 internal constant _ROLE_30 = 1 << 30;
uint256 internal constant _ROLE_31 = 1 << 31;
uint256 internal constant _ROLE_32 = 1 << 32;
uint256 internal constant _ROLE_33 = 1 << 33;
uint256 internal constant _ROLE_34 = 1 << 34;
uint256 internal constant _ROLE_35 = 1 << 35;
uint256 internal constant _ROLE_36 = 1 << 36;
uint256 internal constant _ROLE_37 = 1 << 37;
uint256 internal constant _ROLE_38 = 1 << 38;
uint256 internal constant _ROLE_39 = 1 << 39;
uint256 internal constant _ROLE_40 = 1 << 40;
uint256 internal constant _ROLE_41 = 1 << 41;
uint256 internal constant _ROLE_42 = 1 << 42;
uint256 internal constant _ROLE_43 = 1 << 43;
uint256 internal constant _ROLE_44 = 1 << 44;
uint256 internal constant _ROLE_45 = 1 << 45;
uint256 internal constant _ROLE_46 = 1 << 46;
uint256 internal constant _ROLE_47 = 1 << 47;
uint256 internal constant _ROLE_48 = 1 << 48;
uint256 internal constant _ROLE_49 = 1 << 49;
uint256 internal constant _ROLE_50 = 1 << 50;
uint256 internal constant _ROLE_51 = 1 << 51;
uint256 internal constant _ROLE_52 = 1 << 52;
uint256 internal constant _ROLE_53 = 1 << 53;
uint256 internal constant _ROLE_54 = 1 << 54;
uint256 internal constant _ROLE_55 = 1 << 55;
uint256 internal constant _ROLE_56 = 1 << 56;
uint256 internal constant _ROLE_57 = 1 << 57;
uint256 internal constant _ROLE_58 = 1 << 58;
uint256 internal constant _ROLE_59 = 1 << 59;
uint256 internal constant _ROLE_60 = 1 << 60;
uint256 internal constant _ROLE_61 = 1 << 61;
uint256 internal constant _ROLE_62 = 1 << 62;
uint256 internal constant _ROLE_63 = 1 << 63;
uint256 internal constant _ROLE_64 = 1 << 64;
uint256 internal constant _ROLE_65 = 1 << 65;
uint256 internal constant _ROLE_66 = 1 << 66;
uint256 internal constant _ROLE_67 = 1 << 67;
uint256 internal constant _ROLE_68 = 1 << 68;
uint256 internal constant _ROLE_69 = 1 << 69;
uint256 internal constant _ROLE_70 = 1 << 70;
uint256 internal constant _ROLE_71 = 1 << 71;
uint256 internal constant _ROLE_72 = 1 << 72;
uint256 internal constant _ROLE_73 = 1 << 73;
uint256 internal constant _ROLE_74 = 1 << 74;
uint256 internal constant _ROLE_75 = 1 << 75;
uint256 internal constant _ROLE_76 = 1 << 76;
uint256 internal constant _ROLE_77 = 1 << 77;
uint256 internal constant _ROLE_78 = 1 << 78;
uint256 internal constant _ROLE_79 = 1 << 79;
uint256 internal constant _ROLE_80 = 1 << 80;
uint256 internal constant _ROLE_81 = 1 << 81;
uint256 internal constant _ROLE_82 = 1 << 82;
uint256 internal constant _ROLE_83 = 1 << 83;
uint256 internal constant _ROLE_84 = 1 << 84;
uint256 internal constant _ROLE_85 = 1 << 85;
uint256 internal constant _ROLE_86 = 1 << 86;
uint256 internal constant _ROLE_87 = 1 << 87;
uint256 internal constant _ROLE_88 = 1 << 88;
uint256 internal constant _ROLE_89 = 1 << 89;
uint256 internal constant _ROLE_90 = 1 << 90;
uint256 internal constant _ROLE_91 = 1 << 91;
uint256 internal constant _ROLE_92 = 1 << 92;
uint256 internal constant _ROLE_93 = 1 << 93;
uint256 internal constant _ROLE_94 = 1 << 94;
uint256 internal constant _ROLE_95 = 1 << 95;
uint256 internal constant _ROLE_96 = 1 << 96;
uint256 internal constant _ROLE_97 = 1 << 97;
uint256 internal constant _ROLE_98 = 1 << 98;
uint256 internal constant _ROLE_99 = 1 << 99;
uint256 internal constant _ROLE_100 = 1 << 100;
uint256 internal constant _ROLE_101 = 1 << 101;
uint256 internal constant _ROLE_102 = 1 << 102;
uint256 internal constant _ROLE_103 = 1 << 103;
uint256 internal constant _ROLE_104 = 1 << 104;
uint256 internal constant _ROLE_105 = 1 << 105;
uint256 internal constant _ROLE_106 = 1 << 106;
uint256 internal constant _ROLE_107 = 1 << 107;
uint256 internal constant _ROLE_108 = 1 << 108;
uint256 internal constant _ROLE_109 = 1 << 109;
uint256 internal constant _ROLE_110 = 1 << 110;
uint256 internal constant _ROLE_111 = 1 << 111;
uint256 internal constant _ROLE_112 = 1 << 112;
uint256 internal constant _ROLE_113 = 1 << 113;
uint256 internal constant _ROLE_114 = 1 << 114;
uint256 internal constant _ROLE_115 = 1 << 115;
uint256 internal constant _ROLE_116 = 1 << 116;
uint256 internal constant _ROLE_117 = 1 << 117;
uint256 internal constant _ROLE_118 = 1 << 118;
uint256 internal constant _ROLE_119 = 1 << 119;
uint256 internal constant _ROLE_120 = 1 << 120;
uint256 internal constant _ROLE_121 = 1 << 121;
uint256 internal constant _ROLE_122 = 1 << 122;
uint256 internal constant _ROLE_123 = 1 << 123;
uint256 internal constant _ROLE_124 = 1 << 124;
uint256 internal constant _ROLE_125 = 1 << 125;
uint256 internal constant _ROLE_126 = 1 << 126;
uint256 internal constant _ROLE_127 = 1 << 127;
uint256 internal constant _ROLE_128 = 1 << 128;
uint256 internal constant _ROLE_129 = 1 << 129;
uint256 internal constant _ROLE_130 = 1 << 130;
uint256 internal constant _ROLE_131 = 1 << 131;
uint256 internal constant _ROLE_132 = 1 << 132;
uint256 internal constant _ROLE_133 = 1 << 133;
uint256 internal constant _ROLE_134 = 1 << 134;
uint256 internal constant _ROLE_135 = 1 << 135;
uint256 internal constant _ROLE_136 = 1 << 136;
uint256 internal constant _ROLE_137 = 1 << 137;
uint256 internal constant _ROLE_138 = 1 << 138;
uint256 internal constant _ROLE_139 = 1 << 139;
uint256 internal constant _ROLE_140 = 1 << 140;
uint256 internal constant _ROLE_141 = 1 << 141;
uint256 internal constant _ROLE_142 = 1 << 142;
uint256 internal constant _ROLE_143 = 1 << 143;
uint256 internal constant _ROLE_144 = 1 << 144;
uint256 internal constant _ROLE_145 = 1 << 145;
uint256 internal constant _ROLE_146 = 1 << 146;
uint256 internal constant _ROLE_147 = 1 << 147;
uint256 internal constant _ROLE_148 = 1 << 148;
uint256 internal constant _ROLE_149 = 1 << 149;
uint256 internal constant _ROLE_150 = 1 << 150;
uint256 internal constant _ROLE_151 = 1 << 151;
uint256 internal constant _ROLE_152 = 1 << 152;
uint256 internal constant _ROLE_153 = 1 << 153;
uint256 internal constant _ROLE_154 = 1 << 154;
uint256 internal constant _ROLE_155 = 1 << 155;
uint256 internal constant _ROLE_156 = 1 << 156;
uint256 internal constant _ROLE_157 = 1 << 157;
uint256 internal constant _ROLE_158 = 1 << 158;
uint256 internal constant _ROLE_159 = 1 << 159;
uint256 internal constant _ROLE_160 = 1 << 160;
uint256 internal constant _ROLE_161 = 1 << 161;
uint256 internal constant _ROLE_162 = 1 << 162;
uint256 internal constant _ROLE_163 = 1 << 163;
uint256 internal constant _ROLE_164 = 1 << 164;
uint256 internal constant _ROLE_165 = 1 << 165;
uint256 internal constant _ROLE_166 = 1 << 166;
uint256 internal constant _ROLE_167 = 1 << 167;
uint256 internal constant _ROLE_168 = 1 << 168;
uint256 internal constant _ROLE_169 = 1 << 169;
uint256 internal constant _ROLE_170 = 1 << 170;
uint256 internal constant _ROLE_171 = 1 << 171;
uint256 internal constant _ROLE_172 = 1 << 172;
uint256 internal constant _ROLE_173 = 1 << 173;
uint256 internal constant _ROLE_174 = 1 << 174;
uint256 internal constant _ROLE_175 = 1 << 175;
uint256 internal constant _ROLE_176 = 1 << 176;
uint256 internal constant _ROLE_177 = 1 << 177;
uint256 internal constant _ROLE_178 = 1 << 178;
uint256 internal constant _ROLE_179 = 1 << 179;
uint256 internal constant _ROLE_180 = 1 << 180;
uint256 internal constant _ROLE_181 = 1 << 181;
uint256 internal constant _ROLE_182 = 1 << 182;
uint256 internal constant _ROLE_183 = 1 << 183;
uint256 internal constant _ROLE_184 = 1 << 184;
uint256 internal constant _ROLE_185 = 1 << 185;
uint256 internal constant _ROLE_186 = 1 << 186;
uint256 internal constant _ROLE_187 = 1 << 187;
uint256 internal constant _ROLE_188 = 1 << 188;
uint256 internal constant _ROLE_189 = 1 << 189;
uint256 internal constant _ROLE_190 = 1 << 190;
uint256 internal constant _ROLE_191 = 1 << 191;
uint256 internal constant _ROLE_192 = 1 << 192;
uint256 internal constant _ROLE_193 = 1 << 193;
uint256 internal constant _ROLE_194 = 1 << 194;
uint256 internal constant _ROLE_195 = 1 << 195;
uint256 internal constant _ROLE_196 = 1 << 196;
uint256 internal constant _ROLE_197 = 1 << 197;
uint256 internal constant _ROLE_198 = 1 << 198;
uint256 internal constant _ROLE_199 = 1 << 199;
uint256 internal constant _ROLE_200 = 1 << 200;
uint256 internal constant _ROLE_201 = 1 << 201;
uint256 internal constant _ROLE_202 = 1 << 202;
uint256 internal constant _ROLE_203 = 1 << 203;
uint256 internal constant _ROLE_204 = 1 << 204;
uint256 internal constant _ROLE_205 = 1 << 205;
uint256 internal constant _ROLE_206 = 1 << 206;
uint256 internal constant _ROLE_207 = 1 << 207;
uint256 internal constant _ROLE_208 = 1 << 208;
uint256 internal constant _ROLE_209 = 1 << 209;
uint256 internal constant _ROLE_210 = 1 << 210;
uint256 internal constant _ROLE_211 = 1 << 211;
uint256 internal constant _ROLE_212 = 1 << 212;
uint256 internal constant _ROLE_213 = 1 << 213;
uint256 internal constant _ROLE_214 = 1 << 214;
uint256 internal constant _ROLE_215 = 1 << 215;
uint256 internal constant _ROLE_216 = 1 << 216;
uint256 internal constant _ROLE_217 = 1 << 217;
uint256 internal constant _ROLE_218 = 1 << 218;
uint256 internal constant _ROLE_219 = 1 << 219;
uint256 internal constant _ROLE_220 = 1 << 220;
uint256 internal constant _ROLE_221 = 1 << 221;
uint256 internal constant _ROLE_222 = 1 << 222;
uint256 internal constant _ROLE_223 = 1 << 223;
uint256 internal constant _ROLE_224 = 1 << 224;
uint256 internal constant _ROLE_225 = 1 << 225;
uint256 internal constant _ROLE_226 = 1 << 226;
uint256 internal constant _ROLE_227 = 1 << 227;
uint256 internal constant _ROLE_228 = 1 << 228;
uint256 internal constant _ROLE_229 = 1 << 229;
uint256 internal constant _ROLE_230 = 1 << 230;
uint256 internal constant _ROLE_231 = 1 << 231;
uint256 internal constant _ROLE_232 = 1 << 232;
uint256 internal constant _ROLE_233 = 1 << 233;
uint256 internal constant _ROLE_234 = 1 << 234;
uint256 internal constant _ROLE_235 = 1 << 235;
uint256 internal constant _ROLE_236 = 1 << 236;
uint256 internal constant _ROLE_237 = 1 << 237;
uint256 internal constant _ROLE_238 = 1 << 238;
uint256 internal constant _ROLE_239 = 1 << 239;
uint256 internal constant _ROLE_240 = 1 << 240;
uint256 internal constant _ROLE_241 = 1 << 241;
uint256 internal constant _ROLE_242 = 1 << 242;
uint256 internal constant _ROLE_243 = 1 << 243;
uint256 internal constant _ROLE_244 = 1 << 244;
uint256 internal constant _ROLE_245 = 1 << 245;
uint256 internal constant _ROLE_246 = 1 << 246;
uint256 internal constant _ROLE_247 = 1 << 247;
uint256 internal constant _ROLE_248 = 1 << 248;
uint256 internal constant _ROLE_249 = 1 << 249;
uint256 internal constant _ROLE_250 = 1 << 250;
uint256 internal constant _ROLE_251 = 1 << 251;
uint256 internal constant _ROLE_252 = 1 << 252;
uint256 internal constant _ROLE_253 = 1 << 253;
uint256 internal constant _ROLE_254 = 1 << 254;
uint256 internal constant _ROLE_255 = 1 << 255;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
contract BeforeMintCallbackERC721 {
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
error BeforeMintCallbackERC721NotImplemented();
/*//////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice The beforeMintERC721 hook that is called by a core token before minting tokens.
*
* @param _to The address that is minting tokens.
* @param _startTokenId The token ID being minted.
* @param _amount The amount of tokens to mint.
* @param _data Optional extra data passed to the hook.
* @return result Abi encoded bytes result of the hook.
*/
function beforeMintERC721(address _to, uint256 _startTokenId, uint256 _amount, bytes memory _data)
external
payable
virtual
returns (bytes memory result)
{
revert BeforeMintCallbackERC721NotImplemented();
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
contract BeforeMintWithSignatureCallbackERC721 {
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
error BeforeMintWithSignatureCallbackERC721NotImplemented();
/*//////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @notice The beforeMintWithSignatureERC721 hook that is called by a core token before minting tokens.
*
* @param _to The address that is minting tokens.
* @param _startTokenId The token ID being minted.
* @param _amount The amount of tokens to mint.
* @param _data Optional extra data passed to the hook.
* @param _signer The address that signed the minting request.
* @return result Abi encoded bytes result of the hook.
*/
function beforeMintWithSignatureERC721(
address _to,
uint256 _startTokenId,
uint256 _amount,
bytes memory _data,
address _signer
) external payable virtual returns (bytes memory result) {
revert BeforeMintWithSignatureCallbackERC721NotImplemented();
}
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
interface IInstallationCallback {
/*//////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @dev Called by a Core into an Module during the installation of the Module.
*
* @param data The data passed to the Core's installModule function.
*/
function onInstall(bytes calldata data) external;
/**
* @dev Called by a Core into an Module during the uninstallation of the Module.
*
* @param data The data passed to the Core's uninstallModule function.
*/
function onUninstall(bytes calldata data) external;
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
import {IModuleConfig} from "./IModuleConfig.sol";
interface IModule is IModuleConfig {
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/**
* @dev Returns the ModuleConfig of the Module contract.
*/
function getModuleConfig() external pure returns (ModuleConfig memory);
}// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
interface IModuleConfig {
/*//////////////////////////////////////////////////////////////
STRUCTS & ENUMS
//////////////////////////////////////////////////////////////*/
/**
* @dev Struct for a callback function. Called by a Core into an Module during the execution of some fixed function.
*
* @param selector The 4-byte selector of the function.
* @param callType The type of call to be made to the function.
*/
struct CallbackFunction {
bytes4 selector;
}
/**
* @dev Struct for a fallback function. Called by a Core into an Module via the Core's fallback.
*
* @param selector The 4-byte selector of the function.
* @param callType The type of call to be made to the function.
* @param permissionBits Core’s fallback function MUST check that msg.sender has these permissions before
* performing a call on the Module. (OPTIONAL field)
*/
struct FallbackFunction {
bytes4 selector;
uint256 permissionBits;
}
/**
* @dev Struct containing all information that a Core uses to check whether an Module is compatible for installation.
*
* @param registerInstallationCallback Whether the Module expects onInstall and onUninstall callback function calls at
* installation and uninstallation time, respectively
* @param requiredInterfaces The ERC-165 interface that a Core MUST support to be compatible for installation. OPTIONAL -- can be bytes4(0)
* if there is no required interface id.
* @param supportedInterfaces The ERC-165 interfaces that a Core supports upon installing the Module.
* @param callbackFunctions List of callback functions that the Core MUST call at some point in the execution of its fixed functions.
* @param fallbackFunctions List of functions that the Core MUST call via its fallback function with the Module as the call destination.
*/
struct ModuleConfig {
bool registerInstallationCallback;
bytes4[] requiredInterfaces;
bytes4[] supportedInterfaces;
CallbackFunction[] callbackFunctions;
FallbackFunction[] fallbackFunctions;
}
}{
"optimizer": {
"enabled": true,
"runs": 10000
},
"evmVersion": "paris",
"remappings": [
":@erc721a-upgradeable/=lib/ERC721A-Upgradeable/contracts/",
":@erc721a/=lib/erc721a/contracts/",
":@limitbreak/creator-token-standards/=lib/creator-token-standards/src/",
":@limitbreak/permit-c/=lib/PermitC/src/",
":@opensea/tstorish/=lib/creator-token-standards/lib/tstorish/src/",
":@openzeppelin/=lib/creator-token-contracts/node_modules/@openzeppelin/",
":@rari-capital/solmate/=lib/PermitC/lib/solmate/",
":@solady/=lib/solady/src/",
":ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/",
":ERC721A/=lib/creator-token-standards/lib/ERC721A/contracts/",
":PermitC/=lib/PermitC/",
":creator-token-contracts/=lib/creator-token-contracts/contracts/",
":creator-token-standards/=lib/creator-token-standards/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/PermitC/lib/openzeppelin-contracts/lib/erc4626-tests/",
":erc721a/=lib/erc721a/contracts/",
":forge-gas-metering/=lib/PermitC/lib/forge-gas-metering/",
":forge-std/=lib/forge-std/src/",
":hardhat/=lib/creator-token-contracts/node_modules/hardhat/",
":murky/=lib/creator-token-standards/lib/murky/",
":openzeppelin-contracts/=lib/creator-token-standards/lib/openzeppelin-contracts/",
":openzeppelin/=lib/PermitC/lib/openzeppelin-contracts/contracts/",
":solady/=lib/solady/src/",
":solmate/=lib/PermitC/lib/solmate/src/",
":tstorish/=lib/creator-token-standards/lib/tstorish/src/"
],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"BeforeMintCallbackERC721NotImplemented","type":"error"},{"inputs":[],"name":"BeforeMintWithSignatureCallbackERC721NotImplemented","type":"error"},{"inputs":[],"name":"ClaimableIncorrectNativeTokenSent","type":"error"},{"inputs":[],"name":"ClaimableIncorrectPriceOrCurrency","type":"error"},{"inputs":[],"name":"ClaimableMaxMintPerWalletExceeded","type":"error"},{"inputs":[],"name":"ClaimableNotInAllowlist","type":"error"},{"inputs":[],"name":"ClaimableOutOfSupply","type":"error"},{"inputs":[],"name":"ClaimableOutOfTimeWindow","type":"error"},{"inputs":[],"name":"ClaimableRequestMismatch","type":"error"},{"inputs":[],"name":"ClaimableRequestOutOfTimeWindow","type":"error"},{"inputs":[],"name":"ClaimableRequestUidReused","type":"error"},{"inputs":[],"name":"ClaimableRequestUnauthorizedSignature","type":"error"},{"inputs":[],"name":"ClaimableSignatureMintUnauthorized","type":"error"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_startTokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"beforeMintERC721","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_startTokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"},{"internalType":"address","name":"_signer","type":"address"}],"name":"beforeMintWithSignatureERC721","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"pricePerUnit","type":"uint256"},{"internalType":"bytes32[]","name":"recipientAllowlistProof","type":"bytes32[]"}],"internalType":"struct ClaimableERC721.ClaimParamsERC721","name":"params","type":"tuple"}],"name":"encodeBytesBeforeMintERC721","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"uint48","name":"startTimestamp","type":"uint48"},{"internalType":"uint48","name":"endTimestamp","type":"uint48"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"maxMintPerWallet","type":"uint256"},{"internalType":"uint256","name":"pricePerUnit","type":"uint256"},{"internalType":"bytes32","name":"uid","type":"bytes32"}],"internalType":"struct ClaimableERC721.ClaimSignatureParamsERC721","name":"params","type":"tuple"}],"name":"encodeBytesBeforeMintWithSignatureERC721","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"primarySaleRecipient","type":"address"}],"name":"encodeBytesOnInstall","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"encodeBytesOnUninstall","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getClaimCondition","outputs":[{"components":[{"internalType":"uint256","name":"availableSupply","type":"uint256"},{"internalType":"bytes32","name":"allowlistMerkleRoot","type":"bytes32"},{"internalType":"uint256","name":"pricePerUnit","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"maxMintPerWallet","type":"uint256"},{"internalType":"uint48","name":"startTimestamp","type":"uint48"},{"internalType":"uint48","name":"endTimestamp","type":"uint48"},{"internalType":"string","name":"auxData","type":"string"}],"internalType":"struct ClaimableERC721.ClaimCondition","name":"claimCondition","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getModuleConfig","outputs":[{"components":[{"internalType":"bool","name":"registerInstallationCallback","type":"bool"},{"internalType":"bytes4[]","name":"requiredInterfaces","type":"bytes4[]"},{"internalType":"bytes4[]","name":"supportedInterfaces","type":"bytes4[]"},{"components":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"internalType":"struct IModuleConfig.CallbackFunction[]","name":"callbackFunctions","type":"tuple[]"},{"components":[{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"uint256","name":"permissionBits","type":"uint256"}],"internalType":"struct IModuleConfig.FallbackFunction[]","name":"fallbackFunctions","type":"tuple[]"}],"internalType":"struct IModuleConfig.ModuleConfig","name":"config","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getSaleConfig","outputs":[{"internalType":"address","name":"primarySaleRecipient","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onInstall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onUninstall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"availableSupply","type":"uint256"},{"internalType":"bytes32","name":"allowlistMerkleRoot","type":"bytes32"},{"internalType":"uint256","name":"pricePerUnit","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"maxMintPerWallet","type":"uint256"},{"internalType":"uint48","name":"startTimestamp","type":"uint48"},{"internalType":"uint48","name":"endTimestamp","type":"uint48"},{"internalType":"string","name":"auxData","type":"string"}],"internalType":"struct ClaimableERC721.ClaimCondition","name":"_claimCondition","type":"tuple"}],"name":"setClaimCondition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_primarySaleRecipient","type":"address"}],"name":"setSaleConfig","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6080604052348015600f57600080fd5b506120be8061001f6000396000f3fe6080604052600436106100d25760003560e01c80638a91b0e31161007f578063cea943ee11610059578063cea943ee146101f8578063d29a362814610232578063d958465114610252578063f5b75d2a1461027257600080fd5b80638a91b0e314610199578063937bdca4146101b8578063ac0c12f4146101d857600080fd5b80636d61fe70116100b05780636d61fe7014610142578063765e80931461016457806389e04e0e1461017757600080fd5b80630daf9328146100d757806330a63e11146101005780635d4c0b8914610122575b600080fd5b6100ea6100e53660046115f1565b610293565b6040516100f791906116af565b60405180910390f35b34801561010c57600080fd5b506101156103ac565b6040516100f791906116c9565b34801561012e57600080fd5b506100ea61013d366004611762565b61053a565b34801561014e57600080fd5b5061016261015d36600461177f565b610575565b005b6100ea6101723660046117f3565b610600565b34801561018357600080fd5b5061018c610653565b6040516100f79190611914565b3480156101a557600080fd5b506101626101b436600461177f565b5050565b3480156101c457600080fd5b506100ea6101d3366004611a0b565b6109b4565b3480156101e457600080fd5b506101626101f3366004611a81565b610a2c565b34801561020457600080fd5b5061020d610b17565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f7565b34801561023e57600080fd5b5061016261024d366004611762565b610b54565b34801561025e57600080fd5b506100ea61026d366004611b72565b610bcd565b34801561027e57600080fd5b506040805160208101909152600081526100ea565b6040517f1cd64df400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152600160248201526060903090631cd64df490604401602060405180830381865afa158015610307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032b9190611c62565b610361576040517f14bc6d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838060200190518101906103779190611c84565b9050610384818887610be0565b6103a233826040015183608001518861039d9190611d29565b610e1e565b5095945050505050565b61041d604051806101000160405280600081526020016000801916815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600065ffffffffffff168152602001600065ffffffffffff168152602001606081525090565b610425610f56565b6040805161010081018252600383018054825260048401546020830152600584015492820192909252600683015473ffffffffffffffffffffffffffffffffffffffff16606082015260078301546080820152600883015465ffffffffffff80821660a084015266010000000000009091041660c08201526009909201805460e0840191906104b390611d46565b80601f01602080910402602001604051908101604052809291908181526020018280546104df90611d46565b801561052c5780601f106105015761010080835404028352916020019161052c565b820191906000526020600020905b81548152906001019060200180831161050f57829003601f168201915b505050505081525050905090565b6040805173ffffffffffffffffffffffffffffffffffffffff83166020820152606091015b6040516020818303038152906040529050919050565b600061058382840184611762565b905060405180602001604052808273ffffffffffffffffffffffffffffffffffffffff168152506105b2610f56565b9051600290910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055505050565b60606000828060200190518101906106189190611d99565b90506106338685836000015184602001518560400151610f65565b8051602082015161064a91339161039d9088611d29565b50949350505050565b6106876040518060a00160405280600015158152602001606081526020016060815260200160608152602001606081525090565b6040805160028082526060820190925290816020015b60408051602081019091526000815281526020019060019003908161069d575050606082015260408051600480825260a0820190925290602082015b60408051808201909152600080825260208201528152602001906001900390816106d9575050608082015260408051602081019091527f765e80930000000000000000000000000000000000000000000000000000000081526060820151805160009061074857610748611e74565b60200260200101819052506040518060200160405280630daf932860e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815250816060015160018151811061079f5761079f611e74565b6020026020010181905250604051806040016040528063cea943ee60e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001600081525081608001516000815181106107fd576107fd611e74565b6020026020010181905250604051806040016040528063d29a362860e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020016002815250816080015160018151811061085b5761085b611e74565b602002602001018190525060405180604001604052806330a63e1160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001600081525081608001516002815181106108b9576108b9611e74565b6020026020010181905250604051806040016040528063ac0c12f460e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020016001815250816080015160038151811061091757610917611e74565b6020908102919091010152604080516001808252818301909252908160200160208202803683375050506020820181905280517f80ac58cd00000000000000000000000000000000000000000000000000000000919060009061097c5761097c611e74565b7fffffffff00000000000000000000000000000000000000000000000000000000909216602092830291909101909101526001815290565b60608160405160200161055f9190600060c08201905065ffffffffffff835116825265ffffffffffff602084015116602083015273ffffffffffffffffffffffffffffffffffffffff6040840151166040830152606083015160608301526080830151608083015260a083015160a083015292915050565b80610a35610f56565b8151600382019081556020830151600483015560408301516005830155606083015160068301805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff00000000000000000000000000000000000000009092169190911790556080830151600783015560a083015160088301805460c086015165ffffffffffff9081166601000000000000027fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090921693169290921791909117905560e0830151909160090190610b119082611ef1565b50505050565b600080610b22610f56565b60408051602081019091526002919091015473ffffffffffffffffffffffffffffffffffffffff169081905292915050565b60405180602001604052808273ffffffffffffffffffffffffffffffffffffffff16815250610b81610f56565b9051600290910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905550565b60608160405160200161055f9190611fec565b825165ffffffffffff16421080610c03575042836020015165ffffffffffff1611155b15610c3a576040517fa04a11a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c42610f56565b60a08401516000908152602091909152604090205460ff1615610c91576040517f249394ec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c99610f56565b60030154811115610cd6576040517faf9ef11500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8260600151610ce3610f56565b73ffffffffffffffffffffffffffffffffffffffff841660009081526001919091016020526040902054610d179083612062565b1115610d4f576040517fb390ab3900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001610d59610f56565b60a085015160009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905580610da3610f56565b6003018054600090610db6908490612075565b90915550819050610dc5610f56565b60010160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e149190612062565b9091555050505050565b80600003610e63573415610e5e576040517f3de5a9a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6000610e6d610f56565b60408051602081019091526002919091015473ffffffffffffffffffffffffffffffffffffffff908116825290915083167fffffffffffffffffffffffff111111111111111111111111111111111111111201610f0e57813414610efd576040517f3de5a9a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051610f09908361133a565b610b11565b3415610f46576040517f3de5a9a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b118385836000015185611356565b6000610f606113b3565b905090565b6000610f6f610f56565b6040805161010081018252600383018054825260048401546020830152600584015492820192909252600683015473ffffffffffffffffffffffffffffffffffffffff16606082015260078301546080820152600883015465ffffffffffff80821660a084015266010000000000009091041660c08201526009909201805460e084019190610ffd90611d46565b80601f016020809104026020016040519081016040528092919081815260200182805461102990611d46565b80156110765780601f1061104b57610100808354040283529160200191611076565b820191906000526020600020905b81548152906001019060200180831161105957829003601f168201915b50505050508152505090508060a0015165ffffffffffff164210806110a75750428160c0015165ffffffffffff1611155b156110de576040517fe106319b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806060015173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580611121575080604001518314155b15611158576040517ffb10278300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051851115611193576040517faf9ef11500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80608001516111a0610f56565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260019190910160205260409020546111d49087612062565b111561120c576040517fb390ab3900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6020810151156112b35760006112788383602001518960405160200161125d919060609190911b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016815260140190565b60405160208183030381529060405280519060200120611433565b9050806112b1576040517ffdc4d9fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b846112bc610f56565b60030180546000906112cf908490612075565b909155508590506112de610f56565b60010160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461132d9190612062565b9091555050505050505050565b60003860003884865af16101b45763b12d13eb6000526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c52602060006064601c6000895af13d1560016000511417166113a557637939f4246000526004601cfd5b600060605260405250505050565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0061140260017f063f5c9930ebcb24c6e9f871c5cf07f8107734a7831d2d366df33bb963835137612075565b60405160200161141491815260200190565b60408051601f1981840301815291905280516020909101201692915050565b600083511561146e5760208401845160051b81015b8151841160051b9384528151602094851852604060002093909101908082106114485750505b5014919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461149757600080fd5b50565b80356114a581611475565b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156114fc576114fc6114aa565b60405290565b604051610100810167ffffffffffffffff811182821017156114fc576114fc6114aa565b6040516060810167ffffffffffffffff811182821017156114fc576114fc6114aa565b604051601f8201601f1916810167ffffffffffffffff81118282101715611572576115726114aa565b604052919050565b600082601f83011261158b57600080fd5b81356020830160008067ffffffffffffffff8411156115ac576115ac6114aa565b50601f8301601f19166020016115c181611549565b9150508281528583830111156115d657600080fd5b82826020830137600092810160200192909252509392505050565b600080600080600060a0868803121561160957600080fd5b853561161481611475565b94506020860135935060408601359250606086013567ffffffffffffffff81111561163e57600080fd5b61164a8882890161157a565b925050608086013561165b81611475565b809150509295509295909350565b6000815180845260005b8181101561168f57602081850181015186830182015201611673565b506000602082860101526020601f19601f83011685010191505092915050565b6020815260006116c26020830184611669565b9392505050565b6020815281516020820152602082015160408201526040820151606082015273ffffffffffffffffffffffffffffffffffffffff6060830151166080820152608082015160a082015265ffffffffffff60a08301511660c0820152600060c083015161173f60e084018265ffffffffffff169052565b5060e08301516101008084015261175a610120840182611669565b949350505050565b60006020828403121561177457600080fd5b81356116c281611475565b6000806020838503121561179257600080fd5b823567ffffffffffffffff8111156117a957600080fd5b8301601f810185136117ba57600080fd5b803567ffffffffffffffff8111156117d157600080fd5b8560208284010111156117e357600080fd5b6020919091019590945092505050565b6000806000806080858703121561180957600080fd5b843561181481611475565b93506020850135925060408501359150606085013567ffffffffffffffff81111561183e57600080fd5b61184a8782880161157a565b91505092959194509250565b600081518084526020840193506020830160005b828110156118aa5781517fffffffff000000000000000000000000000000000000000000000000000000001686526020958601959091019060010161186a565b5093949350505050565b600081518084526020840193506020830160005b828110156118aa57815180517fffffffff0000000000000000000000000000000000000000000000000000000016875260209081015181880152604090960195909101906001016118c8565b602081528151151560208201526000602083015160a0604084015261193c60c0840182611856565b90506040840151601f198483030160608501526119598282611856565b6060860151858203601f19016080870152805180835260209182019450600093509101905b808310156119c4577fffffffff0000000000000000000000000000000000000000000000000000000084515116825260208201915060208401935060018301925061197e565b5060808601519250601f198582030160a08601526119e281846118b4565b9695505050505050565b65ffffffffffff8116811461149757600080fd5b80356114a5816119ec565b600060c0828403128015611a1e57600080fd5b50611a276114d9565b8235611a32816119ec565b81526020830135611a42816119ec565b60208201526040830135611a5581611475565b6040820152606083810135908201526080808401359082015260a0928301359281019290925250919050565b600060208284031215611a9357600080fd5b813567ffffffffffffffff811115611aaa57600080fd5b82016101008185031215611abd57600080fd5b611ac5611502565b813581526020808301359082015260408083013590820152611ae96060830161149a565b606082015260808281013590820152611b0460a08301611a00565b60a0820152611b1560c08301611a00565b60c082015260e082013567ffffffffffffffff811115611b3457600080fd5b611b408682850161157a565b60e083015250949350505050565b600067ffffffffffffffff821115611b6857611b686114aa565b5060051b60200190565b600060208284031215611b8457600080fd5b813567ffffffffffffffff811115611b9b57600080fd5b820160608185031215611bad57600080fd5b611bb5611526565b8135611bc081611475565b815260208281013590820152604082013567ffffffffffffffff811115611be657600080fd5b80830192505084601f830112611bfb57600080fd5b8135611c0e611c0982611b4e565b611549565b8082825260208201915060208360051b860101925087831115611c3057600080fd5b6020850194505b82851015611c52578435825260209485019490910190611c37565b6040840152509095945050505050565b600060208284031215611c7457600080fd5b815180151581146116c257600080fd5b600060c0828403128015611c9757600080fd5b50611ca06114d9565b8251611cab816119ec565b81526020830151611cbb816119ec565b60208201526040830151611cce81611475565b6040820152606083810151908201526080808401519082015260a0928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417611d4057611d40611cfa565b92915050565b600181811c90821680611d5a57607f821691505b602082108103611d93577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215611dab57600080fd5b815167ffffffffffffffff811115611dc257600080fd5b820160608185031215611dd457600080fd5b611ddc611526565b8151611de781611475565b815260208281015190820152604082015167ffffffffffffffff811115611e0d57600080fd5b80830192505084601f830112611e2257600080fd5b8151611e30611c0982611b4e565b8082825260208201915060208360051b860101925087831115611e5257600080fd5b6020850194505b82851015611c52578451825260209485019490910190611e59565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b601f821115610e5e57806000526020600020601f840160051c81016020851015611eca5750805b601f840160051c820191505b81811015611eea5760008155600101611ed6565b5050505050565b815167ffffffffffffffff811115611f0b57611f0b6114aa565b611f1f81611f198454611d46565b84611ea3565b6020601f821160018114611f715760008315611f3b5750848201515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600385901b1c1916600184901b178455611eea565b600084815260208120601f198516915b82811015611fa15787850151825560209485019460019092019101611f81565b5084821015611fdd57868401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b60f8161c191681555b50505050600190811b01905550565b6020815260006080820173ffffffffffffffffffffffffffffffffffffffff845116602084015260208401516040840152604084015160608085015281815180845260a086019150602083019350600092505b808310156103a2578351825260208201915060208401935060018301925061203f565b80820180821115611d4057611d40611cfa565b81810381811115611d4057611d40611cfa56fea264697066735822122072ff0d9827fc623ac87f962c693f8ab29ba0007361fe554301b6577dd2726eb364736f6c634300081a0033
Deployed Bytecode
0x6080604052600436106100d25760003560e01c80638a91b0e31161007f578063cea943ee11610059578063cea943ee146101f8578063d29a362814610232578063d958465114610252578063f5b75d2a1461027257600080fd5b80638a91b0e314610199578063937bdca4146101b8578063ac0c12f4146101d857600080fd5b80636d61fe70116100b05780636d61fe7014610142578063765e80931461016457806389e04e0e1461017757600080fd5b80630daf9328146100d757806330a63e11146101005780635d4c0b8914610122575b600080fd5b6100ea6100e53660046115f1565b610293565b6040516100f791906116af565b60405180910390f35b34801561010c57600080fd5b506101156103ac565b6040516100f791906116c9565b34801561012e57600080fd5b506100ea61013d366004611762565b61053a565b34801561014e57600080fd5b5061016261015d36600461177f565b610575565b005b6100ea6101723660046117f3565b610600565b34801561018357600080fd5b5061018c610653565b6040516100f79190611914565b3480156101a557600080fd5b506101626101b436600461177f565b5050565b3480156101c457600080fd5b506100ea6101d3366004611a0b565b6109b4565b3480156101e457600080fd5b506101626101f3366004611a81565b610a2c565b34801561020457600080fd5b5061020d610b17565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f7565b34801561023e57600080fd5b5061016261024d366004611762565b610b54565b34801561025e57600080fd5b506100ea61026d366004611b72565b610bcd565b34801561027e57600080fd5b506040805160208101909152600081526100ea565b6040517f1cd64df400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152600160248201526060903090631cd64df490604401602060405180830381865afa158015610307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032b9190611c62565b610361576040517f14bc6d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838060200190518101906103779190611c84565b9050610384818887610be0565b6103a233826040015183608001518861039d9190611d29565b610e1e565b5095945050505050565b61041d604051806101000160405280600081526020016000801916815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600065ffffffffffff168152602001600065ffffffffffff168152602001606081525090565b610425610f56565b6040805161010081018252600383018054825260048401546020830152600584015492820192909252600683015473ffffffffffffffffffffffffffffffffffffffff16606082015260078301546080820152600883015465ffffffffffff80821660a084015266010000000000009091041660c08201526009909201805460e0840191906104b390611d46565b80601f01602080910402602001604051908101604052809291908181526020018280546104df90611d46565b801561052c5780601f106105015761010080835404028352916020019161052c565b820191906000526020600020905b81548152906001019060200180831161050f57829003601f168201915b505050505081525050905090565b6040805173ffffffffffffffffffffffffffffffffffffffff83166020820152606091015b6040516020818303038152906040529050919050565b600061058382840184611762565b905060405180602001604052808273ffffffffffffffffffffffffffffffffffffffff168152506105b2610f56565b9051600290910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055505050565b60606000828060200190518101906106189190611d99565b90506106338685836000015184602001518560400151610f65565b8051602082015161064a91339161039d9088611d29565b50949350505050565b6106876040518060a00160405280600015158152602001606081526020016060815260200160608152602001606081525090565b6040805160028082526060820190925290816020015b60408051602081019091526000815281526020019060019003908161069d575050606082015260408051600480825260a0820190925290602082015b60408051808201909152600080825260208201528152602001906001900390816106d9575050608082015260408051602081019091527f765e80930000000000000000000000000000000000000000000000000000000081526060820151805160009061074857610748611e74565b60200260200101819052506040518060200160405280630daf932860e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815250816060015160018151811061079f5761079f611e74565b6020026020010181905250604051806040016040528063cea943ee60e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001600081525081608001516000815181106107fd576107fd611e74565b6020026020010181905250604051806040016040528063d29a362860e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020016002815250816080015160018151811061085b5761085b611e74565b602002602001018190525060405180604001604052806330a63e1160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001600081525081608001516002815181106108b9576108b9611e74565b6020026020010181905250604051806040016040528063ac0c12f460e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020016001815250816080015160038151811061091757610917611e74565b6020908102919091010152604080516001808252818301909252908160200160208202803683375050506020820181905280517f80ac58cd00000000000000000000000000000000000000000000000000000000919060009061097c5761097c611e74565b7fffffffff00000000000000000000000000000000000000000000000000000000909216602092830291909101909101526001815290565b60608160405160200161055f9190600060c08201905065ffffffffffff835116825265ffffffffffff602084015116602083015273ffffffffffffffffffffffffffffffffffffffff6040840151166040830152606083015160608301526080830151608083015260a083015160a083015292915050565b80610a35610f56565b8151600382019081556020830151600483015560408301516005830155606083015160068301805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff00000000000000000000000000000000000000009092169190911790556080830151600783015560a083015160088301805460c086015165ffffffffffff9081166601000000000000027fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090921693169290921791909117905560e0830151909160090190610b119082611ef1565b50505050565b600080610b22610f56565b60408051602081019091526002919091015473ffffffffffffffffffffffffffffffffffffffff169081905292915050565b60405180602001604052808273ffffffffffffffffffffffffffffffffffffffff16815250610b81610f56565b9051600290910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905550565b60608160405160200161055f9190611fec565b825165ffffffffffff16421080610c03575042836020015165ffffffffffff1611155b15610c3a576040517fa04a11a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c42610f56565b60a08401516000908152602091909152604090205460ff1615610c91576040517f249394ec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c99610f56565b60030154811115610cd6576040517faf9ef11500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8260600151610ce3610f56565b73ffffffffffffffffffffffffffffffffffffffff841660009081526001919091016020526040902054610d179083612062565b1115610d4f576040517fb390ab3900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001610d59610f56565b60a085015160009081526020919091526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905580610da3610f56565b6003018054600090610db6908490612075565b90915550819050610dc5610f56565b60010160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e149190612062565b9091555050505050565b80600003610e63573415610e5e576040517f3de5a9a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6000610e6d610f56565b60408051602081019091526002919091015473ffffffffffffffffffffffffffffffffffffffff908116825290915083167fffffffffffffffffffffffff111111111111111111111111111111111111111201610f0e57813414610efd576040517f3de5a9a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051610f09908361133a565b610b11565b3415610f46576040517f3de5a9a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610b118385836000015185611356565b6000610f606113b3565b905090565b6000610f6f610f56565b6040805161010081018252600383018054825260048401546020830152600584015492820192909252600683015473ffffffffffffffffffffffffffffffffffffffff16606082015260078301546080820152600883015465ffffffffffff80821660a084015266010000000000009091041660c08201526009909201805460e084019190610ffd90611d46565b80601f016020809104026020016040519081016040528092919081815260200182805461102990611d46565b80156110765780601f1061104b57610100808354040283529160200191611076565b820191906000526020600020905b81548152906001019060200180831161105957829003601f168201915b50505050508152505090508060a0015165ffffffffffff164210806110a75750428160c0015165ffffffffffff1611155b156110de576040517fe106319b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806060015173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580611121575080604001518314155b15611158576040517ffb10278300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051851115611193576040517faf9ef11500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80608001516111a0610f56565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260019190910160205260409020546111d49087612062565b111561120c576040517fb390ab3900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6020810151156112b35760006112788383602001518960405160200161125d919060609190911b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016815260140190565b60405160208183030381529060405280519060200120611433565b9050806112b1576040517ffdc4d9fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b846112bc610f56565b60030180546000906112cf908490612075565b909155508590506112de610f56565b60010160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461132d9190612062565b9091555050505050505050565b60003860003884865af16101b45763b12d13eb6000526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c52602060006064601c6000895af13d1560016000511417166113a557637939f4246000526004601cfd5b600060605260405250505050565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0061140260017f063f5c9930ebcb24c6e9f871c5cf07f8107734a7831d2d366df33bb963835137612075565b60405160200161141491815260200190565b60408051601f1981840301815291905280516020909101201692915050565b600083511561146e5760208401845160051b81015b8151841160051b9384528151602094851852604060002093909101908082106114485750505b5014919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461149757600080fd5b50565b80356114a581611475565b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156114fc576114fc6114aa565b60405290565b604051610100810167ffffffffffffffff811182821017156114fc576114fc6114aa565b6040516060810167ffffffffffffffff811182821017156114fc576114fc6114aa565b604051601f8201601f1916810167ffffffffffffffff81118282101715611572576115726114aa565b604052919050565b600082601f83011261158b57600080fd5b81356020830160008067ffffffffffffffff8411156115ac576115ac6114aa565b50601f8301601f19166020016115c181611549565b9150508281528583830111156115d657600080fd5b82826020830137600092810160200192909252509392505050565b600080600080600060a0868803121561160957600080fd5b853561161481611475565b94506020860135935060408601359250606086013567ffffffffffffffff81111561163e57600080fd5b61164a8882890161157a565b925050608086013561165b81611475565b809150509295509295909350565b6000815180845260005b8181101561168f57602081850181015186830182015201611673565b506000602082860101526020601f19601f83011685010191505092915050565b6020815260006116c26020830184611669565b9392505050565b6020815281516020820152602082015160408201526040820151606082015273ffffffffffffffffffffffffffffffffffffffff6060830151166080820152608082015160a082015265ffffffffffff60a08301511660c0820152600060c083015161173f60e084018265ffffffffffff169052565b5060e08301516101008084015261175a610120840182611669565b949350505050565b60006020828403121561177457600080fd5b81356116c281611475565b6000806020838503121561179257600080fd5b823567ffffffffffffffff8111156117a957600080fd5b8301601f810185136117ba57600080fd5b803567ffffffffffffffff8111156117d157600080fd5b8560208284010111156117e357600080fd5b6020919091019590945092505050565b6000806000806080858703121561180957600080fd5b843561181481611475565b93506020850135925060408501359150606085013567ffffffffffffffff81111561183e57600080fd5b61184a8782880161157a565b91505092959194509250565b600081518084526020840193506020830160005b828110156118aa5781517fffffffff000000000000000000000000000000000000000000000000000000001686526020958601959091019060010161186a565b5093949350505050565b600081518084526020840193506020830160005b828110156118aa57815180517fffffffff0000000000000000000000000000000000000000000000000000000016875260209081015181880152604090960195909101906001016118c8565b602081528151151560208201526000602083015160a0604084015261193c60c0840182611856565b90506040840151601f198483030160608501526119598282611856565b6060860151858203601f19016080870152805180835260209182019450600093509101905b808310156119c4577fffffffff0000000000000000000000000000000000000000000000000000000084515116825260208201915060208401935060018301925061197e565b5060808601519250601f198582030160a08601526119e281846118b4565b9695505050505050565b65ffffffffffff8116811461149757600080fd5b80356114a5816119ec565b600060c0828403128015611a1e57600080fd5b50611a276114d9565b8235611a32816119ec565b81526020830135611a42816119ec565b60208201526040830135611a5581611475565b6040820152606083810135908201526080808401359082015260a0928301359281019290925250919050565b600060208284031215611a9357600080fd5b813567ffffffffffffffff811115611aaa57600080fd5b82016101008185031215611abd57600080fd5b611ac5611502565b813581526020808301359082015260408083013590820152611ae96060830161149a565b606082015260808281013590820152611b0460a08301611a00565b60a0820152611b1560c08301611a00565b60c082015260e082013567ffffffffffffffff811115611b3457600080fd5b611b408682850161157a565b60e083015250949350505050565b600067ffffffffffffffff821115611b6857611b686114aa565b5060051b60200190565b600060208284031215611b8457600080fd5b813567ffffffffffffffff811115611b9b57600080fd5b820160608185031215611bad57600080fd5b611bb5611526565b8135611bc081611475565b815260208281013590820152604082013567ffffffffffffffff811115611be657600080fd5b80830192505084601f830112611bfb57600080fd5b8135611c0e611c0982611b4e565b611549565b8082825260208201915060208360051b860101925087831115611c3057600080fd5b6020850194505b82851015611c52578435825260209485019490910190611c37565b6040840152509095945050505050565b600060208284031215611c7457600080fd5b815180151581146116c257600080fd5b600060c0828403128015611c9757600080fd5b50611ca06114d9565b8251611cab816119ec565b81526020830151611cbb816119ec565b60208201526040830151611cce81611475565b6040820152606083810151908201526080808401519082015260a0928301519281019290925250919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082028115828204841417611d4057611d40611cfa565b92915050565b600181811c90821680611d5a57607f821691505b602082108103611d93577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215611dab57600080fd5b815167ffffffffffffffff811115611dc257600080fd5b820160608185031215611dd457600080fd5b611ddc611526565b8151611de781611475565b815260208281015190820152604082015167ffffffffffffffff811115611e0d57600080fd5b80830192505084601f830112611e2257600080fd5b8151611e30611c0982611b4e565b8082825260208201915060208360051b860101925087831115611e5257600080fd5b6020850194505b82851015611c52578451825260209485019490910190611e59565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b601f821115610e5e57806000526020600020601f840160051c81016020851015611eca5750805b601f840160051c820191505b81811015611eea5760008155600101611ed6565b5050505050565b815167ffffffffffffffff811115611f0b57611f0b6114aa565b611f1f81611f198454611d46565b84611ea3565b6020601f821160018114611f715760008315611f3b5750848201515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600385901b1c1916600184901b178455611eea565b600084815260208120601f198516915b82811015611fa15787850151825560209485019460019092019101611f81565b5084821015611fdd57868401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b60f8161c191681555b50505050600190811b01905550565b6020815260006080820173ffffffffffffffffffffffffffffffffffffffff845116602084015260208401516040840152604084015160608085015281815180845260a086019150602083019350600092505b808310156103a2578351825260208201915060208401935060018301925061203f565b80820180821115611d4057611d40611cfa565b81810381811115611d4057611d40611cfa56fea264697066735822122072ff0d9827fc623ac87f962c693f8ab29ba0007361fe554301b6577dd2726eb364736f6c634300081a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.