Polygon Sponsored slots available. Book your slot here!
More Info
Private Name Tags
Latest 25 from a total of 28 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Buy Item | 48547118 | 530 days ago | IN | 0 POL | 0.00841655 | ||||
Renounce Role | 48410804 | 534 days ago | IN | 0 POL | 0.00179041 | ||||
Renounce Role | 48335957 | 536 days ago | IN | 0 POL | 0.00102664 | ||||
Renounce Role | 48335954 | 536 days ago | IN | 0 POL | 0.0010086 | ||||
Renounce Role | 48335950 | 536 days ago | IN | 0 POL | 0.00108928 | ||||
Grant Role | 48335928 | 536 days ago | IN | 0 POL | 0.0026268 | ||||
Grant Role | 48335921 | 536 days ago | IN | 0 POL | 0.00218001 | ||||
Grant Role | 48335913 | 536 days ago | IN | 0 POL | 0.00208561 | ||||
Buy Item | 48296096 | 537 days ago | IN | 0 POL | 0.0074396 | ||||
Buy Item | 48274066 | 537 days ago | IN | 0 POL | 0.01582049 | ||||
Buy Item | 48260814 | 538 days ago | IN | 0 POL | 0.02447556 | ||||
Withdraw All | 48260689 | 538 days ago | IN | 0 POL | 0.01400282 | ||||
Grant Role | 48260673 | 538 days ago | IN | 0 POL | 0.00935172 | ||||
Buy Item | 48259897 | 538 days ago | IN | 0 POL | 0.01938628 | ||||
List Item | 48252674 | 538 days ago | IN | 0 POL | 0.0091303 | ||||
List Item | 48252658 | 538 days ago | IN | 0 POL | 0.00965154 | ||||
List Item | 48252652 | 538 days ago | IN | 0 POL | 0.00882591 | ||||
List Item | 48252642 | 538 days ago | IN | 0 POL | 0.00908782 | ||||
List Item | 48252625 | 538 days ago | IN | 0 POL | 0.00897944 | ||||
List Item | 48252608 | 538 days ago | IN | 0 POL | 0.00909429 | ||||
List Item | 48252568 | 538 days ago | IN | 0 POL | 0.00894992 | ||||
List Item | 48252548 | 538 days ago | IN | 0 POL | 0.0090878 | ||||
List Item | 48252527 | 538 days ago | IN | 0 POL | 0.00931414 | ||||
List Item | 48252504 | 538 days ago | IN | 0 POL | 0.01212431 | ||||
Add ERC1155 | 48252416 | 538 days ago | IN | 0 POL | 0.00891327 |
Loading...
Loading
Contract Name:
GOBMarket
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "../token/vesting/IVesting.sol"; import "../token/base/ERC20/IERC20MetadataBurnable.sol"; import "../token/base/ERC1155/IERC1155Mint.sol"; /** * @author Alejandro Garrido - Guardians of the Ball. * @title Guardians of the Ball - GOBMarket. * @notice GOBMarket sales ERC1155 tokens. * Tokens listed for sale can be viewed with `listedItems()` and `listedItem()`. * Tokens are minted to the buyer when the purchase is completed. * Tokens can be bought using one of three different payment methods: * - `buyItem()`: pay with ERC20 tokens listed in `validCurrencies()`. * - `buyItemWithVesting()`: pay with ERC20 tokens locked in `vesting`. * - `buyItemWithSeed()`: pay with ERC20 seed tokens used by `vesting`. */ contract GOBMarket is AccessControl { using EnumerableSet for EnumerableSet.AddressSet; using EnumerableSet for EnumerableSet.UintSet; using SafeERC20 for IERC20; using SafeERC20 for IERC20Metadata; bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE"); bytes32 public constant SELLER_ROLE = keccak256("SELLER_ROLE"); bytes32 public constant WITHDRAW_ROLE = keccak256("WITHDRAW_ROLE"); /** * @dev Emitted when a token has been purchased. */ event TokenPurchased( address indexed erc1155, uint256 indexed tokenId, address indexed to, uint256 quantity, address currency, uint256 totalAmount ); /** * @dev Emitted when MANAGER_ROLE adds a new valid currency. */ event CurrencyAdded(address indexed newCurrency); /** * @dev Emitted when MANAGER_ROLE removes a valid currency. */ event CurrencyRemoved(address indexed newCurrency); /** * @dev Emitted when MANAGER_ROLE adds a new valid erc1155. */ event ERC1155Added(address indexed erc1155); /** * @dev Emitted when MANAGER_ROLE removes valid erc1155. */ event ERC1155Removed(address indexed erc1155); /** * @dev Emitted when MANAGER_ROLE changed the vesting address. */ event VestingChanged(address indexed newVesting); /** * @dev Emitted when MANAGER_ROLE changed `seedPrice`. */ event SeedPriceChanged(uint256 indexed newSeedPrice); /** * @dev Emitted when SELLER_ROLE lists an item for sale. */ event TokenListed( address indexed erc1155, uint256 indexed tokenId, uint256 price, uint256 salesCap ); /** * @dev Emitted when SELLER_ROLE removes an item selling list. */ event TokenUnlisted(address indexed erc1155, uint256 indexed tokenId); /** * @dev Emitted when SELLER_ROLE changes the price of a token. */ event PriceChanged( address indexed erc1155, uint256 indexed tokenId, uint256 oldPrice, uint256 newPrice ); /** * @dev Emitted when SELLER_ROLE changes the sale cap of a token listed for sale. */ event CapChanged( address indexed erc1155, uint256 indexed tokenId, uint256 oldCap, uint256 newCap ); /** * @dev Emitted when WITHDRAW_ROLE withdraws funds. */ event Withdrawn(address indexed account, address indexed currency, uint256 amount); modifier validCurrency(address currency) { require(_currencies.contains(currency), "GOBMarket: Invalid currency"); _; } modifier validERC1155(address erc1155) { require(_erc1155Set.contains(erc1155), "GOBMarket: Erc1155 not found"); _; } modifier validTokenId(address erc1155, uint256 tokenId) { require(_tokenIdSet[erc1155].contains(tokenId), "GOBMarket: TokenId not found"); _; } modifier isVestingSet() { require(address(vesting) != address(0), "GOBMarket: Vesting not set"); require(seedPrice > 0, "GOBMarket: Vesting price not set"); _; } struct ItemInfo { uint256 price; uint256 salesCap; uint256 sold; } enum BuyWith { ValidCurrency, SeedToken, SeedTokenVested } // Decimals use to set the price for `_currencies` and seedTokens in `vesting` uint8 public immutable priceDecimals; // erc1155 => tokenId => SaleInfo. Items may or me not be for sale. mapping(address => mapping(uint256 => ItemInfo)) public items; // Price of seedTokens with decimals `priceDecimals` uint256 public seedPrice; // Vesting contract IVesting public vesting; // Accepted currencies; EnumerableSet.AddressSet private _currencies; // Erc1155s listed as valid EnumerableSet.AddressSet private _erc1155Set; // Tokens available for sale. Erc1155 => tokenId set. mapping(address => EnumerableSet.UintSet) private _tokenIdSet; /** * @dev Sets the deployer with role DEFAULT_ADMIN_ROLE and set priceDecimals. * * Requirements: * - `currencies` cannot be empty. * - `priceDecimals_ must be >=2 and <=6. * * @param currencies ERC20 accepted as payment. Should be stablecoins pegged to the same asset. * @param priceDecimals_ Decimals used in `items.price` and `seedPrice`. */ constructor(address[] memory currencies, uint8 priceDecimals_) { uint256 len = currencies.length; require(len > 0, "Currencies cannot be empty"); require(priceDecimals_ >= 2, "Price decimals must be >= 2"); // Cannot be gratter than 6 to be able to work with USDT and USDC require(priceDecimals_ <= 6, "Price decimals must be <= 6"); for (uint256 i = 0; i < len; ) { require(currencies[i] != address(0), "Invalid currency address"); require( IERC20Metadata(currencies[i]).decimals() >= priceDecimals_, "Currency decimals too low" ); _currencies.add(currencies[i]); unchecked { i++; } } priceDecimals = priceDecimals_; _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); } // --- PUBLIC --- /** * @notice Buy tokens of a listed ERC1155 using an approved ERC20 as payment. * The token's price is in `items` and it is expressed in `priceDecimals` * If the price of token id 1 is set at 300000 and priceDecimals is 4, the price in USDC is 30.00 * if paying with USDC as currency. * * Emits {TokenPurchased}. * * Requirements: * - `currency` must exists in validCurrencies(). * - `erc1155` and `tokenId` must be listed for sale. See `listedItems` and `listedItem`. * - Sender must have enough balance of selected `currency`. * - GOBMarket must have enough allowance of sender's selected `currency`. * * @param erc1155 ERC1155 addresss. * @param tokenId Token to purchase. * @param to Address to mint the `tokenId`. * @param quantity Amount of tokens to purchase. It cannot be zero. * @param currency ERC20 to be used as payment. */ function buyItem( address erc1155, uint256 tokenId, address to, uint256 quantity, address currency ) external validCurrency(currency) { _buyItem(erc1155, tokenId, to, quantity, currency, BuyWith.ValidCurrency); } /** * @notice Buy tokens of a listed ERC1155 using ERC20 tokens locked in `vesting`. * The token's price is in `items` and it is expressed in `priceDecimals`. * The value of the locked tokens is set in `seedPrice` and is also using `priceDecimals`. * (See buyItem) * * If `seedPrice` is 10000 and `priceDecimals` is 4, the convertion rate between * any `validCurrencies()` and locked tokens is 1:1 (10000 / 10**4) (ie: 1 LockedToken = 1 USDC) * If `seedPrice` is 5000 the convertion rate is 1:2 (5000 / 10**4) (ie: 1 LockedToken = 2 USDC) * * Emits {TokenPurchased}. * * Requirements: * - `erc1155` and `tokenId` must be listed for sale. See `listedItems` and `listedItem`. * - `vesting` and `seedPrice` must be set. * - Sender must have enough balance of locked tokens in `vesting`. * * @param erc1155 ERC1155 addresss. * @param tokenId Token to purchase. * @param to Address to mint the `tokenId`. * @param quantity Amount of tokens to purchase. It cannot be zero. */ function buyItemWithVesting( address erc1155, uint256 tokenId, address to, uint256 quantity ) external isVestingSet { _buyItem(erc1155, tokenId, to, quantity, vesting.token(), BuyWith.SeedTokenVested); } /** * @notice Buy tokens of a listed ERC1155 using ERC20 seed tokens used by `vesting`. * All price calculations are the same as `buyItemWithVesting()`. * * Emits {TokenPurchased}. * * Requirements: * - `erc1155` and `tokenId` must be listed for sale. See `listedItems` and `listedItem`. * - Sender must have enough balance of seed token used by `vesting`. * - GOBMarket must have enough allowance of sender's seed token. * - `vesting` and `seedPrice` must be set. * * @param erc1155 ERC1155 addresss. * @param to Address to mint the `tokenId`. * @param tokenId Token to purchase. * @param quantity Amount of tokens to purchase. It cannot be zero. */ function buyItemWithSeed( address erc1155, uint256 tokenId, address to, uint256 quantity ) external isVestingSet { _buyItem(erc1155, tokenId, to, quantity, vesting.token(), BuyWith.SeedToken); } /** * @notice Returns the selling info for a token in `erc1155`. * @param erc1155 ERC1155 addresss. * @param tokenId Token to query. Must be listed for sale. See `listedItems`. * @return item Struct of `ItemInfo` with the price, cap and sold data. */ function listedItem( address erc1155, uint256 tokenId ) external view validTokenId(erc1155, tokenId) returns (ItemInfo memory item) { return items[erc1155][tokenId]; } /** * @notice Returns the selling info for all tokens in `erc1155` available for sale. * @param erc1155 ERC1155 addresss. * @return tokenIds Array of all tokenIds. * @return listedItems_ Array of `ItemInfo`. Matched by index with `_tokenIds`. */ function listedItems( address erc1155 ) external view validERC1155(erc1155) returns (uint256[] memory tokenIds, ItemInfo[] memory listedItems_) { uint256 length = _tokenIdSet[erc1155].length(); listedItems_ = new ItemInfo[](length); tokenIds = new uint256[](length); for (uint256 i = 0; i < length; ) { listedItems_[i] = items[erc1155][_tokenIdSet[erc1155].at(i)]; tokenIds[i] = _tokenIdSet[erc1155].at(i); unchecked { i++; } } } /** * @notice Returns all ERC20 accepted as payment. * @return Array with all ERC20 addresses. */ function validCurrencies() external view returns (address[] memory) { return _currencies.values(); } /** * @notice Returns all the available ERC1155. * @return Array with all ERC1155 addresses. */ function erc1155List() external view returns (address[] memory) { return _erc1155Set.values(); } /** * @notice Returns the ERC1155 counter. * @return ERC1155 counter. */ function erc1155Length() external view returns (uint256) { return _erc1155Set.length(); } /** * @notice Returns the ERC1155 address at a specific `index`. * @return ERC1155 address. */ function erc1155At(uint256 index) external view returns (address) { return _erc1155Set.at(index); } // --- MANAGER --- /** * @notice Adds a new currency to the list of ERC20s accepted as payments. * * IMPORTANT: All ERC20s are assumed to be of the same market value. * There is only one price per token id listed for sale, and that price applies * to all currencies. * * Emits {CurrencyAdded}. * * @param newCurrency ERC20 address (ie: usdc). */ function addCurrency(address newCurrency) external onlyRole(MANAGER_ROLE) { require(newCurrency != address(0), "GOBMarket: Zero address"); require(!_currencies.contains(newCurrency), "GOBMarket: Currency already exists"); require( IERC20Metadata(newCurrency).decimals() >= priceDecimals, "GOBMarket: Currency decimals too low" ); _currencies.add(newCurrency); emit CurrencyAdded(newCurrency); } /** * @notice Removes an ERC20 from the accepted list of currencies. * * Emits {CurrencyRemoved}. * * @param currency ERC20 address. */ function removeCurrency( address currency ) external onlyRole(MANAGER_ROLE) validCurrency(currency) { require(currency != address(0), "GOBMarket: Zero address"); require(_currencies.length() > 1, "GOBMarket: Only one currency left"); _currencies.remove(currency); emit CurrencyRemoved(currency); } /** * @notice Adds an ERC1155 that will hold the tokens to be sold (minted). * GOBMarket must have minting access in `erc1155` at purchase time. * * Emits {ERC1155Added}. * * @param erc1155 ERC1155 address */ function addERC1155(address erc1155) external onlyRole(MANAGER_ROLE) { require(erc1155 != address(0), "GOBMarket: Invalid erc1155 address"); require(!_erc1155Set.contains(erc1155), "GOBMarket: Erc1155 already exists"); _erc1155Set.add(erc1155); emit ERC1155Added(erc1155); } /** * @notice Removes an ERC1155. * * Emits {ERC1155Removed}. * * Requirements: * - `erc1155` must not have tokens listed for sale. * * @param erc1155 ERC1155 address */ function removeERC1155(address erc1155) external onlyRole(MANAGER_ROLE) validERC1155(erc1155) { require(_tokenIdSet[erc1155].length() == 0, "GOBMarket: Erc1155 has tokens listed"); _erc1155Set.remove(erc1155); emit ERC1155Removed(erc1155); } /** * @notice Sets the vesting contract that allows the purchase using vested tokens or seedTokens. * @param vesting_ Vesting address. * * Emits {VestingChanged}. * * Requirements: * - `vesting_` must have vesting token set. * - vested token decimals must be >= `priceDecimals`. */ function setVesting(address vesting_) external onlyRole(MANAGER_ROLE) { require(vesting_ != address(0), "GOBMarket: Zero address"); IERC20Metadata seedToken = IERC20Metadata(IVesting(vesting_).token()); require( seedToken.decimals() >= priceDecimals, "GOBMarket: Vesting token's decimals too low" ); vesting = IVesting(vesting_); emit VestingChanged(vesting_); } // --- SELLER --- /** * @notice Lists one tokenId for sale. `erc1155` must exists. * * Emits {TokenListed}. * * Requirements: * - `tokenId` Must no be listed. * * @param erc1155 ERC1155 address. * @param tokenId The token id to be minted in `erc1155`. . * @param price Token's price using validCurrencies() with priceDecimals. * @param salesCap Max amount of tokens that can be sold. */ function listItem( address erc1155, uint256 tokenId, uint256 price, uint256 salesCap ) external onlyRole(SELLER_ROLE) validERC1155(erc1155) { require(!_tokenIdSet[erc1155].contains(tokenId), "GOBMarket: Token aleready listed"); // Add tokenId if not present _tokenIdSet[erc1155].add(tokenId); // Set price (if different) _setPrice(erc1155, tokenId, price); // Set cap (if diffeerent) _setCap(erc1155, tokenId, salesCap); emit TokenListed(erc1155, tokenId, price, salesCap); } /** * @notice Unlists a token from the selling list. * * Emits {TokenUnlisted}. * * Requirements: * - `tokenId` must be listed. * * @param erc1155 ERC1155 address. * @param tokenId The token id to be removed. */ function unlistItem( address erc1155, uint256 tokenId ) external onlyRole(SELLER_ROLE) validTokenId(erc1155, tokenId) { _tokenIdSet[erc1155].remove(tokenId); emit TokenUnlisted(erc1155, tokenId); } /** * @notice Changes the priced of a token listed for sale. * * Emits {PriceChanged}. * * Requirements: * - `tokenId` must be listed. * - `newPrice` must be different than the previous price. * * @param erc1155 ERC1155 address. * @param tokenId The token id to be changed. * @param newPrice New price. */ function changePrice( address erc1155, uint256 tokenId, uint256 newPrice ) external onlyRole(SELLER_ROLE) validTokenId(erc1155, tokenId) { uint256 oldPrice = items[erc1155][tokenId].price; require(_setPrice(erc1155, tokenId, newPrice), "GOBMarket: Same price"); emit PriceChanged(erc1155, tokenId, oldPrice, newPrice); } /** * @notice Change the sale cap of a token listed for sale. * * Emits {CapChanged}. * * Requirements: * - `tokenId` must be listed. * - `newCap`Must be different than previous cap and cannot be less than the amount sold so far. * * @param erc1155 ERC1155 address. * @param tokenId The token id to be changed. * @param newCap New cap. */ function changeCap( address erc1155, uint256 tokenId, uint256 newCap ) external onlyRole(SELLER_ROLE) validTokenId(erc1155, tokenId) { uint256 oldCap = items[erc1155][tokenId].salesCap; require(_setCap(erc1155, tokenId, newCap), "GOBMarket: Same cap"); emit CapChanged(erc1155, tokenId, oldCap, newCap); } /** * @notice Sets the parity betwen the seed token in `vesting` and accepted currencies. * Calculations use `priceDecimals`. See `buyItemWithVesting()`. * * NOTE: If `seedPrice` is set to zero, buyItemWithVesting() and buyItemWithSeed() * will be disabled. * * Emits {SeedPriceChanged}. * * @param price New price. */ function setSeedPrice(uint256 price) external onlyRole(SELLER_ROLE) { seedPrice = price; emit SeedPriceChanged(price); } // --- WITHDRAW --- /** * @notice Withdraws all available funds from `_currencies`. * * Emits {Withdrawn} for each curreny in _currencies that had balance. * * Requirements: * - GOBMarket must have balanca of one or more `validCurrencies()`. */ function withdrawAll() external onlyRole(WITHDRAW_ROLE) { bool transfered; uint256 bal; uint256 len = _currencies.length(); IERC20 currency; address sender = _msgSender(); for (uint256 i = 0; i < len; ) { currency = IERC20(_currencies.at(i)); bal = currency.balanceOf(address(this)); if (bal > 0) { currency.safeTransfer(msg.sender, bal); emit Withdrawn(sender, address(currency), bal); transfered = true; } unchecked { i++; } } require(transfered, "GOBMarket: No balance available"); } /** * @notice Withdraw `amount` from `_currency` * * Emits {Withdrawn} * * Requirements: * - GOBMarket's balance of `currency_` must be greater than zero. * * @param currency_ ERC20 address of funds. * @param amount Amount to withdraw. */ function withdraw(address currency_, uint256 amount) external onlyRole(WITHDRAW_ROLE) { require(amount > 0, "GOBMarket: Amount cannot be zero"); IERC20 currency = IERC20(currency_); currency.safeTransfer(msg.sender, amount); emit Withdrawn(_msgSender(), currency_, amount); } // --- PRIVATE --- /** * @dev Called by buyItem(), buyItemWithVesting() and buyItemWithSeed(). */ function _buyItem( address erc1155, uint256 tokenId, address to, uint256 quantity, address currency, BuyWith buywith ) private validTokenId(erc1155, tokenId) { require(to != address(0), "GOBMarket: Zero to address"); require(quantity > 0, "GOBMarket: Quantity cannot be zero"); require( items[erc1155][tokenId].salesCap - items[erc1155][tokenId].sold >= quantity, "GOBMarket: Not enough units available" ); items[erc1155][tokenId].sold += quantity; uint256 totalAmout; address sender = _msgSender(); if (buywith == BuyWith.ValidCurrency) { IERC20Metadata _currency = IERC20Metadata(currency); uint256 price = items[erc1155][tokenId].price; totalAmout = price * quantity * (10 ** (_currency.decimals() - priceDecimals)); _currency.safeTransferFrom(sender, address(this), totalAmout); } else { IERC20MetadataBurnable seedToken = IERC20MetadataBurnable(currency); uint256 factor = items[erc1155][tokenId].price * seedPrice; uint256 price = (factor * 10 ** (seedToken.decimals() - priceDecimals)) / 10 ** priceDecimals; totalAmout = price * quantity; if (buywith == BuyWith.SeedToken) { seedToken.burnFrom(sender, totalAmout); } else { // buywith == BuyWith.SeedTokenVested IVesting(vesting).withdrawFrom(sender, totalAmout); seedToken.burn(totalAmout); } } IERC1155Mint(erc1155).mint(to, tokenId, quantity, ""); emit TokenPurchased(erc1155, tokenId, to, quantity, currency, totalAmout); } /** * @dev Changes the token's price only if `newPrice` is different than stored price. * @return bool Returns true if the stored price was changed and false otherwise. */ function _setPrice(address erc1155, uint256 tokenId, uint256 newPrice) private returns (bool) { require(newPrice > 0, "GOBMarket: Price cannot be zero"); if (items[erc1155][tokenId].price == newPrice) { return false; } items[erc1155][tokenId].price = newPrice; return true; } /** * @dev Changes the token's salesCap only if `newCap` is different than stored salesCap. * @return bool Returns true if the stored salesCap was changed and false otherwise. */ function _setCap(address erc1155, uint256 tokenId, uint256 newCap) private returns (bool) { require(newCap > 0, "GOBMarket: SalesCap cannot be zero"); if (items[erc1155][tokenId].salesCap == newCap) { return false; } require( newCap >= items[erc1155][tokenId].sold, "GOBMarket: SalesCap cannot be less than sold" ); items[erc1155][tokenId].salesCap = newCap; return true; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @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. */ 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]. */ 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 v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../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 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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @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.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @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, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @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.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @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, it is bubbled up by this * function (like regular Solidity function calls). * * 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. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @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`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @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 up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (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; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) 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. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); 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 (rounding == Rounding.Up && 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 down. * * 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @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 v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @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), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(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) { 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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); 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 keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ /// @title Guardians of the Ball - ERC1155CrossmintAdapter /// @author Guardians of the Ball // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; interface IERC1155Mint { function mint(address to, uint256 id, uint256 amount, bytes memory data) external; }
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ /// @title Guardians of the Ball - IERC20MetadataBurnable /// @author Guardians of the Ball // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IERC20MetadataBurnable is IERC20Metadata { function burn(uint256 amount) external; function burnFrom(address account, uint256 amount) external; }
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; /** * @title Guardians of the Ball - IVesting * @author Guardians of the Ball * @notice Vesting contract Interface */ interface IVesting { /** * @dev Agenda struct. * @param account The address of the agenda owner. * @param amount The amount of tokens currently being locked, amount is substracted for each withdrawal/authorizedWithdrawal. * @param endTime The end time of the vesting in unix timestamp. */ struct Agenda { uint256 amount; uint256 endTime; } /** * @notice Emitted when a new agenda is created by the `OTC_CONTROLLER_ROLE`. * @param account The address of the agenda owner. * @param amount The amount of tokens to be vested. * @param agendaId the hash identifier of the agenda * @param start The start time of the vesting in unix timestamp. * @param end The end time of the vesting in unix timestamp. */ event AgendaCreated( address indexed account, uint256 amount, bytes32 agendaId, uint256 start, uint256 end ); /** * @notice Emitted when a withdrawal or authorized withdrawal is made. * @param account The address of the agenda owner. * @param operator The address of the caller, if `operator` == `account` then it is a withdrawal, else, an authorized withdrawal. * @param amount The amount of tokens withdrawn. */ event Withdrawn(address indexed account, address indexed operator, uint256 amount); /** * @dev Returns the address of the token being vested. */ function token() external view returns (address); /** * @dev Returns available balance of `account`. * @param account The address to query. */ function balanceOf(address account) external view returns (uint256); /** * @dev Returns locked balance of `account`. * @param account The address to query. */ function totalLocked(address account) external view returns (uint256); /** * @dev Returns all vested balance of `account`. * @param account The address to query. */ function totalVested(address account) external view returns (uint256); /** * @dev withdraws all available tokens for the sender. * * Emits a {Withdrawn} event. * * Requirements: * - the agenda must be unlocked. * - the sender must have a non-zero balance. */ function withdraw() external; /** * @dev withdraws `amount` tokens for `agendaOwner`. * @param agendaOwner address to spend `amount` tokens from * @param amount The amount of tokens to spend. * * Emits a {Withdrawn} event. * * Requirements: * - `agendaOwner` must have a non-zero balance. * - Must be called by `AUTHORIZED_SPENDER_ROLE` * - `agendaOwner` must have approved operator or caller to spend `amount` tokens */ function withdrawFrom(address agendaOwner, uint256 amount) external; /** * @dev Creates a new agenda that locks `amount` tokens for `beneficiary` until `block.timestamp` + `durationPerAgenda`. * @param beneficiary The address of the agenda owner. * @param amount The amount of tokens to be vested. * * Emits a {AgendaCreated} event. * * Requirements: * - Must be called by `OTC_CONTROLLER_ROLE` * - `beneficiary` must not be the zero address. * - `amount` must be non-zero. * - `beneficiary` must have approved contract to spend `amount` tokens. */ function createAgenda(address beneficiary, uint256 amount) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "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":"currencies","type":"address[]"},{"internalType":"uint8","name":"priceDecimals_","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc1155","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCap","type":"uint256"}],"name":"CapChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newCurrency","type":"address"}],"name":"CurrencyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newCurrency","type":"address"}],"name":"CurrencyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc1155","type":"address"}],"name":"ERC1155Added","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc1155","type":"address"}],"name":"ERC1155Removed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc1155","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newSeedPrice","type":"uint256"}],"name":"SeedPriceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc1155","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"salesCap","type":"uint256"}],"name":"TokenListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc1155","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"address","name":"currency","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"TokenPurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc1155","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenUnlisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newVesting","type":"address"}],"name":"VestingChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"currency","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SELLER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newCurrency","type":"address"}],"name":"addCurrency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"}],"name":"addERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"address","name":"currency","type":"address"}],"name":"buyItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"buyItemWithSeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"buyItemWithVesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"newCap","type":"uint256"}],"name":"changeCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"changePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"erc1155At","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc1155Length","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc1155List","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"items","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"salesCap","type":"uint256"},{"internalType":"uint256","name":"sold","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"salesCap","type":"uint256"}],"name":"listItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"listedItem","outputs":[{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"salesCap","type":"uint256"},{"internalType":"uint256","name":"sold","type":"uint256"}],"internalType":"struct GOBMarket.ItemInfo","name":"item","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"}],"name":"listedItems","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"salesCap","type":"uint256"},{"internalType":"uint256","name":"sold","type":"uint256"}],"internalType":"struct GOBMarket.ItemInfo[]","name":"listedItems_","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currency","type":"address"}],"name":"removeCurrency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"}],"name":"removeERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"seedPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setSeedPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vesting_","type":"address"}],"name":"setVesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc1155","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unlistItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"validCurrencies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vesting","outputs":[{"internalType":"contract IVesting","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currency_","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b506040516200376538038062003765833981016040819052620000349162000450565b815180620000895760405162461bcd60e51b815260206004820152601a60248201527f43757272656e636965732063616e6e6f7420626520656d70747900000000000060448201526064015b60405180910390fd5b60028260ff161015620000df5760405162461bcd60e51b815260206004820152601b60248201527f507269636520646563696d616c73206d757374206265203e3d20320000000000604482015260640162000080565b60068260ff161115620001355760405162461bcd60e51b815260206004820152601b60248201527f507269636520646563696d616c73206d757374206265203c3d20360000000000604482015260640162000080565b60005b81811015620002da5760006001600160a01b031684828151811062000161576200016162000536565b60200260200101516001600160a01b031603620001c15760405162461bcd60e51b815260206004820152601860248201527f496e76616c69642063757272656e637920616464726573730000000000000000604482015260640162000080565b8260ff16848281518110620001da57620001da62000536565b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000220573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200024691906200054c565b60ff161015620002995760405162461bcd60e51b815260206004820152601960248201527f43757272656e637920646563696d616c7320746f6f206c6f7700000000000000604482015260640162000080565b620002d0848281518110620002b257620002b262000536565b60200260200101516004620002f860201b620019f91790919060201c565b5060010162000138565b5060ff8216608052620002ef60003362000318565b5050506200056a565b60006200030f836001600160a01b038416620003b9565b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620003b5576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003743390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000818152600183016020526040812054620004025750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000312565b50600062000312565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200043957600080fd5b919050565b805160ff811681146200043957600080fd5b600080604083850312156200046457600080fd5b82516001600160401b03808211156200047c57600080fd5b818501915085601f8301126200049157600080fd5b8151602082821115620004a857620004a86200040b565b8160051b604051601f19603f83011681018181108682111715620004d057620004d06200040b565b604052928352818301935084810182019289841115620004ef57600080fd5b948201945b838610156200051857620005088662000421565b85529482019493820193620004f4565b96506200052990508782016200043e565b9450505050509250929050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156200055f57600080fd5b6200030f826200043e565b6080516131bc620005a96000396000818161025801528181610a1301528181610fbf01528181611c7101528181611d600152611d8801526131bc6000f3fe608060405234801561001057600080fd5b50600436106102105760003560e01c80638ab234b611610125578063d547741f116100ad578063e1a9109d1161007c578063e1a9109d146104fd578063eb5e443d14610510578063ec87621c14610523578063f3fef3a314610538578063f8fad9931461054b57600080fd5b8063d547741f146104a6578063d61a4849146104b9578063dbe4613d146104c1578063e02023a1146104d657600080fd5b8063a6dd562d116100f4578063a6dd562d14610447578063abc1877b1461045a578063b56da7121461046d578063bcb143ef14610480578063c5d3a1071461049357600080fd5b80638ab234b61461040657806391d148541461041957806399bd17e41461042c578063a217fddf1461043f57600080fd5b806336568abe116101a85780636f6ff3bc116101775780636f6ff3bc146103bc578063741cbae4146103cf5780637e34cd3d146103e257806381b85600146103eb578063853828b6146103fe57600080fd5b806336568abe1461030d5780634370e1081461032057806344c63eec146103405780635c80a4351461036b57600080fd5b80631d28031f116101e45780631d28031f146102ad578063248a9ca3146102c25780632c27b071146102e55780632f2ff15d146102fa57600080fd5b80623bf96c1461021557806301ffc9a71461023057806305300b28146102535780630ea903d51461028c575b600080fd5b61021d61055e565b6040519081526020015b60405180910390f35b61024361023e366004612a60565b61056f565b6040519015158152602001610227565b61027a7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610227565b61029f61029a366004612a9f565b6105a6565b604051610227929190612abc565b6102b5610794565b6040516102279190612b54565b61021d6102d0366004612ba1565b60009081526020819052604090206001015490565b6102f86102f3366004612bba565b6107a0565b005b6102f8610308366004612c19565b61080f565b6102f861031b366004612c19565b610839565b61033361032e366004612c49565b6108b7565b6040516102279190612c75565b600354610353906001600160a01b031681565b6040516001600160a01b039091168152602001610227565b6103a1610379366004612c49565b6001602081815260009384526040808520909152918352912080549181015460029091015483565b60408051938452602084019290925290820152606001610227565b6102f86103ca366004612a9f565b61096d565b6102f86103dd366004612c96565b610b48565b61021d60025481565b6102f86103f9366004612ccb565b610c65565b6102f8610d9a565b6102f8610414366004612a9f565b610f1c565b610243610427366004612c19565b6110e4565b6102f861043a366004612c49565b61110d565b61021d600081565b6102f8610455366004612a9f565b6111c7565b6102f8610468366004612c96565b6112e6565b6102f861047b366004612a9f565b6113f6565b6102f861048e366004612d13565b6114f5565b6102f86104a1366004612a9f565b61162d565b6102f86104b4366004612c19565b61176b565b6102b5611790565b61021d60008051602061314783398151915281565b61021d7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec81565b6102f861050b366004612ba1565b61179c565b61035361051e366004612ba1565b6117e8565b61021d60008051602061316783398151915281565b6102f8610546366004612c49565b6117f5565b6102f8610559366004612ccb565b6118ca565b600061056a6006611a15565b905090565b60006001600160e01b03198216637965db0b60e01b14806105a057506301ffc9a760e01b6001600160e01b03198316145b92915050565b606080826105b5600682611a1f565b6105da5760405162461bcd60e51b81526004016105d190612d4e565b60405180910390fd5b6001600160a01b03841660009081526008602052604081206105fb90611a15565b90508067ffffffffffffffff81111561061657610616612d85565b60405190808252806020026020018201604052801561066b57816020015b61065860405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816106345790505b5092508067ffffffffffffffff81111561068757610687612d85565b6040519080825280602002602001820160405280156106b0578160200160208202803683370190505b50935060005b8181101561078c576001600160a01b0386166000908152600160209081526040808320600890925282209091906106ed9084611a41565b8152602001908152602001600020604051806060016040529081600082015481526020016001820154815260200160028201548152505084828151811061073657610736612d9b565b6020908102919091018101919091526001600160a01b03871660009081526008909152604090206107679082611a41565b85828151811061077957610779612d9b565b60209081029190910101526001016106b6565b505050915091565b606061056a6004611a4d565b806107ac600482611a1f565b6107f85760405162461bcd60e51b815260206004820152601b60248201527f474f424d61726b65743a20496e76616c69642063757272656e6379000000000060448201526064016105d1565b61080786868686866000611a5a565b505050505050565b60008281526020819052604090206001015461082a8161205c565b6108348383612069565b505050565b6001600160a01b03811633146108a95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105d1565b6108b382826120ed565b5050565b6108db60405180606001604052806000815260200160008152602001600081525090565b6001600160a01b0383166000908152600860205260409020839083906109019082612152565b61091d5760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b0385166000908152600160208181526040808420888552825292839020835160608101855281548152928101549183019190915260020154918101919091529250505092915050565b6000805160206131678339815191526109858161205c565b6001600160a01b0382166109ab5760405162461bcd60e51b81526004016105d190612de8565b6000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109eb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0f9190612e1f565b90507f000000000000000000000000000000000000000000000000000000000000000060ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a979190612e3c565b60ff161015610afc5760405162461bcd60e51b815260206004820152602b60248201527f474f424d61726b65743a2056657374696e6720746f6b656e277320646563696d60448201526a616c7320746f6f206c6f7760a81b60648201526084016105d1565b600380546001600160a01b0319166001600160a01b0385169081179091556040517fa382d6de23230b4513b2ee62dcfa30957a86ccaf67a224d61a08bbff48348e6390600090a2505050565b600080516020613147833981519152610b608161205c565b6001600160a01b038416600090815260086020526040902084908490610b869082612152565b610ba25760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b0386166000908152600160209081526040808320888452909152902054610bd187878761216a565b610c155760405162461bcd60e51b8152602060048201526015602482015274474f424d61726b65743a2053616d6520707269636560581b60448201526064016105d1565b604080518281526020810187905287916001600160a01b038a16917fdac6aecd066304d15a41e8e590fc5ab5bf93634f43cba363f743d5e158d7998891015b60405180910390a350505050505050565b6003546001600160a01b0316610cbd5760405162461bcd60e51b815260206004820152601a60248201527f474f424d61726b65743a2056657374696e67206e6f742073657400000000000060448201526064016105d1565b600060025411610d0f5760405162461bcd60e51b815260206004820181905260248201527f474f424d61726b65743a2056657374696e67207072696365206e6f742073657460448201526064016105d1565b610d9484848484600360009054906101000a90046001600160a01b03166001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8d9190612e1f565b6001611a5a565b50505050565b7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec610dc48161205c565b6000806000610dd36004611a15565b9050600033815b83811015610ece57610ded600482611a41565b6040516370a0823160e01b81523060048201529093506001600160a01b038416906370a0823190602401602060405180830381865afa158015610e34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e589190612e5f565b94508415610ec657610e746001600160a01b038416338761221c565b826001600160a01b0316826001600160a01b03167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb87604051610eb991815260200190565b60405180910390a3600195505b600101610dda565b50846108075760405162461bcd60e51b815260206004820152601f60248201527f474f424d61726b65743a204e6f2062616c616e636520617661696c61626c650060448201526064016105d1565b600080516020613167833981519152610f348161205c565b6001600160a01b038216610f5a5760405162461bcd60e51b81526004016105d190612de8565b610f65600483611a1f565b15610fbd5760405162461bcd60e51b815260206004820152602260248201527f474f424d61726b65743a2043757272656e637920616c72656164792065786973604482015261747360f01b60648201526084016105d1565b7f000000000000000000000000000000000000000000000000000000000000000060ff16826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561101f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110439190612e3c565b60ff1610156110a05760405162461bcd60e51b8152602060048201526024808201527f474f424d61726b65743a2043757272656e637920646563696d616c7320746f6f604482015263206c6f7760e01b60648201526084016105d1565b6110ab6004836119f9565b506040516001600160a01b038316907fe0390a89516146ccfb796a9fbfc3f7646282194c554d05020484599ee992dd5a90600090a25050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206131478339815191526111258161205c565b6001600160a01b03831660009081526008602052604090208390839061114b9082612152565b6111675760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b0385166000908152600860205260409020611189908561227f565b5060405184906001600160a01b038716907f24287c09523dfd960e13a9774c247fb28a2ccb301eb4208b0d4072bcd0f1826e90600090a35050505050565b6000805160206131678339815191526111df8161205c565b6001600160a01b0382166112405760405162461bcd60e51b815260206004820152602260248201527f474f424d61726b65743a20496e76616c69642065726331313535206164647265604482015261737360f01b60648201526084016105d1565b61124b600683611a1f565b156112a25760405162461bcd60e51b815260206004820152602160248201527f474f424d61726b65743a204572633131353520616c72656164792065786973746044820152607360f81b60648201526084016105d1565b6112ad6006836119f9565b506040516001600160a01b038316907f5501b95f3bff8ce106b3c09db9b2ffb02d9ca5ac1abcf8767f67d51adb87757d90600090a25050565b6000805160206131478339815191526112fe8161205c565b6001600160a01b0384166000908152600860205260409020849084906113249082612152565b6113405760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b0386166000908152600160208181526040808420898552909152909120015461137187878761228b565b6113b35760405162461bcd60e51b81526020600482015260136024820152720474f424d61726b65743a2053616d652063617606c1b60448201526064016105d1565b604080518281526020810187905287916001600160a01b038a16917f11525740b12fb21d5d301e8ce898dacdf8f3387741cfb3a28014c74e90ab40499101610c54565b60008051602061316783398151915261140e8161205c565b8161141a600682611a1f565b6114365760405162461bcd60e51b81526004016105d190612d4e565b6001600160a01b038316600090815260086020526040902061145790611a15565b156114b05760405162461bcd60e51b8152602060048201526024808201527f474f424d61726b65743a20457263313135352068617320746f6b656e73206c696044820152631cdd195960e21b60648201526084016105d1565b6114bb6006846123d7565b506040516001600160a01b038416907f34d19a3fc93e662c545004ca0e3326e0bd6a3758a4ee4479b77011480bc19f5390600090a2505050565b60008051602061314783398151915261150d8161205c565b84611519600682611a1f565b6115355760405162461bcd60e51b81526004016105d190612d4e565b6001600160a01b03861660009081526008602052604090206115579086612152565b156115a45760405162461bcd60e51b815260206004820181905260248201527f474f424d61726b65743a20546f6b656e20616c657265616479206c697374656460448201526064016105d1565b6001600160a01b03861660009081526008602052604090206115c690866123ec565b506115d286868661216a565b506115de86868561228b565b50604080518581526020810185905286916001600160a01b038916917fda2d7fa13c443a4ce51bb68b8ce92f41fac2c10d9d5bdb6a9e9a91429020b7c3910160405180910390a3505050505050565b6000805160206131678339815191526116458161205c565b81611651600482611a1f565b61169d5760405162461bcd60e51b815260206004820152601b60248201527f474f424d61726b65743a20496e76616c69642063757272656e6379000000000060448201526064016105d1565b6001600160a01b0383166116c35760405162461bcd60e51b81526004016105d190612de8565b60016116cf6004611a15565b116117265760405162461bcd60e51b815260206004820152602160248201527f474f424d61726b65743a204f6e6c79206f6e652063757272656e6379206c65666044820152601d60fa1b60648201526084016105d1565b6117316004846123d7565b506040516001600160a01b038416907fa40d69111be14f29022626d38310e47cc2d7f4cb728961509c2f65a4bee08c5b90600090a2505050565b6000828152602081905260409020600101546117868161205c565b61083483836120ed565b606061056a6006611a4d565b6000805160206131478339815191526117b48161205c565b600282905560405182907f57618c193c7eac829ada16edd6c8f6f0e4491ee879135ee2248ef3185184382f90600090a25050565b60006105a0600683611a41565b7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec61181f8161205c565b6000821161186f5760405162461bcd60e51b815260206004820181905260248201527f474f424d61726b65743a20416d6f756e742063616e6e6f74206265207a65726f60448201526064016105d1565b826118846001600160a01b038216338561221c565b6040518381526001600160a01b0385169033907fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060200160405180910390a350505050565b6003546001600160a01b03166119225760405162461bcd60e51b815260206004820152601a60248201527f474f424d61726b65743a2056657374696e67206e6f742073657400000000000060448201526064016105d1565b6000600254116119745760405162461bcd60e51b815260206004820181905260248201527f474f424d61726b65743a2056657374696e67207072696365206e6f742073657460448201526064016105d1565b610d9484848484600360009054906101000a90046001600160a01b03166001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f29190612e1f565b6002611a5a565b6000611a0e836001600160a01b0384166123f4565b9392505050565b60006105a0825490565b6001600160a01b03811660009081526001830160205260408120541515611a0e565b6000611a0e8383612443565b60606000611a0e8361246d565b6001600160a01b038616600090815260086020526040902086908690611a809082612152565b611a9c5760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b038616611af25760405162461bcd60e51b815260206004820152601a60248201527f474f424d61726b65743a205a65726f20746f206164647265737300000000000060448201526064016105d1565b60008511611b4d5760405162461bcd60e51b815260206004820152602260248201527f474f424d61726b65743a205175616e746974792063616e6e6f74206265207a65604482015261726f60f01b60648201526084016105d1565b6001600160a01b03881660009081526001602081815260408084208b855290915290912060028101549101548691611b8491612e8e565b1015611be05760405162461bcd60e51b815260206004820152602560248201527f474f424d61726b65743a204e6f7420656e6f75676820756e69747320617661696044820152646c61626c6560d81b60648201526084016105d1565b6001600160a01b03881660009081526001602090815260408083208a845290915281206002018054879290611c16908490612ea1565b90915550600090503381856002811115611c3257611c32612eb4565b03611d25576001600160a01b03808b1660009081526001602090815260408083208d845282529182902054825163313ce56760e01b815292518a9491937f0000000000000000000000000000000000000000000000000000000000000000939286169263313ce567926004808401938290030181865afa158015611cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cde9190612e3c565b611ce89190612eca565b611cf390600a612fc7565b611cfd8a83612fd6565b611d079190612fd6565b9350611d1e6001600160a01b0383168430876124c9565b5050611f85565b6002546001600160a01b038b1660009081526001602090815260408083208d84529091528120548892611d5791612fd6565b90506000611d867f0000000000000000000000000000000000000000000000000000000000000000600a612fc7565b7f0000000000000000000000000000000000000000000000000000000000000000846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611de5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e099190612e3c565b611e139190612eca565b611e1e90600a612fc7565b611e289084612fd6565b611e329190612fed565b9050611e3e8a82612fd6565b94506001886002811115611e5457611e54612eb4565b03611ec05760405163079cc67960e41b81526001600160a01b038581166004830152602482018790528416906379cc679090604401600060405180830381600087803b158015611ea357600080fd5b505af1158015611eb7573d6000803e3d6000fd5b50505050611f81565b600354604051639470b0bd60e01b81526001600160a01b0386811660048301526024820188905290911690639470b0bd90604401600060405180830381600087803b158015611f0e57600080fd5b505af1158015611f22573d6000803e3d6000fd5b5050604051630852cd8d60e31b8152600481018890526001600160a01b03861692506342966c689150602401600060405180830381600087803b158015611f6857600080fd5b505af1158015611f7c573d6000803e3d6000fd5b505050505b5050505b60405163731133e960e01b81526001600160a01b038981166004830152602482018b90526044820189905260806064830152600060848301528b169063731133e99060a401600060405180830381600087803b158015611fe457600080fd5b505af1158015611ff8573d6000803e3d6000fd5b5050604080518a81526001600160a01b038a81166020830152918101869052818c1693508c9250908d16907f0c06179431976ca809870adf5899b0c76b3cc196dcbe03c8fcf78fa88d4c6fb49060600160405180910390a450505050505050505050565b6120668133612501565b50565b61207382826110e4565b6108b3576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556120a93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6120f782826110e4565b156108b3576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008181526001830160205260408120541515611a0e565b60008082116121bb5760405162461bcd60e51b815260206004820152601f60248201527f474f424d61726b65743a2050726963652063616e6e6f74206265207a65726f0060448201526064016105d1565b6001600160a01b03841660009081526001602090815260408083208684529091529020548290036121ee57506000611a0e565b506001600160a01b039290921660009081526001602081815260408084209484529390529190209190915590565b6040516001600160a01b03831660248201526044810182905261083490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261255a565b6000611a0e838361262f565b60008082116122e75760405162461bcd60e51b815260206004820152602260248201527f474f424d61726b65743a2053616c65734361702063616e6e6f74206265207a65604482015261726f60f01b60648201526084016105d1565b6001600160a01b0384166000908152600160208181526040808420878552909152909120015482900361231c57506000611a0e565b6001600160a01b03841660009081526001602090815260408083208684529091529020600201548210156123a75760405162461bcd60e51b815260206004820152602c60248201527f474f424d61726b65743a2053616c65734361702063616e6e6f74206265206c6560448201526b1cdcc81d1a185b881cdbdb1960a21b60648201526084016105d1565b506001600160a01b0392909216600090815260016020818152604080842094845293905291902081019190915590565b6000611a0e836001600160a01b03841661262f565b6000611a0e83835b600081815260018301602052604081205461243b575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105a0565b5060006105a0565b600082600001828154811061245a5761245a612d9b565b9060005260206000200154905092915050565b6060816000018054806020026020016040519081016040528092919081815260200182805480156124bd57602002820191906000526020600020905b8154815260200190600101908083116124a9575b50505050509050919050565b6040516001600160a01b0380851660248301528316604482015260648101829052610d949085906323b872dd60e01b90608401612248565b61250b82826110e4565b6108b35761251881612722565b612523836020612734565b604051602001612534929190613033565b60408051601f198184030181529082905262461bcd60e51b82526105d1916004016130a8565b60006125af826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128d09092919063ffffffff16565b90508051600014806125d05750808060200190518101906125d091906130db565b6108345760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105d1565b60008181526001830160205260408120548015612718576000612653600183612e8e565b855490915060009061266790600190612e8e565b90508181146126cc57600086600001828154811061268757612687612d9b565b90600052602060002001549050808760000184815481106126aa576126aa612d9b565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806126dd576126dd6130fd565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105a0565b60009150506105a0565b60606105a06001600160a01b03831660145b60606000612743836002612fd6565b61274e906002612ea1565b67ffffffffffffffff81111561276657612766612d85565b6040519080825280601f01601f191660200182016040528015612790576020820181803683370190505b509050600360fc1b816000815181106127ab576127ab612d9b565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106127da576127da612d9b565b60200101906001600160f81b031916908160001a90535060006127fe846002612fd6565b612809906001612ea1565b90505b6001811115612881576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061283d5761283d612d9b565b1a60f81b82828151811061285357612853612d9b565b60200101906001600160f81b031916908160001a90535060049490941c9361287a81613113565b905061280c565b508315611a0e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d1565b60606128df84846000856128e7565b949350505050565b6060824710156129485760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105d1565b600080866001600160a01b03168587604051612964919061312a565b60006040518083038185875af1925050503d80600081146129a1576040519150601f19603f3d011682016040523d82523d6000602084013e6129a6565b606091505b50915091506129b7878383876129c2565b979650505050505050565b60608315612a31578251600003612a2a576001600160a01b0385163b612a2a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105d1565b50816128df565b6128df8383815115612a465781518083602001fd5b8060405162461bcd60e51b81526004016105d191906130a8565b600060208284031215612a7257600080fd5b81356001600160e01b031981168114611a0e57600080fd5b6001600160a01b038116811461206657600080fd5b600060208284031215612ab157600080fd5b8135611a0e81612a8a565b60408082528351908201819052600090606090818401906020808801855b83811015612af657815185529382019390820190600101612ada565b5050858303818701528651808452878201938201925060005b81811015612b4657612b368486518051825260208082015190830152604090810151910152565b9382019392850192600101612b0f565b509198975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612b955783516001600160a01b031683529284019291840191600101612b70565b50909695505050505050565b600060208284031215612bb357600080fd5b5035919050565b600080600080600060a08688031215612bd257600080fd5b8535612bdd81612a8a565b9450602086013593506040860135612bf481612a8a565b9250606086013591506080860135612c0b81612a8a565b809150509295509295909350565b60008060408385031215612c2c57600080fd5b823591506020830135612c3e81612a8a565b809150509250929050565b60008060408385031215612c5c57600080fd5b8235612c6781612a8a565b946020939093013593505050565b815181526020808301519082015260408083015190820152606081016105a0565b600080600060608486031215612cab57600080fd5b8335612cb681612a8a565b95602085013595506040909401359392505050565b60008060008060808587031215612ce157600080fd5b8435612cec81612a8a565b9350602085013592506040850135612d0381612a8a565b9396929550929360600135925050565b60008060008060808587031215612d2957600080fd5b8435612d3481612a8a565b966020860135965060408601359560600135945092505050565b6020808252601c908201527f474f424d61726b65743a2045726331313535206e6f7420666f756e6400000000604082015260600190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252601c908201527f474f424d61726b65743a20546f6b656e4964206e6f7420666f756e6400000000604082015260600190565b60208082526017908201527f474f424d61726b65743a205a65726f2061646472657373000000000000000000604082015260600190565b600060208284031215612e3157600080fd5b8151611a0e81612a8a565b600060208284031215612e4e57600080fd5b815160ff81168114611a0e57600080fd5b600060208284031215612e7157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105a0576105a0612e78565b808201808211156105a0576105a0612e78565b634e487b7160e01b600052602160045260246000fd5b60ff82811682821603908111156105a0576105a0612e78565b600181815b80851115612f1e578160001904821115612f0457612f04612e78565b80851615612f1157918102915b93841c9390800290612ee8565b509250929050565b600082612f35575060016105a0565b81612f42575060006105a0565b8160018114612f585760028114612f6257612f7e565b60019150506105a0565b60ff841115612f7357612f73612e78565b50506001821b6105a0565b5060208310610133831016604e8410600b8410161715612fa1575081810a6105a0565b612fab8383612ee3565b8060001904821115612fbf57612fbf612e78565b029392505050565b6000611a0e60ff841683612f26565b80820281158282048414176105a0576105a0612e78565b60008261300a57634e487b7160e01b600052601260045260246000fd5b500490565b60005b8381101561302a578181015183820152602001613012565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161306b81601785016020880161300f565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161309c81602884016020880161300f565b01602801949350505050565b60208152600082518060208401526130c781604085016020870161300f565b601f01601f19169190910160400192915050565b6000602082840312156130ed57600080fd5b81518015158114611a0e57600080fd5b634e487b7160e01b600052603160045260246000fd5b60008161312257613122612e78565b506000190190565b6000825161313c81846020870161300f565b919091019291505056fe43f25613eb2f15fb17222a5d424ca2655743e71265d98e4b93c05e5fb589ecde241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220192359c67a3dcf97b9128fc7d106417bff550169cf824b8759cd0dceb86b6ee164736f6c634300081200330000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102105760003560e01c80638ab234b611610125578063d547741f116100ad578063e1a9109d1161007c578063e1a9109d146104fd578063eb5e443d14610510578063ec87621c14610523578063f3fef3a314610538578063f8fad9931461054b57600080fd5b8063d547741f146104a6578063d61a4849146104b9578063dbe4613d146104c1578063e02023a1146104d657600080fd5b8063a6dd562d116100f4578063a6dd562d14610447578063abc1877b1461045a578063b56da7121461046d578063bcb143ef14610480578063c5d3a1071461049357600080fd5b80638ab234b61461040657806391d148541461041957806399bd17e41461042c578063a217fddf1461043f57600080fd5b806336568abe116101a85780636f6ff3bc116101775780636f6ff3bc146103bc578063741cbae4146103cf5780637e34cd3d146103e257806381b85600146103eb578063853828b6146103fe57600080fd5b806336568abe1461030d5780634370e1081461032057806344c63eec146103405780635c80a4351461036b57600080fd5b80631d28031f116101e45780631d28031f146102ad578063248a9ca3146102c25780632c27b071146102e55780632f2ff15d146102fa57600080fd5b80623bf96c1461021557806301ffc9a71461023057806305300b28146102535780630ea903d51461028c575b600080fd5b61021d61055e565b6040519081526020015b60405180910390f35b61024361023e366004612a60565b61056f565b6040519015158152602001610227565b61027a7f000000000000000000000000000000000000000000000000000000000000000481565b60405160ff9091168152602001610227565b61029f61029a366004612a9f565b6105a6565b604051610227929190612abc565b6102b5610794565b6040516102279190612b54565b61021d6102d0366004612ba1565b60009081526020819052604090206001015490565b6102f86102f3366004612bba565b6107a0565b005b6102f8610308366004612c19565b61080f565b6102f861031b366004612c19565b610839565b61033361032e366004612c49565b6108b7565b6040516102279190612c75565b600354610353906001600160a01b031681565b6040516001600160a01b039091168152602001610227565b6103a1610379366004612c49565b6001602081815260009384526040808520909152918352912080549181015460029091015483565b60408051938452602084019290925290820152606001610227565b6102f86103ca366004612a9f565b61096d565b6102f86103dd366004612c96565b610b48565b61021d60025481565b6102f86103f9366004612ccb565b610c65565b6102f8610d9a565b6102f8610414366004612a9f565b610f1c565b610243610427366004612c19565b6110e4565b6102f861043a366004612c49565b61110d565b61021d600081565b6102f8610455366004612a9f565b6111c7565b6102f8610468366004612c96565b6112e6565b6102f861047b366004612a9f565b6113f6565b6102f861048e366004612d13565b6114f5565b6102f86104a1366004612a9f565b61162d565b6102f86104b4366004612c19565b61176b565b6102b5611790565b61021d60008051602061314783398151915281565b61021d7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec81565b6102f861050b366004612ba1565b61179c565b61035361051e366004612ba1565b6117e8565b61021d60008051602061316783398151915281565b6102f8610546366004612c49565b6117f5565b6102f8610559366004612ccb565b6118ca565b600061056a6006611a15565b905090565b60006001600160e01b03198216637965db0b60e01b14806105a057506301ffc9a760e01b6001600160e01b03198316145b92915050565b606080826105b5600682611a1f565b6105da5760405162461bcd60e51b81526004016105d190612d4e565b60405180910390fd5b6001600160a01b03841660009081526008602052604081206105fb90611a15565b90508067ffffffffffffffff81111561061657610616612d85565b60405190808252806020026020018201604052801561066b57816020015b61065860405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816106345790505b5092508067ffffffffffffffff81111561068757610687612d85565b6040519080825280602002602001820160405280156106b0578160200160208202803683370190505b50935060005b8181101561078c576001600160a01b0386166000908152600160209081526040808320600890925282209091906106ed9084611a41565b8152602001908152602001600020604051806060016040529081600082015481526020016001820154815260200160028201548152505084828151811061073657610736612d9b565b6020908102919091018101919091526001600160a01b03871660009081526008909152604090206107679082611a41565b85828151811061077957610779612d9b565b60209081029190910101526001016106b6565b505050915091565b606061056a6004611a4d565b806107ac600482611a1f565b6107f85760405162461bcd60e51b815260206004820152601b60248201527f474f424d61726b65743a20496e76616c69642063757272656e6379000000000060448201526064016105d1565b61080786868686866000611a5a565b505050505050565b60008281526020819052604090206001015461082a8161205c565b6108348383612069565b505050565b6001600160a01b03811633146108a95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105d1565b6108b382826120ed565b5050565b6108db60405180606001604052806000815260200160008152602001600081525090565b6001600160a01b0383166000908152600860205260409020839083906109019082612152565b61091d5760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b0385166000908152600160208181526040808420888552825292839020835160608101855281548152928101549183019190915260020154918101919091529250505092915050565b6000805160206131678339815191526109858161205c565b6001600160a01b0382166109ab5760405162461bcd60e51b81526004016105d190612de8565b6000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109eb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0f9190612e1f565b90507f000000000000000000000000000000000000000000000000000000000000000460ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a979190612e3c565b60ff161015610afc5760405162461bcd60e51b815260206004820152602b60248201527f474f424d61726b65743a2056657374696e6720746f6b656e277320646563696d60448201526a616c7320746f6f206c6f7760a81b60648201526084016105d1565b600380546001600160a01b0319166001600160a01b0385169081179091556040517fa382d6de23230b4513b2ee62dcfa30957a86ccaf67a224d61a08bbff48348e6390600090a2505050565b600080516020613147833981519152610b608161205c565b6001600160a01b038416600090815260086020526040902084908490610b869082612152565b610ba25760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b0386166000908152600160209081526040808320888452909152902054610bd187878761216a565b610c155760405162461bcd60e51b8152602060048201526015602482015274474f424d61726b65743a2053616d6520707269636560581b60448201526064016105d1565b604080518281526020810187905287916001600160a01b038a16917fdac6aecd066304d15a41e8e590fc5ab5bf93634f43cba363f743d5e158d7998891015b60405180910390a350505050505050565b6003546001600160a01b0316610cbd5760405162461bcd60e51b815260206004820152601a60248201527f474f424d61726b65743a2056657374696e67206e6f742073657400000000000060448201526064016105d1565b600060025411610d0f5760405162461bcd60e51b815260206004820181905260248201527f474f424d61726b65743a2056657374696e67207072696365206e6f742073657460448201526064016105d1565b610d9484848484600360009054906101000a90046001600160a01b03166001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8d9190612e1f565b6001611a5a565b50505050565b7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec610dc48161205c565b6000806000610dd36004611a15565b9050600033815b83811015610ece57610ded600482611a41565b6040516370a0823160e01b81523060048201529093506001600160a01b038416906370a0823190602401602060405180830381865afa158015610e34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e589190612e5f565b94508415610ec657610e746001600160a01b038416338761221c565b826001600160a01b0316826001600160a01b03167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb87604051610eb991815260200190565b60405180910390a3600195505b600101610dda565b50846108075760405162461bcd60e51b815260206004820152601f60248201527f474f424d61726b65743a204e6f2062616c616e636520617661696c61626c650060448201526064016105d1565b600080516020613167833981519152610f348161205c565b6001600160a01b038216610f5a5760405162461bcd60e51b81526004016105d190612de8565b610f65600483611a1f565b15610fbd5760405162461bcd60e51b815260206004820152602260248201527f474f424d61726b65743a2043757272656e637920616c72656164792065786973604482015261747360f01b60648201526084016105d1565b7f000000000000000000000000000000000000000000000000000000000000000460ff16826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561101f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110439190612e3c565b60ff1610156110a05760405162461bcd60e51b8152602060048201526024808201527f474f424d61726b65743a2043757272656e637920646563696d616c7320746f6f604482015263206c6f7760e01b60648201526084016105d1565b6110ab6004836119f9565b506040516001600160a01b038316907fe0390a89516146ccfb796a9fbfc3f7646282194c554d05020484599ee992dd5a90600090a25050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206131478339815191526111258161205c565b6001600160a01b03831660009081526008602052604090208390839061114b9082612152565b6111675760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b0385166000908152600860205260409020611189908561227f565b5060405184906001600160a01b038716907f24287c09523dfd960e13a9774c247fb28a2ccb301eb4208b0d4072bcd0f1826e90600090a35050505050565b6000805160206131678339815191526111df8161205c565b6001600160a01b0382166112405760405162461bcd60e51b815260206004820152602260248201527f474f424d61726b65743a20496e76616c69642065726331313535206164647265604482015261737360f01b60648201526084016105d1565b61124b600683611a1f565b156112a25760405162461bcd60e51b815260206004820152602160248201527f474f424d61726b65743a204572633131353520616c72656164792065786973746044820152607360f81b60648201526084016105d1565b6112ad6006836119f9565b506040516001600160a01b038316907f5501b95f3bff8ce106b3c09db9b2ffb02d9ca5ac1abcf8767f67d51adb87757d90600090a25050565b6000805160206131478339815191526112fe8161205c565b6001600160a01b0384166000908152600860205260409020849084906113249082612152565b6113405760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b0386166000908152600160208181526040808420898552909152909120015461137187878761228b565b6113b35760405162461bcd60e51b81526020600482015260136024820152720474f424d61726b65743a2053616d652063617606c1b60448201526064016105d1565b604080518281526020810187905287916001600160a01b038a16917f11525740b12fb21d5d301e8ce898dacdf8f3387741cfb3a28014c74e90ab40499101610c54565b60008051602061316783398151915261140e8161205c565b8161141a600682611a1f565b6114365760405162461bcd60e51b81526004016105d190612d4e565b6001600160a01b038316600090815260086020526040902061145790611a15565b156114b05760405162461bcd60e51b8152602060048201526024808201527f474f424d61726b65743a20457263313135352068617320746f6b656e73206c696044820152631cdd195960e21b60648201526084016105d1565b6114bb6006846123d7565b506040516001600160a01b038416907f34d19a3fc93e662c545004ca0e3326e0bd6a3758a4ee4479b77011480bc19f5390600090a2505050565b60008051602061314783398151915261150d8161205c565b84611519600682611a1f565b6115355760405162461bcd60e51b81526004016105d190612d4e565b6001600160a01b03861660009081526008602052604090206115579086612152565b156115a45760405162461bcd60e51b815260206004820181905260248201527f474f424d61726b65743a20546f6b656e20616c657265616479206c697374656460448201526064016105d1565b6001600160a01b03861660009081526008602052604090206115c690866123ec565b506115d286868661216a565b506115de86868561228b565b50604080518581526020810185905286916001600160a01b038916917fda2d7fa13c443a4ce51bb68b8ce92f41fac2c10d9d5bdb6a9e9a91429020b7c3910160405180910390a3505050505050565b6000805160206131678339815191526116458161205c565b81611651600482611a1f565b61169d5760405162461bcd60e51b815260206004820152601b60248201527f474f424d61726b65743a20496e76616c69642063757272656e6379000000000060448201526064016105d1565b6001600160a01b0383166116c35760405162461bcd60e51b81526004016105d190612de8565b60016116cf6004611a15565b116117265760405162461bcd60e51b815260206004820152602160248201527f474f424d61726b65743a204f6e6c79206f6e652063757272656e6379206c65666044820152601d60fa1b60648201526084016105d1565b6117316004846123d7565b506040516001600160a01b038416907fa40d69111be14f29022626d38310e47cc2d7f4cb728961509c2f65a4bee08c5b90600090a2505050565b6000828152602081905260409020600101546117868161205c565b61083483836120ed565b606061056a6006611a4d565b6000805160206131478339815191526117b48161205c565b600282905560405182907f57618c193c7eac829ada16edd6c8f6f0e4491ee879135ee2248ef3185184382f90600090a25050565b60006105a0600683611a41565b7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec61181f8161205c565b6000821161186f5760405162461bcd60e51b815260206004820181905260248201527f474f424d61726b65743a20416d6f756e742063616e6e6f74206265207a65726f60448201526064016105d1565b826118846001600160a01b038216338561221c565b6040518381526001600160a01b0385169033907fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060200160405180910390a350505050565b6003546001600160a01b03166119225760405162461bcd60e51b815260206004820152601a60248201527f474f424d61726b65743a2056657374696e67206e6f742073657400000000000060448201526064016105d1565b6000600254116119745760405162461bcd60e51b815260206004820181905260248201527f474f424d61726b65743a2056657374696e67207072696365206e6f742073657460448201526064016105d1565b610d9484848484600360009054906101000a90046001600160a01b03166001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f29190612e1f565b6002611a5a565b6000611a0e836001600160a01b0384166123f4565b9392505050565b60006105a0825490565b6001600160a01b03811660009081526001830160205260408120541515611a0e565b6000611a0e8383612443565b60606000611a0e8361246d565b6001600160a01b038616600090815260086020526040902086908690611a809082612152565b611a9c5760405162461bcd60e51b81526004016105d190612db1565b6001600160a01b038616611af25760405162461bcd60e51b815260206004820152601a60248201527f474f424d61726b65743a205a65726f20746f206164647265737300000000000060448201526064016105d1565b60008511611b4d5760405162461bcd60e51b815260206004820152602260248201527f474f424d61726b65743a205175616e746974792063616e6e6f74206265207a65604482015261726f60f01b60648201526084016105d1565b6001600160a01b03881660009081526001602081815260408084208b855290915290912060028101549101548691611b8491612e8e565b1015611be05760405162461bcd60e51b815260206004820152602560248201527f474f424d61726b65743a204e6f7420656e6f75676820756e69747320617661696044820152646c61626c6560d81b60648201526084016105d1565b6001600160a01b03881660009081526001602090815260408083208a845290915281206002018054879290611c16908490612ea1565b90915550600090503381856002811115611c3257611c32612eb4565b03611d25576001600160a01b03808b1660009081526001602090815260408083208d845282529182902054825163313ce56760e01b815292518a9491937f0000000000000000000000000000000000000000000000000000000000000004939286169263313ce567926004808401938290030181865afa158015611cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cde9190612e3c565b611ce89190612eca565b611cf390600a612fc7565b611cfd8a83612fd6565b611d079190612fd6565b9350611d1e6001600160a01b0383168430876124c9565b5050611f85565b6002546001600160a01b038b1660009081526001602090815260408083208d84529091528120548892611d5791612fd6565b90506000611d867f0000000000000000000000000000000000000000000000000000000000000004600a612fc7565b7f0000000000000000000000000000000000000000000000000000000000000004846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611de5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e099190612e3c565b611e139190612eca565b611e1e90600a612fc7565b611e289084612fd6565b611e329190612fed565b9050611e3e8a82612fd6565b94506001886002811115611e5457611e54612eb4565b03611ec05760405163079cc67960e41b81526001600160a01b038581166004830152602482018790528416906379cc679090604401600060405180830381600087803b158015611ea357600080fd5b505af1158015611eb7573d6000803e3d6000fd5b50505050611f81565b600354604051639470b0bd60e01b81526001600160a01b0386811660048301526024820188905290911690639470b0bd90604401600060405180830381600087803b158015611f0e57600080fd5b505af1158015611f22573d6000803e3d6000fd5b5050604051630852cd8d60e31b8152600481018890526001600160a01b03861692506342966c689150602401600060405180830381600087803b158015611f6857600080fd5b505af1158015611f7c573d6000803e3d6000fd5b505050505b5050505b60405163731133e960e01b81526001600160a01b038981166004830152602482018b90526044820189905260806064830152600060848301528b169063731133e99060a401600060405180830381600087803b158015611fe457600080fd5b505af1158015611ff8573d6000803e3d6000fd5b5050604080518a81526001600160a01b038a81166020830152918101869052818c1693508c9250908d16907f0c06179431976ca809870adf5899b0c76b3cc196dcbe03c8fcf78fa88d4c6fb49060600160405180910390a450505050505050505050565b6120668133612501565b50565b61207382826110e4565b6108b3576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556120a93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6120f782826110e4565b156108b3576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008181526001830160205260408120541515611a0e565b60008082116121bb5760405162461bcd60e51b815260206004820152601f60248201527f474f424d61726b65743a2050726963652063616e6e6f74206265207a65726f0060448201526064016105d1565b6001600160a01b03841660009081526001602090815260408083208684529091529020548290036121ee57506000611a0e565b506001600160a01b039290921660009081526001602081815260408084209484529390529190209190915590565b6040516001600160a01b03831660248201526044810182905261083490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261255a565b6000611a0e838361262f565b60008082116122e75760405162461bcd60e51b815260206004820152602260248201527f474f424d61726b65743a2053616c65734361702063616e6e6f74206265207a65604482015261726f60f01b60648201526084016105d1565b6001600160a01b0384166000908152600160208181526040808420878552909152909120015482900361231c57506000611a0e565b6001600160a01b03841660009081526001602090815260408083208684529091529020600201548210156123a75760405162461bcd60e51b815260206004820152602c60248201527f474f424d61726b65743a2053616c65734361702063616e6e6f74206265206c6560448201526b1cdcc81d1a185b881cdbdb1960a21b60648201526084016105d1565b506001600160a01b0392909216600090815260016020818152604080842094845293905291902081019190915590565b6000611a0e836001600160a01b03841661262f565b6000611a0e83835b600081815260018301602052604081205461243b575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105a0565b5060006105a0565b600082600001828154811061245a5761245a612d9b565b9060005260206000200154905092915050565b6060816000018054806020026020016040519081016040528092919081815260200182805480156124bd57602002820191906000526020600020905b8154815260200190600101908083116124a9575b50505050509050919050565b6040516001600160a01b0380851660248301528316604482015260648101829052610d949085906323b872dd60e01b90608401612248565b61250b82826110e4565b6108b35761251881612722565b612523836020612734565b604051602001612534929190613033565b60408051601f198184030181529082905262461bcd60e51b82526105d1916004016130a8565b60006125af826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128d09092919063ffffffff16565b90508051600014806125d05750808060200190518101906125d091906130db565b6108345760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105d1565b60008181526001830160205260408120548015612718576000612653600183612e8e565b855490915060009061266790600190612e8e565b90508181146126cc57600086600001828154811061268757612687612d9b565b90600052602060002001549050808760000184815481106126aa576126aa612d9b565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806126dd576126dd6130fd565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105a0565b60009150506105a0565b60606105a06001600160a01b03831660145b60606000612743836002612fd6565b61274e906002612ea1565b67ffffffffffffffff81111561276657612766612d85565b6040519080825280601f01601f191660200182016040528015612790576020820181803683370190505b509050600360fc1b816000815181106127ab576127ab612d9b565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106127da576127da612d9b565b60200101906001600160f81b031916908160001a90535060006127fe846002612fd6565b612809906001612ea1565b90505b6001811115612881576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061283d5761283d612d9b565b1a60f81b82828151811061285357612853612d9b565b60200101906001600160f81b031916908160001a90535060049490941c9361287a81613113565b905061280c565b508315611a0e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d1565b60606128df84846000856128e7565b949350505050565b6060824710156129485760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105d1565b600080866001600160a01b03168587604051612964919061312a565b60006040518083038185875af1925050503d80600081146129a1576040519150601f19603f3d011682016040523d82523d6000602084013e6129a6565b606091505b50915091506129b7878383876129c2565b979650505050505050565b60608315612a31578251600003612a2a576001600160a01b0385163b612a2a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105d1565b50816128df565b6128df8383815115612a465781518083602001fd5b8060405162461bcd60e51b81526004016105d191906130a8565b600060208284031215612a7257600080fd5b81356001600160e01b031981168114611a0e57600080fd5b6001600160a01b038116811461206657600080fd5b600060208284031215612ab157600080fd5b8135611a0e81612a8a565b60408082528351908201819052600090606090818401906020808801855b83811015612af657815185529382019390820190600101612ada565b5050858303818701528651808452878201938201925060005b81811015612b4657612b368486518051825260208082015190830152604090810151910152565b9382019392850192600101612b0f565b509198975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612b955783516001600160a01b031683529284019291840191600101612b70565b50909695505050505050565b600060208284031215612bb357600080fd5b5035919050565b600080600080600060a08688031215612bd257600080fd5b8535612bdd81612a8a565b9450602086013593506040860135612bf481612a8a565b9250606086013591506080860135612c0b81612a8a565b809150509295509295909350565b60008060408385031215612c2c57600080fd5b823591506020830135612c3e81612a8a565b809150509250929050565b60008060408385031215612c5c57600080fd5b8235612c6781612a8a565b946020939093013593505050565b815181526020808301519082015260408083015190820152606081016105a0565b600080600060608486031215612cab57600080fd5b8335612cb681612a8a565b95602085013595506040909401359392505050565b60008060008060808587031215612ce157600080fd5b8435612cec81612a8a565b9350602085013592506040850135612d0381612a8a565b9396929550929360600135925050565b60008060008060808587031215612d2957600080fd5b8435612d3481612a8a565b966020860135965060408601359560600135945092505050565b6020808252601c908201527f474f424d61726b65743a2045726331313535206e6f7420666f756e6400000000604082015260600190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252601c908201527f474f424d61726b65743a20546f6b656e4964206e6f7420666f756e6400000000604082015260600190565b60208082526017908201527f474f424d61726b65743a205a65726f2061646472657373000000000000000000604082015260600190565b600060208284031215612e3157600080fd5b8151611a0e81612a8a565b600060208284031215612e4e57600080fd5b815160ff81168114611a0e57600080fd5b600060208284031215612e7157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156105a0576105a0612e78565b808201808211156105a0576105a0612e78565b634e487b7160e01b600052602160045260246000fd5b60ff82811682821603908111156105a0576105a0612e78565b600181815b80851115612f1e578160001904821115612f0457612f04612e78565b80851615612f1157918102915b93841c9390800290612ee8565b509250929050565b600082612f35575060016105a0565b81612f42575060006105a0565b8160018114612f585760028114612f6257612f7e565b60019150506105a0565b60ff841115612f7357612f73612e78565b50506001821b6105a0565b5060208310610133831016604e8410600b8410161715612fa1575081810a6105a0565b612fab8383612ee3565b8060001904821115612fbf57612fbf612e78565b029392505050565b6000611a0e60ff841683612f26565b80820281158282048414176105a0576105a0612e78565b60008261300a57634e487b7160e01b600052601260045260246000fd5b500490565b60005b8381101561302a578181015183820152602001613012565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161306b81601785016020880161300f565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161309c81602884016020880161300f565b01602801949350505050565b60208152600082518060208401526130c781604085016020870161300f565b601f01601f19169190910160400192915050565b6000602082840312156130ed57600080fd5b81518015158114611a0e57600080fd5b634e487b7160e01b600052603160045260246000fd5b60008161312257613122612e78565b506000190190565b6000825161313c81846020870161300f565b919091019291505056fe43f25613eb2f15fb17222a5d424ca2655743e71265d98e4b93c05e5fb589ecde241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220192359c67a3dcf97b9128fc7d106417bff550169cf824b8759cd0dceb86b6ee164736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f
-----Decoded View---------------
Arg [0] : currencies (address[]): 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174,0xc2132D05D31c914a87C6611C10748AEb04B58e8F
Arg [1] : priceDecimals_ (uint8): 4
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [3] : 0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174
Arg [4] : 000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
POL | 100.00% | $0.999923 | 4 | $4 |
Loading...
Loading
Loading...
Loading
[ 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.