Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 9,001 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 19618634 | 78 days ago | IN | 0 ETH | 0.00180992 | ||||
Buy Open Phase | 19558530 | 86 days ago | IN | 0.2 ETH | 0.0004879 | ||||
Buy With Allowed... | 19551238 | 87 days ago | IN | 0.04 ETH | 0.00077992 | ||||
Buy With Allowed... | 19551238 | 87 days ago | IN | 0.04 ETH | 0.00080104 | ||||
Set Open Phase A... | 19541316 | 89 days ago | IN | 0 ETH | 0.00153557 | ||||
Set Open Phase A... | 19541188 | 89 days ago | IN | 0 ETH | 0.0016974 | ||||
Buy Open Phase | 19536417 | 89 days ago | IN | 0.1 ETH | 0.00073023 | ||||
Buy Open Phase | 19535975 | 89 days ago | IN | 0.1 ETH | 0.00077913 | ||||
Buy Open Phase | 19532777 | 90 days ago | IN | 2.5 ETH | 0.00153069 | ||||
Buy Open Phase | 19532774 | 90 days ago | IN | 2.5 ETH | 0.00148424 | ||||
Buy Open Phase | 19532769 | 90 days ago | IN | 0.25 ETH | 0.00118832 | ||||
Buy Open Phase | 19532769 | 90 days ago | IN | 0.4 ETH | 0.00118832 | ||||
Buy Open Phase | 19532767 | 90 days ago | IN | 0.05 ETH | 0.00122057 | ||||
Buy Open Phase | 19532765 | 90 days ago | IN | 0.1 ETH | 0.00302331 | ||||
Buy Open Phase | 19532765 | 90 days ago | IN | 2.5 ETH | 0.00302331 | ||||
Buy Open Phase | 19532765 | 90 days ago | IN | 0.15 ETH | 0.00302331 | ||||
Buy Open Phase | 19532765 | 90 days ago | IN | 1.5 ETH | 0.00302331 | ||||
Buy Open Phase | 19532765 | 90 days ago | IN | 0.25 ETH | 0.00318149 | ||||
Buy Open Phase | 19532764 | 90 days ago | IN | 0.3 ETH | 0.00245876 | ||||
Buy Open Phase | 19532764 | 90 days ago | IN | 0.2 ETH | 0.003132 | ||||
Buy Open Phase | 19532764 | 90 days ago | IN | 0.05 ETH | 0.00313213 | ||||
Buy Open Phase | 19532764 | 90 days ago | IN | 0.05 ETH | 0.00313919 | ||||
Buy Open Phase | 19532763 | 90 days ago | IN | 0.25 ETH | 0.00297381 | ||||
Buy Open Phase | 19532763 | 90 days ago | IN | 0.2 ETH | 0.00233448 | ||||
Buy Open Phase | 19532763 | 90 days ago | IN | 0.1 ETH | 0.00297396 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
19532765 | 90 days ago | 0.1 ETH | ||||
19532765 | 90 days ago | 2.5 ETH | ||||
19532765 | 90 days ago | 0.15 ETH | ||||
19532765 | 90 days ago | 1.5 ETH | ||||
19532765 | 90 days ago | 0.25 ETH | ||||
19532764 | 90 days ago | 0.3 ETH | ||||
19532764 | 90 days ago | 0.2 ETH | ||||
19532764 | 90 days ago | 0.05 ETH | ||||
19532764 | 90 days ago | 0.05 ETH | ||||
19532763 | 90 days ago | 0.25 ETH | ||||
19532763 | 90 days ago | 0.2 ETH | ||||
19532763 | 90 days ago | 0.1 ETH | ||||
19532763 | 90 days ago | 0.15 ETH | ||||
19532762 | 90 days ago | 2.15 ETH | ||||
19532762 | 90 days ago | 0.55 ETH | ||||
19532762 | 90 days ago | 2.5 ETH | ||||
19532762 | 90 days ago | 0.75 ETH | ||||
19532761 | 90 days ago | 1.5 ETH | ||||
19532761 | 90 days ago | 0.15 ETH | ||||
19532760 | 90 days ago | 2.5 ETH | ||||
19532760 | 90 days ago | 0.1 ETH | ||||
19532760 | 90 days ago | 0.05 ETH | ||||
19532760 | 90 days ago | 2.5 ETH | ||||
19532760 | 90 days ago | 0.1 ETH | ||||
19532759 | 90 days ago | 0.05 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Presale
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 10000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.24; import {MerkleProof} from "lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol"; import {ECDSA} from "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol"; import {MessageHashUtils} from "lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol"; import {IERC721} from "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol"; import {ReentrancyGuard} from "lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol"; import {Ownable2Step, Ownable} from "lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol"; import {Pausable} from "lib/openzeppelin-contracts/contracts/utils/Pausable.sol"; import {IDelegationRegistry} from "src/lib/IDelegationRegistry.sol"; import {IDelegateRegistry} from "lib/delegate-registry/src/IDelegateRegistry.sol"; /// @title Presale /// @notice Block Games presale contract /// @author karooolis contract Presale is Ownable2Step, Pausable, ReentrancyGuard { /*============================================================== CONSTANTS & IMMUTABLES ==============================================================*/ /// @notice Event emitted when the merkle root for the allowed wallets is set bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(uint256 chainId,address verifyingContract)"); /// @notice Event emitted when the merkle root for the allowed wallets is set bytes32 public immutable cachedDomainSeparator; /// @notice Chain ID of the contract uint256 public immutable cachedChainId; // @notice Address of the contract address public immutable cachedThis; /// @notice Address of the Dice NFT address public immutable diceNFT; /// @notice Address of the wallet that will receive the funds address public immutable treasury; /// @notice Address of the delegate registry v1 IDelegationRegistry public immutable delegateRegistryV1; /// @notice Address of the delegate registry v2 IDelegateRegistry public immutable delegateRegistryV2; /*============================================================== STRUCTS ==============================================================*/ struct BuyWithDiceNFTParams { bytes32[] proof; uint256 tokenId; uint256 amount; uint256 maxAmount; } struct BuyWithAllowedNFTParams { bytes32[] proof; address collection; uint256 tokenId; uint256 amount; uint256 maxAmount; } struct AllowedWalletParams { bytes32[] proof; uint256 amount; uint256 maxAmount; } /*============================================================== STORAGE VARIABLES ==============================================================*/ enum Phase { Guaranteed, Lucky, Open } /// @notice Merkle root for the allowed wallets, and their caps (wallet + ETH amount) bytes32 public allowedWalletsMerkleRoot; /// @notice Merkle root for the Dice NFTs, and their caps (tokenId + ETH amount) bytes32 public diceNFTsMerkleRoot; /// @notice Merkle root for the allowed NFT collections, and their caps (collection + ETH amount) bytes32 public allowedNFTsMerkleRoot; /// @notice Merkle root for Open phase alocations (wallet + ETH amount + tokens amount) bytes32 public openPhaseAllocationsMerkleRoot; /// @notice Merkle root for Dice NFT eligible tokens (tokenId + tokens amount) bytes32 public diceNFTsTokensEligibleMerkleRoot; /// @notice Guaranteed allocation (ETH) uint256 public guaranteedAllocation; /// @notice Lucky allocation for each Lucky Tier 1 (ETH) uint256 public luckyAllocationTier1; /// @notice Lucky allocation for each Lucky Tier 2 (ETH) uint256 public luckyAllocationTier2; /// @notice Lucky allocation for each Lucky Tier 3 (ETH) uint256 public luckyAllocationTier3; /// @notice Signer of lucky signatures address public luckySigner; /// @notice Guaranteed phase start uint256 public guaranteedStart; /// @notice Guaranteed phase end uint256 public guaranteedEnd; /// @notice Lucky phase start uint256 public luckyStart; /// @notice Lucky phase end uint256 public luckyEnd; /// @notice Open phase start uint256 public openStart; /// @notice Open phase end uint256 public openEnd; /// @notice Wallet cap for the Open phase uint256 public openPhaseWalletCap; /// @notice Contribution step for the Open phase uint256 public openPhaseContributionStep; /// @notice Guaranteed phase exchange rate uint256 public guaranteedExchangeRate; /// @notice Lucky phase Tier 1 exchange rate uint256 public luckyExchangeRate1; /// @notice Lucky phase Tier 2 exchange rate uint256 public luckyExchangeRate2; /// @notice Lucky phase Tier 3 exchange rate uint256 public luckyExchangeRate3; /// @notice Guaranteed phase raised ETH uint256 public guaranteedRaisedETH; /// @notice Lucky phase raised ETH uint256 public luckyRaisedETH; /// @notice Open phase raised ETH uint256 public openRaisedETH; /// @notice Contributed ETH in allowed NFTs (tokenId => amount) mapping(uint256 => uint256) public diceNFTContributed; /// @notice Contributed in allowed wallets (wallet => amount) mapping(address => uint256) public allowedWalletContributed; /// @notice Contributed in allowed NFTs (collection => (tokenId => amount) mapping(address => mapping(uint256 => uint256)) public allowedNFTContributed; /// @notice Contributed in Lucky phase (wallet => amount) mapping(address => uint256) public luckyPhaseContributed; /// @notice Contributed in Lucky phase with signature (signature => amount) mapping(bytes => uint256) public raffleTicketContributed; /// @notice Contributed in Open phase (wallet => amount) mapping(address => uint256) public openPhaseContributed; /// @notice Tokens vestable after contribution (wallet => amount) mapping(address => uint256) public tokensEligible; /*============================================================== MODIFIERS ==============================================================*/ /// @notice Modifier to check if the phase is active /// @param _phase The phase to check modifier phaseGuard(Phase _phase) { bool isPhaseActive = isPhaseActive(_phase); if (!isPhaseActive) { revert PhaseNotActive(_phase); } _; } /// @notice Check if the presale has not started modifier onlyBeforePresale() { if ( (guaranteedStart != 0 && block.timestamp > guaranteedStart) || (luckyStart != 0 && block.timestamp > luckyStart) || (openStart != 0 && block.timestamp > openStart) ) { revert OnlyBeforePresale(); } _; } /// @notice Check if the presale has ended modifier onlyAfterPresale() { if ( (guaranteedEnd != 0 && block.timestamp < guaranteedEnd) || (luckyEnd != 0 && block.timestamp < luckyEnd) || (openEnd != 0 && block.timestamp < openEnd) ) { revert OnlyAfterPresale(); } _; } /*============================================================== FUNCTIONS ==============================================================*/ /// @param _diceNFT Address of the Dice NFT /// @param _treasury Address of the wallet that will receive the funds /// @param _initialOwner Address of the initial owner /// @param _delegateRegistryV1 Address of the delegate registry v1 /// @param _delegateRegistryV2 Address of the delegate registry v2 constructor( address _diceNFT, address _treasury, address _initialOwner, address _delegateRegistryV1, address _delegateRegistryV2 ) Ownable(_initialOwner) { diceNFT = _diceNFT; treasury = _treasury; delegateRegistryV1 = IDelegationRegistry(_delegateRegistryV1); delegateRegistryV2 = IDelegateRegistry(_delegateRegistryV2); // Domain separator for EIP-712 cachedChainId = block.chainid; cachedDomainSeparator = _constructDomainSeparator(); cachedThis = address(this); } /// @notice Buy tokens with Dice NFTs /// @dev This function allows users to buy tokens with Dice NFTs during the guaranteed phase /// @param _params Array of BuyWithDiceNFTParams function buyWithDiceNFTs(BuyWithDiceNFTParams[] calldata _params) public payable { uint256 ethContributed; for (uint256 i = 0; i < _params.length; i++) { _buyWithDiceNFT(_params[i].amount, _params[i].proof, _params[i].tokenId, _params[i].maxAmount); ethContributed += _params[i].amount; } if (ethContributed != msg.value) { revert ContributionAmountMismatch(); } } /// @notice Buy tokens with a Dice NFT /// @dev This function allows users to buy tokens with a Dice NFT during the guaranteed phase /// @param _proof Merkle proof /// @param _tokenId ID of the NFT /// @param _maxAmount Maximum amount of ETH that can be contributed function buyWithDiceNFT(bytes32[] calldata _proof, uint256 _tokenId, uint256 _maxAmount) external payable { _buyWithDiceNFT(msg.value, _proof, _tokenId, _maxAmount); } /// @notice Buy tokens with an allowlisted wallet /// @dev This function relies on the merkle proof to verify the caller's eligibility /// @param _proof Merkle proof /// @param _maxAmount Maximum amount of ETH that can be contributed function buyWithAllowedWallet(bytes32[] calldata _proof, uint256 _maxAmount) external payable { _buyWithAllowedWallet(msg.value, _proof, _maxAmount); } /// @notice Buy tokens with an allowlisted wallet /// @param _params AllowedWalletParams function buyWithAllowedNFTs(BuyWithAllowedNFTParams[] calldata _params) external payable { uint256 ethContributed; for (uint256 i = 0; i < _params.length; i++) { _buyWithAllowedNFT( _params[i].amount, _params[i].proof, _params[i].collection, _params[i].tokenId, _params[i].maxAmount ); ethContributed += _params[i].amount; } if (ethContributed != msg.value) { revert ContributionAmountMismatch(); } } /// @notice Buy tokens with an allowlisted NFT /// @dev This function allows users to buy tokens with an allowlisted NFT /// @param _proof Merkle proof /// @param _collection Address of the NFT collection /// @param _tokenId ID of the NFT /// @param _maxAmount Maximum amount of ETH that can be contributed function buyWithAllowedNFT(bytes32[] calldata _proof, address _collection, uint256 _tokenId, uint256 _maxAmount) external payable { _buyWithAllowedNFT(msg.value, _proof, _collection, _tokenId, _maxAmount); } /// @notice Buy tokens in the Lucky phase /// @dev This function uses a signature to verify the maximum investment amount /// @param _maxAmount Maximum amount of ETH that can be contributed /// @param _signature Signature of the maximum amount and the sender's address function buyLuckyTier(uint256 _maxAmount, bytes calldata _signature) external payable { _buyLuckyTier(msg.value, _maxAmount, _signature); } /// @notice Buy tokens in the Open phase function buyOpenPhase() external payable { _buyOpenPhase(msg.value); } /// @notice Buy tokens in all phases /// @param _diceNFTParams Array of BuyWithDiceNFTParams /// @param _allowedNFTParams Array of BuyWithAllowedNFTParams /// @param _allowedWalletParams AllowedWalletParams /// @param _luckyPhaseSignature Signature of the maximum amount and the sender's address /// @param _luckyPhaseAmount Amount of ETH to contribute in the lucky phase /// @param _luckyPhaseMaxAmount Maximum amount of ETH that can be contributed in the lucky phase /// @param _openPhaseAmount Amount of ETH to contribute in the open phase function buyAllPhases( BuyWithDiceNFTParams[] calldata _diceNFTParams, BuyWithAllowedNFTParams[] calldata _allowedNFTParams, AllowedWalletParams calldata _allowedWalletParams, bytes calldata _luckyPhaseSignature, uint256 _luckyPhaseAmount, uint256 _luckyPhaseMaxAmount, uint256 _openPhaseAmount ) external payable { uint256 ethContributed; uint256 diceNFTParamsLength = _diceNFTParams.length; for (uint256 i = 0; i < diceNFTParamsLength; i++) { BuyWithDiceNFTParams memory param = _diceNFTParams[i]; _buyWithDiceNFT(param.amount, _diceNFTParams[i].proof, param.tokenId, param.maxAmount); ethContributed += param.amount; } uint256 allowedNFTParamsLength = _allowedNFTParams.length; for (uint256 i = 0; i < allowedNFTParamsLength; i++) { BuyWithAllowedNFTParams memory param = _allowedNFTParams[i]; _buyWithAllowedNFT( param.amount, _allowedNFTParams[i].proof, param.collection, param.tokenId, param.maxAmount ); ethContributed += param.amount; } if (_allowedWalletParams.proof.length > 0) { _buyWithAllowedWallet( _allowedWalletParams.amount, _allowedWalletParams.proof, _allowedWalletParams.maxAmount ); ethContributed += _allowedWalletParams.amount; } if (_luckyPhaseSignature.length > 0) { _buyLuckyTier(_luckyPhaseAmount, _luckyPhaseMaxAmount, _luckyPhaseSignature); ethContributed += _luckyPhaseAmount; } if (_openPhaseAmount > 0) { _buyOpenPhase(_openPhaseAmount); ethContributed += _openPhaseAmount; } if (ethContributed != msg.value) { revert ContributionAmountMismatch(); } } /*============================================================== VIEW FUNCTIONS ==============================================================*/ /// @notice Calculate the amount of tokens for a given amount and phase /// @param _amount Amount of ETH to calculate tokens for /// @param _phase Phase to calculate tokens for function calculateTokens(uint256 _amount, Phase _phase) public view returns (uint256 tokens) { if (_phase == Phase.Guaranteed) { tokens = _amount * guaranteedExchangeRate; } else { uint256 remainingETH = _amount; uint256 luckyRaisedETH_ = luckyRaisedETH; uint256 tier1Space = luckyAllocationTier1 > luckyRaisedETH_ ? luckyAllocationTier1 - luckyRaisedETH_ : 0; if (tier1Space > 0) { uint256 tier1ETH = remainingETH > tier1Space ? tier1Space : remainingETH; tokens = tier1ETH * luckyExchangeRate1; remainingETH -= tier1ETH; luckyRaisedETH_ += tier1Space; } if (remainingETH > 0) { uint256 tier2Space = luckyAllocationTier1 + luckyAllocationTier2 > luckyRaisedETH_ ? luckyAllocationTier1 + luckyAllocationTier2 - luckyRaisedETH_ : 0; if (tier2Space > 0) { uint256 tier2ETH = remainingETH > tier2Space ? tier2Space : remainingETH; tokens += tier2ETH * luckyExchangeRate2; remainingETH -= tier2ETH; } } if (remainingETH > 0) { tokens += remainingETH * luckyExchangeRate3; } } } /// @notice Check if a phase is active /// @param _phase Phase to check /// @return bool function isPhaseActive(Phase _phase) public view returns (bool) { if (_phase == Phase.Guaranteed) { if ( guaranteedRaisedETH > guaranteedAllocation || (block.timestamp < guaranteedStart || block.timestamp > guaranteedEnd) ) { return false; } } else if (_phase == Phase.Lucky) { if ( luckyRaisedETH > luckyAllocationTier1 + luckyAllocationTier2 + luckyAllocationTier3 || (block.timestamp < luckyStart || block.timestamp > luckyEnd) ) { return false; } } else if (_phase == Phase.Open) { if (block.timestamp < openStart || block.timestamp > openEnd) { return false; } } return true; } /*============================================================== ADMIN FUNCTIONS ==============================================================*/ /// @notice Set the merkle root for the allowed wallets /// @param _allowedWalletsMerkleRoot Merkle root for the allowed wallets function setAllowedWalletsMerkleRoot(bytes32 _allowedWalletsMerkleRoot) external onlyOwner onlyBeforePresale { allowedWalletsMerkleRoot = _allowedWalletsMerkleRoot; emit AllowedWalletsMerkleRootSet(_allowedWalletsMerkleRoot); } /// @notice Set the merkle root for the Dice NFTs /// @param _diceNFTsMerkleRoot Merkle root for the Dice NFTs function setDiceNFTsMerkleRoot(bytes32 _diceNFTsMerkleRoot) external onlyOwner onlyBeforePresale { diceNFTsMerkleRoot = _diceNFTsMerkleRoot; emit DiceNFTsMerkleRootSet(_diceNFTsMerkleRoot); } /// @notice Set the merkle root for the allowed NFTs /// @param _allowedNFTsMerkleRoot Merkle root for the allowed NFTs function setAllowedNFTsMerkleRoot(bytes32 _allowedNFTsMerkleRoot) external onlyOwner onlyBeforePresale { allowedNFTsMerkleRoot = _allowedNFTsMerkleRoot; emit AllowedNFTsMerkleRootSet(_allowedNFTsMerkleRoot); } /// @notice Set the merkle root for the Open phase allocations /// @param _openPhaseAllocationsMerkleRoot Merkle root for the Open phase allocations function setOpenPhaseAllocationsMerkleRoot(bytes32 _openPhaseAllocationsMerkleRoot) external onlyOwner onlyAfterPresale { openPhaseAllocationsMerkleRoot = _openPhaseAllocationsMerkleRoot; emit OpenPhaseAllocationsMerkleRootSet(_openPhaseAllocationsMerkleRoot); } /// @notice Sets the merkle root for the Dice NFTs tokens eligible /// @param _diceNFTsTokensEligibleMerkleRoot Merkle root for the Dice NFTs tokens eligible function setDiceNFTsTokensEligibleMerkleRoot(bytes32 _diceNFTsTokensEligibleMerkleRoot) external onlyOwner onlyAfterPresale { diceNFTsTokensEligibleMerkleRoot = _diceNFTsTokensEligibleMerkleRoot; emit DiceNFTsTokensEligibleMerkleRootSet(_diceNFTsTokensEligibleMerkleRoot); } /// @notice Set guaranteed phase start, end and allocation /// @param _guaranteedStart Start time of the guaranteed phase /// @param _guaranteedEnd End time of the guaranteed phase /// @param _guaranteedAllocation Allocation for the guaranteed phase function setGuaranteedPhase(uint256 _guaranteedStart, uint256 _guaranteedEnd, uint256 _guaranteedAllocation) external onlyOwner onlyBeforePresale { guaranteedStart = _guaranteedStart; guaranteedEnd = _guaranteedEnd; guaranteedAllocation = _guaranteedAllocation; emit GuaranteedPhaseSet(guaranteedStart, guaranteedEnd, guaranteedAllocation); } /// @notice Set Lucky phase start, end, allocations per tier, and wallet cap /// @param _luckyStart Start time of the Lucky phase /// @param _luckyEnd End time of the Lucky phase /// @param _luckyAllocationTier1 Allocation for the first lucky tier1 /// @param _luckyAllocationTier2 Allocation for the second lucky tier2 /// @param _luckyAllocationTier3 Allocation for the third lucky tier3 /// @param _luckySigner Signer of lucky signatures function setLuckyPhase( uint256 _luckyStart, uint256 _luckyEnd, uint256 _luckyAllocationTier1, uint256 _luckyAllocationTier2, uint256 _luckyAllocationTier3, address _luckySigner ) external onlyOwner onlyBeforePresale { luckyStart = _luckyStart; luckyEnd = _luckyEnd; luckyAllocationTier1 = _luckyAllocationTier1; luckyAllocationTier2 = _luckyAllocationTier2; luckyAllocationTier3 = _luckyAllocationTier3; luckySigner = _luckySigner; emit LuckyPhaseSet( _luckyStart, _luckyEnd, _luckyAllocationTier1, _luckyAllocationTier2, _luckyAllocationTier3, _luckySigner ); } /// @notice Set Open phase start, end and allocation /// @param _openStart Start time of the open phase /// @param _openEnd End time of the open phase function setOpenPhase( uint256 _openStart, uint256 _openEnd, uint256 _openPhaseWalletCap, uint256 _openPhaseContributionStep ) external onlyOwner onlyBeforePresale { openStart = _openStart; openEnd = _openEnd; openPhaseWalletCap = _openPhaseWalletCap; openPhaseContributionStep = _openPhaseContributionStep; emit OpenPhaseSet(_openStart, _openEnd, _openPhaseWalletCap, _openPhaseContributionStep); } /// @notice Set the exchange rates for each phase /// @param _guaranteedExchangeRate Exchange rate for the guaranteed phase /// @param _luckyExchangeRate1 Exchange rate for the first lucky phase /// @param _luckyExchangeRate2 Exchange rate for the second lucky phase /// @param _luckyExchangeRate3 Exchange rate for the third lucky phase function setExchangeRates( uint256 _guaranteedExchangeRate, uint256 _luckyExchangeRate1, uint256 _luckyExchangeRate2, uint256 _luckyExchangeRate3 ) external onlyOwner onlyBeforePresale { guaranteedExchangeRate = _guaranteedExchangeRate; luckyExchangeRate1 = _luckyExchangeRate1; luckyExchangeRate2 = _luckyExchangeRate2; luckyExchangeRate3 = _luckyExchangeRate3; emit ExchangeRatesSet(_guaranteedExchangeRate, _luckyExchangeRate1, _luckyExchangeRate2, _luckyExchangeRate3); } /// @notice Pause the purchase functions, only owner can call this function function pause() external onlyOwner { _pause(); } /// @notice Unpause the purchase functions, only owner can call this function function unpause() external onlyOwner { _unpause(); } /*============================================================== INTERNAL FUNCTIONS ==============================================================*/ function _buyWithDiceNFT(uint256 _amount, bytes32[] calldata _proof, uint256 _tokenId, uint256 _maxAmount) internal nonReentrant whenNotPaused phaseGuard(Phase.Guaranteed) { _verifyTokenOwner(diceNFT, _tokenId); _verifyDiceNFTProof(_proof, _tokenId, _maxAmount); // check if contribution cap is not exceeded if (diceNFTContributed[_tokenId] + _amount > _maxAmount) { revert ExceededDiceNFTCap(_tokenId); } // check if total contribution cap is not exceeded if (guaranteedRaisedETH + _amount > guaranteedAllocation) { revert ExceededGuaranteedAllocation(); } // update contributed amount, tokens eligible & total sold uint256 tokensAmount = calculateTokens(_amount, Phase.Guaranteed); tokensEligible[msg.sender] += tokensAmount; diceNFTContributed[_tokenId] += _amount; guaranteedRaisedETH += _amount; // transfer ETH to receiver wallet (bool success,) = treasury.call{value: _amount}(""); if (!success) { revert TransferFailed(treasury, _amount); } emit ContributedDiceNFT(msg.sender, _amount, tokensAmount, _tokenId); } /// @notice Buy tokens with an allowlisted NFT /// @param _amount Amount of ETH to contribute /// @param _proof Merkle proof /// @param _collection Address of the NFT collection /// @param _tokenId ID of the NFT /// @param _maxAmount Maximum amount of ETH that can be contributed function _buyWithAllowedNFT( uint256 _amount, bytes32[] calldata _proof, address _collection, uint256 _tokenId, uint256 _maxAmount ) internal nonReentrant whenNotPaused phaseGuard(Phase.Guaranteed) { _verifyTokenOwner(_collection, _tokenId); _verifyAllowedNFTProof(_proof, _collection, _maxAmount); // check if total contribution cap is not exceeded if (guaranteedRaisedETH + _amount > guaranteedAllocation) { revert ExceededGuaranteedAllocation(); } // check if NFT cap is not exceeded if (allowedNFTContributed[_collection][_tokenId] + _amount > _maxAmount) { revert ExceededNFTCap(_collection, _tokenId); } // update contributed amount, tokens eligible & total sold uint256 tokensAmount = calculateTokens(_amount, Phase.Guaranteed); tokensEligible[msg.sender] += tokensAmount; allowedNFTContributed[_collection][_tokenId] += _amount; guaranteedRaisedETH += _amount; // transfer ETH to receiver wallet (bool success,) = treasury.call{value: _amount}(""); if (!success) { revert TransferFailed(treasury, _amount); } emit ContributedAllowedNFT(msg.sender, _amount, tokensAmount, _collection, _tokenId); } /// @notice Buy tokens with an allowlisted wallet /// @param _amount Amount of ETH to contribute /// @param _proof Merkle proof /// @param _maxAmount Maximum amount of ETH that can be contributed function _buyWithAllowedWallet(uint256 _amount, bytes32[] calldata _proof, uint256 _maxAmount) internal nonReentrant whenNotPaused phaseGuard(Phase.Guaranteed) { _verifyAllowedWalletProof(_proof, _maxAmount); // check if contribution cap is not exceeded if (allowedWalletContributed[msg.sender] + _amount > _maxAmount) { revert ExceededAllowedWalletCap(msg.sender); } // check if total contribution cap is not exceeded if (guaranteedRaisedETH + _amount > guaranteedAllocation) { revert ExceededGuaranteedAllocation(); } // Update contributed amount, tokens eligible & total sold uint256 tokensAmount = calculateTokens(_amount, Phase.Guaranteed); tokensEligible[msg.sender] += tokensAmount; allowedWalletContributed[msg.sender] += _amount; guaranteedRaisedETH += _amount; // Transfer ETH to receiver wallet (bool success,) = treasury.call{value: _amount}(""); if (!success) { revert TransferFailed(treasury, _amount); } emit ContributedAllowedWallet(msg.sender, _amount, tokensAmount); } /// @notice Buy tokens in the Lucky phase /// @param _amount Amount of ETH to contribute /// @param _maxAmount Maximum amount of ETH that can be contributed /// @param _signature Signature of the maximum amount and the sender's address function _buyLuckyTier(uint256 _amount, uint256 _maxAmount, bytes calldata _signature) internal nonReentrant whenNotPaused phaseGuard(Phase.Lucky) { _verifyLuckySignature(_maxAmount, _signature); if (raffleTicketContributed[_signature] + _amount > _maxAmount) { revert ExceededRaffleTicketContribution(); } else if (luckyRaisedETH + _amount > luckyAllocationTier1 + luckyAllocationTier2 + luckyAllocationTier3) { revert ExceededLuckyAllocation(); } // update contributed amounts for raffle ticket and per-wallet, tokens eligible & total sold uint256 tokensAmount = calculateTokens(_amount, Phase.Lucky); tokensEligible[msg.sender] += tokensAmount; raffleTicketContributed[_signature] += _amount; luckyPhaseContributed[msg.sender] += _amount; luckyRaisedETH += _amount; // transfer ETH to receiver wallet (bool success,) = treasury.call{value: _amount}(""); if (!success) { revert TransferFailed(treasury, _amount); } emit ContributedLuckyPhase(msg.sender, _amount, tokensAmount); } /// @notice Buy tokens in the Open phase /// @param _amount Amount of ETH to contribute function _buyOpenPhase(uint256 _amount) internal nonReentrant whenNotPaused phaseGuard(Phase.Open) { if (_amount % openPhaseContributionStep != 0) { revert IncorrectContributionStep(); } if (openPhaseContributed[msg.sender] + _amount > openPhaseWalletCap) { revert ExceededOpenPhaseWalletCap(msg.sender); } openPhaseContributed[msg.sender] += _amount; openRaisedETH += _amount; // transfer ETH to receiver wallet (bool success,) = treasury.call{value: _amount}(""); if (!success) { revert TransferFailed(treasury, _amount); } emit ContributedOpenPhase(msg.sender, _amount); } /// @notice Verifies if the sender is the owner of a given token or a valid delegate. /// @param _collection The address of the collection contract. /// @param _tokenId The token ID to verify ownership or delegation for. function _verifyTokenOwner(address _collection, uint256 _tokenId) internal view { address _tokenOwner = IERC721(_collection).ownerOf(_tokenId); // Check sender is owner if (_tokenOwner == msg.sender) { return; } // Check with delegate registry v2 if (delegateRegistryV2.checkDelegateForERC721(msg.sender, _tokenOwner, _collection, _tokenId, "")) { return; } // Check with delegate registry v1 if (delegateRegistryV1.checkDelegateForToken(msg.sender, _tokenOwner, _collection, _tokenId)) { return; } // Revert if not owner or delegate revert NotTokenOwner(_collection, _tokenId); } /// @notice Verify the signature of the maximum amount and the sender's address /// @param _maxAmount Maximum amount of ETH that can be contributed /// @param _signature Signature of the maximum amount and the sender's address function _verifyLuckySignature(uint256 _maxAmount, bytes calldata _signature) internal view { bytes32 signedMessageHash = MessageHashUtils.toEthSignedMessageHash( keccak256(abi.encode(_getDomainSeparator(), _maxAmount, msg.sender)) ); address recoveredOwner = ECDSA.recover(signedMessageHash, _signature); if (recoveredOwner != luckySigner) { revert InvalidSignature(); } } /// @notice Verify the merkle proof /// @param _proof The merkle proof /// @param _maxAmount The amount to verify function _verifyAllowedWalletProof(bytes32[] calldata _proof, uint256 _maxAmount) internal view { bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(msg.sender, _maxAmount)))); if (!MerkleProof.verify(_proof, allowedWalletsMerkleRoot, leaf)) { revert InvalidAllowedWalletProof(); } } /// @notice Verify the merkle proof /// @param _proof The merkle proof /// @param _tokenId The token ID to verify /// @param _maxAmount The amount to verify function _verifyDiceNFTProof(bytes32[] calldata _proof, uint256 _tokenId, uint256 _maxAmount) internal view { bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(_tokenId, _maxAmount)))); if (!MerkleProof.verify(_proof, diceNFTsMerkleRoot, leaf)) { revert InvalidDiceNFTProof(); } } /// @notice Verify the merkle proof /// @param _proof The merkle proof /// @param _collection Collection address /// @param _maxAmount The amount to verify function _verifyAllowedNFTProof(bytes32[] calldata _proof, address _collection, uint256 _maxAmount) internal view { bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(_collection, _maxAmount)))); if (!MerkleProof.verify(_proof, allowedNFTsMerkleRoot, leaf)) { revert InvalidAllowedNFTProof(); } } /// @notice Get the domain separator function _getDomainSeparator() internal view returns (bytes32) { if (address(this) == cachedThis && block.chainid == cachedChainId) { return cachedDomainSeparator; } else { return _constructDomainSeparator(); } } /// @notice Construct the domain separator function _constructDomainSeparator() internal view returns (bytes32) { return keccak256(abi.encode(DOMAIN_TYPEHASH, block.chainid, address(this))); } /*============================================================== EVENTS ==============================================================*/ /// @notice Emitted when the merkle root for the allowed wallets is set /// @param allowedWalletsMerkleRoot The merkle root for the allowed wallets event AllowedWalletsMerkleRootSet(bytes32 indexed allowedWalletsMerkleRoot); /// @notice Emitted when the merkle root for the Dice NFTs is set /// @param diceNFTsMerkleRoot The merkle root for the Dice NFTs event DiceNFTsMerkleRootSet(bytes32 indexed diceNFTsMerkleRoot); /// @notice Emitted when the merkle root for the allowed NFTs is set /// @param allowedNFTsMerkleRoot The merkle root for the allowed NFTs event AllowedNFTsMerkleRootSet(bytes32 indexed allowedNFTsMerkleRoot); /// @notice Emitted when the merkle root for the open phase allocations is set /// @param openPhaseAllocationsMerkleRoot The merkle root for the open phase allocations event OpenPhaseAllocationsMerkleRootSet(bytes32 indexed openPhaseAllocationsMerkleRoot); /// @notice Emitted when the merkle root for the Dice NFTs tokens eligible is set /// @param diceNFTsTokensEligibleMerkleRootSet The merkle root for the Dice NFTs tokens eligible event DiceNFTsTokensEligibleMerkleRootSet(bytes32 indexed diceNFTsTokensEligibleMerkleRootSet); /// @notice Emitted when the exchange rates for each phase are set event ExchangeRatesSet( uint256 guaranteedExchangeRate, uint256 luckyExchangeRate1, uint256 luckyExchangeRate2, uint256 luckyExchangeRate3 ); /// @notice Emitted when the allocations for the guaranteed phase are set /// @param guaranteedStart Start time of the guaranteed phase /// @param guaranteedEnd End time of the guaranteed phase /// @param guaranteedAllocation Allocation for the guaranteed phase event GuaranteedPhaseSet( uint256 indexed guaranteedStart, uint256 indexed guaranteedEnd, uint256 indexed guaranteedAllocation ); /// @notice Emitted when the allocations for the lucky phase are set /// @param luckyStart Start time of the Lucky phase /// @param luckyEnd End time of the Lucky phase /// @param luckyAllocationTier1 Allocation for the first lucky tier1 /// @param luckyAllocationTier2 Allocation for the second lucky tier2 /// @param luckyAllocationTier3 Allocation for the third lucky tier3 /// @param luckySigner Signer of lucky signatures event LuckyPhaseSet( uint256 luckyStart, uint256 luckyEnd, uint256 luckyAllocationTier1, uint256 luckyAllocationTier2, uint256 luckyAllocationTier3, address luckySigner ); /// @notice Emitted when the allocations for the open phase are set /// @param openStart Start time of the Open phase /// @param openEnd End time of the Open phase /// @param openPhaseWalletCap Wallet cap for the Open phase /// @param openPhaseContributionStep Contribution step for the Open phase event OpenPhaseSet( uint256 openStart, uint256 openEnd, uint256 openPhaseWalletCap, uint256 openPhaseContributionStep ); /// @notice Emitted when a contributor buys tokens /// @param contributor The address of the contributor /// @param amount The amount of ETH contributed event Contributed(address indexed contributor, uint256 indexed amount); /// @notice Emitted when a contributor buys tokens with allowed wallet /// @param contributor The address of the contributor /// @param amount The amount of ETH contributed /// @param tokensAmount The amount of tokens contributed event ContributedAllowedWallet(address indexed contributor, uint256 indexed amount, uint256 indexed tokensAmount); /// @notice Emitted when a contributor buys tokens with a Dice NFT /// @param contributor The address of the contributor /// @param amount The amount of ETH contributed /// @param tokensAmount The amount of tokens contributed /// @param tokenId The token ID contributed for event ContributedDiceNFT( address indexed contributor, uint256 indexed amount, uint256 indexed tokensAmount, uint256 tokenId ); /// @notice Emitted when a contributor buys tokens with an allowlisted NFT /// @param contributor The address of the contributor /// @param amount The amount of ETH contributed /// @param tokensAmount The amount of tokens contributed /// @param collection The address of the NFT collection /// @param tokenId The token ID contributed for event ContributedAllowedNFT( address indexed contributor, uint256 indexed amount, uint256 indexed tokensAmount, address collection, uint256 tokenId ); /// @notice Emitted when a contributor buys tokens in the Lucky phase /// @param contributor The address of the contributor /// @param amount The amount of ETH contributed /// @param tokensAmount The amount of tokens contributed event ContributedLuckyPhase(address indexed contributor, uint256 indexed amount, uint256 indexed tokensAmount); /// @notice Emitted when a contributor buys tokens in the Open phase /// @param contributor The address of the contributor /// @param amount The amount of ETH contributed event ContributedOpenPhase(address indexed contributor, uint256 indexed amount); /*============================================================== ERRORS ==============================================================*/ /// @notice Revert if the transfer of funds fails /// @param recipient The address of the recipient /// @param amount The amount of funds refunded error TransferFailed(address recipient, uint256 amount); /// @notice Reverse if the signature is invalid error InvalidSignature(); /// @notice Revert if the merkle proof for allowed wallet is invalid error InvalidAllowedWalletProof(); /// @notice Revert if the merkle proof for Dice NFT is invalid error InvalidDiceNFTProof(); /// @notice Revert if the merkle proof for allowed NFT is invalid error InvalidAllowedNFTProof(); /// @notice Revert if the Dice NFT cap is exceeded error ExceededDiceNFTCap(uint256 tokenId); /// @notice Revert if the NFT cap is exceeded error ExceededNFTCap(address collection, uint256 tokenId); /// @notice Revert if the guaranteed allocation is exceeded error ExceededGuaranteedAllocation(); /// @notice Revert if the contribution amount is incorrect error ContributionAmountMismatch(); /// @notice Revert if the lucky allocation is exceeded error ExceededLuckyAllocation(); /// @notice Revert if the wallet cap is exceeded error ExceededAllowedWalletCap(address wallet); /// @notice Revert if the raffle ticket contribution is exceeded error ExceededOpenPhaseWalletCap(address wallet); /// @notice Revert if the contribution is not divisible by the step error IncorrectContributionStep(); /// @notice Revert if the raffle ticket contribution is exceeded error ExceededRaffleTicketContribution(); /// @notice Revert if the phase is not active error PhaseNotActive(Phase phase); /// @notice Revert if the caller is not the owner of the token or a valid delegate. /// @param collection The address of the collection contract. /// @param tokenId The token ID to verify ownership or delegation for. error NotTokenOwner(address collection, uint256 tokenId); /// @notice Revert if presale has started error OnlyBeforePresale(); /// @notice Revert if presale has ended error OnlyAfterPresale(); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.20; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Sorts the pair (a, b) and hashes the result. */ function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or * {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the address zero. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {Ownable} from "./Ownable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { bool private _paused; /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.17; /** * @title An immutable registry contract to be deployed as a standalone primitive * @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations * from here and integrate those permissions into their flow */ interface IDelegationRegistry { /// @notice Delegation type enum DelegationType { NONE, ALL, CONTRACT, TOKEN } /// @notice Info about a single delegation, used for onchain enumeration struct DelegationInfo { DelegationType type_; address vault; address delegate; address contract_; uint256 tokenId; } /// @notice Info about a single contract-level delegation struct ContractDelegation { address contract_; address delegate; } /// @notice Info about a single token-level delegation struct TokenDelegation { address contract_; uint256 tokenId; address delegate; } /// @notice Emitted when a user delegates their entire wallet event DelegateForAll(address vault, address delegate, bool value); /// @notice Emitted when a user delegates a specific contract event DelegateForContract( address vault, address delegate, address contract_, bool value ); /// @notice Emitted when a user delegates a specific token event DelegateForToken( address vault, address delegate, address contract_, uint256 tokenId, bool value ); /// @notice Emitted when a user revokes all delegations event RevokeAllDelegates(address vault); /// @notice Emitted when a user revoes all delegations for a given delegate event RevokeDelegate(address vault, address delegate); /** * ----------- WRITE ----------- */ /** * @notice Allow the delegate to act on your behalf for all contracts * @param delegate The hotwallet to act on your behalf * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForAll(address delegate, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific contract * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForContract( address delegate, address contract_, bool value ) external; /** * @notice Allow the delegate to act on your behalf for a specific token * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForToken( address delegate, address contract_, uint256 tokenId, bool value ) external; /** * @notice Revoke all delegates */ function revokeAllDelegates() external; /** * @notice Revoke a specific delegate for all their permissions * @param delegate The hotwallet to revoke */ function revokeDelegate(address delegate) external; /** * @notice Remove yourself as a delegate for a specific vault * @param vault The vault which delegated to the msg.sender, and should be removed */ function revokeSelf(address vault) external; /** * ----------- READ ----------- */ /** * @notice Returns all active delegations a given delegate is able to claim on behalf of * @param delegate The delegate that you would like to retrieve delegations for * @return info Array of DelegationInfo structs */ function getDelegationsByDelegate( address delegate ) external view returns (DelegationInfo[] memory); /** * @notice Returns an array of wallet-level delegates for a given vault * @param vault The cold wallet who issued the delegation * @return addresses Array of wallet-level delegates for a given vault */ function getDelegatesForAll( address vault ) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault and contract * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract you're delegating * @return addresses Array of contract-level delegates for a given vault and contract */ function getDelegatesForContract( address vault, address contract_ ) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault's token * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract holding the token * @param tokenId The token id for the token you're delegating * @return addresses Array of contract-level delegates for a given vault's token */ function getDelegatesForToken( address vault, address contract_, uint256 tokenId ) external view returns (address[] memory); /** * @notice Returns all contract-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of ContractDelegation structs */ function getContractLevelDelegations( address vault ) external view returns (ContractDelegation[] memory delegations); /** * @notice Returns all token-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of TokenDelegation structs */ function getTokenLevelDelegations( address vault ) external view returns (TokenDelegation[] memory delegations); /** * @notice Returns true if the address is delegated to act on the entire vault * @param delegate The hotwallet to act on your behalf * @param vault The cold wallet who issued the delegation */ function checkDelegateForAll( address delegate, address vault ) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForContract( address delegate, address vault, address contract_ ) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForToken( address delegate, address vault, address contract_, uint256 tokenId ) external view returns (bool); }
// SPDX-License-Identifier: CC0-1.0 pragma solidity >=0.8.13; /** * @title IDelegateRegistry * @custom:version 2.0 * @custom:author foobar (0xfoobar) * @notice A standalone immutable registry storing delegated permissions from one address to another */ interface IDelegateRegistry { /// @notice Delegation type, NONE is used when a delegation does not exist or is revoked enum DelegationType { NONE, ALL, CONTRACT, ERC721, ERC20, ERC1155 } /// @notice Struct for returning delegations struct Delegation { DelegationType type_; address to; address from; bytes32 rights; address contract_; uint256 tokenId; uint256 amount; } /// @notice Emitted when an address delegates or revokes rights for their entire wallet event DelegateAll(address indexed from, address indexed to, bytes32 rights, bool enable); /// @notice Emitted when an address delegates or revokes rights for a contract address event DelegateContract(address indexed from, address indexed to, address indexed contract_, bytes32 rights, bool enable); /// @notice Emitted when an address delegates or revokes rights for an ERC721 tokenId event DelegateERC721(address indexed from, address indexed to, address indexed contract_, uint256 tokenId, bytes32 rights, bool enable); /// @notice Emitted when an address delegates or revokes rights for an amount of ERC20 tokens event DelegateERC20(address indexed from, address indexed to, address indexed contract_, bytes32 rights, uint256 amount); /// @notice Emitted when an address delegates or revokes rights for an amount of an ERC1155 tokenId event DelegateERC1155(address indexed from, address indexed to, address indexed contract_, uint256 tokenId, bytes32 rights, uint256 amount); /// @notice Thrown if multicall calldata is malformed error MulticallFailed(); /** * ----------- WRITE ----------- */ /** * @notice Call multiple functions in the current contract and return the data from all of them if they all succeed * @param data The encoded function data for each of the calls to make to this contract * @return results The results from each of the calls passed in via data */ function multicall(bytes[] calldata data) external payable returns (bytes[] memory results); /** * @notice Allow the delegate to act on behalf of `msg.sender` for all contracts * @param to The address to act as delegate * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights * @param enable Whether to enable or disable this delegation, true delegates and false revokes * @return delegationHash The unique identifier of the delegation */ function delegateAll(address to, bytes32 rights, bool enable) external payable returns (bytes32 delegationHash); /** * @notice Allow the delegate to act on behalf of `msg.sender` for a specific contract * @param to The address to act as delegate * @param contract_ The contract whose rights are being delegated * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights * @param enable Whether to enable or disable this delegation, true delegates and false revokes * @return delegationHash The unique identifier of the delegation */ function delegateContract(address to, address contract_, bytes32 rights, bool enable) external payable returns (bytes32 delegationHash); /** * @notice Allow the delegate to act on behalf of `msg.sender` for a specific ERC721 token * @param to The address to act as delegate * @param contract_ The contract whose rights are being delegated * @param tokenId The token id to delegate * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights * @param enable Whether to enable or disable this delegation, true delegates and false revokes * @return delegationHash The unique identifier of the delegation */ function delegateERC721(address to, address contract_, uint256 tokenId, bytes32 rights, bool enable) external payable returns (bytes32 delegationHash); /** * @notice Allow the delegate to act on behalf of `msg.sender` for a specific amount of ERC20 tokens * @dev The actual amount is not encoded in the hash, just the existence of a amount (since it is an upper bound) * @param to The address to act as delegate * @param contract_ The address for the fungible token contract * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights * @param amount The amount to delegate, > 0 delegates and 0 revokes * @return delegationHash The unique identifier of the delegation */ function delegateERC20(address to, address contract_, bytes32 rights, uint256 amount) external payable returns (bytes32 delegationHash); /** * @notice Allow the delegate to act on behalf of `msg.sender` for a specific amount of ERC1155 tokens * @dev The actual amount is not encoded in the hash, just the existence of a amount (since it is an upper bound) * @param to The address to act as delegate * @param contract_ The address of the contract that holds the token * @param tokenId The token id to delegate * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights * @param amount The amount of that token id to delegate, > 0 delegates and 0 revokes * @return delegationHash The unique identifier of the delegation */ function delegateERC1155(address to, address contract_, uint256 tokenId, bytes32 rights, uint256 amount) external payable returns (bytes32 delegationHash); /** * ----------- CHECKS ----------- */ /** * @notice Check if `to` is a delegate of `from` for the entire wallet * @param to The potential delegate address * @param from The potential address who delegated rights * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only * @return valid Whether delegate is granted to act on the from's behalf */ function checkDelegateForAll(address to, address from, bytes32 rights) external view returns (bool); /** * @notice Check if `to` is a delegate of `from` for the specified `contract_` or the entire wallet * @param to The delegated address to check * @param contract_ The specific contract address being checked * @param from The cold wallet who issued the delegation * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only * @return valid Whether delegate is granted to act on from's behalf for entire wallet or that specific contract */ function checkDelegateForContract(address to, address from, address contract_, bytes32 rights) external view returns (bool); /** * @notice Check if `to` is a delegate of `from` for the specific `contract` and `tokenId`, the entire `contract_`, or the entire wallet * @param to The delegated address to check * @param contract_ The specific contract address being checked * @param tokenId The token id for the token to delegating * @param from The wallet that issued the delegation * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only * @return valid Whether delegate is granted to act on from's behalf for entire wallet, that contract, or that specific tokenId */ function checkDelegateForERC721(address to, address from, address contract_, uint256 tokenId, bytes32 rights) external view returns (bool); /** * @notice Returns the amount of ERC20 tokens the delegate is granted rights to act on the behalf of * @param to The delegated address to check * @param contract_ The address of the token contract * @param from The cold wallet who issued the delegation * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only * @return balance The delegated balance, which will be 0 if the delegation does not exist */ function checkDelegateForERC20(address to, address from, address contract_, bytes32 rights) external view returns (uint256); /** * @notice Returns the amount of a ERC1155 tokens the delegate is granted rights to act on the behalf of * @param to The delegated address to check * @param contract_ The address of the token contract * @param tokenId The token id to check the delegated amount of * @param from The cold wallet who issued the delegation * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only * @return balance The delegated balance, which will be 0 if the delegation does not exist */ function checkDelegateForERC1155(address to, address from, address contract_, uint256 tokenId, bytes32 rights) external view returns (uint256); /** * ----------- ENUMERATIONS ----------- */ /** * @notice Returns all enabled delegations a given delegate has received * @param to The address to retrieve delegations for * @return delegations Array of Delegation structs */ function getIncomingDelegations(address to) external view returns (Delegation[] memory delegations); /** * @notice Returns all enabled delegations an address has given out * @param from The address to retrieve delegations for * @return delegations Array of Delegation structs */ function getOutgoingDelegations(address from) external view returns (Delegation[] memory delegations); /** * @notice Returns all hashes associated with enabled delegations an address has received * @param to The address to retrieve incoming delegation hashes for * @return delegationHashes Array of delegation hashes */ function getIncomingDelegationHashes(address to) external view returns (bytes32[] memory delegationHashes); /** * @notice Returns all hashes associated with enabled delegations an address has given out * @param from The address to retrieve outgoing delegation hashes for * @return delegationHashes Array of delegation hashes */ function getOutgoingDelegationHashes(address from) external view returns (bytes32[] memory delegationHashes); /** * @notice Returns the delegations for a given array of delegation hashes * @param delegationHashes is an array of hashes that correspond to delegations * @return delegations Array of Delegation structs, return empty structs for nonexistent or revoked delegations */ function getDelegationsFromHashes(bytes32[] calldata delegationHashes) external view returns (Delegation[] memory delegations); /** * ----------- STORAGE ACCESS ----------- */ /** * @notice Allows external contracts to read arbitrary storage slots */ function readSlot(bytes32 location) external view returns (bytes32); /** * @notice Allows external contracts to read an arbitrary array of storage slots */ function readSlots(bytes32[] calldata locations) external view returns (bytes32[] memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "LayerZero-v2/=lib/LayerZero-v2/", "delegate-registry/=lib/delegate-registry/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "murky/=lib/delegate-registry/lib/murky/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/delegate-registry/lib/openzeppelin-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 10000000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_diceNFT","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_initialOwner","type":"address"},{"internalType":"address","name":"_delegateRegistryV1","type":"address"},{"internalType":"address","name":"_delegateRegistryV2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ContributionAmountMismatch","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"ExceededAllowedWalletCap","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ExceededDiceNFTCap","type":"error"},{"inputs":[],"name":"ExceededGuaranteedAllocation","type":"error"},{"inputs":[],"name":"ExceededLuckyAllocation","type":"error"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ExceededNFTCap","type":"error"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"ExceededOpenPhaseWalletCap","type":"error"},{"inputs":[],"name":"ExceededRaffleTicketContribution","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"IncorrectContributionStep","type":"error"},{"inputs":[],"name":"InvalidAllowedNFTProof","type":"error"},{"inputs":[],"name":"InvalidAllowedWalletProof","type":"error"},{"inputs":[],"name":"InvalidDiceNFTProof","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NotTokenOwner","type":"error"},{"inputs":[],"name":"OnlyAfterPresale","type":"error"},{"inputs":[],"name":"OnlyBeforePresale","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"enum Presale.Phase","name":"phase","type":"uint8"}],"name":"PhaseNotActive","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"allowedNFTsMerkleRoot","type":"bytes32"}],"name":"AllowedNFTsMerkleRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"allowedWalletsMerkleRoot","type":"bytes32"}],"name":"AllowedWalletsMerkleRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Contributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokensAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ContributedAllowedNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokensAmount","type":"uint256"}],"name":"ContributedAllowedWallet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokensAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ContributedDiceNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"tokensAmount","type":"uint256"}],"name":"ContributedLuckyPhase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ContributedOpenPhase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"diceNFTsMerkleRoot","type":"bytes32"}],"name":"DiceNFTsMerkleRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"diceNFTsTokensEligibleMerkleRootSet","type":"bytes32"}],"name":"DiceNFTsTokensEligibleMerkleRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"guaranteedExchangeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luckyExchangeRate1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luckyExchangeRate2","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luckyExchangeRate3","type":"uint256"}],"name":"ExchangeRatesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"guaranteedStart","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"guaranteedEnd","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"guaranteedAllocation","type":"uint256"}],"name":"GuaranteedPhaseSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"luckyStart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luckyEnd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luckyAllocationTier1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luckyAllocationTier2","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luckyAllocationTier3","type":"uint256"},{"indexed":false,"internalType":"address","name":"luckySigner","type":"address"}],"name":"LuckyPhaseSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"openPhaseAllocationsMerkleRoot","type":"bytes32"}],"name":"OpenPhaseAllocationsMerkleRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"openStart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"openEnd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"openPhaseWalletCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"openPhaseContributionStep","type":"uint256"}],"name":"OpenPhaseSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"allowedNFTContributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedNFTsMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedWalletContributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedWalletsMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct Presale.BuyWithDiceNFTParams[]","name":"_diceNFTParams","type":"tuple[]"},{"components":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct Presale.BuyWithAllowedNFTParams[]","name":"_allowedNFTParams","type":"tuple[]"},{"components":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct Presale.AllowedWalletParams","name":"_allowedWalletParams","type":"tuple"},{"internalType":"bytes","name":"_luckyPhaseSignature","type":"bytes"},{"internalType":"uint256","name":"_luckyPhaseAmount","type":"uint256"},{"internalType":"uint256","name":"_luckyPhaseMaxAmount","type":"uint256"},{"internalType":"uint256","name":"_openPhaseAmount","type":"uint256"}],"name":"buyAllPhases","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxAmount","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"buyLuckyTier","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"buyOpenPhase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"},{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"buyWithAllowedNFT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct Presale.BuyWithAllowedNFTParams[]","name":"_params","type":"tuple[]"}],"name":"buyWithAllowedNFTs","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"buyWithAllowedWallet","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"buyWithDiceNFT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"internalType":"struct Presale.BuyWithDiceNFTParams[]","name":"_params","type":"tuple[]"}],"name":"buyWithDiceNFTs","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"cachedChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cachedDomainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cachedThis","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"enum Presale.Phase","name":"_phase","type":"uint8"}],"name":"calculateTokens","outputs":[{"internalType":"uint256","name":"tokens","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delegateRegistryV1","outputs":[{"internalType":"contract IDelegationRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delegateRegistryV2","outputs":[{"internalType":"contract IDelegateRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"diceNFT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"diceNFTContributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"diceNFTsMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"diceNFTsTokensEligibleMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guaranteedAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guaranteedEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guaranteedExchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guaranteedRaisedETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guaranteedStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum Presale.Phase","name":"_phase","type":"uint8"}],"name":"isPhaseActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyAllocationTier1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyAllocationTier2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyAllocationTier3","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyExchangeRate1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyExchangeRate2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyExchangeRate3","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"luckyPhaseContributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyRaisedETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckySigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"luckyStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openPhaseAllocationsMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"openPhaseContributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openPhaseContributionStep","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openPhaseWalletCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openRaisedETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"raffleTicketContributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_allowedNFTsMerkleRoot","type":"bytes32"}],"name":"setAllowedNFTsMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_allowedWalletsMerkleRoot","type":"bytes32"}],"name":"setAllowedWalletsMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_diceNFTsMerkleRoot","type":"bytes32"}],"name":"setDiceNFTsMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_diceNFTsTokensEligibleMerkleRoot","type":"bytes32"}],"name":"setDiceNFTsTokensEligibleMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_guaranteedExchangeRate","type":"uint256"},{"internalType":"uint256","name":"_luckyExchangeRate1","type":"uint256"},{"internalType":"uint256","name":"_luckyExchangeRate2","type":"uint256"},{"internalType":"uint256","name":"_luckyExchangeRate3","type":"uint256"}],"name":"setExchangeRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_guaranteedStart","type":"uint256"},{"internalType":"uint256","name":"_guaranteedEnd","type":"uint256"},{"internalType":"uint256","name":"_guaranteedAllocation","type":"uint256"}],"name":"setGuaranteedPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_luckyStart","type":"uint256"},{"internalType":"uint256","name":"_luckyEnd","type":"uint256"},{"internalType":"uint256","name":"_luckyAllocationTier1","type":"uint256"},{"internalType":"uint256","name":"_luckyAllocationTier2","type":"uint256"},{"internalType":"uint256","name":"_luckyAllocationTier3","type":"uint256"},{"internalType":"address","name":"_luckySigner","type":"address"}],"name":"setLuckyPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_openStart","type":"uint256"},{"internalType":"uint256","name":"_openEnd","type":"uint256"},{"internalType":"uint256","name":"_openPhaseWalletCap","type":"uint256"},{"internalType":"uint256","name":"_openPhaseContributionStep","type":"uint256"}],"name":"setOpenPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_openPhaseAllocationsMerkleRoot","type":"bytes32"}],"name":"setOpenPhaseAllocationsMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokensEligible","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101606040523480156200001257600080fd5b5060405162004458380380620044588339810160408190526200003591620001a2565b826001600160a01b0381166200006557604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000708162000117565b506001805460ff60a01b191681556002556001600160a01b0380861660e05284811661010052828116610120528116610140524660a05262000104604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a794692186020820152469181019190915230606082015260009060800160405160208183030381529060405280519060200120905090565b60805250503060c0525062000212915050565b600180546001600160a01b0319169055620001328162000135565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200019d57600080fd5b919050565b600080600080600060a08688031215620001bb57600080fd5b620001c68662000185565b9450620001d66020870162000185565b9350620001e66040870162000185565b9250620001f66060870162000185565b9150620002066080870162000185565b90509295509295909350565b60805160a05160c05160e05161010051610120516101405161417b620002dd60003960008181610a6c0152612d580152600081816107a80152612e2701526000818161060e01528181611e0001528181611ea6015281816120880152818161212e01528181612415015281816124bb015281816126eb01528181612791015281816129f40152612a9a0152600081816108880152611ca001526000818161080901526133a801526000818161072a01526133d201526000818161099301526133fc015261417b6000f3fe6080604052600436106104145760003560e01c8063903ee7ae11610228578063da25478b11610128578063f3ef576c116100bb578063f92d0ce81161008a578063fcf916d01161006f578063fcf916d014610c09578063fd8c5ca914610c29578063fe47f91914610c6057600080fd5b8063f92d0ce814610bc9578063fc51b1a714610be957600080fd5b8063f3ef576c14610b53578063f4bacd1914610b80578063f7aad04514610ba0578063f7e056ee14610bb357600080fd5b8063ed363054116100f7578063ed36305414610af1578063f20e972314610b07578063f2fde38b14610b1d578063f3dbbf6414610b3d57600080fd5b8063da25478b14610a3a578063db584d2514610a5a578063e30c397814610a8e578063ebe6746c14610ab957600080fd5b8063a50d86be116101bb578063c1f5e11c1161018a578063d6134b271161016f578063d6134b27146109f8578063d6ffd7a714610a0e578063d89de2ef14610a2457600080fd5b8063c1f5e11c146109b5578063d55d9e25146109e257600080fd5b8063a50d86be14610942578063a8510c6914610955578063aabfc10f1461096b578063b4f94b2e1461098157600080fd5b80639958130e116101f75780639958130e146108d65780639c4023b9146108ec5780639e8ebdf814610919578063a3f2990b1461092c57600080fd5b8063903ee7ae1461085657806394483cfb1461087657806397c8fa98146108aa57806398ab0193146108c057600080fd5b806361d027b311610333578063715018a6116102c65780638456cb591161029557806388bdfffb1161027a57806388bdfffb146107ca5780638ba7888d146107f75780638da5cb5b1461082b57600080fd5b80638456cb5914610781578063856ed8c91461079657600080fd5b8063715018a614610703578063771da5c51461071857806379ba50971461074c578063801675bd1461076157600080fd5b80636a4a01b4116103025780636a4a01b4146106a15780636a9b477c146106b75780636b3da8ed146106cd5780636ef3375f146106ed57600080fd5b806361d027b3146105fc57806364cd6f0714610655578063684c9599146106755780636861d5d21461068b57600080fd5b80633d30edb6116103ab57806352e4e4591161037a57806352e4e4591461056a57806354e9f7cd1461057d5780635c975abb1461059357806360c07028146105cf57600080fd5b80633d30edb61461050c5780633f4ba83a1461052c57806347ab694f146105415780634e9f4eea1461055457600080fd5b80631b7762ba116103e75780631b7762ba146104a757806320606b70146104ba57806321a8ac27146104ee578063398dc5a0146104f657600080fd5b806301346431146104195780630e471525146104425780630f5731f7146104585780630f80f9671461047a575b600080fd5b34801561042557600080fd5b5061042f60075481565b6040519081526020015b60405180910390f35b34801561044e57600080fd5b5061042f600f5481565b34801561046457600080fd5b5061047861047336600461376d565b610c73565b005b34801561048657600080fd5b5061042f6104953660046137c1565b601f6020526000908152604090205481565b6104786104b536600461382a565b610d57565b3480156104c657600080fd5b5061042f7f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a7946921881565b610478610d6a565b34801561050257600080fd5b5061042f60165481565b34801561051857600080fd5b5061047861052736600461387b565b610d75565b34801561053857600080fd5b50610478610e29565b61047861054f3660046138ee565b610e39565b34801561056057600080fd5b5061042f600d5481565b6104786105783660046139c7565b61103d565b34801561058957600080fd5b5061042f60065481565b34801561059f57600080fd5b5060015474010000000000000000000000000000000000000000900460ff165b6040519015158152602001610439565b3480156105db57600080fd5b5061042f6105ea3660046137c1565b601d6020526000908152604090205481565b34801561060857600080fd5b506106307f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610439565b34801561066157600080fd5b50610478610670366004613a09565b6111a7565b34801561068157600080fd5b5061042f60035481565b34801561069757600080fd5b5061042f60095481565b3480156106ad57600080fd5b5061042f600a5481565b3480156106c357600080fd5b5061042f60135481565b3480156106d957600080fd5b506104786106e836600461387b565b61126b565b3480156106f957600080fd5b5061042f60155481565b34801561070f57600080fd5b5061047861131f565b34801561072457600080fd5b5061042f7f000000000000000000000000000000000000000000000000000000000000000081565b34801561075857600080fd5b50610478611331565b34801561076d57600080fd5b5061047861077c36600461376d565b6113ad565b34801561078d57600080fd5b50610478611487565b3480156107a257600080fd5b506106307f000000000000000000000000000000000000000000000000000000000000000081565b3480156107d657600080fd5b50600c546106309073ffffffffffffffffffffffffffffffffffffffff1681565b34801561080357600080fd5b506106307f000000000000000000000000000000000000000000000000000000000000000081565b34801561083757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610630565b34801561086257600080fd5b5061047861087136600461387b565b611497565b34801561088257600080fd5b506106307f000000000000000000000000000000000000000000000000000000000000000081565b3480156108b657600080fd5b5061042f60145481565b3480156108cc57600080fd5b5061042f600b5481565b3480156108e257600080fd5b5061042f60045481565b3480156108f857600080fd5b5061042f61090736600461387b565b601c6020526000908152604090205481565b610478610927366004613a35565b61154b565b34801561093857600080fd5b5061042f60055481565b610478610950366004613a81565b611557565b34801561096157600080fd5b5061042f601a5481565b34801561097757600080fd5b5061042f601b5481565b34801561098d57600080fd5b5061042f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156109c157600080fd5b5061042f6109d03660046137c1565b60226020526000908152604090205481565b3480156109ee57600080fd5b5061042f60085481565b348015610a0457600080fd5b5061042f60175481565b348015610a1a57600080fd5b5061042f60115481565b348015610a3057600080fd5b5061042f600e5481565b348015610a4657600080fd5b50610478610a5536600461387b565b611563565b348015610a6657600080fd5b506106307f000000000000000000000000000000000000000000000000000000000000000081565b348015610a9a57600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff16610630565b348015610ac557600080fd5b5061042f610ad4366004613acd565b601e60209081526000928352604080842090915290825290205481565b348015610afd57600080fd5b5061042f60195481565b348015610b1357600080fd5b5061042f60125481565b348015610b2957600080fd5b50610478610b383660046137c1565b611617565b348015610b4957600080fd5b5061042f60185481565b348015610b5f57600080fd5b5061042f610b6e3660046137c1565b60216020526000908152604090205481565b348015610b8c57600080fd5b506105bf610b9b366004613b0d565b6116c7565b610478610bae366004613b28565b6117ad565b348015610bbf57600080fd5b5061042f60105481565b348015610bd557600080fd5b50610478610be4366004613b8f565b6117c2565b348015610bf557600080fd5b5061042f610c04366004613be4565b6118fe565b348015610c1557600080fd5b50610478610c2436600461387b565b611a47565b348015610c3557600080fd5b5061042f610c44366004613c8e565b8051602081830181018051828252928201919093012091525481565b610478610c6e3660046139c7565b611afb565b610c7b611bf1565b600d5415801590610c8d5750600d5442115b80610ca55750600f5415801590610ca55750600f5442115b80610cbd575060115415801590610cbd575060115442115b15610cf4576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60158490556016839055601782905560188190556040805185815260208101859052908101839052606081018290527f4d8a982c24f0b6a38c07babdc2bfe2c4a57b614152613ceb74603552ca15e861906080015b60405180910390a150505050565b610d643485858585611c44565b50505050565b610d7334611f3a565b565b610d7d611bf1565b600d5415801590610d8f5750600d5442115b80610da75750600f5415801590610da75750600f5442115b80610dbf575060115415801590610dbf575060115442115b15610df6576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600581905560405181907f4ef31b5f21cb55338937abaa52f32a3db1aa0084d53b45aa6b08727ba53c42b790600090a250565b610e31611bf1565b610d7361219c565b600089815b81811015610ed65760008d8d83818110610e5a57610e5a613d41565b9050602002810190610e6c9190613d70565b610e7590613e2e565b9050610ebc81604001518f8f85818110610e9157610e91613d41565b9050602002810190610ea39190613d70565b610ead9080613eb0565b84602001518560600151611c44565b6040810151610ecb9085613f47565b935050600101610e3e565b508860005b81811015610f785760008c8c83818110610ef757610ef7613d41565b9050602002810190610f099190613f5a565b610f1290613f8e565b9050610f5e81606001518e8e85818110610f2e57610f2e613d41565b9050602002810190610f409190613f5a565b610f4a9080613eb0565b846020015185604001518660800151612219565b6060810151610f6d9086613f47565b945050600101610edb565b506000610f858a80613eb0565b90501115610fba57610fa960208a0135610f9f8b80613eb0565b8c6040013561255a565b610fb760208a013584613f47565b92505b8615610fd957610fcc86868a8a612802565b610fd68684613f47565b92505b8315610ff557610fe884611f3a565b610ff28484613f47565b92505b34831461102e576040517f777b0fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050505050505050505050565b6000805b828110156111685761112c84848381811061105e5761105e613d41565b90506020028101906110709190613f5a565b6060013585858481811061108657611086613d41565b90506020028101906110989190613f5a565b6110a29080613eb0565b8787868181106110b4576110b4613d41565b90506020028101906110c69190613f5a565b6110d79060408101906020016137c1565b8888878181106110e9576110e9613d41565b90506020028101906110fb9190613f5a565b6040013589898881811061111157611111613d41565b90506020028101906111239190613f5a565b60800135612219565b83838281811061113e5761113e613d41565b90506020028101906111509190613f5a565b61115e906060013583613f47565b9150600101611041565b503481146111a2576040517f777b0fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6111af611bf1565b600d54158015906111c15750600d5442115b806111d95750600f54158015906111d95750600f5442115b806111f15750601154158015906111f1575060115442115b15611228576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d839055600e82905560088190556040518190839085907f78769fc196b73c7f0dc7ebc804a1f3c50c2032d6291056afdb013cf3acd5cdb790600090a4505050565b611273611bf1565b600d54158015906112855750600d5442115b8061129d5750600f541580159061129d5750600f5442115b806112b55750601154158015906112b5575060115442115b156112ec576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481905560405181907f35bd7fe3bec55002cd1786658b3d0c08962edbde2642f0185f6e8c0bc8707a5390600090a250565b611327611bf1565b610d736000612b0b565b600154339073ffffffffffffffffffffffffffffffffffffffff1681146113a1576040517f118cdaa700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024015b60405180910390fd5b6113aa81612b0b565b50565b6113b5611bf1565b600d54158015906113c75750600d5442115b806113df5750600f54158015906113df5750600f5442115b806113f75750601154158015906113f7575060115442115b1561142e576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60118490556012839055601382905560148190556040805185815260208101859052908101839052606081018290527fd8813f200dd6fcbf94f60144c02256fd8c77dce2e7ce44271155757bc5d29b9d90608001610d49565b61148f611bf1565b610d73612b3c565b61149f611bf1565b600e54158015906114b15750600e5442105b806114c95750601054158015906114c9575060105442105b806114e15750601254158015906114e1575060125442105b15611518576040517fdce7273700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600681905560405181907fec9e1a8b1b589f78322d51543211c39232ea3e651cbc6cea2634e2d2d024237b90600090a250565b6111a234848484612802565b6111a23484848461255a565b61156b611bf1565b600d541580159061157d5750600d5442115b806115955750600f54158015906115955750600f5442115b806115ad5750601154158015906115ad575060115442115b156115e4576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600381905560405181907fc00c8ef32aa2421f3d05630c7455e707a12de2d568f6c8191e072a5ccde567cd90600090a250565b61161f611bf1565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915561168260005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000808260028111156116dc576116dc614021565b036117115760085460195411806116ff5750600d544210806116ff5750600e5442115b1561170c57506000919050565b6117a5565b600182600281111561172557611725614021565b0361176e57600b54600a5460095461173d9190613f47565b6117479190613f47565b601a5411806116ff5750600f544210806116ff575060105442111561170c57506000919050565b600282600281111561178257611782614021565b036117a557601154421080611798575060125442115b156117a557506000919050565b506001919050565b6117bb348686868686612219565b5050505050565b6117ca611bf1565b600d54158015906117dc5750600d5442115b806117f45750600f54158015906117f45750600f5442115b8061180c57506011541580159061180c575060115442115b15611843576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f86905560108590556009849055600a839055600b829055600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040805188815260208101889052908101869052606081018590526080810184905260a08101919091527f794ec35a85cccb9302cf44c55daf0c86d56f98e909c052721711b74051c3fd7e9060c00160405180910390a1505050505050565b60008082600281111561191357611913614021565b0361192c576015546119259084614050565b9050611a41565b601a546009548491906000908210611945576000611953565b816009546119539190614067565b9050801561199857600081841161196a578361196c565b815b90506016548161197c9190614050565b94506119888185614067565b93506119948284613f47565b9250505b8215611a1d57600082600a546009546119b19190613f47565b116119bd5760006119d8565b82600a546009546119ce9190613f47565b6119d89190614067565b90508015611a1b5760008185116119ef57846119f1565b815b905060175481611a019190614050565b611a0b9087613f47565b9550611a178186614067565b9450505b505b8215611a3d57601854611a309084614050565b611a3a9085613f47565b93505b5050505b92915050565b611a4f611bf1565b600e5415801590611a615750600e5442105b80611a79575060105415801590611a79575060105442105b80611a91575060125415801590611a91575060125442105b15611ac8576040517fdce7273700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600781905560405181907f62f9a36e2e080472b3356380ab8648c65d087024d4227f14dc1d7935ef2e773f90600090a250565b6000805b8281101561116857611bb5848483818110611b1c57611b1c613d41565b9050602002810190611b2e9190613d70565b60400135858584818110611b4457611b44613d41565b9050602002810190611b569190613d70565b611b609080613eb0565b878786818110611b7257611b72613d41565b9050602002810190611b849190613d70565b60200135888887818110611b9a57611b9a613d41565b9050602002810190611bac9190613d70565b60600135611c44565b838382818110611bc757611bc7613d41565b9050602002810190611bd99190613d70565b611be7906040013583613f47565b9150600101611aff565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d73576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401611398565b611c4c612bab565b611c54612bec565b600080611c60826116c7565b905080611c9b57816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b611cc57f000000000000000000000000000000000000000000000000000000000000000085612c41565b611cd186868686612eed565b6000848152601c60205260409020548390611ced908990613f47565b1115611d28576040517f98ce7d5a00000000000000000000000000000000000000000000000000000000815260048101859052602401611398565b60085487601954611d399190613f47565b1115611d71576040517f877cc90b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611d7e8860006118fe565b33600090815260226020526040812080549293508392909190611da2908490613f47565b90915550506000858152601c6020526040812080548a9290611dc5908490613f47565b925050819055508760196000828254611dde9190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016908a908381818185875af1925050503d8060008114611e5b576040519150601f19603f3d011682016040523d82523d6000602084013e611e60565b606091505b5050905080611eda576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166004820152602481018a9052604401611398565b81893373ffffffffffffffffffffffffffffffffffffffff167f6ebc929391d0bb08d885d9cd4fcdd70e4e4324c4105d6414a51f8afbd7aa711289604051611f2491815260200190565b60405180910390a4505050506117bb6001600255565b611f42612bab565b611f4a612bec565b60026000611f57826116c7565b905080611f9257816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b601454611f9f90846140bb565b15611fd6576040517fd15f263900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60135433600090815260216020526040902054611ff4908590613f47565b111561202e576040517fa5d0bbfb000000000000000000000000000000000000000000000000000000008152336004820152602401611398565b336000908152602160205260408120805485929061204d908490613f47565b9250508190555082601b60008282546120669190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169085908381818185875af1925050503d80600081146120e3576040519150601f19603f3d011682016040523d82523d6000602084013e6120e8565b606091505b5050905080612162576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016600482015260248101859052604401611398565b604051849033907f57cac2b845702d796e17be9d38f4b47108e6c9a5d4bb54ecbb392357598d5ad490600090a35050506113aa6001600255565b6121a4612fce565b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b612221612bab565b612229612bec565b600080612235826116c7565b90508061227057816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b61227a8585612c41565b61228687878786613022565b600854886019546122979190613f47565b11156122cf576040517f877cc90b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff85166000908152601e60209081526040808320878452909152902054839061230d908a90613f47565b1115612364576040517f095eced900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616600482015260248101859052604401611398565b60006123718960006118fe565b33600090815260226020526040812080549293508392909190612395908490613f47565b909155505073ffffffffffffffffffffffffffffffffffffffff86166000908152601e60209081526040808320888452909152812080548b92906123da908490613f47565b9250508190555088601960008282546123f39190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016908b908381818185875af1925050503d8060008114612470576040519150601f19603f3d011682016040523d82523d6000602084013e612475565b606091505b50509050806124ef576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166004820152602481018b9052604401611398565b6040805173ffffffffffffffffffffffffffffffffffffffff891681526020810188905283918c9133917fd4d67cb21a5b2492b4e4555dbbca6e53711c6df2145d75cb4b408b10c343c469910160405180910390a4505050506125526001600255565b505050505050565b612562612bab565b61256a612bec565b600080612576826116c7565b9050806125b157816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b6125bc858585613118565b336000908152601d602052604090205483906125d9908890613f47565b1115612612576040517ebd9075000000000000000000000000000000000000000000000000000000008152336004820152602401611398565b600854866019546126239190613f47565b111561265b576040517f877cc90b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006126688760006118fe565b3360009081526022602052604081208054929350839290919061268c908490613f47565b9091555050336000908152601d6020526040812080548992906126b0908490613f47565b9250508190555086601960008282546126c99190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169089908381818185875af1925050503d8060008114612746576040519150601f19603f3d011682016040523d82523d6000602084013e61274b565b606091505b50509050806127c5576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016600482015260248101899052604401611398565b6040518290899033907ff45dd176e8f011701b8c7d8f06ec1d1a660d4eb0721ced75b5bd6ba2a4e70ac490600090a450505050610d646001600255565b61280a612bab565b612812612bec565b6001600061281f826116c7565b90508061285a57816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b6128658585856131f8565b8486602086866040516128799291906140f6565b9081526020016040518091039020546128929190613f47565b11156128ca576040517f7a4b8e8f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b54600a546009546128dd9190613f47565b6128e79190613f47565b86601a546128f59190613f47565b111561292d576040517f6395f82b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061293a8760016118fe565b3360009081526022602052604081208054929350839290919061295e908490613f47565b9250508190555086602086866040516129789291906140f6565b908152602001604051809103902060008282546129959190613f47565b9091555050336000908152601f6020526040812080548992906129b9908490613f47565b9250508190555086601a60008282546129d29190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169089908381818185875af1925050503d8060008114612a4f576040519150601f19603f3d011682016040523d82523d6000602084013e612a54565b606091505b5050905080612ace576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016600482015260248101899052604401611398565b6040518290899033907f3b46266aeba0f54c8a82405606115d276926e122a50ee539cf57080e8b27a98790600090a450505050610d646001600255565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556113aa81613303565b612b44612bec565b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121ef3390565b6002805403612be6576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028055565b60015474010000000000000000000000000000000000000000900460ff1615610d73576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810182905260009073ffffffffffffffffffffffffffffffffffffffff841690636352211e90602401602060405180830381865afa158015612caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd39190614106565b90503373ffffffffffffffffffffffffffffffffffffffff821603612cf757505050565b6040517fb9f3687400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8281166024830152848116604483015260648201849052600060848301527f0000000000000000000000000000000000000000000000000000000000000000169063b9f368749060a401602060405180830381865afa158015612d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dc39190614123565b15612dcd57505050565b6040517faba69cf800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82811660248301528481166044830152606482018490527f0000000000000000000000000000000000000000000000000000000000000000169063aba69cf890608401602060405180830381865afa158015612e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e929190614123565b15612e9c57505050565b6040517f58a5e22200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101839052604401611398565b6040805160208101849052908101829052600090606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201209083015201604051602081830303815290604052805190602001209050612f98858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506004549150849050613378565b6117bb576040517fe60a7a3600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015474010000000000000000000000000000000000000000900460ff16610d73576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff84166020820152908101829052600090606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506130e2858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506005549150849050613378565b6117bb576040517fda4d12cc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051336020820152908101829052600090606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506131c2848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506003549150849050613378565b610d64576040517f2e88619500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061326861320561338e565b6040805160208101929092528101869052336060820152608001604051602081830303815290604052805190602001207f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b905060006132ac8285858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061347f92505050565b600c5490915073ffffffffffffffffffffffffffffffffffffffff8083169116146117bb576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261338585846134a9565b14949350505050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161480156133f457507f000000000000000000000000000000000000000000000000000000000000000046145b1561341e57507f000000000000000000000000000000000000000000000000000000000000000090565b61347a604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a794692186020820152469181019190915230606082015260009060800160405160208183030381529060405280519060200120905090565b905090565b60008060008061348f86866134ec565b92509250925061349f8282613539565b5090949350505050565b600081815b84518110156134e4576134da828683815181106134cd576134cd613d41565b6020026020010151613641565b91506001016134ae565b509392505050565b600080600083516041036135265760208401516040850151606086015160001a61351888828585613673565b955095509550505050613532565b50508151600091506002905b9250925092565b600082600381111561354d5761354d614021565b03613556575050565b600182600381111561356a5761356a614021565b036135a1576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028260038111156135b5576135b5614021565b036135ef576040517ffce698f700000000000000000000000000000000000000000000000000000000815260048101829052602401611398565b600382600381111561360357613603614021565b0361363d576040517fd78bce0c00000000000000000000000000000000000000000000000000000000815260048101829052602401611398565b5050565b600081831061365d57600082815260208490526040902061366c565b60008381526020839052604090205b9392505050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156136ae5750600091506003905082613763565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015613702573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661375957506000925060019150829050613763565b9250600091508190505b9450945094915050565b6000806000806080858703121561378357600080fd5b5050823594602084013594506040840135936060013592509050565b73ffffffffffffffffffffffffffffffffffffffff811681146113aa57600080fd5b6000602082840312156137d357600080fd5b813561366c8161379f565b60008083601f8401126137f057600080fd5b50813567ffffffffffffffff81111561380857600080fd5b6020830191508360208260051b850101111561382357600080fd5b9250929050565b6000806000806060858703121561384057600080fd5b843567ffffffffffffffff81111561385757600080fd5b613863878288016137de565b90989097506020870135966040013595509350505050565b60006020828403121561388d57600080fd5b5035919050565b6000606082840312156138a657600080fd5b50919050565b60008083601f8401126138be57600080fd5b50813567ffffffffffffffff8111156138d657600080fd5b60208301915083602082850101111561382357600080fd5b60008060008060008060008060008060e08b8d03121561390d57600080fd5b8a3567ffffffffffffffff8082111561392557600080fd5b6139318e838f016137de565b909c509a5060208d013591508082111561394a57600080fd5b6139568e838f016137de565b909a50985060408d013591508082111561396f57600080fd5b61397b8e838f01613894565b975060608d013591508082111561399157600080fd5b5061399e8d828e016138ac565b9b9e9a9d50989b979a9699969760808101359760a0820135975060c09091013595509350505050565b600080602083850312156139da57600080fd5b823567ffffffffffffffff8111156139f157600080fd5b6139fd858286016137de565b90969095509350505050565b600080600060608486031215613a1e57600080fd5b505081359360208301359350604090920135919050565b600080600060408486031215613a4a57600080fd5b83359250602084013567ffffffffffffffff811115613a6857600080fd5b613a74868287016138ac565b9497909650939450505050565b600080600060408486031215613a9657600080fd5b833567ffffffffffffffff811115613aad57600080fd5b613ab9868287016137de565b909790965060209590950135949350505050565b60008060408385031215613ae057600080fd5b8235613aeb8161379f565b946020939093013593505050565b803560038110613b0857600080fd5b919050565b600060208284031215613b1f57600080fd5b61366c82613af9565b600080600080600060808688031215613b4057600080fd5b853567ffffffffffffffff811115613b5757600080fd5b613b63888289016137de565b9096509450506020860135613b778161379f565b94979396509394604081013594506060013592915050565b60008060008060008060c08789031215613ba857600080fd5b863595506020870135945060408701359350606087013592506080870135915060a0870135613bd68161379f565b809150509295509295509295565b60008060408385031215613bf757600080fd5b82359150613c0760208401613af9565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613c8657613c86613c10565b604052919050565b60006020808385031215613ca157600080fd5b823567ffffffffffffffff80821115613cb957600080fd5b818501915085601f830112613ccd57600080fd5b813581811115613cdf57613cdf613c10565b613d0f847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613c3f565b91508082528684828501011115613d2557600080fd5b8084840185840137600090820190930192909252509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81833603018112613da457600080fd5b9190910192915050565b600082601f830112613dbf57600080fd5b8135602067ffffffffffffffff821115613ddb57613ddb613c10565b8160051b613dea828201613c3f565b9283528481018201928281019087851115613e0457600080fd5b83870192505b84831015613e2357823582529183019190830190613e0a565b979650505050505050565b600060808236031215613e4057600080fd5b6040516080810167ffffffffffffffff8282108183111715613e6457613e64613c10565b816040528435915080821115613e7957600080fd5b50613e8636828601613dae565b82525060208301356020820152604083013560408201526060830135606082015280915050919050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613ee557600080fd5b83018035915067ffffffffffffffff821115613f0057600080fd5b6020019150600581901b360382131561382357600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115611a4157611a41613f18565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61833603018112613da457600080fd5b600060a08236031215613fa057600080fd5b60405160a0810167ffffffffffffffff8282108183111715613fc457613fc4613c10565b816040528435915080821115613fd957600080fd5b50613fe636828601613dae565b8252506020830135613ff78161379f565b60208201526040838101359082015260608084013590820152608092830135928101929092525090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8082028115828204841417611a4157611a41613f18565b81810381811115611a4157611a41613f18565b60208101600383106140b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6000826140f1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500690565b8183823760009101908152919050565b60006020828403121561411857600080fd5b815161366c8161379f565b60006020828403121561413557600080fd5b8151801515811461366c57600080fdfea26469706673582212205d3a501280d43823a4341b82d77591fa02986518cb6ce08c560ae29c9234ca7064736f6c634300081800330000000000000000000000000581ddf7a136c6837429a46c6cb7b388a3e529710000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff7000000000000000000000000db9f620c0e66527869db59de3cb181c6f5e71cd200000000000000000000000000000000000076a84fef008cdabe6409d2fe638b00000000000000000000000000000000000000447e69651d841bd8d104bed493
Deployed Bytecode
0x6080604052600436106104145760003560e01c8063903ee7ae11610228578063da25478b11610128578063f3ef576c116100bb578063f92d0ce81161008a578063fcf916d01161006f578063fcf916d014610c09578063fd8c5ca914610c29578063fe47f91914610c6057600080fd5b8063f92d0ce814610bc9578063fc51b1a714610be957600080fd5b8063f3ef576c14610b53578063f4bacd1914610b80578063f7aad04514610ba0578063f7e056ee14610bb357600080fd5b8063ed363054116100f7578063ed36305414610af1578063f20e972314610b07578063f2fde38b14610b1d578063f3dbbf6414610b3d57600080fd5b8063da25478b14610a3a578063db584d2514610a5a578063e30c397814610a8e578063ebe6746c14610ab957600080fd5b8063a50d86be116101bb578063c1f5e11c1161018a578063d6134b271161016f578063d6134b27146109f8578063d6ffd7a714610a0e578063d89de2ef14610a2457600080fd5b8063c1f5e11c146109b5578063d55d9e25146109e257600080fd5b8063a50d86be14610942578063a8510c6914610955578063aabfc10f1461096b578063b4f94b2e1461098157600080fd5b80639958130e116101f75780639958130e146108d65780639c4023b9146108ec5780639e8ebdf814610919578063a3f2990b1461092c57600080fd5b8063903ee7ae1461085657806394483cfb1461087657806397c8fa98146108aa57806398ab0193146108c057600080fd5b806361d027b311610333578063715018a6116102c65780638456cb591161029557806388bdfffb1161027a57806388bdfffb146107ca5780638ba7888d146107f75780638da5cb5b1461082b57600080fd5b80638456cb5914610781578063856ed8c91461079657600080fd5b8063715018a614610703578063771da5c51461071857806379ba50971461074c578063801675bd1461076157600080fd5b80636a4a01b4116103025780636a4a01b4146106a15780636a9b477c146106b75780636b3da8ed146106cd5780636ef3375f146106ed57600080fd5b806361d027b3146105fc57806364cd6f0714610655578063684c9599146106755780636861d5d21461068b57600080fd5b80633d30edb6116103ab57806352e4e4591161037a57806352e4e4591461056a57806354e9f7cd1461057d5780635c975abb1461059357806360c07028146105cf57600080fd5b80633d30edb61461050c5780633f4ba83a1461052c57806347ab694f146105415780634e9f4eea1461055457600080fd5b80631b7762ba116103e75780631b7762ba146104a757806320606b70146104ba57806321a8ac27146104ee578063398dc5a0146104f657600080fd5b806301346431146104195780630e471525146104425780630f5731f7146104585780630f80f9671461047a575b600080fd5b34801561042557600080fd5b5061042f60075481565b6040519081526020015b60405180910390f35b34801561044e57600080fd5b5061042f600f5481565b34801561046457600080fd5b5061047861047336600461376d565b610c73565b005b34801561048657600080fd5b5061042f6104953660046137c1565b601f6020526000908152604090205481565b6104786104b536600461382a565b610d57565b3480156104c657600080fd5b5061042f7f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a7946921881565b610478610d6a565b34801561050257600080fd5b5061042f60165481565b34801561051857600080fd5b5061047861052736600461387b565b610d75565b34801561053857600080fd5b50610478610e29565b61047861054f3660046138ee565b610e39565b34801561056057600080fd5b5061042f600d5481565b6104786105783660046139c7565b61103d565b34801561058957600080fd5b5061042f60065481565b34801561059f57600080fd5b5060015474010000000000000000000000000000000000000000900460ff165b6040519015158152602001610439565b3480156105db57600080fd5b5061042f6105ea3660046137c1565b601d6020526000908152604090205481565b34801561060857600080fd5b506106307f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff781565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610439565b34801561066157600080fd5b50610478610670366004613a09565b6111a7565b34801561068157600080fd5b5061042f60035481565b34801561069757600080fd5b5061042f60095481565b3480156106ad57600080fd5b5061042f600a5481565b3480156106c357600080fd5b5061042f60135481565b3480156106d957600080fd5b506104786106e836600461387b565b61126b565b3480156106f957600080fd5b5061042f60155481565b34801561070f57600080fd5b5061047861131f565b34801561072457600080fd5b5061042f7f000000000000000000000000000000000000000000000000000000000000000181565b34801561075857600080fd5b50610478611331565b34801561076d57600080fd5b5061047861077c36600461376d565b6113ad565b34801561078d57600080fd5b50610478611487565b3480156107a257600080fd5b506106307f00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b81565b3480156107d657600080fd5b50600c546106309073ffffffffffffffffffffffffffffffffffffffff1681565b34801561080357600080fd5b506106307f0000000000000000000000007a655a234ddf076c3530ac847040f8d8c511502181565b34801561083757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610630565b34801561086257600080fd5b5061047861087136600461387b565b611497565b34801561088257600080fd5b506106307f0000000000000000000000000581ddf7a136c6837429a46c6cb7b388a3e5297181565b3480156108b657600080fd5b5061042f60145481565b3480156108cc57600080fd5b5061042f600b5481565b3480156108e257600080fd5b5061042f60045481565b3480156108f857600080fd5b5061042f61090736600461387b565b601c6020526000908152604090205481565b610478610927366004613a35565b61154b565b34801561093857600080fd5b5061042f60055481565b610478610950366004613a81565b611557565b34801561096157600080fd5b5061042f601a5481565b34801561097757600080fd5b5061042f601b5481565b34801561098d57600080fd5b5061042f7f48ba26661dae802259fa445fba944fffa2b36485194073d33af560ef627ed8df81565b3480156109c157600080fd5b5061042f6109d03660046137c1565b60226020526000908152604090205481565b3480156109ee57600080fd5b5061042f60085481565b348015610a0457600080fd5b5061042f60175481565b348015610a1a57600080fd5b5061042f60115481565b348015610a3057600080fd5b5061042f600e5481565b348015610a4657600080fd5b50610478610a5536600461387b565b611563565b348015610a6657600080fd5b506106307f00000000000000000000000000000000000000447e69651d841bd8d104bed49381565b348015610a9a57600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff16610630565b348015610ac557600080fd5b5061042f610ad4366004613acd565b601e60209081526000928352604080842090915290825290205481565b348015610afd57600080fd5b5061042f60195481565b348015610b1357600080fd5b5061042f60125481565b348015610b2957600080fd5b50610478610b383660046137c1565b611617565b348015610b4957600080fd5b5061042f60185481565b348015610b5f57600080fd5b5061042f610b6e3660046137c1565b60216020526000908152604090205481565b348015610b8c57600080fd5b506105bf610b9b366004613b0d565b6116c7565b610478610bae366004613b28565b6117ad565b348015610bbf57600080fd5b5061042f60105481565b348015610bd557600080fd5b50610478610be4366004613b8f565b6117c2565b348015610bf557600080fd5b5061042f610c04366004613be4565b6118fe565b348015610c1557600080fd5b50610478610c2436600461387b565b611a47565b348015610c3557600080fd5b5061042f610c44366004613c8e565b8051602081830181018051828252928201919093012091525481565b610478610c6e3660046139c7565b611afb565b610c7b611bf1565b600d5415801590610c8d5750600d5442115b80610ca55750600f5415801590610ca55750600f5442115b80610cbd575060115415801590610cbd575060115442115b15610cf4576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60158490556016839055601782905560188190556040805185815260208101859052908101839052606081018290527f4d8a982c24f0b6a38c07babdc2bfe2c4a57b614152613ceb74603552ca15e861906080015b60405180910390a150505050565b610d643485858585611c44565b50505050565b610d7334611f3a565b565b610d7d611bf1565b600d5415801590610d8f5750600d5442115b80610da75750600f5415801590610da75750600f5442115b80610dbf575060115415801590610dbf575060115442115b15610df6576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600581905560405181907f4ef31b5f21cb55338937abaa52f32a3db1aa0084d53b45aa6b08727ba53c42b790600090a250565b610e31611bf1565b610d7361219c565b600089815b81811015610ed65760008d8d83818110610e5a57610e5a613d41565b9050602002810190610e6c9190613d70565b610e7590613e2e565b9050610ebc81604001518f8f85818110610e9157610e91613d41565b9050602002810190610ea39190613d70565b610ead9080613eb0565b84602001518560600151611c44565b6040810151610ecb9085613f47565b935050600101610e3e565b508860005b81811015610f785760008c8c83818110610ef757610ef7613d41565b9050602002810190610f099190613f5a565b610f1290613f8e565b9050610f5e81606001518e8e85818110610f2e57610f2e613d41565b9050602002810190610f409190613f5a565b610f4a9080613eb0565b846020015185604001518660800151612219565b6060810151610f6d9086613f47565b945050600101610edb565b506000610f858a80613eb0565b90501115610fba57610fa960208a0135610f9f8b80613eb0565b8c6040013561255a565b610fb760208a013584613f47565b92505b8615610fd957610fcc86868a8a612802565b610fd68684613f47565b92505b8315610ff557610fe884611f3a565b610ff28484613f47565b92505b34831461102e576040517f777b0fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050505050505050505050565b6000805b828110156111685761112c84848381811061105e5761105e613d41565b90506020028101906110709190613f5a565b6060013585858481811061108657611086613d41565b90506020028101906110989190613f5a565b6110a29080613eb0565b8787868181106110b4576110b4613d41565b90506020028101906110c69190613f5a565b6110d79060408101906020016137c1565b8888878181106110e9576110e9613d41565b90506020028101906110fb9190613f5a565b6040013589898881811061111157611111613d41565b90506020028101906111239190613f5a565b60800135612219565b83838281811061113e5761113e613d41565b90506020028101906111509190613f5a565b61115e906060013583613f47565b9150600101611041565b503481146111a2576040517f777b0fa600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6111af611bf1565b600d54158015906111c15750600d5442115b806111d95750600f54158015906111d95750600f5442115b806111f15750601154158015906111f1575060115442115b15611228576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d839055600e82905560088190556040518190839085907f78769fc196b73c7f0dc7ebc804a1f3c50c2032d6291056afdb013cf3acd5cdb790600090a4505050565b611273611bf1565b600d54158015906112855750600d5442115b8061129d5750600f541580159061129d5750600f5442115b806112b55750601154158015906112b5575060115442115b156112ec576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600481905560405181907f35bd7fe3bec55002cd1786658b3d0c08962edbde2642f0185f6e8c0bc8707a5390600090a250565b611327611bf1565b610d736000612b0b565b600154339073ffffffffffffffffffffffffffffffffffffffff1681146113a1576040517f118cdaa700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024015b60405180910390fd5b6113aa81612b0b565b50565b6113b5611bf1565b600d54158015906113c75750600d5442115b806113df5750600f54158015906113df5750600f5442115b806113f75750601154158015906113f7575060115442115b1561142e576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60118490556012839055601382905560148190556040805185815260208101859052908101839052606081018290527fd8813f200dd6fcbf94f60144c02256fd8c77dce2e7ce44271155757bc5d29b9d90608001610d49565b61148f611bf1565b610d73612b3c565b61149f611bf1565b600e54158015906114b15750600e5442105b806114c95750601054158015906114c9575060105442105b806114e15750601254158015906114e1575060125442105b15611518576040517fdce7273700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600681905560405181907fec9e1a8b1b589f78322d51543211c39232ea3e651cbc6cea2634e2d2d024237b90600090a250565b6111a234848484612802565b6111a23484848461255a565b61156b611bf1565b600d541580159061157d5750600d5442115b806115955750600f54158015906115955750600f5442115b806115ad5750601154158015906115ad575060115442115b156115e4576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600381905560405181907fc00c8ef32aa2421f3d05630c7455e707a12de2d568f6c8191e072a5ccde567cd90600090a250565b61161f611bf1565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915561168260005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000808260028111156116dc576116dc614021565b036117115760085460195411806116ff5750600d544210806116ff5750600e5442115b1561170c57506000919050565b6117a5565b600182600281111561172557611725614021565b0361176e57600b54600a5460095461173d9190613f47565b6117479190613f47565b601a5411806116ff5750600f544210806116ff575060105442111561170c57506000919050565b600282600281111561178257611782614021565b036117a557601154421080611798575060125442115b156117a557506000919050565b506001919050565b6117bb348686868686612219565b5050505050565b6117ca611bf1565b600d54158015906117dc5750600d5442115b806117f45750600f54158015906117f45750600f5442115b8061180c57506011541580159061180c575060115442115b15611843576040517fb1f491a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f86905560108590556009849055600a839055600b829055600c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040805188815260208101889052908101869052606081018590526080810184905260a08101919091527f794ec35a85cccb9302cf44c55daf0c86d56f98e909c052721711b74051c3fd7e9060c00160405180910390a1505050505050565b60008082600281111561191357611913614021565b0361192c576015546119259084614050565b9050611a41565b601a546009548491906000908210611945576000611953565b816009546119539190614067565b9050801561199857600081841161196a578361196c565b815b90506016548161197c9190614050565b94506119888185614067565b93506119948284613f47565b9250505b8215611a1d57600082600a546009546119b19190613f47565b116119bd5760006119d8565b82600a546009546119ce9190613f47565b6119d89190614067565b90508015611a1b5760008185116119ef57846119f1565b815b905060175481611a019190614050565b611a0b9087613f47565b9550611a178186614067565b9450505b505b8215611a3d57601854611a309084614050565b611a3a9085613f47565b93505b5050505b92915050565b611a4f611bf1565b600e5415801590611a615750600e5442105b80611a79575060105415801590611a79575060105442105b80611a91575060125415801590611a91575060125442105b15611ac8576040517fdce7273700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600781905560405181907f62f9a36e2e080472b3356380ab8648c65d087024d4227f14dc1d7935ef2e773f90600090a250565b6000805b8281101561116857611bb5848483818110611b1c57611b1c613d41565b9050602002810190611b2e9190613d70565b60400135858584818110611b4457611b44613d41565b9050602002810190611b569190613d70565b611b609080613eb0565b878786818110611b7257611b72613d41565b9050602002810190611b849190613d70565b60200135888887818110611b9a57611b9a613d41565b9050602002810190611bac9190613d70565b60600135611c44565b838382818110611bc757611bc7613d41565b9050602002810190611bd99190613d70565b611be7906040013583613f47565b9150600101611aff565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d73576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401611398565b611c4c612bab565b611c54612bec565b600080611c60826116c7565b905080611c9b57816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b611cc57f0000000000000000000000000581ddf7a136c6837429a46c6cb7b388a3e5297185612c41565b611cd186868686612eed565b6000848152601c60205260409020548390611ced908990613f47565b1115611d28576040517f98ce7d5a00000000000000000000000000000000000000000000000000000000815260048101859052602401611398565b60085487601954611d399190613f47565b1115611d71576040517f877cc90b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611d7e8860006118fe565b33600090815260226020526040812080549293508392909190611da2908490613f47565b90915550506000858152601c6020526040812080548a9290611dc5908490613f47565b925050819055508760196000828254611dde9190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff716908a908381818185875af1925050503d8060008114611e5b576040519150601f19603f3d011682016040523d82523d6000602084013e611e60565b606091505b5050905080611eda576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff7166004820152602481018a9052604401611398565b81893373ffffffffffffffffffffffffffffffffffffffff167f6ebc929391d0bb08d885d9cd4fcdd70e4e4324c4105d6414a51f8afbd7aa711289604051611f2491815260200190565b60405180910390a4505050506117bb6001600255565b611f42612bab565b611f4a612bec565b60026000611f57826116c7565b905080611f9257816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b601454611f9f90846140bb565b15611fd6576040517fd15f263900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60135433600090815260216020526040902054611ff4908590613f47565b111561202e576040517fa5d0bbfb000000000000000000000000000000000000000000000000000000008152336004820152602401611398565b336000908152602160205260408120805485929061204d908490613f47565b9250508190555082601b60008282546120669190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff7169085908381818185875af1925050503d80600081146120e3576040519150601f19603f3d011682016040523d82523d6000602084013e6120e8565b606091505b5050905080612162576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff716600482015260248101859052604401611398565b604051849033907f57cac2b845702d796e17be9d38f4b47108e6c9a5d4bb54ecbb392357598d5ad490600090a35050506113aa6001600255565b6121a4612fce565b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b612221612bab565b612229612bec565b600080612235826116c7565b90508061227057816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b61227a8585612c41565b61228687878786613022565b600854886019546122979190613f47565b11156122cf576040517f877cc90b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff85166000908152601e60209081526040808320878452909152902054839061230d908a90613f47565b1115612364576040517f095eced900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616600482015260248101859052604401611398565b60006123718960006118fe565b33600090815260226020526040812080549293508392909190612395908490613f47565b909155505073ffffffffffffffffffffffffffffffffffffffff86166000908152601e60209081526040808320888452909152812080548b92906123da908490613f47565b9250508190555088601960008282546123f39190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff716908b908381818185875af1925050503d8060008114612470576040519150601f19603f3d011682016040523d82523d6000602084013e612475565b606091505b50509050806124ef576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff7166004820152602481018b9052604401611398565b6040805173ffffffffffffffffffffffffffffffffffffffff891681526020810188905283918c9133917fd4d67cb21a5b2492b4e4555dbbca6e53711c6df2145d75cb4b408b10c343c469910160405180910390a4505050506125526001600255565b505050505050565b612562612bab565b61256a612bec565b600080612576826116c7565b9050806125b157816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b6125bc858585613118565b336000908152601d602052604090205483906125d9908890613f47565b1115612612576040517ebd9075000000000000000000000000000000000000000000000000000000008152336004820152602401611398565b600854866019546126239190613f47565b111561265b576040517f877cc90b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006126688760006118fe565b3360009081526022602052604081208054929350839290919061268c908490613f47565b9091555050336000908152601d6020526040812080548992906126b0908490613f47565b9250508190555086601960008282546126c99190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff7169089908381818185875af1925050503d8060008114612746576040519150601f19603f3d011682016040523d82523d6000602084013e61274b565b606091505b50509050806127c5576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff716600482015260248101899052604401611398565b6040518290899033907ff45dd176e8f011701b8c7d8f06ec1d1a660d4eb0721ced75b5bd6ba2a4e70ac490600090a450505050610d646001600255565b61280a612bab565b612812612bec565b6001600061281f826116c7565b90508061285a57816040517f250e9a8b000000000000000000000000000000000000000000000000000000008152600401611398919061407a565b6128658585856131f8565b8486602086866040516128799291906140f6565b9081526020016040518091039020546128929190613f47565b11156128ca576040517f7a4b8e8f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b54600a546009546128dd9190613f47565b6128e79190613f47565b86601a546128f59190613f47565b111561292d576040517f6395f82b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061293a8760016118fe565b3360009081526022602052604081208054929350839290919061295e908490613f47565b9250508190555086602086866040516129789291906140f6565b908152602001604051809103902060008282546129959190613f47565b9091555050336000908152601f6020526040812080548992906129b9908490613f47565b9250508190555086601a60008282546129d29190613f47565b909155505060405160009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff7169089908381818185875af1925050503d8060008114612a4f576040519150601f19603f3d011682016040523d82523d6000602084013e612a54565b606091505b5050905080612ace576040517f1c43b97600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff716600482015260248101899052604401611398565b6040518290899033907f3b46266aeba0f54c8a82405606115d276926e122a50ee539cf57080e8b27a98790600090a450505050610d646001600255565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556113aa81613303565b612b44612bec565b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121ef3390565b6002805403612be6576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028055565b60015474010000000000000000000000000000000000000000900460ff1615610d73576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810182905260009073ffffffffffffffffffffffffffffffffffffffff841690636352211e90602401602060405180830381865afa158015612caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd39190614106565b90503373ffffffffffffffffffffffffffffffffffffffff821603612cf757505050565b6040517fb9f3687400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8281166024830152848116604483015260648201849052600060848301527f00000000000000000000000000000000000000447e69651d841bd8d104bed493169063b9f368749060a401602060405180830381865afa158015612d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dc39190614123565b15612dcd57505050565b6040517faba69cf800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82811660248301528481166044830152606482018490527f00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b169063aba69cf890608401602060405180830381865afa158015612e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e929190614123565b15612e9c57505050565b6040517f58a5e22200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101839052604401611398565b6040805160208101849052908101829052600090606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201209083015201604051602081830303815290604052805190602001209050612f98858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506004549150849050613378565b6117bb576040517fe60a7a3600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015474010000000000000000000000000000000000000000900460ff16610d73576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff84166020820152908101829052600090606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506130e2858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506005549150849050613378565b6117bb576040517fda4d12cc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051336020820152908101829052600090606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012090830152016040516020818303038152906040528051906020012090506131c2848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506003549150849050613378565b610d64576040517f2e88619500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061326861320561338e565b6040805160208101929092528101869052336060820152608001604051602081830303815290604052805190602001207f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b905060006132ac8285858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061347f92505050565b600c5490915073ffffffffffffffffffffffffffffffffffffffff8083169116146117bb576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261338585846134a9565b14949350505050565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007a655a234ddf076c3530ac847040f8d8c5115021161480156133f457507f000000000000000000000000000000000000000000000000000000000000000146145b1561341e57507f48ba26661dae802259fa445fba944fffa2b36485194073d33af560ef627ed8df90565b61347a604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a794692186020820152469181019190915230606082015260009060800160405160208183030381529060405280519060200120905090565b905090565b60008060008061348f86866134ec565b92509250925061349f8282613539565b5090949350505050565b600081815b84518110156134e4576134da828683815181106134cd576134cd613d41565b6020026020010151613641565b91506001016134ae565b509392505050565b600080600083516041036135265760208401516040850151606086015160001a61351888828585613673565b955095509550505050613532565b50508151600091506002905b9250925092565b600082600381111561354d5761354d614021565b03613556575050565b600182600381111561356a5761356a614021565b036135a1576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028260038111156135b5576135b5614021565b036135ef576040517ffce698f700000000000000000000000000000000000000000000000000000000815260048101829052602401611398565b600382600381111561360357613603614021565b0361363d576040517fd78bce0c00000000000000000000000000000000000000000000000000000000815260048101829052602401611398565b5050565b600081831061365d57600082815260208490526040902061366c565b60008381526020839052604090205b9392505050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156136ae5750600091506003905082613763565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015613702573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661375957506000925060019150829050613763565b9250600091508190505b9450945094915050565b6000806000806080858703121561378357600080fd5b5050823594602084013594506040840135936060013592509050565b73ffffffffffffffffffffffffffffffffffffffff811681146113aa57600080fd5b6000602082840312156137d357600080fd5b813561366c8161379f565b60008083601f8401126137f057600080fd5b50813567ffffffffffffffff81111561380857600080fd5b6020830191508360208260051b850101111561382357600080fd5b9250929050565b6000806000806060858703121561384057600080fd5b843567ffffffffffffffff81111561385757600080fd5b613863878288016137de565b90989097506020870135966040013595509350505050565b60006020828403121561388d57600080fd5b5035919050565b6000606082840312156138a657600080fd5b50919050565b60008083601f8401126138be57600080fd5b50813567ffffffffffffffff8111156138d657600080fd5b60208301915083602082850101111561382357600080fd5b60008060008060008060008060008060e08b8d03121561390d57600080fd5b8a3567ffffffffffffffff8082111561392557600080fd5b6139318e838f016137de565b909c509a5060208d013591508082111561394a57600080fd5b6139568e838f016137de565b909a50985060408d013591508082111561396f57600080fd5b61397b8e838f01613894565b975060608d013591508082111561399157600080fd5b5061399e8d828e016138ac565b9b9e9a9d50989b979a9699969760808101359760a0820135975060c09091013595509350505050565b600080602083850312156139da57600080fd5b823567ffffffffffffffff8111156139f157600080fd5b6139fd858286016137de565b90969095509350505050565b600080600060608486031215613a1e57600080fd5b505081359360208301359350604090920135919050565b600080600060408486031215613a4a57600080fd5b83359250602084013567ffffffffffffffff811115613a6857600080fd5b613a74868287016138ac565b9497909650939450505050565b600080600060408486031215613a9657600080fd5b833567ffffffffffffffff811115613aad57600080fd5b613ab9868287016137de565b909790965060209590950135949350505050565b60008060408385031215613ae057600080fd5b8235613aeb8161379f565b946020939093013593505050565b803560038110613b0857600080fd5b919050565b600060208284031215613b1f57600080fd5b61366c82613af9565b600080600080600060808688031215613b4057600080fd5b853567ffffffffffffffff811115613b5757600080fd5b613b63888289016137de565b9096509450506020860135613b778161379f565b94979396509394604081013594506060013592915050565b60008060008060008060c08789031215613ba857600080fd5b863595506020870135945060408701359350606087013592506080870135915060a0870135613bd68161379f565b809150509295509295509295565b60008060408385031215613bf757600080fd5b82359150613c0760208401613af9565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613c8657613c86613c10565b604052919050565b60006020808385031215613ca157600080fd5b823567ffffffffffffffff80821115613cb957600080fd5b818501915085601f830112613ccd57600080fd5b813581811115613cdf57613cdf613c10565b613d0f847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613c3f565b91508082528684828501011115613d2557600080fd5b8084840185840137600090820190930192909252509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81833603018112613da457600080fd5b9190910192915050565b600082601f830112613dbf57600080fd5b8135602067ffffffffffffffff821115613ddb57613ddb613c10565b8160051b613dea828201613c3f565b9283528481018201928281019087851115613e0457600080fd5b83870192505b84831015613e2357823582529183019190830190613e0a565b979650505050505050565b600060808236031215613e4057600080fd5b6040516080810167ffffffffffffffff8282108183111715613e6457613e64613c10565b816040528435915080821115613e7957600080fd5b50613e8636828601613dae565b82525060208301356020820152604083013560408201526060830135606082015280915050919050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613ee557600080fd5b83018035915067ffffffffffffffff821115613f0057600080fd5b6020019150600581901b360382131561382357600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115611a4157611a41613f18565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61833603018112613da457600080fd5b600060a08236031215613fa057600080fd5b60405160a0810167ffffffffffffffff8282108183111715613fc457613fc4613c10565b816040528435915080821115613fd957600080fd5b50613fe636828601613dae565b8252506020830135613ff78161379f565b60208201526040838101359082015260608084013590820152608092830135928101929092525090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8082028115828204841417611a4157611a41613f18565b81810381811115611a4157611a41613f18565b60208101600383106140b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b6000826140f1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500690565b8183823760009101908152919050565b60006020828403121561411857600080fd5b815161366c8161379f565b60006020828403121561413557600080fd5b8151801515811461366c57600080fdfea26469706673582212205d3a501280d43823a4341b82d77591fa02986518cb6ce08c560ae29c9234ca7064736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000581ddf7a136c6837429a46c6cb7b388a3e529710000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff7000000000000000000000000db9f620c0e66527869db59de3cb181c6f5e71cd200000000000000000000000000000000000076a84fef008cdabe6409d2fe638b00000000000000000000000000000000000000447e69651d841bd8d104bed493
-----Decoded View---------------
Arg [0] : _diceNFT (address): 0x0581dDf7A136c6837429a46C6Cb7b388A3E52971
Arg [1] : _treasury (address): 0x1B3703c4fd79aF133f5Dc47ec924e2D7BdA28ff7
Arg [2] : _initialOwner (address): 0xdb9F620C0e66527869DB59de3cb181c6f5E71Cd2
Arg [3] : _delegateRegistryV1 (address): 0x00000000000076A84feF008CDAbe6409d2FE638B
Arg [4] : _delegateRegistryV2 (address): 0x00000000000000447e69651d841bD8D104Bed493
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000581ddf7a136c6837429a46c6cb7b388a3e52971
Arg [1] : 0000000000000000000000001b3703c4fd79af133f5dc47ec924e2d7bda28ff7
Arg [2] : 000000000000000000000000db9f620c0e66527869db59de3cb181c6f5e71cd2
Arg [3] : 00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
Arg [4] : 00000000000000000000000000000000000000447e69651d841bd8d104bed493
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.