Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 3,144 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Purchase Token W... | 20226720 | 1 hr ago | IN | 0.0828 ETH | 0.00216784 | ||||
Purchase Token W... | 20226619 | 1 hr ago | IN | 0.075 ETH | 0.00275839 | ||||
Purchase Token W... | 20226596 | 1 hr ago | IN | 0.081 ETH | 0.00270954 | ||||
Purchase Token W... | 20226583 | 1 hr ago | IN | 0.11 ETH | 0.00297109 | ||||
Purchase Token W... | 20226566 | 1 hr ago | IN | 0.16 ETH | 0.00056853 | ||||
Purchase Token W... | 20226374 | 2 hrs ago | IN | 0.07 ETH | 0.00435918 | ||||
Purchase Token W... | 20226366 | 2 hrs ago | IN | 0.08 ETH | 0.00370494 | ||||
Purchase Token W... | 20226357 | 2 hrs ago | IN | 0 ETH | 0.0046606 | ||||
Purchase Token W... | 20226316 | 2 hrs ago | IN | 0.18 ETH | 0.00395107 | ||||
Purchase Token W... | 20226237 | 2 hrs ago | IN | 0.042 ETH | 0.00397702 | ||||
Purchase Token W... | 20226076 | 3 hrs ago | IN | 0.01333 ETH | 0.00483825 | ||||
Purchase Token W... | 20225867 | 3 hrs ago | IN | 0.1 ETH | 0.0014379 | ||||
Purchase Token W... | 20225771 | 4 hrs ago | IN | 0.17 ETH | 0.00125293 | ||||
Purchase Token W... | 20225766 | 4 hrs ago | IN | 0 ETH | 0.00155876 | ||||
Purchase Token W... | 20225763 | 4 hrs ago | IN | 0.096 ETH | 0.0011634 | ||||
Purchase Token W... | 20225729 | 4 hrs ago | IN | 1.913 ETH | 0.00104434 | ||||
Purchase Token W... | 20225688 | 4 hrs ago | IN | 0.15 ETH | 0.00157412 | ||||
Purchase Token W... | 20225551 | 4 hrs ago | IN | 0.569 ETH | 0.00122779 | ||||
Purchase Token W... | 20225511 | 5 hrs ago | IN | 0.03 ETH | 0.00154855 | ||||
Purchase Token W... | 20225392 | 5 hrs ago | IN | 0 ETH | 0.00141688 | ||||
Purchase Token W... | 20225347 | 5 hrs ago | IN | 0.09 ETH | 0.00083928 | ||||
Purchase Token W... | 20225284 | 5 hrs ago | IN | 0.283 ETH | 0.00050082 | ||||
Purchase Token W... | 20225265 | 5 hrs ago | IN | 0.9 ETH | 0.00054927 | ||||
Purchase Token W... | 20225211 | 6 hrs ago | IN | 0 ETH | 0.00114991 | ||||
Purchase Token W... | 20225165 | 6 hrs ago | IN | 0.017 ETH | 0.00103181 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
20226720 | 1 hr ago | 0.0207 ETH | ||||
20226720 | 1 hr ago | 0.0207 ETH | ||||
20226720 | 1 hr ago | 0.0207 ETH | ||||
20226720 | 1 hr ago | 0.0207 ETH | ||||
20226619 | 1 hr ago | 0.01875 ETH | ||||
20226619 | 1 hr ago | 0.01875 ETH | ||||
20226619 | 1 hr ago | 0.01875 ETH | ||||
20226619 | 1 hr ago | 0.01875 ETH | ||||
20226596 | 1 hr ago | 0.02025 ETH | ||||
20226596 | 1 hr ago | 0.02025 ETH | ||||
20226596 | 1 hr ago | 0.02025 ETH | ||||
20226596 | 1 hr ago | 0.02025 ETH | ||||
20226583 | 1 hr ago | 0.0275 ETH | ||||
20226583 | 1 hr ago | 0.0275 ETH | ||||
20226583 | 1 hr ago | 0.0275 ETH | ||||
20226583 | 1 hr ago | 0.0275 ETH | ||||
20226374 | 2 hrs ago | 0.0175 ETH | ||||
20226374 | 2 hrs ago | 0.0175 ETH | ||||
20226374 | 2 hrs ago | 0.0175 ETH | ||||
20226374 | 2 hrs ago | 0.0175 ETH | ||||
20226366 | 2 hrs ago | 0.02 ETH | ||||
20226366 | 2 hrs ago | 0.02 ETH | ||||
20226366 | 2 hrs ago | 0.02 ETH | ||||
20226366 | 2 hrs ago | 0.02 ETH | ||||
20226316 | 2 hrs ago | 0.045 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PreSale
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.25; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import { MessageHashUtils } from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import { Rounds, Ownable } from "./Rounds.sol"; import { ILockup, IPreSale } from "./ILockup.sol"; import "./Common.sol"; /// @title PreSale contract /// @notice Implements preSale of the token /// @dev The presale contract allows you to purchase presale token with allowed tokens, /// and there will be certain rounds contract PreSale is IPreSale, Rounds, ReentrancyGuard { using SafeERC20 for IERC20; using Address for address payable; /// @member nftAmounts The nft amounts /// @member roundPrice The round number struct ClaimNFT { uint256[] nftAmounts; uint256 roundPrice; } /// @member price The price of token from price feed /// @member normalizationFactorForToken The normalization factor to achieve return value of 18 decimals ,while calculating token purchases and always with different token decimals /// @member normalizationFactorForNFT The normalization factor is the value which helps us to convert decimals of USDT to purchase token decimals and always with different token decimals struct TokenInfo { uint256 latestPrice; uint8 normalizationFactorForToken; uint8 normalizationFactorForNFT; } /// @notice That buyEnable or not bool public buyEnable = true; /// @notice The address of signer wallet address public signerWallet; /// @notice The address of claims contract address public claimsContract; /// @notice The address of the first funds wallet address[] public fundsWallets; /// @notice Sum of tokens purchased in presale uint256 public totalPurchases; /// @notice To achieve return value of required decimals while calculation uint256 private constant NORMALIZARION_FACTOR = 1e30; /// @notice Minimum amount required to lock in order to get discount uint256 private constant MIN_LOCKED_AMOUNT = 5555e18; /// @notice The constant value helps in calculating discount uint256 private constant PPH = 100; /// @notice The constant value helps in calculating discount uint256 private constant FIRST_ROUND = 20; /// @notice The constant value helps in calculating discount uint256 private constant OTHER_ROUND = 7; /// @notice The array of prices of each nft uint256[] public nftPricing; /// @notice The address of lockup contract ILockup public immutable lockup; /// @notice Gives claim info of user in every round mapping(address => mapping(uint32 => uint256)) public claims; /// @notice Gives info about address's permission mapping(address => bool) public blacklistAddress; /// @notice Gives claim info of user nft in every round mapping(address => mapping(uint32 => ClaimNFT[])) public claimNFT; /// @dev Emitted when token is purchased with ETH event PurchasedWithETH( address indexed by, string code, uint256 amountPurchasedETH, uint32 indexed round, uint256 indexed roundPrice, uint256 tokenPurchased ); /// @dev Emitted when presale tokens are purchased with any token event PurchasedWithToken( IERC20 indexed token, uint256 tokenPrice, address indexed by, string code, uint256 amountPurchased, uint256 tokenPurchased, uint32 indexed round ); /// @dev Emitted when NFT is purchased with ETH event PurchasedWithETHForNFT( address indexed by, string code, uint256 amountInETH, uint256 ethPrice, uint32 indexed round, uint256 roundPrice, uint256[] nftAmounts ); /// @dev Emitted when NFT is purchased with any token event PurchasedWithTokenForNFT( IERC20 indexed token, uint256 tokenPrice, address indexed by, string code, uint256 amountPurchased, uint32 indexed round, uint256 roundPrice, uint256[] nftAmounts ); /// @dev Emitted when tokens are purchased with claim amount event PurchasedWithClaimAmount( address indexed by, uint256 amount, IERC20 token, uint32 indexed round, uint256 indexed tokenPrice, uint256 tokenPurchased ); /// @dev Emitted when address of signer is updated event SignerUpdated(address oldSigner, address newSigner); /// @dev Emitted when address of any funds wallets is updated event FundsWalletsUpdated(address[] indexed oldAddresses, address[] indexed newAddresses); /// @dev Emitted when blacklist access of address is updated event BlacklistUpdated(address which, bool accessNow); /// @dev Emitted when buying access changes event BuyEnableUpdated(bool oldAccess, bool newAccess); /// @dev Emitted when NFT prices are updated event PricingUpdated(uint256 oldPrice, uint256 newPrice); /// @notice Thrown when address is blacklisted error Blacklisted(); /// @notice Thrown when buy is disabled error BuyNotEnable(); /// @notice Thrown when sign deadline is expired error DeadlineExpired(); /// @notice Thrown when Eth price suddenly drops while purchasing tokens error UnexpectedPriceDifference(); /// @notice Thrown when value to transfer is zero error ZeroValue(); /// @notice Thrown when price from price feed returns zero error PriceNotFound(); /// @notice Thrown when caller is not claims contract error OnlyClaims(); /// @notice Thrown when purchase amount is less than required error InvalidPurchase(); /// @notice Thrown when both price feed and reference price are non zero error CodeSyncIssue(); /// @notice Thrown if the price is not updated error PriceNotUpdated(); /// @notice Thrown if the roundId of price is not updated error RoundIdNotUpdated(); /// @notice Thrown when updating funds wallet values and values are duplicated error InvalidValue(); /// @notice Thrown when array is not sorted error ArrayNotSorted(); /// @notice Restricts when updating wallet/contract address with zero address modifier checkAddressZero(address which) { if (which == address(0)) { revert ZeroAddress(); } _; } /// @notice Ensures that buy is enabled when buying modifier canBuy() { if (!buyEnable) { revert BuyNotEnable(); } _; } /// @dev Constructor /// @param fundsWalletAddresses The addresses of the funds wallets /// @param signerAddress The address of signer wallet /// @param claimsContractAddress The address of claim contract /// @param lockupContractAddress The address of lockup contract /// @param owner The address of owner wallet /// @param lastRound The last round created /// @param nftPrices The prices of nfts constructor( address[] memory fundsWalletAddresses, address signerAddress, address claimsContractAddress, ILockup lockupContractAddress, address owner, uint32 lastRound, uint256[] memory nftPrices ) Rounds(lastRound) Ownable(owner) { if ( signerAddress == address(0) || claimsContractAddress == address(0) || address(lockupContractAddress) == address(0) ) { revert ZeroAddress(); } _verifyFundsWallets(fundsWalletAddresses); fundsWallets = fundsWalletAddresses; signerWallet = signerAddress; claimsContract = claimsContractAddress; lockup = lockupContractAddress; if (nftPrices.length == 0) { revert ZeroLengthArray(); } for (uint256 i = 0; i < nftPrices.length; ++i) { _checkValue(nftPrices[i]); } nftPricing = nftPrices; } /// @notice Changes access of buying /// @param enabled The decision about buying function enableBuy(bool enabled) external onlyOwner { if (buyEnable == enabled) { revert IdenticalValue(); } emit BuyEnableUpdated({ oldAccess: buyEnable, newAccess: enabled }); buyEnable = enabled; } /// @notice Changes signer wallet address /// @param newSigner The address of the new signer wallet function changeSigner(address newSigner) external checkAddressZero(newSigner) onlyOwner { address oldSigner = signerWallet; if (oldSigner == newSigner) { revert IdenticalValue(); } emit SignerUpdated({ oldSigner: oldSigner, newSigner: newSigner }); signerWallet = newSigner; } /// @notice Changes funds wallets to a new address /// @param newFundsWallets The addresses of the new funds wallets function changeFundsWallets(address[] calldata newFundsWallets) external onlyOwner { _verifyFundsWallets(newFundsWallets); emit FundsWalletsUpdated({ oldAddresses: fundsWallets, newAddresses: newFundsWallets }); fundsWallets = newFundsWallets; } /// @notice Changes the access of any address in contract interaction /// @param which The address for which access is updated /// @param access The access decision of `which` address function updateBlackListedUser(address which, bool access) external checkAddressZero(which) onlyOwner { bool oldAccess = blacklistAddress[which]; if (oldAccess == access) { revert IdenticalValue(); } emit BlacklistUpdated({ which: which, accessNow: access }); blacklistAddress[which] = access; } /// @notice Changes the nft prices /// @param newPrices The new prices of nfts function updatePricing(uint256[] calldata newPrices) external onlyOwner { uint256[] memory oldPrices = nftPricing; for (uint256 i = 0; i < newPrices.length; ++i) { uint256 newPrice = newPrices[i]; _checkValue(newPrice); emit PricingUpdated({ oldPrice: oldPrices[i], newPrice: newPrice }); } nftPricing = newPrices; } /// @notice Returns NFT claim info of user in given round /// @param buyer The address of the buyer /// @param round The round number function getNFTClaims(address buyer, uint32 round) external view returns (ClaimNFT[] memory) { ClaimNFT[] memory nftClaim = claimNFT[buyer][round]; return nftClaim; } /// @notice Purchases presale token with ETH /// @param code The code is used to verify signature of the user /// @param round The round in which user wants to purchase /// @param deadline The deadline is validity of the signature /// @param minAmountToken The minAmountToken user agrees to purchase /// @param indexes The indexes at which user has locked tokens /// @param v The `v` signature parameter /// @param r The `r` signature parameter /// @param s The `s` signature parameter function purchaseTokenWithETH( string memory code, uint32 round, uint256 deadline, uint256 minAmountToken, uint256[] calldata indexes, uint8 v, bytes32 r, bytes32 s ) external payable nonReentrant canBuy { // The input must have been signed by the presale signer _validatePurchaseWithETH(msg.value, round, deadline, code, v, r, s); uint256 roundPrice = _getRoundPriceForToken(msg.sender, indexes, round, ETH); TokenInfo memory tokenInfo = getLatestPrice(ETH); if (tokenInfo.latestPrice == 0) { revert PriceNotFound(); } uint256 toReturn = _calculateAndUpdateTokenAmount( msg.value, tokenInfo.latestPrice, tokenInfo.normalizationFactorForToken, roundPrice ); if (toReturn < minAmountToken) { revert UnexpectedPriceDifference(); } claims[msg.sender][round] += toReturn; (uint256 amountEach, uint256 equivalence) = _calculateTransferAmount(msg.value); payable(claimsContract).sendValue(equivalence); _sendETH(amountEach); emit PurchasedWithETH({ by: msg.sender, code: code, amountPurchasedETH: msg.value, round: round, roundPrice: roundPrice, tokenPurchased: toReturn }); } /// @notice Purchases presale token with any token /// @param token The purchase token /// @param referenceNormalizationFactor The normalization factor /// @param referenceTokenPrice The current price of token in 10 decimals /// @param purchaseAmount The purchase amount /// @param minAmountToken The minAmountToken user agrees to purchase /// @param indexes The indexes at which user has locked tokens /// @param code The code is used to verify signature of the user /// @param round The round in which user wants to purchase /// @param deadline The deadline is validity of the signature /// @param v The `v` signature parameter /// @param r The `r` signature parameter /// @param s The `s` signature parameter function purchaseTokenWithToken( IERC20 token, uint8 referenceNormalizationFactor, uint256 referenceTokenPrice, uint256 purchaseAmount, uint256 minAmountToken, uint256[] calldata indexes, string memory code, uint32 round, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external canBuy nonReentrant { // The input must have been signed by the presale signer _validatePurchaseWithToken( token, round, deadline, code, referenceTokenPrice, referenceNormalizationFactor, v, r, s ); _checkValue(purchaseAmount); uint256 roundPrice = _getRoundPriceForToken(msg.sender, indexes, round, token); (uint256 latestPrice, uint8 normalizationFactor) = _validatePrice( token, referenceTokenPrice, referenceNormalizationFactor ); uint256 toReturn = _calculateAndUpdateTokenAmount(purchaseAmount, latestPrice, normalizationFactor, roundPrice); if (toReturn < minAmountToken) { revert UnexpectedPriceDifference(); } claims[msg.sender][round] += toReturn; (uint256 amountEach, uint256 equivalence) = _calculateTransferAmount(purchaseAmount); token.safeTransferFrom(msg.sender, claimsContract, equivalence); _sendToken(token, amountEach); emit PurchasedWithToken({ token: token, tokenPrice: latestPrice, by: msg.sender, code: code, amountPurchased: purchaseAmount, tokenPurchased: toReturn, round: round }); } /// @notice Purchases NFT with ETH /// @param code The code is used to verify signature of the user /// @param round The round in which user wants to purchase /// @param nftAmounts The nftAmounts is array of nfts selected /// @param deadline The deadline is validity of the signature /// @param indexes The indexes at which user has locked tokens /// @param v The `v` signature parameter /// @param r The `r` signature parameter /// @param s The `s` signature parameter function purchaseNFTWithETH( string memory code, uint32 round, uint256[] calldata nftAmounts, uint256 deadline, uint256[] calldata indexes, uint8 v, bytes32 r, bytes32 s ) external payable canBuy nonReentrant { uint256[] memory nftPrices = nftPricing; _validateArrays(nftAmounts.length, nftPrices.length); // The input must have been signed by the presale signer _validatePurchaseWithETH(msg.value, round, deadline, code, v, r, s); TokenInfo memory tokenInfo = getLatestPrice(ETH); if (tokenInfo.latestPrice == 0) { revert PriceNotFound(); } (uint256 value, uint256 roundPrice) = _processPurchaseNFT( ETH, tokenInfo.latestPrice, tokenInfo.normalizationFactorForNFT, round, indexes, nftAmounts, nftPrices ); if (msg.value < value) { revert InvalidPurchase(); } _checkValue(value); uint256 amountUnused = msg.value - value; if (amountUnused > 0) { payable(msg.sender).sendValue(amountUnused); } (uint256 amountEach, uint256 equivalence) = _calculateTransferAmount(value); payable(claimsContract).sendValue(equivalence); _sendETH(amountEach); emit PurchasedWithETHForNFT({ by: msg.sender, code: code, amountInETH: value, ethPrice: tokenInfo.latestPrice, round: round, roundPrice: roundPrice, nftAmounts: nftAmounts }); } /// @notice Purchases NFT with any token /// @param token The purchase token /// @param referenceTokenPrice The current price of token in 10 decimals /// @param referenceNormalizationFactor The normalization factor /// @param code The code is used to verify signature of the user /// @param round The round in which user wants to purchase /// @param nftAmounts The nftAmounts is array of nfts selected /// @param deadline The deadline is validity of the signature /// @param indexes The indexes at which user has locked tokens /// @param v The `v` signature parameter /// @param r The `r` signature parameter /// @param s The `s` signature parameter function purchaseNFTWithToken( IERC20 token, uint256 referenceTokenPrice, uint8 referenceNormalizationFactor, string memory code, uint32 round, uint256[] calldata nftAmounts, uint256 deadline, uint256[] calldata indexes, uint8 v, bytes32 r, bytes32 s ) external canBuy nonReentrant { uint256[] memory nftPrices = nftPricing; _validateArrays(nftAmounts.length, nftPrices.length); // The input must have been signed by the presale signer _validatePurchaseWithToken( token, round, deadline, code, referenceTokenPrice, referenceNormalizationFactor, v, r, s ); TokenInfo memory tokenInfo = getLatestPrice(token); if (tokenInfo.latestPrice != 0) { if (referenceTokenPrice != 0 || referenceNormalizationFactor != 0) { revert CodeSyncIssue(); } } // If price feed isn't available,we fallback to the reference price if (tokenInfo.latestPrice == 0) { if (referenceTokenPrice == 0 || referenceNormalizationFactor == 0) { revert ZeroValue(); } tokenInfo.latestPrice = referenceTokenPrice; tokenInfo.normalizationFactorForNFT = referenceNormalizationFactor; } (uint256 value, uint256 roundPrice) = _processPurchaseNFT( token, tokenInfo.latestPrice, tokenInfo.normalizationFactorForNFT, round, indexes, nftAmounts, nftPrices ); _checkValue(value); (uint256 amountEach, uint256 equivalence) = _calculateTransferAmount(value); token.safeTransferFrom(msg.sender, claimsContract, equivalence); _sendToken(token, amountEach); emit PurchasedWithTokenForNFT({ token: token, tokenPrice: tokenInfo.latestPrice, by: msg.sender, code: code, amountPurchased: value, round: round, roundPrice: roundPrice, nftAmounts: nftAmounts }); } /// @inheritdoc IPreSale function purchaseWithClaim( IERC20 token, uint256 referenceTokenPrice, uint8 referenceNormalizationFactor, uint256 amount, uint256 minAmountToken, uint256[] calldata indexes, address recipient, uint32 round ) external payable canBuy nonReentrant { if (msg.sender != claimsContract) { revert OnlyClaims(); } _checkBlacklist(recipient); if (!allowedTokens[round][token].access) { revert TokenDisallowed(); } uint256 roundPrice = _getRoundPriceForToken(recipient, indexes, round, token); (uint256 latestPrice, uint8 normalizationFactor) = _validatePrice( token, referenceTokenPrice, referenceNormalizationFactor ); uint256 toReturn = _calculateAndUpdateTokenAmount(amount, latestPrice, normalizationFactor, roundPrice); if (toReturn < minAmountToken) { revert UnexpectedPriceDifference(); } claims[recipient][round] += toReturn; if (token == ETH) { payable(fundsWallets[0]).sendValue(msg.value); } else { token.safeTransferFrom(claimsContract, fundsWallets[0], amount); } emit PurchasedWithClaimAmount({ by: recipient, amount: amount, token: token, round: round, tokenPrice: latestPrice, tokenPurchased: toReturn }); } /// @notice The Chainlink inherited function, give us tokens live price function getLatestPrice(IERC20 token) public view returns (TokenInfo memory) { PriceFeedData memory data = tokenData[token]; TokenInfo memory tokenInfo; if (address(data.priceFeed) == address(0)) { return tokenInfo; } ( uint80 roundId, /*uint80 roundID*/ int price /*uint256 startedAt*/ /*uint80 answeredInRound*/, , uint256 updatedAt, ) = /*uint256 timeStamp*/ data.priceFeed.latestRoundData(); if (roundId == 0) { revert RoundIdNotUpdated(); } if (updatedAt == 0 || block.timestamp - updatedAt > data.tolerance) { revert PriceNotUpdated(); } return TokenInfo({ latestPrice: uint256(price), normalizationFactorForToken: data.normalizationFactorForToken, normalizationFactorForNFT: data.normalizationFactorForNFT }); } /// @dev Checks value, if zero then reverts function _checkValue(uint256 value) private pure { if (value == 0) { revert ZeroValue(); } } /// @dev Validates blacklist address, round and deadline function _validatePurchase(uint32 round, uint256 deadline, IERC20 token) private view { if (block.timestamp > deadline) { revert DeadlineExpired(); } _checkBlacklist(msg.sender); if (!allowedTokens[round][token].access) { revert TokenDisallowed(); } _verifyInRound(round); } /// @dev The helper function which verifies signature, signed by signerWallet, reverts if Invalid function _verifyCode(string memory code, uint256 deadline, uint8 v, bytes32 r, bytes32 s) private view { bytes32 encodedMessageHash = keccak256(abi.encodePacked(msg.sender, code, deadline)); _verifyMessage(encodedMessageHash, v, r, s); } /// @dev The helper function which verifies signature, signed by signerWallet, reverts if Invalid function _verifyCodeWithPrice( string memory code, uint256 deadline, uint256 referenceTokenPrice, IERC20 token, uint256 normalizationFactor, uint8 v, bytes32 r, bytes32 s ) private view { bytes32 encodedMessageHash = keccak256( abi.encodePacked(msg.sender, code, referenceTokenPrice, deadline, token, normalizationFactor) ); _verifyMessage(encodedMessageHash, v, r, s); } /// @dev Verifies the address that signed a hashed message (`hash`) with /// `signature` function _verifyMessage(bytes32 encodedMessageHash, uint8 v, bytes32 r, bytes32 s) private view { if (signerWallet != ECDSA.recover(MessageHashUtils.toEthSignedMessageHash(encodedMessageHash), v, r, s)) { revert InvalidSignature(); } } /// @dev Process nft purchase by calculating nft prices and purchase amount function _processPurchaseNFT( IERC20 token, uint256 price, uint256 normalizationFactor, uint32 round, uint256[] calldata indexes, uint256[] calldata nftAmounts, uint256[] memory nftPrices ) private returns (uint256, uint256) { uint256 value = 0; uint256 totalNFTPrices = 0; for (uint256 i = 0; i < nftPrices.length; ++i) { uint256 nfts = nftAmounts[i]; uint256 prices = nftPrices[i]; // (10**0 * 10**6 +10**10) -10**10 = 6 decimals value += (nfts * prices * (10 ** (normalizationFactor))) / price; totalNFTPrices += nfts * prices; } uint256 roundPrice = _getRoundPriceForToken(msg.sender, indexes, round, token); uint256 incentiveTokens = (totalNFTPrices * NORMALIZARION_FACTOR) / roundPrice; _updateTokenPurchases(incentiveTokens); ClaimNFT memory amounts = ClaimNFT({ nftAmounts: nftAmounts, roundPrice: roundPrice }); claimNFT[msg.sender][round].push(amounts); return (value, roundPrice); } /// @dev Checks that address is blacklisted or not function _checkBlacklist(address which) private view { if (blacklistAddress[which]) { revert Blacklisted(); } } /// @dev Updates total purchases function _updateTokenPurchases(uint256 newPurchase) private { totalPurchases += newPurchase; } /// @dev Validates round, deadline and signature function _validatePurchaseWithETH( uint256 amount, uint32 round, uint256 deadline, string memory code, uint8 v, bytes32 r, bytes32 s ) private view { _checkValue(amount); _validatePurchase(round, deadline, ETH); _verifyCode(code, deadline, v, r, s); } /// @dev Validates round, deadline and signature function _validatePurchaseWithToken( IERC20 token, uint32 round, uint256 deadline, string memory code, uint256 referenceTokenPrice, uint256 normalizationFactor, uint8 v, bytes32 r, bytes32 s ) private view { _validatePurchase(round, deadline, token); _verifyCodeWithPrice(code, deadline, referenceTokenPrice, token, normalizationFactor, v, r, s); } /// @dev Validates round, deadline and signature function _getRoundPriceForToken( address user, uint256[] memory indexes, uint32 round, IERC20 token ) private view returns (uint256) { uint256 customPrice = allowedTokens[round][token].customPrice; uint256 roundPrice = customPrice > 0 ? customPrice : rounds[round].price; uint256 lockedAmount; uint256 indexLength = indexes.length; if (indexLength == 0) { return roundPrice; } for (uint256 i; i < indexLength; ++i) { if (indexLength != i + 1) { if (indexes[i] >= indexes[i + 1]) { revert ArrayNotSorted(); } } (uint256 amount, ) = lockup.stakes(user, indexes[i]); lockedAmount += amount; if (lockedAmount >= MIN_LOCKED_AMOUNT) { if (round == 1) { roundPrice -= ((roundPrice * FIRST_ROUND) / PPH); } else { roundPrice -= ((roundPrice * OTHER_ROUND) / PPH); } break; } } return roundPrice; } /// @dev Calculates and update the token amount function _calculateAndUpdateTokenAmount( uint256 purchaseAmount, uint256 referenceTokenPrice, uint256 normalizationFactor, uint256 roundPrice ) private returns (uint256) { // toReturn= (10**11 * 10**10 +10**15) -10**18 = 18 decimals uint256 toReturn = (purchaseAmount * referenceTokenPrice * (10 ** normalizationFactor)) / roundPrice; _updateTokenPurchases(toReturn); return toReturn; } /// @dev Provides us live price of token from price feed or returns reference price and reverts if invalid function _validatePrice( IERC20 token, uint256 referenceTokenPrice, uint8 referenceNormalizationFactor ) private view returns (uint256, uint8) { TokenInfo memory tokenInfo = getLatestPrice(token); if (tokenInfo.latestPrice != 0) { if (referenceTokenPrice != 0 || referenceNormalizationFactor != 0) { revert CodeSyncIssue(); } } // If price feed isn't available,we fallback to the reference price if (tokenInfo.latestPrice == 0) { if (referenceTokenPrice == 0 || referenceNormalizationFactor == 0) { revert ZeroValue(); } tokenInfo.latestPrice = referenceTokenPrice; tokenInfo.normalizationFactorForToken = referenceNormalizationFactor; } return (tokenInfo.latestPrice, tokenInfo.normalizationFactorForToken); } /// @dev Sends ETH to funds wallets function _sendETH(uint256 amount) private { uint256 fundsWalletsLength = fundsWallets.length; address[] memory wallets = fundsWallets; for (uint256 i; i < fundsWalletsLength; ++i) { payable(wallets[i]).sendValue(amount); } } /// @dev Sends tokens to funds wallets function _sendToken(IERC20 token, uint256 amount) private { uint256 fundsWalletsLength = fundsWallets.length; address[] memory wallets = fundsWallets; for (uint256 i; i < fundsWalletsLength; ++i) { token.safeTransferFrom(msg.sender, wallets[i], amount); } } /// @dev Calculates transfer amounts function _calculateTransferAmount(uint256 amount) private view returns (uint256 amountEach, uint256 equivalence) { uint256 fundsWalletLength = fundsWallets.length; amountEach = amount / (fundsWalletLength + 1); equivalence = amount - (amountEach * fundsWalletLength); } /// @dev Verifies funds wallets addresses function _verifyFundsWallets(address[] memory fundsWalletAddresses) private pure { uint256 fundsWalletsLength = fundsWalletAddresses.length; if (fundsWalletsLength == 0) { revert InvalidData(); } for (uint256 i; i < fundsWalletsLength; ++i) { if (fundsWalletAddresses[i] == address(0)) { revert ZeroAddress(); } if (fundsWalletsLength != i + 1) { if (uint256(uint160(fundsWalletAddresses[i])) >= uint256(uint160(fundsWalletAddresses[i + 1]))) { revert InvalidValue(); } } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // solhint-disable-next-line interface-starts-with-i interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData( uint80 _roundId ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); }
// 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.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) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.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/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) (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); } } }
// 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) (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 pragma solidity 0.8.25; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @dev The address of the Ethereum IERC20 constant ETH = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); /// @notice Thrown when updating an address with zero address error ZeroAddress(); /// @notice Thrown when updating with an array of no values error ZeroLengthArray(); /// @notice Thrown when updating with the same value as previously stored error IdenticalValue(); /// @notice Thrown when two array lengths does not match error ArrayLengthMismatch(); /// @notice Thrown when sign is invalid error InvalidSignature(); /// @notice Thrown when input array length is zero error InvalidData();
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IRounds } from "./IRounds.sol"; interface ILockup { /// @notice Returns locked amount of user at given index /// @param user The address of the user /// @param index The index number at which user has locked amount function stakes(address user, uint256 index) external view returns (uint256 amount, uint256 endTime); } interface IPreSale is IRounds { /// @notice Purchases token with claim amount /// @param token The purchase token /// @param tokenPrice The current price of token in 10 decimals /// @param referenceNormalizationFactor The value to handle decimals /// @param amount The purchase amount /// @param minAmountToken The minimum amount of token recipient will get /// @param indexes The indexes at which user has locked tokens /// @param recipient The address of the recipient /// @param round The round in which user will purchase function purchaseWithClaim( IERC20 token, uint256 tokenPrice, uint8 referenceNormalizationFactor, uint256 amount, uint256 minAmountToken, uint256[] calldata indexes, address recipient, uint32 round ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.25; interface IRounds { /// @notice Returns the round details of the round function rounds(uint32 round) external view returns (uint256 startTime, uint256 endTime, uint256 price); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.25; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { Ownable, Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol"; import { TokenRegistry } from "./TokenRegistry.sol"; import { IRounds } from "./IRounds.sol"; import { ZeroAddress, ArrayLengthMismatch, ZeroLengthArray } from "./Common.sol"; /// @title Rounds contract /// @notice Implements the round creation and updating of presale /// @dev The rounds contract allows you to create a round, update a round abstract contract Rounds is IRounds, Ownable2Step, TokenRegistry { /// @member access The access of the token /// @member customPrice The customPrice price in the round for the token struct AllowedToken { bool access; uint256 customPrice; } /// @member startTime The start time of round /// @member endTime The end time of round /// @member price The price in usd per token struct RoundData { uint256 startTime; uint256 endTime; uint256 price; } /// @notice The round index of last round created uint32 internal immutable _startRound; /// @notice The count of rounds created uint32 internal _roundIndex; /// @notice mapping gives us access info of the token in a given round mapping(uint32 => mapping(IERC20 => AllowedToken)) public allowedTokens; /// @notice mapping gives Round Data of each round mapping(uint32 => RoundData) public rounds; /// @dev Emitted when creating a new round event RoundCreated(uint32 indexed newRound, RoundData roundData); /// @dev Emitted when round is updated event RoundUpdated(uint32 indexed round, RoundData roundData); /// @dev Emitted when token access is updated event TokensAccessUpdated(uint32 indexed round, IERC20 indexed token, bool indexed access, uint256 customPrice); /// @notice Thrown when round time is not started error RoundNotStarted(); /// @notice Thrown when round time is ended error RoundEnded(); /// @notice Thrown when Round is not created error IncorrectRound(); /// @notice Thrown when new round price is less than previous round price error PriceLessThanOldRound(); /// @notice Thrown when round start time is invalid error InvalidStartTime(); /// @notice Thrown when round end time is invalid error InvalidEndTime(); /// @notice Thrown when new price is invalid error PriceInvalid(); /// @notice Thrown when startTime is incorrect when updating round error IncorrectStartTime(); /// @notice Thrown when endTime is incorrect when updating round error IncorrectEndTime(); /// @notice Thrown when round price is greater than next round while updating error PriceGreaterThanNextRound(); /// @notice Thrown when Token is restricted in given round error TokenDisallowed(); /// @dev Constructor. /// @param lastRound The last round created constructor(uint32 lastRound) { _startRound = lastRound; _roundIndex = lastRound; } /// @notice Creates a new round /// @param startTime The startTime of the round /// @param endTime The endTime of the round /// @param price The presale token price in 18 decimals, because our calculations returns a value in 36 decimals and to get returning value in 18 decimals we divide by round price function createNewRound(uint256 startTime, uint256 endTime, uint256 price) external onlyOwner { RoundData memory prevRoundData = rounds[_roundIndex]; uint32 newRound = ++_roundIndex; if (price < prevRoundData.price) { revert PriceLessThanOldRound(); } if (startTime < prevRoundData.endTime) { revert InvalidStartTime(); } _verifyRound(startTime, endTime, price); prevRoundData = RoundData({ startTime: startTime, endTime: endTime, price: price }); rounds[newRound] = prevRoundData; emit RoundCreated({ newRound: newRound, roundData: prevRoundData }); } /// @notice Updates the access of tokens in a given round /// @param round The round in which you want to update /// @param tokens addresses of the tokens /// @param accesses The access for the tokens /// @param customPrices The customPrice prices if any for the tokens function updateAllowedTokens( uint32 round, IERC20[] calldata tokens, bool[] calldata accesses, uint256[] calldata customPrices ) external onlyOwner { uint256 tokensLength = tokens.length; if (tokensLength == 0) { revert ZeroLengthArray(); } if (tokensLength != accesses.length || accesses.length != customPrices.length) { revert ArrayLengthMismatch(); } mapping(IERC20 => AllowedToken) storage selectedRound = allowedTokens[round]; for (uint256 i = 0; i < tokensLength; ++i) { IERC20 token = tokens[i]; if (address(token) == address(0)) { revert ZeroAddress(); } AllowedToken memory allowedToken = AllowedToken({ access: accesses[i], customPrice: customPrices[i] }); selectedRound[token] = allowedToken; emit TokensAccessUpdated({ round: round, token: token, access: allowedToken.access, customPrice: allowedToken.customPrice }); } } /// @notice Updates round data /// @param round The Round that will be updated /// @param startTime The StartTime of the round /// @param endTime The EndTime of the round /// @param price The price of the round in 18 decimals function updateRound(uint32 round, uint256 startTime, uint256 endTime, uint256 price) external onlyOwner { if (round <= _startRound || round > _roundIndex) { revert IncorrectRound(); } RoundData memory previousRound = rounds[round - 1]; RoundData memory nextRound = rounds[round + 1]; if (startTime < previousRound.endTime) { revert IncorrectStartTime(); } if (round != _roundIndex && endTime > nextRound.startTime) { revert IncorrectEndTime(); } if (price < previousRound.price) { revert PriceLessThanOldRound(); } if (round != _roundIndex && price > nextRound.price) { revert PriceGreaterThanNextRound(); } _verifyRound(startTime, endTime, price); rounds[round] = RoundData({ startTime: startTime, endTime: endTime, price: price }); emit RoundUpdated({ round: round, roundData: rounds[round] }); } /// @notice Returns total rounds created /// @return The Round count function getRoundCount() external view returns (uint32) { return _roundIndex; } /// @dev Validates array length and values function _validateArrays(uint256 firstLength, uint256 secondLength) internal pure { if (firstLength == 0) { revert ZeroLengthArray(); } if (firstLength != secondLength) { revert ArrayLengthMismatch(); } } /// @dev Checks round start and end time, reverts if Invalid function _verifyInRound(uint32 round) internal view { RoundData memory dataRound = rounds[round]; if (block.timestamp < dataRound.startTime) { revert RoundNotStarted(); } if (block.timestamp >= dataRound.endTime) { revert RoundEnded(); } } /// @dev Checks the validity of startTime, endTime and price function _verifyRound(uint256 startTime, uint256 endTime, uint256 price) internal view { if (startTime < block.timestamp) { revert InvalidStartTime(); } if (endTime <= startTime) { revert InvalidEndTime(); } if (price == 0) { revert PriceInvalid(); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.25; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { Ownable, Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol"; import { AggregatorV3Interface } from "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol"; import { ZeroAddress, ArrayLengthMismatch, ZeroLengthArray, IdenticalValue } from "./Common.sol"; /// @title Tokens Registry contract /// @notice Implements the price feed of the tokens abstract contract TokenRegistry is Ownable2Step { /// @member priceFeed The Chainlink price feed address /// @member normalizationFactorForToken The normalization factor to achieve return value of 18 decimals, while calculating presale token purchases and always with different token decimals /// @member normalizationFactorForNFT The normalization factor is the value which helps us to convert decimals of USDT to purchase token decimals and always with different token decimals /// @member tolerance The pricefeed live price should be updated in tolerance time to get better price struct PriceFeedData { AggregatorV3Interface priceFeed; uint8 normalizationFactorForToken; uint8 normalizationFactorForNFT; uint256 tolerance; } /// @notice Gives us onchain price oracle address of the token mapping(IERC20 => PriceFeedData) public tokenData; /// @dev Emitted when address of Chainlink price feed contract is added for the token event TokenDataAdded(IERC20 token, PriceFeedData data); /// @notice Sets token price feeds and normalization factors /// @param tokens The addresses of the tokens /// @param priceFeedData Contains the price feed of the tokens, tolerance and the normalization factor function setTokenPriceFeed(IERC20[] calldata tokens, PriceFeedData[] calldata priceFeedData) external onlyOwner { uint256 tokensLength = tokens.length; if (tokensLength == 0) { revert ZeroLengthArray(); } if (tokensLength != priceFeedData.length) { revert ArrayLengthMismatch(); } for (uint256 i = 0; i < tokensLength; ++i) { PriceFeedData calldata data = priceFeedData[i]; IERC20 token = tokens[i]; PriceFeedData memory currentPriceFeedData = tokenData[token]; if (address(token) == address(0) || address(data.priceFeed) == address(0)) { revert ZeroAddress(); } if ( currentPriceFeedData.priceFeed == data.priceFeed && currentPriceFeedData.normalizationFactorForToken == data.normalizationFactorForToken && currentPriceFeedData.normalizationFactorForNFT == data.normalizationFactorForNFT && currentPriceFeedData.tolerance == data.tolerance ) { revert IdenticalValue(); } emit TokenDataAdded({ token: token, data: data }); tokenData[token] = data; } } }
{ "viaIR": true, "optimizer": { "enabled": true, "runs": 1000000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address[]","name":"fundsWalletAddresses","type":"address[]"},{"internalType":"address","name":"signerAddress","type":"address"},{"internalType":"address","name":"claimsContractAddress","type":"address"},{"internalType":"contract ILockup","name":"lockupContractAddress","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint32","name":"lastRound","type":"uint32"},{"internalType":"uint256[]","name":"nftPrices","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"ArrayNotSorted","type":"error"},{"inputs":[],"name":"Blacklisted","type":"error"},{"inputs":[],"name":"BuyNotEnable","type":"error"},{"inputs":[],"name":"CodeSyncIssue","type":"error"},{"inputs":[],"name":"DeadlineExpired","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":"FailedInnerCall","type":"error"},{"inputs":[],"name":"IdenticalValue","type":"error"},{"inputs":[],"name":"IncorrectEndTime","type":"error"},{"inputs":[],"name":"IncorrectRound","type":"error"},{"inputs":[],"name":"IncorrectStartTime","type":"error"},{"inputs":[],"name":"InvalidData","type":"error"},{"inputs":[],"name":"InvalidEndTime","type":"error"},{"inputs":[],"name":"InvalidPurchase","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidStartTime","type":"error"},{"inputs":[],"name":"InvalidValue","type":"error"},{"inputs":[],"name":"OnlyClaims","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"PriceGreaterThanNextRound","type":"error"},{"inputs":[],"name":"PriceInvalid","type":"error"},{"inputs":[],"name":"PriceLessThanOldRound","type":"error"},{"inputs":[],"name":"PriceNotFound","type":"error"},{"inputs":[],"name":"PriceNotUpdated","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"RoundEnded","type":"error"},{"inputs":[],"name":"RoundIdNotUpdated","type":"error"},{"inputs":[],"name":"RoundNotStarted","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"TokenDisallowed","type":"error"},{"inputs":[],"name":"UnexpectedPriceDifference","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroLengthArray","type":"error"},{"inputs":[],"name":"ZeroValue","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"which","type":"address"},{"indexed":false,"internalType":"bool","name":"accessNow","type":"bool"}],"name":"BlacklistUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"oldAccess","type":"bool"},{"indexed":false,"internalType":"bool","name":"newAccess","type":"bool"}],"name":"BuyEnableUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address[]","name":"oldAddresses","type":"address[]"},{"indexed":true,"internalType":"address[]","name":"newAddresses","type":"address[]"}],"name":"FundsWalletsUpdated","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":"uint256","name":"oldPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PricingUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":true,"internalType":"uint32","name":"round","type":"uint32"},{"indexed":true,"internalType":"uint256","name":"tokenPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenPurchased","type":"uint256"}],"name":"PurchasedWithClaimAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"string","name":"code","type":"string"},{"indexed":false,"internalType":"uint256","name":"amountPurchasedETH","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"round","type":"uint32"},{"indexed":true,"internalType":"uint256","name":"roundPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenPurchased","type":"uint256"}],"name":"PurchasedWithETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"string","name":"code","type":"string"},{"indexed":false,"internalType":"uint256","name":"amountInETH","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ethPrice","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"round","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"roundPrice","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"nftAmounts","type":"uint256[]"}],"name":"PurchasedWithETHForNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenPrice","type":"uint256"},{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"string","name":"code","type":"string"},{"indexed":false,"internalType":"uint256","name":"amountPurchased","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenPurchased","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"round","type":"uint32"}],"name":"PurchasedWithToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenPrice","type":"uint256"},{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"string","name":"code","type":"string"},{"indexed":false,"internalType":"uint256","name":"amountPurchased","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"round","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"roundPrice","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"nftAmounts","type":"uint256[]"}],"name":"PurchasedWithTokenForNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"newRound","type":"uint32"},{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"indexed":false,"internalType":"struct Rounds.RoundData","name":"roundData","type":"tuple"}],"name":"RoundCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"round","type":"uint32"},{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"indexed":false,"internalType":"struct Rounds.RoundData","name":"roundData","type":"tuple"}],"name":"RoundUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldSigner","type":"address"},{"indexed":false,"internalType":"address","name":"newSigner","type":"address"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"token","type":"address"},{"components":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"normalizationFactorForToken","type":"uint8"},{"internalType":"uint8","name":"normalizationFactorForNFT","type":"uint8"},{"internalType":"uint256","name":"tolerance","type":"uint256"}],"indexed":false,"internalType":"struct TokenRegistry.PriceFeedData","name":"data","type":"tuple"}],"name":"TokenDataAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"round","type":"uint32"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":true,"internalType":"bool","name":"access","type":"bool"},{"indexed":false,"internalType":"uint256","name":"customPrice","type":"uint256"}],"name":"TokensAccessUpdated","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"contract IERC20","name":"","type":"address"}],"name":"allowedTokens","outputs":[{"internalType":"bool","name":"access","type":"bool"},{"internalType":"uint256","name":"customPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"blacklistAddress","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyEnable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"newFundsWallets","type":"address[]"}],"name":"changeFundsWallets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"}],"name":"changeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimNFT","outputs":[{"internalType":"uint256","name":"roundPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"claims","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimsContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"createNewRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"enableBuy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"fundsWallets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"getLatestPrice","outputs":[{"components":[{"internalType":"uint256","name":"latestPrice","type":"uint256"},{"internalType":"uint8","name":"normalizationFactorForToken","type":"uint8"},{"internalType":"uint8","name":"normalizationFactorForNFT","type":"uint8"}],"internalType":"struct PreSale.TokenInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint32","name":"round","type":"uint32"}],"name":"getNFTClaims","outputs":[{"components":[{"internalType":"uint256[]","name":"nftAmounts","type":"uint256[]"},{"internalType":"uint256","name":"roundPrice","type":"uint256"}],"internalType":"struct PreSale.ClaimNFT[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRoundCount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockup","outputs":[{"internalType":"contract ILockup","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftPricing","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":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"code","type":"string"},{"internalType":"uint32","name":"round","type":"uint32"},{"internalType":"uint256[]","name":"nftAmounts","type":"uint256[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256[]","name":"indexes","type":"uint256[]"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"purchaseNFTWithETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"referenceTokenPrice","type":"uint256"},{"internalType":"uint8","name":"referenceNormalizationFactor","type":"uint8"},{"internalType":"string","name":"code","type":"string"},{"internalType":"uint32","name":"round","type":"uint32"},{"internalType":"uint256[]","name":"nftAmounts","type":"uint256[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256[]","name":"indexes","type":"uint256[]"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"purchaseNFTWithToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"code","type":"string"},{"internalType":"uint32","name":"round","type":"uint32"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"minAmountToken","type":"uint256"},{"internalType":"uint256[]","name":"indexes","type":"uint256[]"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"purchaseTokenWithETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint8","name":"referenceNormalizationFactor","type":"uint8"},{"internalType":"uint256","name":"referenceTokenPrice","type":"uint256"},{"internalType":"uint256","name":"purchaseAmount","type":"uint256"},{"internalType":"uint256","name":"minAmountToken","type":"uint256"},{"internalType":"uint256[]","name":"indexes","type":"uint256[]"},{"internalType":"string","name":"code","type":"string"},{"internalType":"uint32","name":"round","type":"uint32"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"purchaseTokenWithToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"referenceTokenPrice","type":"uint256"},{"internalType":"uint8","name":"referenceNormalizationFactor","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmountToken","type":"uint256"},{"internalType":"uint256[]","name":"indexes","type":"uint256[]"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint32","name":"round","type":"uint32"}],"name":"purchaseWithClaim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"rounds","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"components":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"normalizationFactorForToken","type":"uint8"},{"internalType":"uint8","name":"normalizationFactorForNFT","type":"uint8"},{"internalType":"uint256","name":"tolerance","type":"uint256"}],"internalType":"struct TokenRegistry.PriceFeedData[]","name":"priceFeedData","type":"tuple[]"}],"name":"setTokenPriceFeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signerWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"tokenData","outputs":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"normalizationFactorForToken","type":"uint8"},{"internalType":"uint8","name":"normalizationFactorForNFT","type":"uint8"},{"internalType":"uint256","name":"tolerance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPurchases","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":[{"internalType":"uint32","name":"round","type":"uint32"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"bool[]","name":"accesses","type":"bool[]"},{"internalType":"uint256[]","name":"customPrices","type":"uint256[]"}],"name":"updateAllowedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"which","type":"address"},{"internalType":"bool","name":"access","type":"bool"}],"name":"updateBlackListedUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"newPrices","type":"uint256[]"}],"name":"updatePricing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"round","type":"uint32"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"updateRound","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c06040523461050a57614abe8038038061001981610527565b92833981019060e08183031261050a5780516001600160401b03811161050a57810182601f8201121561050a5780519061005a6100558361054c565b610527565b90602082848152016020819460051b8301019186831161050a57602001905b82821061050f5750505061008f60208401610563565b61009b60408501610563565b6060850151929091906001600160a01b038416840361050a576100c060808701610563565b60a08701519663ffffffff8816880361050a5760c0810151906001600160401b03821161050a57019688601f8901121561050a578751986101036100558b61054c565b9860208a8c815201906020829c60051b82010192831161050a57602001905b8282106104fa575050506001600160a01b038216156104e157600180546001600160a01b0319908116909155600080546001600160a01b03948516928116831782556040519463ffffffff9493929116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3806080521663ffffffff1960035416176003556001600655600160ff19600754161760075560018060a01b0383161580156104d0575b80156104bf575b6104b057508051801561049e5760005b8181106103f9575050516001600160401b03811161037957680100000000000000009485821161037957600954826009558083106103be575b506009600052602060002060005b8381106103a157505060078054610100600160a81b031916600894851b610100600160a81b0316179055505080546001600160a01b0319166001600160a01b039290921691909117905560a05281511561038f5760005b82518110156102b557610295818461058e565b51156102a357600101610282565b604051637c946ed760e01b8152600490fd5b50905191906001600160401b03831161037957821161037957600b5482600b5580831061033e575b5090600b60005260206000209160005b82811061032a5760405161450590816105b9823960805181611e35015260a051818181612c17015281816137ec01528181613a960152613c1a0152f35b6001906020835193019281860155016102ed565b600b600052610373907f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9908101908401610577565b386102dd565b634e487b7160e01b600052604160045260246000fd5b604051630f59b9ff60e01b8152600490fd5b82516001600160a01b03168183015560209092019160010161022b565b60096000526103f3907f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af908101908401610577565b3861021d565b6001600160a01b0361040b828561058e565b51161561048c57600181018082116104765780830361042e575b506001016101e4565b6001600160a01b03610440838661058e565b5116906001600160a01b0390610456908661058e565b511611156104645738610425565b604051632a9ffab760e21b8152600490fd5b634e487b7160e01b600052601160045260246000fd5b60405163d92e233d60e01b8152600490fd5b604051635cb045db60e01b8152600490fd5b63d92e233d60e01b8152600490fd5b506001600160a01b038516156101d4565b506001600160a01b038416156101cd565b604051631e4fbdf760e01b815260006004820152602490fd5b8151815260209182019101610122565b600080fd5b6020809161051c84610563565b815201910190610079565b6040519190601f01601f191682016001600160401b0381118382101761037957604052565b6001600160401b0381116103795760051b60200190565b51906001600160a01b038216820361050a57565b818110610582575050565b60008155600101610577565b80518210156105a25760209160051b010190565b634e487b7160e01b600052603260045260246000fdfe608080604052600436101561001357600080fd5b60003560e01c90816306490f4714612bce57508063070ad04f1461286c5780630a7e0c56146126ad57806312a048ac14612628578063147a80231461246b578063161c9d011461230c57806316345f18146122aa57806327e45c2c146122205780632a253026146120a95780632d55e7df14611ddf5780633d389faf14611d9e57806341e7e34114611ce95780635962a94114611cad57806364f0d35e14611c585780636b70ed08146119205780636de7da78146118de578063715018a61461183957806379a6d51f146117cd57806379ba5097146116f05780637fcb09721461169e57806383ed1385146112885780638da5cb5b1461123657806392f58881146111a557806395f002401461110a578063aad2b72314611025578063ade1721e14610deb578063d1114dbe14610bf2578063e09590d114610aa9578063e30c397814610a57578063e9f8958f146109d7578063f2fde38b1461092a578063f3290d75146108c0578063fc5408b4146103fb578063fc7a822d1461038c5763fd1a013f146101a057600080fd5b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576101d7612e1d565b73ffffffffffffffffffffffffffffffffffffffff6101f4612d51565b9116600052602090600e825263ffffffff6040600020911660005281526040600020805461022181612fce565b9061022f6040519283612c8f565b80825283820190819360005284600020916000905b828210610310578685876040519283928184019082855251809152604084019160408260051b86010193926000905b8382106102805786860387f35b9193957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0908692949603018252838651604083019080519160408552825180915283606086019301906000905b8082106102f6575050509060019383808094015191015297019201920186959492939193610273565b8251855289959485019490920191600191909101906102cd565b8660405161031d81612c3b565b604051808388549182815201908860005284600020906000905b80821061036d57505050918161035560019693600296950382612c8f565b81528488015483820152815201940191019092610244565b825484528d96909301926001928301929190910190610337565b600080fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757600435600b5481101561038757602090600b6000527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90154604051908152f35b34610387576101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610433612e1d565b60243561043e612dcb565b9160643567ffffffffffffffff81116103875761045f903690600401612d0a565b9263ffffffff60843516608435036103875760a43567ffffffffffffffff811161038757610491903690600401612d8a565b94909360e43567ffffffffffffffff8111610387576104b4903690600401612d8a565b9690956101043560ff811681036103875760ff6007541615610896576104d8613389565b61050c60ff6104e5612e7d565b976104f18951876133c4565b16916101443590610124359084888a60c4356084358f613fef565b6105158761330a565b938451610854575b845115610807575b505082519260ff6040820151169660009560009a60009b5b89518d10156105af578c610552818989612f9d565b359061055e908c613041565b5199898d61056c8d85613055565b906105769061355c565b61057f91613055565b906105899161356a565b61059291613034565b9961059c91613055565b6105a591613034565b9b6001019b61053d565b909185896105cf868f966105c98c98608435923691612fe6565b33613bbb565b936c0c9f2c9cd04674edea40000000908181029181830414901517156107d8576105fc856106049261356a565b600a54613034565b600a556040519361061485612c3b565b61061f368785612fe6565b855260209485810182815233600052600e8752604060002063ffffffff608435166000528752604060002080546801000000000000000081101561077a5761066f90600192600182018155612e61565b9390936107a9575180519067ffffffffffffffff821161077a578990610695838761307f565b01846000528960002060005b8381106107695750505050505190600101556106bc826135a3565b6106c58261366a565b60085473ffffffffffffffffffffffffffffffffffffffff9a92916106ed918c16338c613ee2565b6106f7908961417c565b51936040519586958652850160a0905260a0850161071491612f1d565b9160408501526060840152828103608084015260843563ffffffff16963396169461073e92612f60565b037ff989f9bba8cb70e19552fc1abe68d783fb1e7f79941a115c1e5b6c3c776fd44c91a46001600655005b825182820155918b019184016106a1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8015801561084c575b61082257845260408401528880610525565b60046040517f7c946ed7000000000000000000000000000000000000000000000000000000008152fd5b508115610810565b801580159061088d575b1561051d5760046040517ff443cb16000000000000000000000000000000000000000000000000000000008152fd5b5081151561085e565b60046040517f46b57c6f000000000000000000000000000000000000000000000000000000008152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875773ffffffffffffffffffffffffffffffffffffffff61090c612e1d565b16600052600d602052602060ff604060002054166040519015158152f35b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610961612e1d565b61096961375b565b73ffffffffffffffffffffffffffffffffffffffff80911690817fffffffffffffffffffffffff00000000000000000000000000000000000000006001541617600155600054167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610a0e612e1d565b73ffffffffffffffffffffffffffffffffffffffff610a2b612d51565b9116600052600c60205263ffffffff604060002091166000526020526020604060002054604051908152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610ae0612e1d565b602435801515918282036103875773ffffffffffffffffffffffffffffffffffffffff168015610bc857610b1261375b565b80600052600d6020528260ff60406000205416151514610b9e577f6a12b3df6cba4203bd7fd06b816789f87de8c594299aed5717ae070fac781bac6040610b9c948151908482526020820152a1600052600d60205260406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b005b60046040517f2620eb3a000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd92e233d000000000000000000000000000000000000000000000000000000008152fd5b34610387576101807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610c2a612e1d565b6024359060ff8216808303610387576044356064359160a43567ffffffffffffffff9081811161038757610c62903690600401612d8a565b93909160c43590811161038757610c7d903690600401612d0a565b92610c86612d77565b97610124359360ff851685036103875760ff600754161561089657888a6105c9610ce79360ff9a610cd7610cee988c610cf89c610cc1613389565b61016435928d6101443593610104358b8d613fef565b610ce08d6135a3565b3691612fe6565b9288613e48565b9094168486613d50565b916084358310610dc157610d8c7ffa83d5d2a947b30f08c51454033f55a1e19d8d9b20a3d4a68cbe85d702e11ef29333600052600c60205263ffffffff6040600020981697886000526020526040600020610d54828254613034565b9055610d5f8661366a565b9290610d8673ffffffffffffffffffffffffffffffffffffffff948560085416338c613ee2565b8861417c565b610da86040519485948552608060208601526080850190612f1d565b9560408401526060830152339516930390a46001600655005b60046040517fbde82093000000000000000000000000000000000000000000000000000000008152fd5b6101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610e1e612e1d565b610e26612dcb565b6064359060a43567ffffffffffffffff811161038757610e4a903690600401612d8a565b909360c4359373ffffffffffffffffffffffffffffffffffffffff928386169485870361038757610e79612d77565b9060ff600754161561089657610e8d613389565b85600854163303610ffb57610ea188613df1565b63ffffffff821697886000526004602052604060002093878716948560005260205260ff6040600020541615610fd15786610f0594610efb93610eeb60ff9e610ef1953691612fe6565b90613bbb565b9160243587613e48565b9099168985613d50565b906084358210610dc1577f7abcb23b61318b8b612c876bdf3070978b03e1fea48e9ee7bffb0b5b9c2f3a7c948360609588600052600c60205260406000208a6000526020526040600020610f5a868254613034565b905573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8403610fac575050610f9490610f85612de9565b919054349260031b1c166135da565b60405192835260208301526040820152a46001600655005b82610fcc936008541690610fbe612de9565b90549060031b1c1691613ee2565b610f94565b60046040517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b60046040517f049809b1000000000000000000000000000000000000000000000000000000008152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875761105c612e1d565b73ffffffffffffffffffffffffffffffffffffffff908181168015610bc85761108361375b565b600754928360081c1691818314610b9e577f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb60407fffffffffffffffffffffff0000000000000000000000000000000000000000ff9474ffffffffffffffffffffffffffffffffffffffff009482519182526020820152a160081b16911617600755600080f35b346103875760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757611141612e1d565b611149612d51565b73ffffffffffffffffffffffffffffffffffffffff6044359216600052600e60205263ffffffff6040600020911660005260205260406000209081548110156103875761119a600191602093612e61565b500154604051908152f35b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576111dc612d64565b6024359073ffffffffffffffffffffffffffffffffffffffff82168092036103875763ffffffff166000526004602052604060002090600052602052604080600020600160ff825416910154825191151582526020820152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875767ffffffffffffffff600435818111610387576112d8903690600401612d8a565b90918060243511610387573660236024350112156103875760243560040135116103875736602480356004013560071b81350101116103875761131961375b565b80156116745760243560040135810361164a5760005b81811061133857005b6024356004013581101561161b5773ffffffffffffffffffffffffffffffffffffffff61136e611369838587612f9d565b612fad565b1690816000526002602052604060002060405161138a81612c73565b815473ffffffffffffffffffffffffffffffffffffffff811682526001602083019360ff8360a01c16855260ff604085019360a81c16835201549160608101928352851580156115ec575b610bc85773ffffffffffffffffffffffffffffffffffffffff90511673ffffffffffffffffffffffffffffffffffffffff61141860248760071b81350101612fad565b161492836115c7575b50826115a2575b508161158c575b50610b9e5760405182815260248260071b813501013573ffffffffffffffffffffffffffffffffffffffff8116809103610387576001938491602084015260448460071b602435010160ff61148382612ddb565b16604085015260648560071b60243501019160ff6114a084612ddb565b1660608601527fe0ec1b96a1e4f66c20cac6575b2dd77087e61f31bc392fc4d419f8094731614760a060848860071b60243501013596876080820152a1600052600260205260406000209173ffffffffffffffffffffffffffffffffffffffff61151260248860071b81350101612fad565b167fffffffffffffffffffff0000000000000000000000000000000000000000000075ff00000000000000000000000000000000000000000061157974ff000000000000000000000000000000000000000061156f88549761337b565b60a01b169461337b565b60a81b169316171717815501550161132f565b90505160848260071b602435010135148561142f565b60ff919250511660ff6115be60648560071b602435010161337b565b16149086611428565b60ff919350511660ff6115e360448660071b602435010161337b565b16149187611421565b5073ffffffffffffffffffffffffffffffffffffffff61161460248760071b81350101612fad565b16156113d5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60046040517fa24a13a6000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0f59b9ff000000000000000000000000000000000000000000000000000000008152fd5b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602073ffffffffffffffffffffffffffffffffffffffff60085416604051908152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760015473ffffffffffffffffffffffffffffffffffffffff338183160361179d577fffffffffffffffffffffffff00000000000000000000000000000000000000008092166001556000549133908316176000553391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875763ffffffff611809612d64565b16600052600560205260606040600020805490600260018201549101549060405192835260208301526040820152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875761187061375b565b600073ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffff0000000000000000000000000000000000000000806001541660015582549081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602063ffffffff60035416604051908152f35b34610387576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875767ffffffffffffffff60043581811161038757611971903690600401612d8a565b9161197a61375b565b61198383612fce565b6119906040519182612c8f565b8381528481018460051b84019036821161038757869085905b838210611c4157505050508051908115611c175760005b828110611b82575050506040519081806009549360096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af60005b89878210611b555750505003902060405180808660005b8a8a8210611b1e57505050039020907f4ad5809bcb0b573f49207771abf975dbf4eb02164f6de1ce8da957e6b52e14b1600080a3831161077a5768010000000000000000831161077a5782600955808310611aca575b50916000925b828410611a7957005b80359373ffffffffffffffffffffffffffffffffffffffff8516850361038757826001920194817f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01550192611a70565b611b18907f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01837f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01613068565b83611a6a565b82945080919373ffffffffffffffffffffffffffffffffffffffff611b44600195612e40565b168152019301910190839291611a14565b825473ffffffffffffffffffffffffffffffffffffffff16845285945090920191600191820191016119fd565b73ffffffffffffffffffffffffffffffffffffffff80611ba28385613041565b511615610bc85760018201908183116107d857818503611bc7575b50506001016119c0565b611bde81611bd58587613041565b51169285613041565b51161115611bed578780611bbd565b60046040517faa7feadc000000000000000000000000000000000000000000000000000000008152fd5b60046040517f5cb045db000000000000000000000000000000000000000000000000000000008152fd5b828091611c4d84612e40565b8152019101906119a9565b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602073ffffffffffffffffffffffffffffffffffffffff60075460081c16604051908152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576020600a54604051908152f35b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760043580151580910361038757611d2d61375b565b6007549060ff82161515818114610b9e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00917fe557486689c0bf71dde8cb27e7e87ed23badcf92ea724f4a0368676720d416f6604060ff938151908152836020820152a116911617600755600080f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602060ff600754166040519015158152f35b346103875760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757611e16612d64565b6024359060643590604435611e2961375b565b63ffffffff80921693827f000000000000000000000000000000000000000000000000000000000000000016851180159061209c575b612072577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85018381116107d8578316600052602092600584526040600020604051611eaa81612c57565b815481526040600260018401549388840194855201549101908152600188018381116107d857831660005260058652604060002092600260405194611eee86612c57565b805486526001810154898701520154926040850193845251851061204857600354168814158093819461203d575b5061201357518610611fe95781611fde575b50611fb4578360609382611f667fcf17268674ed4ffa34a117862c7b380287afb4c202e842a5f391b92219c0e02a9786600296613d88565b60405190611f7382612c57565b8152818101948552604081019283528760005260058252604060002090519485825551928360018301555193849101556040519384528301526040820152a2005b60046040517fecdcda19000000000000000000000000000000000000000000000000000000008152fd5b905051841186611f2e565b60046040517f434c92c9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f649bb635000000000000000000000000000000000000000000000000000000008152fd5b905051851189611f1c565b60046040517f442db2a5000000000000000000000000000000000000000000000000000000008152fd5b60046040517f82a99657000000000000000000000000000000000000000000000000000000008152fd5b5082600354168511611e5f565b346103875760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576004356044356024356120e961375b565b6003549263ffffffff93848116948560005260056020526040600020916040519161211383612c57565b835483526040600260018601549560208601968752015493019283528088146107d85760017fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009801169687911617600355518410611fe9575181106121f65782826121a27f6877931d901fa420de6b1b5c5b565c4422ab189963a871c828e7b992220e95e39560609585613d88565b604051926121af84612c57565b8352602083019081526040830191825285600052600560205260406000209251928381558151600182015560028351910155604051928352516020830152516040820152a2005b60046040517fb290253c000000000000000000000000000000000000000000000000000000008152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757608073ffffffffffffffffffffffffffffffffffffffff8061226f612e1d565b166000526002602052604060002060ff60018254920154916040519381168452818160a01c16602085015260a81c1660408301526060820152f35b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760606122eb6122e6612e1d565b61330a565b60ff6040805192805184528260208201511660208501520151166040820152f35b34610387576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875767ffffffffffffffff6004358181116103875761235d903690600401612d8a565b9161236661375b565b61236e612e7d565b60005b848110612414575050821161077a5768010000000000000000821161077a57600b5482600b558083106123de575b5060005b8281106123ac57005b81357f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9820155908301906001016123a3565b61240e90837f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db99182019101613068565b8361239f565b807f335f5afc83fe8c5a011a96dc39bcce9fb9d46fb5986502f7040e76e28b03612360406124456001948989612f9d565b3561244f816135a3565b6124598487613041565b519082519182528a820152a101612371565b6101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875767ffffffffffffffff600435818111610387576124b7903690600401612d0a565b906124c0612d51565b90608435908111610387576124d9903690600401612d8a565b6124e1612dbb565b6124e9613389565b60ff60075416156108965761251a928492610ce06125149360e4359060c435908a60443589346133d1565b3361377c565b916125236130ee565b8051156125fe57838160ff60206125409451920151169034613d50565b906064358210610dc1577f9b5db8da8d354582e1a2f754b54eab67f640b467f580ee9b9f5453662ef940119033600052600c60205263ffffffff6040600020941693846000526020526040600020612599848254613034565b90556125d06125cb6125aa3461366a565b73ffffffffffffffffffffffffffffffffffffffff600893929354166135da565b61369b565b6125e560405191606083526060830190612f1d565b9234602083015260408201528033930390a46001600655005b60046040517f358e2ce7000000000000000000000000000000000000000000000000000000008152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576004356009548110156103875773ffffffffffffffffffffffffffffffffffffffff60209160096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af015416604051908152f35b346103875760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576126e4612d64565b67ffffffffffffffff60243581811161038757612705903690600401612d8a565b90916044358181116103875761271f903690600401612d8a565b909160643590811161038757612739903690600401612d8a565b909561274361375b565b841561167457828514801590612862575b61164a5763ffffffff169182600052602090600460205260406000209560005b81811061277d57005b73ffffffffffffffffffffffffffffffffffffffff6127a061136983858d612f9d565b16908115610bc8576127b381858a612f9d565b3580151580910361038757600192887fc1a8d3b5c8695d3120c5ea6e6afca4fd990747cccf9c4513cbc02baf1c32e40d888f8e956127f3888e8b94612f9d565b35966040519161280283612c3b565b82528382019788528660005283526040600020905115159661284f88839060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b519182910155604051908152a401612774565b5081831415612754565b6101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760043567ffffffffffffffff8111610387576128b7903690600401612d0a565b6128bf612d51565b60443567ffffffffffffffff8111610387576128df903690600401612d8a565b60849291923567ffffffffffffffff811161038757612902903690600401612d8a565b93909261290d612dbb565b9260ff600754161561089657612921613389565b61294b61292c612e7d565b946129388651846133c4565b60e4359060c435908a60643587346133d1565b6129536130ee565b928351156125fe5783949397969597519260ff6040870151169760009660009a6000985b88518a10156129f3579b898c9d898b839e9f9c9d612996908c8c612f9d565b35936129a191613041565b519b6129ad8d85613055565b906129b79061355c565b6129c091613055565b906129ca9161356a565b6129d391613034565b996129dd91613055565b6129e691613034565b9b9a996001019897612977565b93965094612a0f87612a098e97988d3691612fe6565b33613a26565b946c0c9f2c9cd04674edea40000000908181029181830414901517156107d8576105fc86612a3c9261356a565b600a5560405190612a4c82612c3b565b612a57368289612fe6565b825260209182810187815233600052600e845263ffffffff60406000209a16998a6000528452604060002080546801000000000000000081101561077a57612aa790600192600182018155612e61565b9390936107a9575180519067ffffffffffffffff821161077a578690612acd838761307f565b01846000528660002060005b838110612bbd57505050505060019051910155843410612b93577f5c49140bae3a14ee4886ae54e90d9a38a19fc00cec7f3a6cd0b879516c1996a39585612b7994612b26612b5c986135a3565b612b308234612eed565b80612b83575b50612b466125cb6125aa8461366a565b519060405197889760a0895260a0890190612f1d565b948701526040860152606085015283820360808501523396612f60565b0390a36001600655005b612b8d90336135da565b8b612b36565b60046040517f53d13992000000000000000000000000000000000000000000000000000000008152fd5b825182820155918801918401612ad9565b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b6040810190811067ffffffffffffffff82111761077a57604052565b6060810190811067ffffffffffffffff82111761077a57604052565b6080810190811067ffffffffffffffff82111761077a57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761077a57604052565b67ffffffffffffffff811161077a57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561038757803590612d2182612cd0565b92612d2f6040519485612c8f565b8284526020838301011161038757816000926020809301838601378301015290565b6024359063ffffffff8216820361038757565b6004359063ffffffff8216820361038757565b60e4359063ffffffff8216820361038757565b9181601f840112156103875782359167ffffffffffffffff8311610387576020808501948460051b01011161038757565b60a4359060ff8216820361038757565b6044359060ff8216820361038757565b359060ff8216820361038757565b6009541561161b5760096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90600090565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361038757565b359073ffffffffffffffffffffffffffffffffffffffff8216820361038757565b805482101561161b5760005260206000209060011b0190600090565b60405190600b54808352826020916020820190600b6000527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9936000905b828210612ed357505050612ed192500383612c8f565b565b855484526001958601958895509381019390910190612ebb565b919082039182116107d857565b60005b838110612f0d5750506000910152565b8181015183820152602001612efd565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093612f5981518092818752878088019101612efa565b0116010190565b90918281527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83116103875760209260051b809284830137010190565b919081101561161b5760051b0190565b3573ffffffffffffffffffffffffffffffffffffffff811681036103875790565b67ffffffffffffffff811161077a5760051b60200190565b9291612ff182612fce565b91612fff6040519384612c8f565b829481845260208094019160051b810192831161038757905b8282106130255750505050565b81358152908301908301613018565b919082018092116107d857565b805182101561161b5760209160051b010190565b818102929181159184041417156107d857565b818110613073575050565b60008155600101613068565b9068010000000000000000811161077a578154908083558181106130a257505050565b612ed19260005260206000209182019101613068565b604051906130c582612c57565b60006040838281528260208201520152565b519069ffffffffffffffffffff8216820361038757565b6130f66130b8565b5073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6000908152600260205260408051907f6a26712a1b2f732f4c1fd85f9d6ed8235573aaa2a79aa2bab72c2423a73a9faf61314583612c73565b80549273ffffffffffffffffffffffffffffffffffffffff9081851681526001602082019360ff8760a01c16855260ff8684019760a81c168752015491606082019283526131916130b8565b91511690811561330057509060a06004928551938480927ffeaf968c0000000000000000000000000000000000000000000000000000000082525afa9182156132f657869087809461328c575b505069ffffffffffffffffffff161561326357811591821561324d575b50506132245760ff809151169251169181519361321785612c57565b8452602084015282015290565b600482517f1f4bcb2b000000000000000000000000000000000000000000000000000000008152fd5b61325991925042612eed565b90511038806131fb565b600484517fa5959c59000000000000000000000000000000000000000000000000000000008152fd5b92935096505060a0863d60a0116132ee575b816132ab60a09383612c8f565b810103126132eb57506132bd856130d7565b9069ffffffffffffffffffff6020870151926132e0608060608a015199016130d7565b5092969290386131de565b80fd5b3d915061329e565b84513d88823e3d90fd5b9550505050505090565b6133126130b8565b5073ffffffffffffffffffffffffffffffffffffffff806000921682526002602052604080832081519261334584612c73565b81549381851681526001602082019360ff8760a01c16855260ff8684019760a81c168752015491606082019283526131916130b8565b3560ff811681036103875790565b60026006541461339a576002600655565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b8015611674570361164a57565b6133e190979695949392976135a3565b8642116135325763ffffffff906133f733613df1565b16956000918783526020926004845260409889822073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8352855260ff8a832054161561350957815260058452889020885161344581612c57565b8154908181528a6002600185015494888401958652015491015242106134e057514210156134b75760546134af91612ed1989951938491613499878401973360601b89528251928391603487019101612efa565b8201906034820152036034810184520182612c8f565b519020614240565b600488517f6b5fd31b000000000000000000000000000000000000000000000000000000008152fd5b600489517f8e9c6e1c000000000000000000000000000000000000000000000000000000008152fd5b60048a517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1ab7da6b000000000000000000000000000000000000000000000000000000008152fd5b604d81116107d857600a0a90565b8115613574570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b1561082257565b3d156135d5573d906135bb82612cd0565b916135c96040519384612c8f565b82523d6000602084013e565b606090565b81471061363a57600080809373ffffffffffffffffffffffffffffffffffffffff8294165af16136086135aa565b501561361057565b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b60246040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152fd5b906009549160018301908184116107d85761369261368b613698938361356a565b9485613055565b90612eed565b90565b600954906040518083815281602080920160096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af9260005b87811061372e5750506136eb92500382612c8f565b60005b8381106136fb5750505050565b806137288473ffffffffffffffffffffffffffffffffffffffff61372160019587613041565b51166135da565b016136ee565b845473ffffffffffffffffffffffffffffffffffffffff16835260019485019486945092820192016136d6565b73ffffffffffffffffffffffffffffffffffffffff60005416330361179d57565b9163ffffffff16906000928284526004908160205260409485812073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee825260205260019460018783200154801515600014613a11575b809783918751908115613a0357509673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811691865b8a8110613827575b50505050505050505050505090565b8b81018082116139d757808c0361398d575b506138448183613041565b519585517f584b62a1000000000000000000000000000000000000000000000000000000008152848b168c820152602497888201528681604481895afa908115613983578a91613950575b5061389991613034565b9569012d231c7c593eec00008710156138b457508b01613810565b9a50505050505050909294915014600014613927576014928385029385850414851517156138fe575050509060646138ed920490612eed565b388080808080808080808080613818565b6011907f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6007928385029385850414851517156138fe5750505090606461394b920490612eed565b6138ed565b90508681813d831161397c575b6139678183612c8f565b81010312613978575161389961388f565b8980fd5b503d61395d565b87513d8c823e3d90fd5b6139a261399a8385613041565b519184613041565b5111156139af5738613839565b8985517f5b938576000000000000000000000000000000000000000000000000000000008152fd5b60248960118d7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b995050505050505050505090565b508082526005602052600287832001546137c6565b9163ffffffff16906000928284526004908160205260409485812073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee825260205260019460018783200154801515600014613ba6575b809783918751908115613a0357509673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811691865b8a8110613ad05750505050505050505050505090565b8b81018082116139d757808c03613b8c575b50613aed8183613041565b519585517f584b62a1000000000000000000000000000000000000000000000000000000008152848b168c820152602497888201528681604481895afa908115613983578a91613b5d575b50613b4291613034565b9569012d231c7c593eec00008710156138b457508b01613aba565b90508681813d8311613b85575b613b748183612c8f565b810103126139785751613b42613b38565b503d613b6a565b613b9961399a8385613041565b5111156139af5738613ae2565b50808252600560205260028783200154613a70565b929163ffffffff16926000908482526004918260205260409586822073ffffffffffffffffffffffffffffffffffffffff809716835260205260019560018884200154801515600014613d3a57975b865184928a8215613d2b575090977f000000000000000000000000000000000000000000000000000000000000000082169190865b8a8110613c555750505050505050505050505090565b8b81018082116139d757808c03613d11575b50613c728183613041565b519585517f584b62a1000000000000000000000000000000000000000000000000000000008152848b168c820152602497888201528681604481895afa908115613983578a91613ce2575b50613cc791613034565b9569012d231c7c593eec00008710156138b457508b01613c3f565b90508681813d8311613d0a575b613cf98183612c8f565b810103126139785751613cc7613cbd565b503d613cef565b613d1e61399a8385613041565b5111156139af5738613c67565b9a505050505050505050505090565b5081835260056020526002888420015497613c0a565b91613d6b613d65613d7193613d769695613055565b9161355c565b90613055565b61356a565b613d8281600a54613034565b600a5590565b904282106121f6571115613dc75715613d9d57565b60046040517f2013535a000000000000000000000000000000000000000000000000000000008152fd5b60046040517f38af65f7000000000000000000000000000000000000000000000000000000008152fd5b73ffffffffffffffffffffffffffffffffffffffff16600052600d60205260ff60406000205416613e1e57565b60046040517f09550c77000000000000000000000000000000000000000000000000000000008152fd5b613e549093929361330a565b928351613e9d575b835115613e73575b505060ff602083519301511690565b81158015613e92575b6108225760ff9184521660208301523880613e64565b5060ff811615613e7c565b8115801590613ed6575b15613e5c5760046040517ff443cb16000000000000000000000000000000000000000000000000000000008152fd5b5060ff81161515613ea7565b90916040519360208501937f23b872dd00000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff9283809216602488015216604486015260648501526064845260a084019184831067ffffffffffffffff84111761077a57613f7a926040521692600080938192519082875af1613f736135aa565b9084614459565b908151918215159283613fc3575b505050613f925750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b819293509060209181010312613feb5760200151908115918215036132eb5750388080613f88565b5080fd5b93909897969594989291928342116135325763ffffffff9061401033613df1565b16986000948a86526020956004875260409b8c822073ffffffffffffffffffffffffffffffffffffffff84168352885260ff8d8320541615614153578152600587528b90208b5161406081612c57565b8154908181528d60026001850154948b84019586520154910152421061412a575142101561410157916134af93917fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060a894612ed19c9d519788956140d88b88019b3360601b8d52825192839160348b019101612efa565b8601946034860152605485015260601b1660748301526088820152036088810184520182612c8f565b60048b517f6b5fd31b000000000000000000000000000000000000000000000000000000008152fd5b60048c517f8e9c6e1c000000000000000000000000000000000000000000000000000000008152fd5b60048d517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b90600954916040518084815281602080920160096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af9260005b8881106142135750506141cd92500382612c8f565b60005b8481106141de575050505050565b8061420d8573ffffffffffffffffffffffffffffffffffffffff61420460019587613041565b51163387613ee2565b016141d0565b845473ffffffffffffffffffffffffffffffffffffffff16835260019485019486945092820192016141b8565b9261429a906142a3929373ffffffffffffffffffffffffffffffffffffffff948560075460081c16967f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206142d5565b90929192614372565b16036142ab57565b60046040517f8baa579f000000000000000000000000000000000000000000000000000000008152fd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161436657926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa1561435a57805173ffffffffffffffffffffffffffffffffffffffff81161561435157918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b600481101561442a5780614384575050565b600181036143b65760046040517ff645eedf000000000000000000000000000000000000000000000000000000008152fd5b600281036143ef57602482604051907ffce698f70000000000000000000000000000000000000000000000000000000082526004820152fd5b6003146143f95750565b602490604051907fd78bce0c0000000000000000000000000000000000000000000000000000000082526004820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9061446e575080511561361057805190602001fd5b815115806144c6575b61447f575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b1561447756fea264697066735822122056d4f1de9f88e6457f6620a45e9365d0be1230f5a0b6c9ad161cb1b6b663470d64736f6c6343000819003300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000003088149945e0dfdf78f10650a36cd0c1fb8816eb00000000000000000000000027e00382b0c3ecd74d1505e8cd73706d79d0bd540000000000000000000000006a1aa5ac35f38bdb25bbd976e8eca942b23260b2000000000000000000000000f414b6cf553c65adb145b78f2e87694aa3c9c1d10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000030000000000000000000000003e4f2e23fbabc1e5decda6af2e62040d04d4e4b4000000000000000000000000923e18eb8dc9c92f2e746f80b7d6a64a9cdebfbf000000000000000000000000eec8783b59e290f1eba81244f5e251fb783667e60000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000bebc200000000000000000000000000000000000000000000000000000000001dcd6500000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000012a05f20000000000000000000000000000000000000000000000000000000002540be40000000000000000000000000000000000000000000000000000000006fc23ac000000000000000000000000000000000000000000000000000000001176592e00
Deployed Bytecode
0x608080604052600436101561001357600080fd5b60003560e01c90816306490f4714612bce57508063070ad04f1461286c5780630a7e0c56146126ad57806312a048ac14612628578063147a80231461246b578063161c9d011461230c57806316345f18146122aa57806327e45c2c146122205780632a253026146120a95780632d55e7df14611ddf5780633d389faf14611d9e57806341e7e34114611ce95780635962a94114611cad57806364f0d35e14611c585780636b70ed08146119205780636de7da78146118de578063715018a61461183957806379a6d51f146117cd57806379ba5097146116f05780637fcb09721461169e57806383ed1385146112885780638da5cb5b1461123657806392f58881146111a557806395f002401461110a578063aad2b72314611025578063ade1721e14610deb578063d1114dbe14610bf2578063e09590d114610aa9578063e30c397814610a57578063e9f8958f146109d7578063f2fde38b1461092a578063f3290d75146108c0578063fc5408b4146103fb578063fc7a822d1461038c5763fd1a013f146101a057600080fd5b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576101d7612e1d565b73ffffffffffffffffffffffffffffffffffffffff6101f4612d51565b9116600052602090600e825263ffffffff6040600020911660005281526040600020805461022181612fce565b9061022f6040519283612c8f565b80825283820190819360005284600020916000905b828210610310578685876040519283928184019082855251809152604084019160408260051b86010193926000905b8382106102805786860387f35b9193957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0908692949603018252838651604083019080519160408552825180915283606086019301906000905b8082106102f6575050509060019383808094015191015297019201920186959492939193610273565b8251855289959485019490920191600191909101906102cd565b8660405161031d81612c3b565b604051808388549182815201908860005284600020906000905b80821061036d57505050918161035560019693600296950382612c8f565b81528488015483820152815201940191019092610244565b825484528d96909301926001928301929190910190610337565b600080fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757600435600b5481101561038757602090600b6000527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90154604051908152f35b34610387576101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610433612e1d565b60243561043e612dcb565b9160643567ffffffffffffffff81116103875761045f903690600401612d0a565b9263ffffffff60843516608435036103875760a43567ffffffffffffffff811161038757610491903690600401612d8a565b94909360e43567ffffffffffffffff8111610387576104b4903690600401612d8a565b9690956101043560ff811681036103875760ff6007541615610896576104d8613389565b61050c60ff6104e5612e7d565b976104f18951876133c4565b16916101443590610124359084888a60c4356084358f613fef565b6105158761330a565b938451610854575b845115610807575b505082519260ff6040820151169660009560009a60009b5b89518d10156105af578c610552818989612f9d565b359061055e908c613041565b5199898d61056c8d85613055565b906105769061355c565b61057f91613055565b906105899161356a565b61059291613034565b9961059c91613055565b6105a591613034565b9b6001019b61053d565b909185896105cf868f966105c98c98608435923691612fe6565b33613bbb565b936c0c9f2c9cd04674edea40000000908181029181830414901517156107d8576105fc856106049261356a565b600a54613034565b600a556040519361061485612c3b565b61061f368785612fe6565b855260209485810182815233600052600e8752604060002063ffffffff608435166000528752604060002080546801000000000000000081101561077a5761066f90600192600182018155612e61565b9390936107a9575180519067ffffffffffffffff821161077a578990610695838761307f565b01846000528960002060005b8381106107695750505050505190600101556106bc826135a3565b6106c58261366a565b60085473ffffffffffffffffffffffffffffffffffffffff9a92916106ed918c16338c613ee2565b6106f7908961417c565b51936040519586958652850160a0905260a0850161071491612f1d565b9160408501526060840152828103608084015260843563ffffffff16963396169461073e92612f60565b037ff989f9bba8cb70e19552fc1abe68d783fb1e7f79941a115c1e5b6c3c776fd44c91a46001600655005b825182820155918b019184016106a1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8015801561084c575b61082257845260408401528880610525565b60046040517f7c946ed7000000000000000000000000000000000000000000000000000000008152fd5b508115610810565b801580159061088d575b1561051d5760046040517ff443cb16000000000000000000000000000000000000000000000000000000008152fd5b5081151561085e565b60046040517f46b57c6f000000000000000000000000000000000000000000000000000000008152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875773ffffffffffffffffffffffffffffffffffffffff61090c612e1d565b16600052600d602052602060ff604060002054166040519015158152f35b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610961612e1d565b61096961375b565b73ffffffffffffffffffffffffffffffffffffffff80911690817fffffffffffffffffffffffff00000000000000000000000000000000000000006001541617600155600054167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610a0e612e1d565b73ffffffffffffffffffffffffffffffffffffffff610a2b612d51565b9116600052600c60205263ffffffff604060002091166000526020526020604060002054604051908152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610ae0612e1d565b602435801515918282036103875773ffffffffffffffffffffffffffffffffffffffff168015610bc857610b1261375b565b80600052600d6020528260ff60406000205416151514610b9e577f6a12b3df6cba4203bd7fd06b816789f87de8c594299aed5717ae070fac781bac6040610b9c948151908482526020820152a1600052600d60205260406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b005b60046040517f2620eb3a000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd92e233d000000000000000000000000000000000000000000000000000000008152fd5b34610387576101807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610c2a612e1d565b6024359060ff8216808303610387576044356064359160a43567ffffffffffffffff9081811161038757610c62903690600401612d8a565b93909160c43590811161038757610c7d903690600401612d0a565b92610c86612d77565b97610124359360ff851685036103875760ff600754161561089657888a6105c9610ce79360ff9a610cd7610cee988c610cf89c610cc1613389565b61016435928d6101443593610104358b8d613fef565b610ce08d6135a3565b3691612fe6565b9288613e48565b9094168486613d50565b916084358310610dc157610d8c7ffa83d5d2a947b30f08c51454033f55a1e19d8d9b20a3d4a68cbe85d702e11ef29333600052600c60205263ffffffff6040600020981697886000526020526040600020610d54828254613034565b9055610d5f8661366a565b9290610d8673ffffffffffffffffffffffffffffffffffffffff948560085416338c613ee2565b8861417c565b610da86040519485948552608060208601526080850190612f1d565b9560408401526060830152339516930390a46001600655005b60046040517fbde82093000000000000000000000000000000000000000000000000000000008152fd5b6101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757610e1e612e1d565b610e26612dcb565b6064359060a43567ffffffffffffffff811161038757610e4a903690600401612d8a565b909360c4359373ffffffffffffffffffffffffffffffffffffffff928386169485870361038757610e79612d77565b9060ff600754161561089657610e8d613389565b85600854163303610ffb57610ea188613df1565b63ffffffff821697886000526004602052604060002093878716948560005260205260ff6040600020541615610fd15786610f0594610efb93610eeb60ff9e610ef1953691612fe6565b90613bbb565b9160243587613e48565b9099168985613d50565b906084358210610dc1577f7abcb23b61318b8b612c876bdf3070978b03e1fea48e9ee7bffb0b5b9c2f3a7c948360609588600052600c60205260406000208a6000526020526040600020610f5a868254613034565b905573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8403610fac575050610f9490610f85612de9565b919054349260031b1c166135da565b60405192835260208301526040820152a46001600655005b82610fcc936008541690610fbe612de9565b90549060031b1c1691613ee2565b610f94565b60046040517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b60046040517f049809b1000000000000000000000000000000000000000000000000000000008152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875761105c612e1d565b73ffffffffffffffffffffffffffffffffffffffff908181168015610bc85761108361375b565b600754928360081c1691818314610b9e577f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb60407fffffffffffffffffffffff0000000000000000000000000000000000000000ff9474ffffffffffffffffffffffffffffffffffffffff009482519182526020820152a160081b16911617600755600080f35b346103875760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757611141612e1d565b611149612d51565b73ffffffffffffffffffffffffffffffffffffffff6044359216600052600e60205263ffffffff6040600020911660005260205260406000209081548110156103875761119a600191602093612e61565b500154604051908152f35b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576111dc612d64565b6024359073ffffffffffffffffffffffffffffffffffffffff82168092036103875763ffffffff166000526004602052604060002090600052602052604080600020600160ff825416910154825191151582526020820152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b346103875760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875767ffffffffffffffff600435818111610387576112d8903690600401612d8a565b90918060243511610387573660236024350112156103875760243560040135116103875736602480356004013560071b81350101116103875761131961375b565b80156116745760243560040135810361164a5760005b81811061133857005b6024356004013581101561161b5773ffffffffffffffffffffffffffffffffffffffff61136e611369838587612f9d565b612fad565b1690816000526002602052604060002060405161138a81612c73565b815473ffffffffffffffffffffffffffffffffffffffff811682526001602083019360ff8360a01c16855260ff604085019360a81c16835201549160608101928352851580156115ec575b610bc85773ffffffffffffffffffffffffffffffffffffffff90511673ffffffffffffffffffffffffffffffffffffffff61141860248760071b81350101612fad565b161492836115c7575b50826115a2575b508161158c575b50610b9e5760405182815260248260071b813501013573ffffffffffffffffffffffffffffffffffffffff8116809103610387576001938491602084015260448460071b602435010160ff61148382612ddb565b16604085015260648560071b60243501019160ff6114a084612ddb565b1660608601527fe0ec1b96a1e4f66c20cac6575b2dd77087e61f31bc392fc4d419f8094731614760a060848860071b60243501013596876080820152a1600052600260205260406000209173ffffffffffffffffffffffffffffffffffffffff61151260248860071b81350101612fad565b167fffffffffffffffffffff0000000000000000000000000000000000000000000075ff00000000000000000000000000000000000000000061157974ff000000000000000000000000000000000000000061156f88549761337b565b60a01b169461337b565b60a81b169316171717815501550161132f565b90505160848260071b602435010135148561142f565b60ff919250511660ff6115be60648560071b602435010161337b565b16149086611428565b60ff919350511660ff6115e360448660071b602435010161337b565b16149187611421565b5073ffffffffffffffffffffffffffffffffffffffff61161460248760071b81350101612fad565b16156113d5565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60046040517fa24a13a6000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0f59b9ff000000000000000000000000000000000000000000000000000000008152fd5b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602073ffffffffffffffffffffffffffffffffffffffff60085416604051908152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760015473ffffffffffffffffffffffffffffffffffffffff338183160361179d577fffffffffffffffffffffffff00000000000000000000000000000000000000008092166001556000549133908316176000553391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875763ffffffff611809612d64565b16600052600560205260606040600020805490600260018201549101549060405192835260208301526040820152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875761187061375b565b600073ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffff0000000000000000000000000000000000000000806001541660015582549081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602063ffffffff60035416604051908152f35b34610387576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875767ffffffffffffffff60043581811161038757611971903690600401612d8a565b9161197a61375b565b61198383612fce565b6119906040519182612c8f565b8381528481018460051b84019036821161038757869085905b838210611c4157505050508051908115611c175760005b828110611b82575050506040519081806009549360096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af60005b89878210611b555750505003902060405180808660005b8a8a8210611b1e57505050039020907f4ad5809bcb0b573f49207771abf975dbf4eb02164f6de1ce8da957e6b52e14b1600080a3831161077a5768010000000000000000831161077a5782600955808310611aca575b50916000925b828410611a7957005b80359373ffffffffffffffffffffffffffffffffffffffff8516850361038757826001920194817f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01550192611a70565b611b18907f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01837f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01613068565b83611a6a565b82945080919373ffffffffffffffffffffffffffffffffffffffff611b44600195612e40565b168152019301910190839291611a14565b825473ffffffffffffffffffffffffffffffffffffffff16845285945090920191600191820191016119fd565b73ffffffffffffffffffffffffffffffffffffffff80611ba28385613041565b511615610bc85760018201908183116107d857818503611bc7575b50506001016119c0565b611bde81611bd58587613041565b51169285613041565b51161115611bed578780611bbd565b60046040517faa7feadc000000000000000000000000000000000000000000000000000000008152fd5b60046040517f5cb045db000000000000000000000000000000000000000000000000000000008152fd5b828091611c4d84612e40565b8152019101906119a9565b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602073ffffffffffffffffffffffffffffffffffffffff60075460081c16604051908152f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576020600a54604051908152f35b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760043580151580910361038757611d2d61375b565b6007549060ff82161515818114610b9e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00917fe557486689c0bf71dde8cb27e7e87ed23badcf92ea724f4a0368676720d416f6604060ff938151908152836020820152a116911617600755600080f35b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757602060ff600754166040519015158152f35b346103875760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757611e16612d64565b6024359060643590604435611e2961375b565b63ffffffff80921693827f000000000000000000000000000000000000000000000000000000000000000016851180159061209c575b612072577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85018381116107d8578316600052602092600584526040600020604051611eaa81612c57565b815481526040600260018401549388840194855201549101908152600188018381116107d857831660005260058652604060002092600260405194611eee86612c57565b805486526001810154898701520154926040850193845251851061204857600354168814158093819461203d575b5061201357518610611fe95781611fde575b50611fb4578360609382611f667fcf17268674ed4ffa34a117862c7b380287afb4c202e842a5f391b92219c0e02a9786600296613d88565b60405190611f7382612c57565b8152818101948552604081019283528760005260058252604060002090519485825551928360018301555193849101556040519384528301526040820152a2005b60046040517fecdcda19000000000000000000000000000000000000000000000000000000008152fd5b905051841186611f2e565b60046040517f434c92c9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f649bb635000000000000000000000000000000000000000000000000000000008152fd5b905051851189611f1c565b60046040517f442db2a5000000000000000000000000000000000000000000000000000000008152fd5b60046040517f82a99657000000000000000000000000000000000000000000000000000000008152fd5b5082600354168511611e5f565b346103875760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576004356044356024356120e961375b565b6003549263ffffffff93848116948560005260056020526040600020916040519161211383612c57565b835483526040600260018601549560208601968752015493019283528088146107d85760017fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009801169687911617600355518410611fe9575181106121f65782826121a27f6877931d901fa420de6b1b5c5b565c4422ab189963a871c828e7b992220e95e39560609585613d88565b604051926121af84612c57565b8352602083019081526040830191825285600052600560205260406000209251928381558151600182015560028351910155604051928352516020830152516040820152a2005b60046040517fb290253c000000000000000000000000000000000000000000000000000000008152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261038757608073ffffffffffffffffffffffffffffffffffffffff8061226f612e1d565b166000526002602052604060002060ff60018254920154916040519381168452818160a01c16602085015260a81c1660408301526060820152f35b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760606122eb6122e6612e1d565b61330a565b60ff6040805192805184528260208201511660208501520151166040820152f35b34610387576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875767ffffffffffffffff6004358181116103875761235d903690600401612d8a565b9161236661375b565b61236e612e7d565b60005b848110612414575050821161077a5768010000000000000000821161077a57600b5482600b558083106123de575b5060005b8281106123ac57005b81357f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9820155908301906001016123a3565b61240e90837f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db99182019101613068565b8361239f565b807f335f5afc83fe8c5a011a96dc39bcce9fb9d46fb5986502f7040e76e28b03612360406124456001948989612f9d565b3561244f816135a3565b6124598487613041565b519082519182528a820152a101612371565b6101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875767ffffffffffffffff600435818111610387576124b7903690600401612d0a565b906124c0612d51565b90608435908111610387576124d9903690600401612d8a565b6124e1612dbb565b6124e9613389565b60ff60075416156108965761251a928492610ce06125149360e4359060c435908a60443589346133d1565b3361377c565b916125236130ee565b8051156125fe57838160ff60206125409451920151169034613d50565b906064358210610dc1577f9b5db8da8d354582e1a2f754b54eab67f640b467f580ee9b9f5453662ef940119033600052600c60205263ffffffff6040600020941693846000526020526040600020612599848254613034565b90556125d06125cb6125aa3461366a565b73ffffffffffffffffffffffffffffffffffffffff600893929354166135da565b61369b565b6125e560405191606083526060830190612f1d565b9234602083015260408201528033930390a46001600655005b60046040517f358e2ce7000000000000000000000000000000000000000000000000000000008152fd5b346103875760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576004356009548110156103875773ffffffffffffffffffffffffffffffffffffffff60209160096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af015416604051908152f35b346103875760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610387576126e4612d64565b67ffffffffffffffff60243581811161038757612705903690600401612d8a565b90916044358181116103875761271f903690600401612d8a565b909160643590811161038757612739903690600401612d8a565b909561274361375b565b841561167457828514801590612862575b61164a5763ffffffff169182600052602090600460205260406000209560005b81811061277d57005b73ffffffffffffffffffffffffffffffffffffffff6127a061136983858d612f9d565b16908115610bc8576127b381858a612f9d565b3580151580910361038757600192887fc1a8d3b5c8695d3120c5ea6e6afca4fd990747cccf9c4513cbc02baf1c32e40d888f8e956127f3888e8b94612f9d565b35966040519161280283612c3b565b82528382019788528660005283526040600020905115159661284f88839060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b519182910155604051908152a401612774565b5081831415612754565b6101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760043567ffffffffffffffff8111610387576128b7903690600401612d0a565b6128bf612d51565b60443567ffffffffffffffff8111610387576128df903690600401612d8a565b60849291923567ffffffffffffffff811161038757612902903690600401612d8a565b93909261290d612dbb565b9260ff600754161561089657612921613389565b61294b61292c612e7d565b946129388651846133c4565b60e4359060c435908a60643587346133d1565b6129536130ee565b928351156125fe5783949397969597519260ff6040870151169760009660009a6000985b88518a10156129f3579b898c9d898b839e9f9c9d612996908c8c612f9d565b35936129a191613041565b519b6129ad8d85613055565b906129b79061355c565b6129c091613055565b906129ca9161356a565b6129d391613034565b996129dd91613055565b6129e691613034565b9b9a996001019897612977565b93965094612a0f87612a098e97988d3691612fe6565b33613a26565b946c0c9f2c9cd04674edea40000000908181029181830414901517156107d8576105fc86612a3c9261356a565b600a5560405190612a4c82612c3b565b612a57368289612fe6565b825260209182810187815233600052600e845263ffffffff60406000209a16998a6000528452604060002080546801000000000000000081101561077a57612aa790600192600182018155612e61565b9390936107a9575180519067ffffffffffffffff821161077a578690612acd838761307f565b01846000528660002060005b838110612bbd57505050505060019051910155843410612b93577f5c49140bae3a14ee4886ae54e90d9a38a19fc00cec7f3a6cd0b879516c1996a39585612b7994612b26612b5c986135a3565b612b308234612eed565b80612b83575b50612b466125cb6125aa8461366a565b519060405197889760a0895260a0890190612f1d565b948701526040860152606085015283820360808501523396612f60565b0390a36001600655005b612b8d90336135da565b8b612b36565b60046040517f53d13992000000000000000000000000000000000000000000000000000000008152fd5b825182820155918801918401612ad9565b346103875760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103875760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000006a1aa5ac35f38bdb25bbd976e8eca942b23260b2168152f35b6040810190811067ffffffffffffffff82111761077a57604052565b6060810190811067ffffffffffffffff82111761077a57604052565b6080810190811067ffffffffffffffff82111761077a57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761077a57604052565b67ffffffffffffffff811161077a57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561038757803590612d2182612cd0565b92612d2f6040519485612c8f565b8284526020838301011161038757816000926020809301838601378301015290565b6024359063ffffffff8216820361038757565b6004359063ffffffff8216820361038757565b60e4359063ffffffff8216820361038757565b9181601f840112156103875782359167ffffffffffffffff8311610387576020808501948460051b01011161038757565b60a4359060ff8216820361038757565b6044359060ff8216820361038757565b359060ff8216820361038757565b6009541561161b5760096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90600090565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361038757565b359073ffffffffffffffffffffffffffffffffffffffff8216820361038757565b805482101561161b5760005260206000209060011b0190600090565b60405190600b54808352826020916020820190600b6000527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9936000905b828210612ed357505050612ed192500383612c8f565b565b855484526001958601958895509381019390910190612ebb565b919082039182116107d857565b60005b838110612f0d5750506000910152565b8181015183820152602001612efd565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093612f5981518092818752878088019101612efa565b0116010190565b90918281527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83116103875760209260051b809284830137010190565b919081101561161b5760051b0190565b3573ffffffffffffffffffffffffffffffffffffffff811681036103875790565b67ffffffffffffffff811161077a5760051b60200190565b9291612ff182612fce565b91612fff6040519384612c8f565b829481845260208094019160051b810192831161038757905b8282106130255750505050565b81358152908301908301613018565b919082018092116107d857565b805182101561161b5760209160051b010190565b818102929181159184041417156107d857565b818110613073575050565b60008155600101613068565b9068010000000000000000811161077a578154908083558181106130a257505050565b612ed19260005260206000209182019101613068565b604051906130c582612c57565b60006040838281528260208201520152565b519069ffffffffffffffffffff8216820361038757565b6130f66130b8565b5073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6000908152600260205260408051907f6a26712a1b2f732f4c1fd85f9d6ed8235573aaa2a79aa2bab72c2423a73a9faf61314583612c73565b80549273ffffffffffffffffffffffffffffffffffffffff9081851681526001602082019360ff8760a01c16855260ff8684019760a81c168752015491606082019283526131916130b8565b91511690811561330057509060a06004928551938480927ffeaf968c0000000000000000000000000000000000000000000000000000000082525afa9182156132f657869087809461328c575b505069ffffffffffffffffffff161561326357811591821561324d575b50506132245760ff809151169251169181519361321785612c57565b8452602084015282015290565b600482517f1f4bcb2b000000000000000000000000000000000000000000000000000000008152fd5b61325991925042612eed565b90511038806131fb565b600484517fa5959c59000000000000000000000000000000000000000000000000000000008152fd5b92935096505060a0863d60a0116132ee575b816132ab60a09383612c8f565b810103126132eb57506132bd856130d7565b9069ffffffffffffffffffff6020870151926132e0608060608a015199016130d7565b5092969290386131de565b80fd5b3d915061329e565b84513d88823e3d90fd5b9550505050505090565b6133126130b8565b5073ffffffffffffffffffffffffffffffffffffffff806000921682526002602052604080832081519261334584612c73565b81549381851681526001602082019360ff8760a01c16855260ff8684019760a81c168752015491606082019283526131916130b8565b3560ff811681036103875790565b60026006541461339a576002600655565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b8015611674570361164a57565b6133e190979695949392976135a3565b8642116135325763ffffffff906133f733613df1565b16956000918783526020926004845260409889822073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8352855260ff8a832054161561350957815260058452889020885161344581612c57565b8154908181528a6002600185015494888401958652015491015242106134e057514210156134b75760546134af91612ed1989951938491613499878401973360601b89528251928391603487019101612efa565b8201906034820152036034810184520182612c8f565b519020614240565b600488517f6b5fd31b000000000000000000000000000000000000000000000000000000008152fd5b600489517f8e9c6e1c000000000000000000000000000000000000000000000000000000008152fd5b60048a517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1ab7da6b000000000000000000000000000000000000000000000000000000008152fd5b604d81116107d857600a0a90565b8115613574570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b1561082257565b3d156135d5573d906135bb82612cd0565b916135c96040519384612c8f565b82523d6000602084013e565b606090565b81471061363a57600080809373ffffffffffffffffffffffffffffffffffffffff8294165af16136086135aa565b501561361057565b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b60246040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152fd5b906009549160018301908184116107d85761369261368b613698938361356a565b9485613055565b90612eed565b90565b600954906040518083815281602080920160096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af9260005b87811061372e5750506136eb92500382612c8f565b60005b8381106136fb5750505050565b806137288473ffffffffffffffffffffffffffffffffffffffff61372160019587613041565b51166135da565b016136ee565b845473ffffffffffffffffffffffffffffffffffffffff16835260019485019486945092820192016136d6565b73ffffffffffffffffffffffffffffffffffffffff60005416330361179d57565b9163ffffffff16906000928284526004908160205260409485812073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee825260205260019460018783200154801515600014613a11575b809783918751908115613a0357509673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000006a1aa5ac35f38bdb25bbd976e8eca942b23260b2811691865b8a8110613827575b50505050505050505050505090565b8b81018082116139d757808c0361398d575b506138448183613041565b519585517f584b62a1000000000000000000000000000000000000000000000000000000008152848b168c820152602497888201528681604481895afa908115613983578a91613950575b5061389991613034565b9569012d231c7c593eec00008710156138b457508b01613810565b9a50505050505050909294915014600014613927576014928385029385850414851517156138fe575050509060646138ed920490612eed565b388080808080808080808080613818565b6011907f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6007928385029385850414851517156138fe5750505090606461394b920490612eed565b6138ed565b90508681813d831161397c575b6139678183612c8f565b81010312613978575161389961388f565b8980fd5b503d61395d565b87513d8c823e3d90fd5b6139a261399a8385613041565b519184613041565b5111156139af5738613839565b8985517f5b938576000000000000000000000000000000000000000000000000000000008152fd5b60248960118d7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b995050505050505050505090565b508082526005602052600287832001546137c6565b9163ffffffff16906000928284526004908160205260409485812073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee825260205260019460018783200154801515600014613ba6575b809783918751908115613a0357509673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000006a1aa5ac35f38bdb25bbd976e8eca942b23260b2811691865b8a8110613ad05750505050505050505050505090565b8b81018082116139d757808c03613b8c575b50613aed8183613041565b519585517f584b62a1000000000000000000000000000000000000000000000000000000008152848b168c820152602497888201528681604481895afa908115613983578a91613b5d575b50613b4291613034565b9569012d231c7c593eec00008710156138b457508b01613aba565b90508681813d8311613b85575b613b748183612c8f565b810103126139785751613b42613b38565b503d613b6a565b613b9961399a8385613041565b5111156139af5738613ae2565b50808252600560205260028783200154613a70565b929163ffffffff16926000908482526004918260205260409586822073ffffffffffffffffffffffffffffffffffffffff809716835260205260019560018884200154801515600014613d3a57975b865184928a8215613d2b575090977f0000000000000000000000006a1aa5ac35f38bdb25bbd976e8eca942b23260b282169190865b8a8110613c555750505050505050505050505090565b8b81018082116139d757808c03613d11575b50613c728183613041565b519585517f584b62a1000000000000000000000000000000000000000000000000000000008152848b168c820152602497888201528681604481895afa908115613983578a91613ce2575b50613cc791613034565b9569012d231c7c593eec00008710156138b457508b01613c3f565b90508681813d8311613d0a575b613cf98183612c8f565b810103126139785751613cc7613cbd565b503d613cef565b613d1e61399a8385613041565b5111156139af5738613c67565b9a505050505050505050505090565b5081835260056020526002888420015497613c0a565b91613d6b613d65613d7193613d769695613055565b9161355c565b90613055565b61356a565b613d8281600a54613034565b600a5590565b904282106121f6571115613dc75715613d9d57565b60046040517f2013535a000000000000000000000000000000000000000000000000000000008152fd5b60046040517f38af65f7000000000000000000000000000000000000000000000000000000008152fd5b73ffffffffffffffffffffffffffffffffffffffff16600052600d60205260ff60406000205416613e1e57565b60046040517f09550c77000000000000000000000000000000000000000000000000000000008152fd5b613e549093929361330a565b928351613e9d575b835115613e73575b505060ff602083519301511690565b81158015613e92575b6108225760ff9184521660208301523880613e64565b5060ff811615613e7c565b8115801590613ed6575b15613e5c5760046040517ff443cb16000000000000000000000000000000000000000000000000000000008152fd5b5060ff81161515613ea7565b90916040519360208501937f23b872dd00000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff9283809216602488015216604486015260648501526064845260a084019184831067ffffffffffffffff84111761077a57613f7a926040521692600080938192519082875af1613f736135aa565b9084614459565b908151918215159283613fc3575b505050613f925750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b819293509060209181010312613feb5760200151908115918215036132eb5750388080613f88565b5080fd5b93909897969594989291928342116135325763ffffffff9061401033613df1565b16986000948a86526020956004875260409b8c822073ffffffffffffffffffffffffffffffffffffffff84168352885260ff8d8320541615614153578152600587528b90208b5161406081612c57565b8154908181528d60026001850154948b84019586520154910152421061412a575142101561410157916134af93917fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060a894612ed19c9d519788956140d88b88019b3360601b8d52825192839160348b019101612efa565b8601946034860152605485015260601b1660748301526088820152036088810184520182612c8f565b60048b517f6b5fd31b000000000000000000000000000000000000000000000000000000008152fd5b60048c517f8e9c6e1c000000000000000000000000000000000000000000000000000000008152fd5b60048d517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b90600954916040518084815281602080920160096000527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af9260005b8881106142135750506141cd92500382612c8f565b60005b8481106141de575050505050565b8061420d8573ffffffffffffffffffffffffffffffffffffffff61420460019587613041565b51163387613ee2565b016141d0565b845473ffffffffffffffffffffffffffffffffffffffff16835260019485019486945092820192016141b8565b9261429a906142a3929373ffffffffffffffffffffffffffffffffffffffff948560075460081c16967f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206142d5565b90929192614372565b16036142ab57565b60046040517f8baa579f000000000000000000000000000000000000000000000000000000008152fd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161436657926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa1561435a57805173ffffffffffffffffffffffffffffffffffffffff81161561435157918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b600481101561442a5780614384575050565b600181036143b65760046040517ff645eedf000000000000000000000000000000000000000000000000000000008152fd5b600281036143ef57602482604051907ffce698f70000000000000000000000000000000000000000000000000000000082526004820152fd5b6003146143f95750565b602490604051907fd78bce0c0000000000000000000000000000000000000000000000000000000082526004820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9061446e575080511561361057805190602001fd5b815115806144c6575b61447f575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b1561447756fea264697066735822122056d4f1de9f88e6457f6620a45e9365d0be1230f5a0b6c9ad161cb1b6b663470d64736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000003088149945e0dfdf78f10650a36cd0c1fb8816eb00000000000000000000000027e00382b0c3ecd74d1505e8cd73706d79d0bd540000000000000000000000006a1aa5ac35f38bdb25bbd976e8eca942b23260b2000000000000000000000000f414b6cf553c65adb145b78f2e87694aa3c9c1d10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000030000000000000000000000003e4f2e23fbabc1e5decda6af2e62040d04d4e4b4000000000000000000000000923e18eb8dc9c92f2e746f80b7d6a64a9cdebfbf000000000000000000000000eec8783b59e290f1eba81244f5e251fb783667e60000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000bebc200000000000000000000000000000000000000000000000000000000001dcd6500000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000012a05f20000000000000000000000000000000000000000000000000000000002540be40000000000000000000000000000000000000000000000000000000006fc23ac000000000000000000000000000000000000000000000000000000001176592e00
-----Decoded View---------------
Arg [0] : fundsWalletAddresses (address[]): 0x3e4f2e23Fbabc1e5DECdA6af2E62040d04d4e4B4,0x923E18eb8dc9C92f2e746f80b7D6a64a9cDebfbf,0xEEc8783b59E290f1EBA81244F5e251fB783667E6
Arg [1] : signerAddress (address): 0x3088149945e0dFdf78f10650A36cd0C1fb8816eB
Arg [2] : claimsContractAddress (address): 0x27E00382b0C3eCd74d1505e8CD73706d79D0Bd54
Arg [3] : lockupContractAddress (address): 0x6A1aa5ac35f38Bdb25BBD976E8eca942b23260b2
Arg [4] : owner (address): 0xf414B6cf553C65ADb145b78F2e87694AA3C9c1D1
Arg [5] : lastRound (uint32): 0
Arg [6] : nftPrices (uint256[]): 200000000,500000000,1000000000,5000000000,10000000000,30000000000,75000000000
-----Encoded View---------------
19 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [1] : 0000000000000000000000003088149945e0dfdf78f10650a36cd0c1fb8816eb
Arg [2] : 00000000000000000000000027e00382b0c3ecd74d1505e8cd73706d79d0bd54
Arg [3] : 0000000000000000000000006a1aa5ac35f38bdb25bbd976e8eca942b23260b2
Arg [4] : 000000000000000000000000f414b6cf553c65adb145b78f2e87694aa3c9c1d1
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [8] : 0000000000000000000000003e4f2e23fbabc1e5decda6af2e62040d04d4e4b4
Arg [9] : 000000000000000000000000923e18eb8dc9c92f2e746f80b7d6a64a9cdebfbf
Arg [10] : 000000000000000000000000eec8783b59e290f1eba81244f5e251fb783667e6
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [12] : 000000000000000000000000000000000000000000000000000000000bebc200
Arg [13] : 000000000000000000000000000000000000000000000000000000001dcd6500
Arg [14] : 000000000000000000000000000000000000000000000000000000003b9aca00
Arg [15] : 000000000000000000000000000000000000000000000000000000012a05f200
Arg [16] : 00000000000000000000000000000000000000000000000000000002540be400
Arg [17] : 00000000000000000000000000000000000000000000000000000006fc23ac00
Arg [18] : 0000000000000000000000000000000000000000000000000000001176592e00
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.