Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 25 from a total of 6,534 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Purchase Token W... | 19981881 | 651 days ago | IN | 0.01551 ETH | 0.00047683 | ||||
| Purchase Token W... | 19981881 | 651 days ago | IN | 0.01551 ETH | 0.00041531 | ||||
| Purchase Token W... | 19981881 | 651 days ago | IN | 0.03 ETH | 0.0004296 | ||||
| Update Round | 19921327 | 660 days ago | IN | 0 ETH | 0.0005942 | ||||
| Purchase Token W... | 19921150 | 660 days ago | IN | 0.025 ETH | 0.00098302 | ||||
| Purchase Token W... | 19920483 | 660 days ago | IN | 0.01 ETH | 0.00208649 | ||||
| Purchase Token W... | 19920258 | 660 days ago | IN | 0 ETH | 0.002051 | ||||
| Purchase Token W... | 19920193 | 660 days ago | IN | 0.026 ETH | 0.00236657 | ||||
| Purchase Token W... | 19920108 | 660 days ago | IN | 0.07 ETH | 0.00284355 | ||||
| Purchase Token W... | 19919952 | 660 days ago | IN | 0.3 ETH | 0.00330839 | ||||
| Purchase Token W... | 19919897 | 660 days ago | IN | 0.08 ETH | 0.00306241 | ||||
| Purchase Token W... | 19919894 | 660 days ago | IN | 0.3 ETH | 0.00320772 | ||||
| Purchase Token W... | 19919877 | 660 days ago | IN | 1.6 ETH | 0.00292933 | ||||
| Purchase Token W... | 19919844 | 660 days ago | IN | 0.7 ETH | 0.00268229 | ||||
| Purchase Token W... | 19919481 | 660 days ago | IN | 0 ETH | 0.00426729 | ||||
| Purchase Token W... | 19919446 | 660 days ago | IN | 0.037 ETH | 0.00432327 | ||||
| Purchase Token W... | 19919312 | 660 days ago | IN | 0.01 ETH | 0.00124283 | ||||
| Purchase Token W... | 19919311 | 660 days ago | IN | 0.1826 ETH | 0.00131 | ||||
| Purchase Token W... | 19919306 | 660 days ago | IN | 0.58 ETH | 0.00126991 | ||||
| Purchase Token W... | 19919264 | 660 days ago | IN | 0 ETH | 0.00096676 | ||||
| Purchase Token W... | 19919230 | 660 days ago | IN | 0 ETH | 0.00137619 | ||||
| Purchase Token W... | 19919138 | 660 days ago | IN | 0.009 ETH | 0.00331639 | ||||
| Purchase Token W... | 19919115 | 660 days ago | IN | 17 ETH | 0.00339548 | ||||
| Purchase Token W... | 19919107 | 660 days ago | IN | 0 ETH | 0.00248733 | ||||
| Purchase Token W... | 19919071 | 660 days ago | IN | 0 ETH | 0.00255366 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 19960349 | 654 days ago | 0.00425 ETH | ||||
| Purchase With Cl... | 19960349 | 654 days ago | 0.00425 ETH | ||||
| Transfer | 19959909 | 654 days ago | 0.04074 ETH | ||||
| Purchase With Cl... | 19959909 | 654 days ago | 0.04074 ETH | ||||
| Transfer | 19946370 | 656 days ago | 0.01275 ETH | ||||
| Purchase With Cl... | 19946370 | 656 days ago | 0.01275 ETH | ||||
| Transfer | 19946363 | 656 days ago | 0.015 ETH | ||||
| Purchase With Cl... | 19946363 | 656 days ago | 0.015 ETH | ||||
| Transfer | 19930953 | 658 days ago | 0.19957 ETH | ||||
| Purchase With Cl... | 19930953 | 658 days ago | 0.19957 ETH | ||||
| Transfer | 19927690 | 659 days ago | 0.23252 ETH | ||||
| Purchase With Cl... | 19927690 | 659 days ago | 0.23252 ETH | ||||
| Transfer | 19925297 | 659 days ago | 0.01768 ETH | ||||
| Purchase With Cl... | 19925297 | 659 days ago | 0.01768 ETH | ||||
| Transfer | 19924123 | 659 days ago | 0.85149 ETH | ||||
| Purchase With Cl... | 19924123 | 659 days ago | 0.85149 ETH | ||||
| Transfer | 19922837 | 660 days ago | 0.0336 ETH | ||||
| Purchase With Cl... | 19922837 | 660 days ago | 0.0336 ETH | ||||
| Transfer | 19922394 | 660 days ago | 0.00709 ETH | ||||
| Purchase With Cl... | 19922394 | 660 days ago | 0.00709 ETH | ||||
| Transfer | 19922356 | 660 days ago | 0.0274 ETH | ||||
| Purchase With Cl... | 19922356 | 660 days ago | 0.0274 ETH | ||||
| Transfer | 19922290 | 660 days ago | 0.07699 ETH | ||||
| Purchase With Cl... | 19922290 | 660 days ago | 0.07699 ETH | ||||
| Transfer | 19921150 | 660 days ago | 0.025 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
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 { IPreSale } from "./IPreSale.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;
/// @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 max cap is reached
error MaxCapReached();
/// @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 funds wallet
address public fundsWallet;
/// @notice The maximum number of tokens that will be sold in presale
uint256 public immutable maxCap;
/// @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 The array of prices of each nft
uint256[] public nftPricing;
/// @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;
/// @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;
}
/// @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 funds wallet is updated
event FundsWalletUpdated(address oldAddress, address newAddress);
/// @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 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 fundsWalletAddress The address of funds wallet
/// @param signerAddress The address of signer wallet
/// @param claimsContractAddress The address of claim contract
/// @param owner The address of owner wallet
/// @param lastRound The last round created
/// @param nftPrices The prices of nfts
/// @param initMaxCap The max cap of gems token
constructor(
address fundsWalletAddress,
address signerAddress,
address claimsContractAddress,
address owner,
uint32 lastRound,
uint256[] memory nftPrices,
uint256 initMaxCap
) Rounds(lastRound) Ownable(owner) {
if (fundsWalletAddress == address(0) || signerAddress == address(0) || claimsContractAddress == address(0)) {
revert ZeroAddress();
}
fundsWallet = fundsWalletAddress;
signerWallet = signerAddress;
claimsContract = claimsContractAddress;
if (nftPrices.length == 0) {
revert ZeroLengthArray();
}
for (uint256 i = 0; i < nftPrices.length; ++i) {
_checkValue(nftPrices[i]);
}
nftPricing = nftPrices;
_checkValue(initMaxCap);
maxCap = initMaxCap;
}
/// @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
});
}
/// @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 wallet to a new address
/// @param newFundsWallet The address of the new funds wallet
function changeFundsWallet(address newFundsWallet) external checkAddressZero(newFundsWallet) onlyOwner {
address oldWallet = fundsWallet;
if (oldWallet == newFundsWallet) {
revert IdenticalValue();
}
emit FundsWalletUpdated({ oldAddress: oldWallet, newAddress: newFundsWallet });
fundsWallet = newFundsWallet;
}
/// @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 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,
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(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;
payable(fundsWallet).sendValue(msg.value);
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 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,
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(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;
token.safeTransferFrom(msg.sender, fundsWallet, purchaseAmount);
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 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,
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,
nftAmounts,
nftPrices
);
if (msg.value < value) {
revert InvalidPurchase();
}
_checkValue(value);
uint256 amountUnused = msg.value - value;
if (amountUnused > 0) {
payable(msg.sender).sendValue(amountUnused);
}
payable(fundsWallet).sendValue(value);
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 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,
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,
nftAmounts,
nftPrices
);
_checkValue(value);
token.safeTransferFrom(msg.sender, fundsWallet, value);
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,
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(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(fundsWallet).sendValue(msg.value);
} else {
token.safeTransferFrom(claimsContract, fundsWallet, amount);
}
emit PurchasedWithClaimAmount({
by: recipient,
amount: amount,
token: token,
round: round,
tokenPrice: latestPrice,
tokenPurchased: toReturn
});
}
/// @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 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(round, token);
uint256 gemsTokens = (totalNFTPrices * NORMALIZARION_FACTOR) / roundPrice;
_updateTokenPurchases(gemsTokens);
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 Checks max cap and updates total purchases
function _updateTokenPurchases(uint256 newPurchase) private {
if (newPurchase + totalPurchases > maxCap) {
revert MaxCapReached();
}
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(uint32 round, IERC20 token) private view returns (uint256) {
uint256 customPrice = allowedTokens[round][token].customPrice;
uint256 roundPrice = customPrice > 0 ? customPrice : rounds[round].price;
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);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
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) (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";
/// @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();
/// @dev The address of the Ethereum
IERC20 constant ETH = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IRounds } from "./IRounds.sol";
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 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,
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 } from "@openzeppelin/contracts/access/Ownable.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, Ownable, TokenRegistry {
/// @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();
/// @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;
/// @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;
}
/// @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);
/// @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 } from "@openzeppelin/contracts/access/Ownable.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 Ownable {
/// @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);
/// @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 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
Contract ABI
API[{"inputs":[{"internalType":"address","name":"fundsWalletAddress","type":"address"},{"internalType":"address","name":"signerAddress","type":"address"},{"internalType":"address","name":"claimsContractAddress","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint32","name":"lastRound","type":"uint32"},{"internalType":"uint256[]","name":"nftPrices","type":"uint256[]"},{"internalType":"uint256","name":"initMaxCap","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":"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":"InvalidEndTime","type":"error"},{"inputs":[],"name":"InvalidPurchase","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidStartTime","type":"error"},{"inputs":[],"name":"MaxCapReached","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":false,"internalType":"address","name":"oldAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"FundsWalletUpdated","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":[{"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":"newFundsWallet","type":"address"}],"name":"changeFundsWallet","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":[],"name":"fundsWallet","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":"maxCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"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":"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":"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":"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":"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":"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
604060c08152346102ec57613da28038038061001a81610307565b92833981019060e0818303126102ec576100338161032c565b602061004081840161032c565b9361004c86850161032c565b946100596060860161032c565b9460808101519263ffffffff8416978885036102ec5760a08301516001600160401b0397908881116102ec5784019483601f870112156102ec578551948986116102f1576005948660051b978a6100b1818b01610307565b8099815201908b829a8201019283116102ec578b809101915b8383106102dc575050505060c001519a6001600160a01b039a8b169788156102c457918b93918e959360009a8b549e8f988d8360018060a01b0319809c16179055519f167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08d80a360805263ffffffff19600254161760025560019b8c60055584600654931690811580156102ba575b80156102b0575b6102a1575060088054871690911781556001600160a81b0319909216911b610100600160a81b0316178a1760065560078054909316911617905581511561029057869084825b610269575b505050519384116102555768010000000000000000841161025557600a5484600a5580851061022d575b5091600a8252808220915b84811061021c5787876101f381610340565b60a05251613a48908161035a823960805181611e40015260a0518181816124ee01526137270152f35b8351838201559281019285016101e1565b600a8352858585852092830192015b82811061024a5750506101d6565b84815501869061023c565b634e487b7160e01b82526041600452602482fd5b835181101561028b5780610284888593851b87010151610340565b01826101a7565b6101ac565b8851630f59b9ff60e01b8152600490fd5b63d92e233d60e01b8152600490fd5b5085851615610161565b508583161561015a565b8d51631e4fbdf760e01b815260006004820152602490fd5b82518152918101918c91016100ca565b600080fd5b634e487b7160e01b600052604160045260246000fd5b6040519190601f01601f191682016001600160401b038111838210176102f157604052565b51906001600160a01b03821682036102ec57565b1561034757565b604051637c946ed760e01b8152600490fdfe6080604052600436101561001257600080fd5b60003560e01c80630a7e0c561461272f578063161c9d01146125c557806316345f18146125635780632194f3a21461251157806323548b8b146124b857806327824e53146122b557806327e45c2c1461222b5780632a253026146120b45780632d55e7df14611dea5780633d389faf14611da957806340c8e892146119b0578063411a9df51461154a57806341e7e341146114955780635962a9411461145957806364f0d35e146114045780636de7da78146113c2578063715018a61461132657806372287c021461113f57806379a6d51f146110d35780637bc2d71014610ec25780637d6f0d5f14610de25780637fcb097214610d9057806383ed1385146109765780638da5cb5b1461092457806392f588811461089357806395f00240146107f8578063aad2b723146106f7578063e09590d1146105ae578063e9f8958f1461052e578063f2fde38b1461044c578063f3290d75146103e2578063fc7a822d146103735763fd1a013f1461018757600080fd5b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576101be612958565b73ffffffffffffffffffffffffffffffffffffffff6101db612914565b9116600052602090600d825263ffffffff6040600020911660005281526040600020805461020881612f7b565b9061021660405192836129fd565b80825283820190819360005284600020916000905b8282106102f7578685876040519283928184019082855251809152604084019160408260051b86010193926000905b8382106102675786860387f35b9193957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0908692949603018252838651604083019080519160408552825180915283606086019301906000905b8082106102dd57505050906001938380809401519101529701920192018695949293919361025a565b8251855289959485019490920191600191909101906102b4565b86604051610304816129a9565b604051808388549182815201908860005284600020906000905b80821061035457505050918161033c600196936002969503826129fd565b8152848801548382015281520194019101909261022b565b825484528d9690930192600192830192919091019061031e565b600080fd5b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57600435600a5481101561036e57602090600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80154604051908152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5773ffffffffffffffffffffffffffffffffffffffff61042e612958565b16600052600c602052602060ff604060002054166040519015158152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57610483612958565b61048b612f93565b73ffffffffffffffffffffffffffffffffffffffff8091169081156104fd57600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60246040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152fd5b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57610565612958565b73ffffffffffffffffffffffffffffffffffffffff610582612914565b9116600052600b60205263ffffffff604060002091166000526020526020604060002054604051908152f35b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576105e5612958565b6024358015159182820361036e5773ffffffffffffffffffffffffffffffffffffffff1680156106cd57610617612f93565b80600052600c6020528260ff604060002054161515146106a3577f6a12b3df6cba4203bd7fd06b816789f87de8c594299aed5717ae070fac781bac60406106a1948151908482526020820152a1600052600c60205260406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b005b60046040517f2620eb3a000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd92e233d000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5761072e612958565b73ffffffffffffffffffffffffffffffffffffffff9081811680156106cd57610755612f93565b600654928360081c169081146106a3576040805173ffffffffffffffffffffffffffffffffffffffff928316815291831660208301527fffffffffffffffffffffff0000000000000000000000000000000000000000ff9274ffffffffffffffffffffffffffffffffffffffff009290917f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb91a160081b16911617600655600080f35b3461036e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5761082f612958565b610837612914565b73ffffffffffffffffffffffffffffffffffffffff6044359216600052600d60205263ffffffff60406000209116600052602052604060002090815481101561036e57610888600191602093612abf565b500154604051908152f35b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576108ca6128ee565b6024359073ffffffffffffffffffffffffffffffffffffffff821680920361036e5763ffffffff166000526003602052604060002090600052602052604080600020600160ff825416910154825191151582526020820152f35b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5767ffffffffffffffff60043581811161036e576109c6903690600401612927565b90826024351161036e5736602360243501121561036e576024356004013592831161036e573660248460071b813501011161036e57610a03612f93565b8115610d6657828203610d3c5760005b828110610a1c57005b83811015610d0d5773ffffffffffffffffffffffffffffffffffffffff610a4c610a47838686612adb565b612aeb565b16908160005260016020526040600020604051610a68816129e1565b815473ffffffffffffffffffffffffffffffffffffffff811682526001602083019360ff8360a01c16855260ff604085019360a81c1683520154916060810192835285158015610cde575b6106cd5773ffffffffffffffffffffffffffffffffffffffff90511673ffffffffffffffffffffffffffffffffffffffff610af660248760071b81350101612aeb565b16149283610cb9575b5082610c94575b5081610c7e575b506106a35760405182815260248260071b813501013573ffffffffffffffffffffffffffffffffffffffff8116810361036e5760019373ffffffffffffffffffffffffffffffffffffffff859216602084015260448460071b602435010160ff610b768261299b565b16604085015260648560071b60243501019160ff610b938461299b565b1660608601527fe0ec1b96a1e4f66c20cac6575b2dd77087e61f31bc392fc4d419f8094731614760a060848860071b60243501013596876080820152a16000528260205260406000209173ffffffffffffffffffffffffffffffffffffffff610c0460248860071b81350101612aeb565b167fffffffffffffffffffff0000000000000000000000000000000000000000000075ff000000000000000000000000000000000000000000610c6b74ff0000000000000000000000000000000000000000610c61885497612f6d565b60a01b1694612f6d565b60a81b1693161717178155015501610a13565b90505160848260071b6024350101351486610b0d565b60ff919250511660ff610cb060648560071b6024350101612f6d565b16149087610b06565b60ff919350511660ff610cd560448660071b6024350101612f6d565b16149188610aff565b5073ffffffffffffffffffffffffffffffffffffffff610d0660248760071b81350101612aeb565b1615610ab3565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60046040517fa24a13a6000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0f59b9ff000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602073ffffffffffffffffffffffffffffffffffffffff60075416604051908152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57610e19612958565b73ffffffffffffffffffffffffffffffffffffffff908181169182156106cd57610e41612f93565b6008549081168381146106a3576040805173ffffffffffffffffffffffffffffffffffffffff92831681529390911660208401527fffffffffffffffffffffffff0000000000000000000000000000000000000000927fe22b566ac7db56412e2e041c88a7fd3151151ad6c6647e954f9bdc054bcb780e9190a11617600855005b3461036e576101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57610efa612958565b6024359060ff821680830361036e57604435926064359160a43567ffffffffffffffff811161036e57610f31903690600401612a78565b90610f3a612901565b956101043560ff8116810361036e5760ff60065416156110a957610fbb94610f82888a610f9c94610fc097610f6d612feb565b878a6101443595610124359560e435916133ff565b610f8b87612fe4565b610f95888a61307d565b92886130db565b610fb560ff610fae848a999599612b90565b9216613175565b90612b90565b613183565b91610fca83613717565b608435831061107f577ffa83d5d2a947b30f08c51454033f55a1e19d8d9b20a3d4a68cbe85d702e11ef29233600052600b60205263ffffffff6040600020971696876000526020526040600020611022828254612ebd565b905573ffffffffffffffffffffffffffffffffffffffff9061104a868360085416338a6131bc565b6110666040519485948552608060208601526080850190612eed565b9560408401526060830152339516930390a46001600555005b60046040517fbde82093000000000000000000000000000000000000000000000000000000008152fd5b60046040517f46b57c6f000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5763ffffffff61110f6128ee565b16600052600460205260606040600020805490600260018201549101549060405192835260208301526040820152f35b60e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760043567ffffffffffffffff811161036e57611189903690600401612a78565b611191612914565b61119961298b565b906111a2612feb565b60ff60065416156110a9576111c963ffffffff9260c4359060a435908660443586346135be565b1680600052602060038152604060002073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600052815260016040600020015480151560001461130e57925b611210612c30565b8051156112e45784610fbb82610fb561123560ff8861123b9751940151169234612b90565b91613175565b9061124582613717565b606435821061107f577f9b5db8da8d354582e1a2f754b54eab67f640b467f580ee9b9f5453662ef940119133600052600b845260406000208560005284526040600020611293828254612ebd565b90556112b73473ffffffffffffffffffffffffffffffffffffffff600854166132f9565b6112cc60405192606084526060840190612eed565b93349083015260408201528033930390a46001600555005b60046040517f358e2ce7000000000000000000000000000000000000000000000000000000008152fd5b50816000526004815260026040600020015492611208565b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5761135d612f93565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602063ffffffff60025416604051908152f35b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602073ffffffffffffffffffffffffffffffffffffffff60065460081c16604051908152f35b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576020600954604051908152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760043580151580910361036e576114d9612f93565b6006549060ff821615158181146106a3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00917fe557486689c0bf71dde8cb27e7e87ed23badcf92ea724f4a0368676720d416f6604060ff938151908152836020820152a116911617600655600080f35b60e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760043567ffffffffffffffff811161036e57611594903690600401612a78565b61159c612914565b9060443567ffffffffffffffff811161036e576115bd903690600401612927565b92906115c761298b565b60ff60065416156110a9576115da612feb565b6116046115e5612b0c565b916115f18351886133f2565b60c4359060a435908760643588346135be565b61160c612c30565b948551156112e457859295519560ff60408501511693600095600080975b86518910156116a55790849392916116458a888e9998612adb565b35906116518b8a612b7c565b519c61165d8e84612b90565b6116668c613175565b61166f91612b90565b9061167991613183565b61168291612ebd565b9b61168c91612b90565b61169591612ebd565b976001019790919293949961162a565b90899163ffffffff84166000526003602052604060002073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60005260205260016040600020015480151560001461199157915b6c0c9f2c9cd04674edea4000000090818102918183041490151715611962576117188361171d92613183565b613717565b604051611729816129a9565b61173288612f7b565b61173f60405191826129fd565b88815260208101368a60051b8a011161036e5788905b8a60051b8a01821061195257505081526020810183815233600052600d602052604060002063ffffffff871660005260205260406000208054680100000000000000008110156118f4576117ae91600182018155612abf565b929092611923575180519067ffffffffffffffff82116118f4576020906117d58386612ba3565b0183600052602060002060005b8381106118e05750505050600190519101558034106118b65763ffffffff61187b9461189c937f5c49140bae3a14ee4886ae54e90d9a38a19fc00cec7f3a6cd0b879516c1996a39761183385612fe4565b61183d8534612c23565b806118a6575b506118668573ffffffffffffffffffffffffffffffffffffffff600854166132f9565b5160405197889760a0895260a0890190612eed565b94602088015260408701526060860152848303608086015216963396612f30565b0390a36001600555005b6118b090336132f9565b8b611843565b60046040517f53d13992000000000000000000000000000000000000000000000000000000008152fd5b6001906020845194019381840155016117e2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b8135815260209182019101611755565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5063ffffffff84166000526004602052600260406000200154916116ec565b3461036e576101407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576119e8612958565b6024356119f361297b565b9060643567ffffffffffffffff811161036e57611a14903690600401612a78565b906084359263ffffffff8416840361036e5760a43567ffffffffffffffff811161036e57611a46903690600401612927565b60e49691963560ff8116810361036e5760ff60065416156110a957611a69612feb565b611a9b60ff611a76612b0c565b95611a828751866133f2565b16916101243590610104359084898b60c4358e8b6133ff565b611aa483612e4c565b948551611d67575b855115611d1a575b505083519660ff604086015116946000936000976000985b87518a1015611b3a57611ae08a8787612adb565b35611aeb8b8a612b7c565b51978d611af88a84612b90565b611b018d613175565b611b0a91612b90565b90611b1491613183565b611b1d91612ebd565b97611b2791612b90565b611b3091612ebd565b9860010198611acc565b90849187878d611b4a878261307d565b936c0c9f2c9cd04674edea40000000908181029181830414901517156119625761171885611b7792613183565b604051611b83816129a9565b611b8c83612f7b565b611b9960405191826129fd565b83815260208101368560051b8a011161036e5788905b8560051b8a018210611d0a57505081526020810185815233600052600d602052604060002063ffffffff841660005260205260406000208054680100000000000000008110156118f457611c0b90600192600182018155612abf565b939093611923575180519067ffffffffffffffff82116118f457602090611c328387612ba3565b0184600052602060002060005b838110611cf75750505050507ff989f9bba8cb70e19552fc1abe68d783fb1e7f79941a115c1e5b6c3c776fd44c96959492611ced9492600163ffffffff9351910155611c8a84612fe4565b73ffffffffffffffffffffffffffffffffffffffff9a611cb1858d600854168d33906131bc565b5195611ccf604051988998895260a060208a015260a0890190612eed565b94604088015260608701528584036080870152169833981696612f30565b0390a46001600555005b8490602084519401938184015501611c3f565b8135815260209182019101611baf565b80158015611d5f575b611d3557855260408501528780611ab4565b60046040517f7c946ed7000000000000000000000000000000000000000000000000000000008152fd5b508115611d23565b8015801590611da0575b15611aac5760046040517ff443cb16000000000000000000000000000000000000000000000000000000008152fd5b50811515611d71565b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602060ff600654166040519015158152f35b3461036e5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57611e216128ee565b6024359060643590604435611e34612f93565b63ffffffff80921693827f00000000000000000000000000000000000000000000000000000000000000001685118015906120a7575b61207d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8501838111611962578316600052602092600484526040600020604051611eb5816129c5565b8154815260406002600184015493888401948552015491019081526001880183811161196257831660005260048652604060002092600260405194611ef9866129c5565b8054865260018101548987015201549260408501938452518510612053576002541688141580938194612048575b5061201e57518610611ff45781611fe9575b50611fbf578360609382611f717fcf17268674ed4ffa34a117862c7b380287afb4c202e842a5f391b92219c0e02a9786600296613389565b60405190611f7e826129c5565b8152818101948552604081019283528760005260048252604060002090519485825551928360018301555193849101556040519384528301526040820152a2005b60046040517fecdcda19000000000000000000000000000000000000000000000000000000008152fd5b905051841186611f39565b60046040517f434c92c9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f649bb635000000000000000000000000000000000000000000000000000000008152fd5b905051851189611f27565b60046040517f442db2a5000000000000000000000000000000000000000000000000000000008152fd5b60046040517f82a99657000000000000000000000000000000000000000000000000000000008152fd5b5082600254168511611e6a565b3461036e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576004356044356024356120f4612f93565b6002549263ffffffff93848116948560005260046020526040600020916040519161211e836129c5565b835483526040600260018601549560208601968752015493019283528088146119625760017fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009801169687911617600255518410611ff4575181106122015782826121ad7f6877931d901fa420de6b1b5c5b565c4422ab189963a871c828e7b992220e95e39560609585613389565b604051926121ba846129c5565b8352602083019081526040830191825285600052600460205260406000209251928381558151600182015560028351910155604051928352516020830152516040820152a2005b60046040517fb290253c000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57608073ffffffffffffffffffffffffffffffffffffffff8061227a612958565b166000526001602052604060002060ff60018254920154916040519381168452818160a01c16602085015260a81c1660408301526060820152f35b60e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576122e7612958565b6122ef61297b565b9060a4359073ffffffffffffffffffffffffffffffffffffffff8083169160643583850361036e5761231f612901565b9460ff60065416156110a957612333612feb565b8360075416330361248e5761234790613026565b63ffffffff851694856000526003602052604060002090848416918260005260205260ff604060002054161561246457610fbb9761239561238b866123a79461307d565b91602435876130db565b610fb560ff610fae84899e959e612b90565b906123b182613717565b608435821061107f577f7abcb23b61318b8b612c876bdf3070978b03e1fea48e9ee7bffb0b5b9c2f3a7c948360609588600052600b60205260406000208a6000526020526040600020612405868254612ebd565b905573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee840361244b575050612433906008541634906132f9565b60405192835260208301526040820152a46001600555005b8261245f93600754169060085416916131bc565b612433565b60046040517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b60046040517f049809b1000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602073ffffffffffffffffffffffffffffffffffffffff60085416604051908152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760606125a461259f612958565b612e4c565b60ff6040805192805184528260208201511660208501520151166040820152f35b3461036e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5767ffffffffffffffff60043581811161036e57612616903690600401612927565b9161261f612f93565b612627612b0c565b60005b8481106126d857505082116118f4576801000000000000000082116118f457600a5482600a55808310612697575b5060005b82811061266557005b81357fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88201559083019060010161265c565b827fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a891820191015b8181106126cc5750612658565b600081556001016126bf565b807f335f5afc83fe8c5a011a96dc39bcce9fb9d46fb5986502f7040e76e28b03612360406127096001948989612adb565b3561271381612fe4565b61271d8487612b7c565b519082519182528a820152a10161262a565b3461036e5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576127666128ee565b67ffffffffffffffff60243581811161036e57612787903690600401612927565b909160443581811161036e576127a1903690600401612927565b909160643590811161036e576127bb903690600401612927565b90956127c5612f93565b8415610d66578285148015906128e4575b610d3c5763ffffffff169182600052602090600360205260406000209560005b8181106127ff57005b73ffffffffffffffffffffffffffffffffffffffff612822610a4783858d612adb565b169081156106cd5761283581858a612adb565b3580151580910361036e57600192887fc1a8d3b5c8695d3120c5ea6e6afca4fd990747cccf9c4513cbc02baf1c32e40d888f8e95612875888e8b94612adb565b359660405191612884836129a9565b8252838201978852866000528352604060002090511515966128d188839060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b519182910155604051908152a4016127f6565b50818314156127d6565b6004359063ffffffff8216820361036e57565b60c4359063ffffffff8216820361036e57565b6024359063ffffffff8216820361036e57565b9181601f8401121561036e5782359167ffffffffffffffff831161036e576020808501948460051b01011161036e57565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361036e57565b6044359060ff8216820361036e57565b6084359060ff8216820361036e57565b359060ff8216820361036e57565b6040810190811067ffffffffffffffff8211176118f457604052565b6060810190811067ffffffffffffffff8211176118f457604052565b6080810190811067ffffffffffffffff8211176118f457604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176118f457604052565b67ffffffffffffffff81116118f457601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561036e57803590612a8f82612a3e565b92612a9d60405194856129fd565b8284526020838301011161036e57816000926020809301838601378301015290565b8054821015610d0d5760005260206000209060011b0190600090565b9190811015610d0d5760051b0190565b3573ffffffffffffffffffffffffffffffffffffffff8116810361036e5790565b60405190600a54808352826020916020820190600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8936000905b828210612b6257505050612b60925003836129fd565b565b855484526001958601958895509381019390910190612b4a565b8051821015610d0d5760209160051b010190565b8181029291811591840414171561196257565b6801000000000000000082116118f457805491808255828110612bc557505050565b600091600052602060002092830192015b828110612be257505050565b818155600101612bd6565b60405190612bfa826129c5565b60006040838281528260208201520152565b519069ffffffffffffffffffff8216820361036e57565b9190820391821161196257565b612c38612bed565b5073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6000908152600160205260408051907fde3e59ea0eeb6a65f16dd826b7bdfb53723c09ad80c81d458bbf2e138d918523612c87836129e1565b80549273ffffffffffffffffffffffffffffffffffffffff9081851681526001602082019360ff8760a01c16855260ff8684019760a81c16875201549160608201928352612cd3612bed565b915116908115612e4257509060a06004928551938480927ffeaf968c0000000000000000000000000000000000000000000000000000000082525afa918215612e38578690878094612dce575b505069ffffffffffffffffffff1615612da5578115918215612d8f575b5050612d665760ff8091511692511691815193612d59856129c5565b8452602084015282015290565b600482517f1f4bcb2b000000000000000000000000000000000000000000000000000000008152fd5b612d9b91925042612c23565b9051103880612d3d565b600484517fa5959c59000000000000000000000000000000000000000000000000000000008152fd5b92935096505060a0863d60a011612e30575b81612ded60a093836129fd565b81010312612e2d5750612dff85612c0c565b9069ffffffffffffffffffff602087015192612e22608060608a01519901612c0c565b509296929038612d20565b80fd5b3d9150612de0565b84513d88823e3d90fd5b9550505050505090565b612e54612bed565b5073ffffffffffffffffffffffffffffffffffffffff8060009216825260016020526040808320815192612e87846129e1565b81549381851681526001602082019360ff8760a01c16855260ff8684019760a81c16875201549160608201928352612cd3612bed565b9190820180921161196257565b60005b838110612edd5750506000910152565b8181015183820152602001612ecd565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093612f2981518092818752878088019101612eca565b0116010190565b90918281527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831161036e5760209260051b809284830137010190565b3560ff8116810361036e5790565b67ffffffffffffffff81116118f45760051b60200190565b73ffffffffffffffffffffffffffffffffffffffff600054163303612fb457565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b15611d3557565b600260055414612ffc576002600555565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b73ffffffffffffffffffffffffffffffffffffffff16600052600c60205260ff6040600020541661305357565b60046040517f09550c77000000000000000000000000000000000000000000000000000000008152fd5b63ffffffff1690600090828252600360205273ffffffffffffffffffffffffffffffffffffffff60408320911682526020526001604082200154918215156000146130c757505090565b815260046020526040902060020154919050565b6130e790939293612e4c565b928351613130575b835115613106575b505060ff602083519301511690565b81158015613125575b611d355760ff91845216602083015238806130f7565b5060ff81161561310f565b8115801590613169575b156130ef5760046040517ff443cb16000000000000000000000000000000000000000000000000000000008152fd5b5060ff8116151561313a565b604d811161196257600a0a90565b811561318d570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b90916040519360208501937f23b872dd00000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff9283809216602488015216604486015260648501526064845260a084019184831067ffffffffffffffff8411176118f457613254926040521692600080938192519082875af161324d6132c9565b9084613818565b90815191821515928361329d575b50505061326c5750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b8192935090602091810103126132c5576020015190811591821503612e2d5750388080613262565b5080fd5b3d156132f4573d906132da82612a3e565b916132e860405193846129fd565b82523d6000602084013e565b606090565b81471061335957600080809373ffffffffffffffffffffffffffffffffffffffff8294165af16133276132c9565b501561332f57565b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b60246040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152fd5b904282106122015711156133c8571561339e57565b60046040517f2013535a000000000000000000000000000000000000000000000000000000008152fd5b60046040517f38af65f7000000000000000000000000000000000000000000000000000000008152fd5b8015610d665703610d3c57565b93909897969594989291928342116135945763ffffffff9061342033613026565b16986000948a86526020956003875260409b8c822073ffffffffffffffffffffffffffffffffffffffff84168352885260ff8d832054161561356b578152600487528b90208b51613470816129c5565b8154908181528d60026001850154948b8401958652015491015242106135425751421015613519579161351193917fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060a894612b609c9d519788956134e88b88019b3360601b8d52825192839160348b019101612eca565b8601946034860152605485015260601b16607483015260888201520360888101845201826129fd565b519020613783565b60048b517f6b5fd31b000000000000000000000000000000000000000000000000000000008152fd5b60048c517f8e9c6e1c000000000000000000000000000000000000000000000000000000008152fd5b60048d517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1ab7da6b000000000000000000000000000000000000000000000000000000008152fd5b6135ce9097969594939297612fe4565b8642116135945763ffffffff906135e433613026565b16956000918783526020926003845260409889822073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8352855260ff8a83205416156136ee578152600484528890208851613632816129c5565b8154908181528a6002600185015494888401958652015491015242106136c5575142101561369c57605461351191612b60989951938491613686878401973360601b89528251928391603487019101612eca565b82019060348201520360348101845201826129fd565b600488517f6b5fd31b000000000000000000000000000000000000000000000000000000008152fd5b600489517f8e9c6e1c000000000000000000000000000000000000000000000000000000008152fd5b60048a517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b600954906137258282612ebd565b7f0000000000000000000000000000000000000000000000000000000000000000106137595761375491612ebd565b600955565b60046040517ff10b176b000000000000000000000000000000000000000000000000000000008152fd5b926137dd906137e6929373ffffffffffffffffffffffffffffffffffffffff948560065460081c16967f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002061388e565b9092919261392b565b16036137ee57565b60046040517f8baa579f000000000000000000000000000000000000000000000000000000008152fd5b9061382d575080511561332f57805190602001fd5b81511580613885575b61383e575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b15613836565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161391f57926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa1561391357805173ffffffffffffffffffffffffffffffffffffffff81161561390a57918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b60048110156139e3578061393d575050565b6001810361396f5760046040517ff645eedf000000000000000000000000000000000000000000000000000000008152fd5b600281036139a857602482604051907ffce698f70000000000000000000000000000000000000000000000000000000082526004820152fd5b6003146139b25750565b602490604051907fd78bce0c0000000000000000000000000000000000000000000000000000000082526004820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea26469706673582212205de86bdb7b7802523de2d9f5a00598d54e533c7a4ff05102e0eb063d74d44b6164736f6c634300081900330000000000000000000000005ecb43acf0e367c6ba1c5b8c512a9d29d3f5071d0000000000000000000000003088149945e0dfdf78f10650a36cd0c1fb8816eb00000000000000000000000096d7e90e6176466a0d882fc8ba6436021f1aeb060000000000000000000000001a21480ba1a3bb5b6a070b3bd47a21f917607dff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000ec565a6ce4346c819400000000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000bebc200000000000000000000000000000000000000000000000000000000001dcd6500000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000012a05f20000000000000000000000000000000000000000000000000000000002540be40000000000000000000000000000000000000000000000000000000006fc23ac000000000000000000000000000000000000000000000000000000001176592e00
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80630a7e0c561461272f578063161c9d01146125c557806316345f18146125635780632194f3a21461251157806323548b8b146124b857806327824e53146122b557806327e45c2c1461222b5780632a253026146120b45780632d55e7df14611dea5780633d389faf14611da957806340c8e892146119b0578063411a9df51461154a57806341e7e341146114955780635962a9411461145957806364f0d35e146114045780636de7da78146113c2578063715018a61461132657806372287c021461113f57806379a6d51f146110d35780637bc2d71014610ec25780637d6f0d5f14610de25780637fcb097214610d9057806383ed1385146109765780638da5cb5b1461092457806392f588811461089357806395f00240146107f8578063aad2b723146106f7578063e09590d1146105ae578063e9f8958f1461052e578063f2fde38b1461044c578063f3290d75146103e2578063fc7a822d146103735763fd1a013f1461018757600080fd5b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576101be612958565b73ffffffffffffffffffffffffffffffffffffffff6101db612914565b9116600052602090600d825263ffffffff6040600020911660005281526040600020805461020881612f7b565b9061021660405192836129fd565b80825283820190819360005284600020916000905b8282106102f7578685876040519283928184019082855251809152604084019160408260051b86010193926000905b8382106102675786860387f35b9193957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0908692949603018252838651604083019080519160408552825180915283606086019301906000905b8082106102dd57505050906001938380809401519101529701920192018695949293919361025a565b8251855289959485019490920191600191909101906102b4565b86604051610304816129a9565b604051808388549182815201908860005284600020906000905b80821061035457505050918161033c600196936002969503826129fd565b8152848801548382015281520194019101909261022b565b825484528d9690930192600192830192919091019061031e565b600080fd5b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57600435600a5481101561036e57602090600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80154604051908152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5773ffffffffffffffffffffffffffffffffffffffff61042e612958565b16600052600c602052602060ff604060002054166040519015158152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57610483612958565b61048b612f93565b73ffffffffffffffffffffffffffffffffffffffff8091169081156104fd57600054827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60246040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152fd5b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57610565612958565b73ffffffffffffffffffffffffffffffffffffffff610582612914565b9116600052600b60205263ffffffff604060002091166000526020526020604060002054604051908152f35b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576105e5612958565b6024358015159182820361036e5773ffffffffffffffffffffffffffffffffffffffff1680156106cd57610617612f93565b80600052600c6020528260ff604060002054161515146106a3577f6a12b3df6cba4203bd7fd06b816789f87de8c594299aed5717ae070fac781bac60406106a1948151908482526020820152a1600052600c60205260406000209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b005b60046040517f2620eb3a000000000000000000000000000000000000000000000000000000008152fd5b60046040517fd92e233d000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5761072e612958565b73ffffffffffffffffffffffffffffffffffffffff9081811680156106cd57610755612f93565b600654928360081c169081146106a3576040805173ffffffffffffffffffffffffffffffffffffffff928316815291831660208301527fffffffffffffffffffffff0000000000000000000000000000000000000000ff9274ffffffffffffffffffffffffffffffffffffffff009290917f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb91a160081b16911617600655600080f35b3461036e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5761082f612958565b610837612914565b73ffffffffffffffffffffffffffffffffffffffff6044359216600052600d60205263ffffffff60406000209116600052602052604060002090815481101561036e57610888600191602093612abf565b500154604051908152f35b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576108ca6128ee565b6024359073ffffffffffffffffffffffffffffffffffffffff821680920361036e5763ffffffff166000526003602052604060002090600052602052604080600020600160ff825416910154825191151582526020820152f35b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b3461036e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5767ffffffffffffffff60043581811161036e576109c6903690600401612927565b90826024351161036e5736602360243501121561036e576024356004013592831161036e573660248460071b813501011161036e57610a03612f93565b8115610d6657828203610d3c5760005b828110610a1c57005b83811015610d0d5773ffffffffffffffffffffffffffffffffffffffff610a4c610a47838686612adb565b612aeb565b16908160005260016020526040600020604051610a68816129e1565b815473ffffffffffffffffffffffffffffffffffffffff811682526001602083019360ff8360a01c16855260ff604085019360a81c1683520154916060810192835285158015610cde575b6106cd5773ffffffffffffffffffffffffffffffffffffffff90511673ffffffffffffffffffffffffffffffffffffffff610af660248760071b81350101612aeb565b16149283610cb9575b5082610c94575b5081610c7e575b506106a35760405182815260248260071b813501013573ffffffffffffffffffffffffffffffffffffffff8116810361036e5760019373ffffffffffffffffffffffffffffffffffffffff859216602084015260448460071b602435010160ff610b768261299b565b16604085015260648560071b60243501019160ff610b938461299b565b1660608601527fe0ec1b96a1e4f66c20cac6575b2dd77087e61f31bc392fc4d419f8094731614760a060848860071b60243501013596876080820152a16000528260205260406000209173ffffffffffffffffffffffffffffffffffffffff610c0460248860071b81350101612aeb565b167fffffffffffffffffffff0000000000000000000000000000000000000000000075ff000000000000000000000000000000000000000000610c6b74ff0000000000000000000000000000000000000000610c61885497612f6d565b60a01b1694612f6d565b60a81b1693161717178155015501610a13565b90505160848260071b6024350101351486610b0d565b60ff919250511660ff610cb060648560071b6024350101612f6d565b16149087610b06565b60ff919350511660ff610cd560448660071b6024350101612f6d565b16149188610aff565b5073ffffffffffffffffffffffffffffffffffffffff610d0660248760071b81350101612aeb565b1615610ab3565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60046040517fa24a13a6000000000000000000000000000000000000000000000000000000008152fd5b60046040517f0f59b9ff000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602073ffffffffffffffffffffffffffffffffffffffff60075416604051908152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57610e19612958565b73ffffffffffffffffffffffffffffffffffffffff908181169182156106cd57610e41612f93565b6008549081168381146106a3576040805173ffffffffffffffffffffffffffffffffffffffff92831681529390911660208401527fffffffffffffffffffffffff0000000000000000000000000000000000000000927fe22b566ac7db56412e2e041c88a7fd3151151ad6c6647e954f9bdc054bcb780e9190a11617600855005b3461036e576101607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57610efa612958565b6024359060ff821680830361036e57604435926064359160a43567ffffffffffffffff811161036e57610f31903690600401612a78565b90610f3a612901565b956101043560ff8116810361036e5760ff60065416156110a957610fbb94610f82888a610f9c94610fc097610f6d612feb565b878a6101443595610124359560e435916133ff565b610f8b87612fe4565b610f95888a61307d565b92886130db565b610fb560ff610fae848a999599612b90565b9216613175565b90612b90565b613183565b91610fca83613717565b608435831061107f577ffa83d5d2a947b30f08c51454033f55a1e19d8d9b20a3d4a68cbe85d702e11ef29233600052600b60205263ffffffff6040600020971696876000526020526040600020611022828254612ebd565b905573ffffffffffffffffffffffffffffffffffffffff9061104a868360085416338a6131bc565b6110666040519485948552608060208601526080850190612eed565b9560408401526060830152339516930390a46001600555005b60046040517fbde82093000000000000000000000000000000000000000000000000000000008152fd5b60046040517f46b57c6f000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5763ffffffff61110f6128ee565b16600052600460205260606040600020805490600260018201549101549060405192835260208301526040820152f35b60e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760043567ffffffffffffffff811161036e57611189903690600401612a78565b611191612914565b61119961298b565b906111a2612feb565b60ff60065416156110a9576111c963ffffffff9260c4359060a435908660443586346135be565b1680600052602060038152604060002073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600052815260016040600020015480151560001461130e57925b611210612c30565b8051156112e45784610fbb82610fb561123560ff8861123b9751940151169234612b90565b91613175565b9061124582613717565b606435821061107f577f9b5db8da8d354582e1a2f754b54eab67f640b467f580ee9b9f5453662ef940119133600052600b845260406000208560005284526040600020611293828254612ebd565b90556112b73473ffffffffffffffffffffffffffffffffffffffff600854166132f9565b6112cc60405192606084526060840190612eed565b93349083015260408201528033930390a46001600555005b60046040517f358e2ce7000000000000000000000000000000000000000000000000000000008152fd5b50816000526004815260026040600020015492611208565b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5761135d612f93565b600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602063ffffffff60025416604051908152f35b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602073ffffffffffffffffffffffffffffffffffffffff60065460081c16604051908152f35b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576020600954604051908152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760043580151580910361036e576114d9612f93565b6006549060ff821615158181146106a3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00917fe557486689c0bf71dde8cb27e7e87ed23badcf92ea724f4a0368676720d416f6604060ff938151908152836020820152a116911617600655600080f35b60e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760043567ffffffffffffffff811161036e57611594903690600401612a78565b61159c612914565b9060443567ffffffffffffffff811161036e576115bd903690600401612927565b92906115c761298b565b60ff60065416156110a9576115da612feb565b6116046115e5612b0c565b916115f18351886133f2565b60c4359060a435908760643588346135be565b61160c612c30565b948551156112e457859295519560ff60408501511693600095600080975b86518910156116a55790849392916116458a888e9998612adb565b35906116518b8a612b7c565b519c61165d8e84612b90565b6116668c613175565b61166f91612b90565b9061167991613183565b61168291612ebd565b9b61168c91612b90565b61169591612ebd565b976001019790919293949961162a565b90899163ffffffff84166000526003602052604060002073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60005260205260016040600020015480151560001461199157915b6c0c9f2c9cd04674edea4000000090818102918183041490151715611962576117188361171d92613183565b613717565b604051611729816129a9565b61173288612f7b565b61173f60405191826129fd565b88815260208101368a60051b8a011161036e5788905b8a60051b8a01821061195257505081526020810183815233600052600d602052604060002063ffffffff871660005260205260406000208054680100000000000000008110156118f4576117ae91600182018155612abf565b929092611923575180519067ffffffffffffffff82116118f4576020906117d58386612ba3565b0183600052602060002060005b8381106118e05750505050600190519101558034106118b65763ffffffff61187b9461189c937f5c49140bae3a14ee4886ae54e90d9a38a19fc00cec7f3a6cd0b879516c1996a39761183385612fe4565b61183d8534612c23565b806118a6575b506118668573ffffffffffffffffffffffffffffffffffffffff600854166132f9565b5160405197889760a0895260a0890190612eed565b94602088015260408701526060860152848303608086015216963396612f30565b0390a36001600555005b6118b090336132f9565b8b611843565b60046040517f53d13992000000000000000000000000000000000000000000000000000000008152fd5b6001906020845194019381840155016117e2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b8135815260209182019101611755565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5063ffffffff84166000526004602052600260406000200154916116ec565b3461036e576101407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576119e8612958565b6024356119f361297b565b9060643567ffffffffffffffff811161036e57611a14903690600401612a78565b906084359263ffffffff8416840361036e5760a43567ffffffffffffffff811161036e57611a46903690600401612927565b60e49691963560ff8116810361036e5760ff60065416156110a957611a69612feb565b611a9b60ff611a76612b0c565b95611a828751866133f2565b16916101243590610104359084898b60c4358e8b6133ff565b611aa483612e4c565b948551611d67575b855115611d1a575b505083519660ff604086015116946000936000976000985b87518a1015611b3a57611ae08a8787612adb565b35611aeb8b8a612b7c565b51978d611af88a84612b90565b611b018d613175565b611b0a91612b90565b90611b1491613183565b611b1d91612ebd565b97611b2791612b90565b611b3091612ebd565b9860010198611acc565b90849187878d611b4a878261307d565b936c0c9f2c9cd04674edea40000000908181029181830414901517156119625761171885611b7792613183565b604051611b83816129a9565b611b8c83612f7b565b611b9960405191826129fd565b83815260208101368560051b8a011161036e5788905b8560051b8a018210611d0a57505081526020810185815233600052600d602052604060002063ffffffff841660005260205260406000208054680100000000000000008110156118f457611c0b90600192600182018155612abf565b939093611923575180519067ffffffffffffffff82116118f457602090611c328387612ba3565b0184600052602060002060005b838110611cf75750505050507ff989f9bba8cb70e19552fc1abe68d783fb1e7f79941a115c1e5b6c3c776fd44c96959492611ced9492600163ffffffff9351910155611c8a84612fe4565b73ffffffffffffffffffffffffffffffffffffffff9a611cb1858d600854168d33906131bc565b5195611ccf604051988998895260a060208a015260a0890190612eed565b94604088015260608701528584036080870152169833981696612f30565b0390a46001600555005b8490602084519401938184015501611c3f565b8135815260209182019101611baf565b80158015611d5f575b611d3557855260408501528780611ab4565b60046040517f7c946ed7000000000000000000000000000000000000000000000000000000008152fd5b508115611d23565b8015801590611da0575b15611aac5760046040517ff443cb16000000000000000000000000000000000000000000000000000000008152fd5b50811515611d71565b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602060ff600654166040519015158152f35b3461036e5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57611e216128ee565b6024359060643590604435611e34612f93565b63ffffffff80921693827f00000000000000000000000000000000000000000000000000000000000000001685118015906120a7575b61207d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8501838111611962578316600052602092600484526040600020604051611eb5816129c5565b8154815260406002600184015493888401948552015491019081526001880183811161196257831660005260048652604060002092600260405194611ef9866129c5565b8054865260018101548987015201549260408501938452518510612053576002541688141580938194612048575b5061201e57518610611ff45781611fe9575b50611fbf578360609382611f717fcf17268674ed4ffa34a117862c7b380287afb4c202e842a5f391b92219c0e02a9786600296613389565b60405190611f7e826129c5565b8152818101948552604081019283528760005260048252604060002090519485825551928360018301555193849101556040519384528301526040820152a2005b60046040517fecdcda19000000000000000000000000000000000000000000000000000000008152fd5b905051841186611f39565b60046040517f434c92c9000000000000000000000000000000000000000000000000000000008152fd5b60046040517f649bb635000000000000000000000000000000000000000000000000000000008152fd5b905051851189611f27565b60046040517f442db2a5000000000000000000000000000000000000000000000000000000008152fd5b60046040517f82a99657000000000000000000000000000000000000000000000000000000008152fd5b5082600254168511611e6a565b3461036e5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576004356044356024356120f4612f93565b6002549263ffffffff93848116948560005260046020526040600020916040519161211e836129c5565b835483526040600260018601549560208601968752015493019283528088146119625760017fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009801169687911617600255518410611ff4575181106122015782826121ad7f6877931d901fa420de6b1b5c5b565c4422ab189963a871c828e7b992220e95e39560609585613389565b604051926121ba846129c5565b8352602083019081526040830191825285600052600460205260406000209251928381558151600182015560028351910155604051928352516020830152516040820152a2005b60046040517fb290253c000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57608073ffffffffffffffffffffffffffffffffffffffff8061227a612958565b166000526001602052604060002060ff60018254920154916040519381168452818160a01c16602085015260a81c1660408301526060820152f35b60e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576122e7612958565b6122ef61297b565b9060a4359073ffffffffffffffffffffffffffffffffffffffff8083169160643583850361036e5761231f612901565b9460ff60065416156110a957612333612feb565b8360075416330361248e5761234790613026565b63ffffffff851694856000526003602052604060002090848416918260005260205260ff604060002054161561246457610fbb9761239561238b866123a79461307d565b91602435876130db565b610fb560ff610fae84899e959e612b90565b906123b182613717565b608435821061107f577f7abcb23b61318b8b612c876bdf3070978b03e1fea48e9ee7bffb0b5b9c2f3a7c948360609588600052600b60205260406000208a6000526020526040600020612405868254612ebd565b905573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee840361244b575050612433906008541634906132f9565b60405192835260208301526040820152a46001600555005b8261245f93600754169060085416916131bc565b612433565b60046040517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b60046040517f049809b1000000000000000000000000000000000000000000000000000000008152fd5b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760206040517f000000000000000000000000000000000000000000ec565a6ce4346c819400008152f35b3461036e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e57602073ffffffffffffffffffffffffffffffffffffffff60085416604051908152f35b3461036e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5760606125a461259f612958565b612e4c565b60ff6040805192805184528260208201511660208501520151166040820152f35b3461036e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e5767ffffffffffffffff60043581811161036e57612616903690600401612927565b9161261f612f93565b612627612b0c565b60005b8481106126d857505082116118f4576801000000000000000082116118f457600a5482600a55808310612697575b5060005b82811061266557005b81357fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88201559083019060010161265c565b827fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a891820191015b8181106126cc5750612658565b600081556001016126bf565b807f335f5afc83fe8c5a011a96dc39bcce9fb9d46fb5986502f7040e76e28b03612360406127096001948989612adb565b3561271381612fe4565b61271d8487612b7c565b519082519182528a820152a10161262a565b3461036e5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261036e576127666128ee565b67ffffffffffffffff60243581811161036e57612787903690600401612927565b909160443581811161036e576127a1903690600401612927565b909160643590811161036e576127bb903690600401612927565b90956127c5612f93565b8415610d66578285148015906128e4575b610d3c5763ffffffff169182600052602090600360205260406000209560005b8181106127ff57005b73ffffffffffffffffffffffffffffffffffffffff612822610a4783858d612adb565b169081156106cd5761283581858a612adb565b3580151580910361036e57600192887fc1a8d3b5c8695d3120c5ea6e6afca4fd990747cccf9c4513cbc02baf1c32e40d888f8e95612875888e8b94612adb565b359660405191612884836129a9565b8252838201978852866000528352604060002090511515966128d188839060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b519182910155604051908152a4016127f6565b50818314156127d6565b6004359063ffffffff8216820361036e57565b60c4359063ffffffff8216820361036e57565b6024359063ffffffff8216820361036e57565b9181601f8401121561036e5782359167ffffffffffffffff831161036e576020808501948460051b01011161036e57565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361036e57565b6044359060ff8216820361036e57565b6084359060ff8216820361036e57565b359060ff8216820361036e57565b6040810190811067ffffffffffffffff8211176118f457604052565b6060810190811067ffffffffffffffff8211176118f457604052565b6080810190811067ffffffffffffffff8211176118f457604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176118f457604052565b67ffffffffffffffff81116118f457601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561036e57803590612a8f82612a3e565b92612a9d60405194856129fd565b8284526020838301011161036e57816000926020809301838601378301015290565b8054821015610d0d5760005260206000209060011b0190600090565b9190811015610d0d5760051b0190565b3573ffffffffffffffffffffffffffffffffffffffff8116810361036e5790565b60405190600a54808352826020916020820190600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8936000905b828210612b6257505050612b60925003836129fd565b565b855484526001958601958895509381019390910190612b4a565b8051821015610d0d5760209160051b010190565b8181029291811591840414171561196257565b6801000000000000000082116118f457805491808255828110612bc557505050565b600091600052602060002092830192015b828110612be257505050565b818155600101612bd6565b60405190612bfa826129c5565b60006040838281528260208201520152565b519069ffffffffffffffffffff8216820361036e57565b9190820391821161196257565b612c38612bed565b5073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6000908152600160205260408051907fde3e59ea0eeb6a65f16dd826b7bdfb53723c09ad80c81d458bbf2e138d918523612c87836129e1565b80549273ffffffffffffffffffffffffffffffffffffffff9081851681526001602082019360ff8760a01c16855260ff8684019760a81c16875201549160608201928352612cd3612bed565b915116908115612e4257509060a06004928551938480927ffeaf968c0000000000000000000000000000000000000000000000000000000082525afa918215612e38578690878094612dce575b505069ffffffffffffffffffff1615612da5578115918215612d8f575b5050612d665760ff8091511692511691815193612d59856129c5565b8452602084015282015290565b600482517f1f4bcb2b000000000000000000000000000000000000000000000000000000008152fd5b612d9b91925042612c23565b9051103880612d3d565b600484517fa5959c59000000000000000000000000000000000000000000000000000000008152fd5b92935096505060a0863d60a011612e30575b81612ded60a093836129fd565b81010312612e2d5750612dff85612c0c565b9069ffffffffffffffffffff602087015192612e22608060608a01519901612c0c565b509296929038612d20565b80fd5b3d9150612de0565b84513d88823e3d90fd5b9550505050505090565b612e54612bed565b5073ffffffffffffffffffffffffffffffffffffffff8060009216825260016020526040808320815192612e87846129e1565b81549381851681526001602082019360ff8760a01c16855260ff8684019760a81c16875201549160608201928352612cd3612bed565b9190820180921161196257565b60005b838110612edd5750506000910152565b8181015183820152602001612ecd565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602093612f2981518092818752878088019101612eca565b0116010190565b90918281527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831161036e5760209260051b809284830137010190565b3560ff8116810361036e5790565b67ffffffffffffffff81116118f45760051b60200190565b73ffffffffffffffffffffffffffffffffffffffff600054163303612fb457565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b15611d3557565b600260055414612ffc576002600555565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b73ffffffffffffffffffffffffffffffffffffffff16600052600c60205260ff6040600020541661305357565b60046040517f09550c77000000000000000000000000000000000000000000000000000000008152fd5b63ffffffff1690600090828252600360205273ffffffffffffffffffffffffffffffffffffffff60408320911682526020526001604082200154918215156000146130c757505090565b815260046020526040902060020154919050565b6130e790939293612e4c565b928351613130575b835115613106575b505060ff602083519301511690565b81158015613125575b611d355760ff91845216602083015238806130f7565b5060ff81161561310f565b8115801590613169575b156130ef5760046040517ff443cb16000000000000000000000000000000000000000000000000000000008152fd5b5060ff8116151561313a565b604d811161196257600a0a90565b811561318d570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b90916040519360208501937f23b872dd00000000000000000000000000000000000000000000000000000000855273ffffffffffffffffffffffffffffffffffffffff9283809216602488015216604486015260648501526064845260a084019184831067ffffffffffffffff8411176118f457613254926040521692600080938192519082875af161324d6132c9565b9084613818565b90815191821515928361329d575b50505061326c5750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b8192935090602091810103126132c5576020015190811591821503612e2d5750388080613262565b5080fd5b3d156132f4573d906132da82612a3e565b916132e860405193846129fd565b82523d6000602084013e565b606090565b81471061335957600080809373ffffffffffffffffffffffffffffffffffffffff8294165af16133276132c9565b501561332f57565b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b60246040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152fd5b904282106122015711156133c8571561339e57565b60046040517f2013535a000000000000000000000000000000000000000000000000000000008152fd5b60046040517f38af65f7000000000000000000000000000000000000000000000000000000008152fd5b8015610d665703610d3c57565b93909897969594989291928342116135945763ffffffff9061342033613026565b16986000948a86526020956003875260409b8c822073ffffffffffffffffffffffffffffffffffffffff84168352885260ff8d832054161561356b578152600487528b90208b51613470816129c5565b8154908181528d60026001850154948b8401958652015491015242106135425751421015613519579161351193917fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060a894612b609c9d519788956134e88b88019b3360601b8d52825192839160348b019101612eca565b8601946034860152605485015260601b16607483015260888201520360888101845201826129fd565b519020613783565b60048b517f6b5fd31b000000000000000000000000000000000000000000000000000000008152fd5b60048c517f8e9c6e1c000000000000000000000000000000000000000000000000000000008152fd5b60048d517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b60046040517f1ab7da6b000000000000000000000000000000000000000000000000000000008152fd5b6135ce9097969594939297612fe4565b8642116135945763ffffffff906135e433613026565b16956000918783526020926003845260409889822073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8352855260ff8a83205416156136ee578152600484528890208851613632816129c5565b8154908181528a6002600185015494888401958652015491015242106136c5575142101561369c57605461351191612b60989951938491613686878401973360601b89528251928391603487019101612eca565b82019060348201520360348101845201826129fd565b600488517f6b5fd31b000000000000000000000000000000000000000000000000000000008152fd5b600489517f8e9c6e1c000000000000000000000000000000000000000000000000000000008152fd5b60048a517f49a8defd000000000000000000000000000000000000000000000000000000008152fd5b600954906137258282612ebd565b7f000000000000000000000000000000000000000000ec565a6ce4346c81940000106137595761375491612ebd565b600955565b60046040517ff10b176b000000000000000000000000000000000000000000000000000000008152fd5b926137dd906137e6929373ffffffffffffffffffffffffffffffffffffffff948560065460081c16967f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002061388e565b9092919261392b565b16036137ee57565b60046040517f8baa579f000000000000000000000000000000000000000000000000000000008152fd5b9061382d575080511561332f57805190602001fd5b81511580613885575b61383e575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b15613836565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161391f57926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa1561391357805173ffffffffffffffffffffffffffffffffffffffff81161561390a57918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b60048110156139e3578061393d575050565b6001810361396f5760046040517ff645eedf000000000000000000000000000000000000000000000000000000008152fd5b600281036139a857602482604051907ffce698f70000000000000000000000000000000000000000000000000000000082526004820152fd5b6003146139b25750565b602490604051907fd78bce0c0000000000000000000000000000000000000000000000000000000082526004820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea26469706673582212205de86bdb7b7802523de2d9f5a00598d54e533c7a4ff05102e0eb063d74d44b6164736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005ecb43acf0e367c6ba1c5b8c512a9d29d3f5071d0000000000000000000000003088149945e0dfdf78f10650a36cd0c1fb8816eb00000000000000000000000096d7e90e6176466a0d882fc8ba6436021f1aeb060000000000000000000000001a21480ba1a3bb5b6a070b3bd47a21f917607dff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000ec565a6ce4346c819400000000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000bebc200000000000000000000000000000000000000000000000000000000001dcd6500000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000012a05f20000000000000000000000000000000000000000000000000000000002540be40000000000000000000000000000000000000000000000000000000006fc23ac000000000000000000000000000000000000000000000000000000001176592e00
-----Decoded View---------------
Arg [0] : fundsWalletAddress (address): 0x5ECB43aCf0e367c6ba1C5B8c512a9d29d3F5071D
Arg [1] : signerAddress (address): 0x3088149945e0dFdf78f10650A36cd0C1fb8816eB
Arg [2] : claimsContractAddress (address): 0x96d7e90E6176466a0D882fc8BA6436021F1AeB06
Arg [3] : owner (address): 0x1a21480bA1A3Bb5b6A070b3bd47a21F917607dFf
Arg [4] : lastRound (uint32): 0
Arg [5] : nftPrices (uint256[]): 200000000,500000000,1000000000,5000000000,10000000000,30000000000,75000000000
Arg [6] : initMaxCap (uint256): 285714285000000000000000000
-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 0000000000000000000000005ecb43acf0e367c6ba1c5b8c512a9d29d3f5071d
Arg [1] : 0000000000000000000000003088149945e0dfdf78f10650a36cd0c1fb8816eb
Arg [2] : 00000000000000000000000096d7e90e6176466a0d882fc8ba6436021f1aeb06
Arg [3] : 0000000000000000000000001a21480ba1a3bb5b6a070b3bd47a21f917607dff
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [5] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [6] : 000000000000000000000000000000000000000000ec565a6ce4346c81940000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [8] : 000000000000000000000000000000000000000000000000000000000bebc200
Arg [9] : 000000000000000000000000000000000000000000000000000000001dcd6500
Arg [10] : 000000000000000000000000000000000000000000000000000000003b9aca00
Arg [11] : 000000000000000000000000000000000000000000000000000000012a05f200
Arg [12] : 00000000000000000000000000000000000000000000000000000002540be400
Arg [13] : 00000000000000000000000000000000000000000000000000000006fc23ac00
Arg [14] : 0000000000000000000000000000000000000000000000000000001176592e00
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.