Source Code
Overview
S Balance
More Info
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
CoverProducts
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: GPL-3.0-only pragma solidity ^0.8.18; import "@openzeppelin/contracts-v4/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; import "../../abstract/MasterAwareV2.sol"; import "../../abstract/Multicall.sol"; import "../../interfaces/ICover.sol"; import "../../interfaces/ICoverProducts.sol"; import "../../interfaces/ILegacyCover.sol"; import "../../interfaces/IPool.sol"; import "../../interfaces/IStakingProducts.sol"; contract CoverProducts is ICoverProducts, MasterAwareV2, Multicall { /* ========== STATE VARIABLES ========== */ Product[] internal _products; ProductType[] internal _productTypes; // productId => product name mapping(uint => string) internal productNames; // productTypeId => productType name mapping(uint => string) internal productTypeNames; // product id => allowed pool ids mapping(uint => uint[]) internal allowedPools; mapping(uint => Metadata[]) internal productMetadata; mapping(uint => Metadata[]) internal productTypeMetadata; /* ========== CONSTANTS ========== */ uint private constant PRICE_DENOMINATOR = 10000; uint private constant CAPACITY_REDUCTION_DENOMINATOR = 10000; /* ========== VIEWS ========== */ function getProductType(uint productTypeId) external view returns (ProductType memory) { return _productTypes[productTypeId]; } function getProductTypeName(uint productTypeId) external view returns (string memory) { return productTypeNames[productTypeId]; } function getProductTypeCount() external view returns (uint) { return _productTypes.length; } function getProductTypes() external view returns (ProductType[] memory) { return _productTypes; } function getProduct(uint productId) external view returns (Product memory) { return _products[productId]; } function getProductName(uint productId) external view returns (string memory) { return productNames[productId]; } function getProductCount() public view returns (uint) { return _products.length; } function getProducts() external view returns (Product[] memory) { return _products; } function getProductWithType(uint productId) external override view returns ( Product memory product, ProductType memory productType ) { product = _products[productId]; productType = _productTypes[product.productType]; } function getLatestProductMetadata(uint productId) external view returns (Metadata memory) { uint metadataLength = productMetadata[productId].length; return metadataLength > 0 ? productMetadata[productId][metadataLength - 1] : Metadata("", 0); } function getLatestProductTypeMetadata(uint productTypeId) external view returns (Metadata memory) { uint metadataLength = productTypeMetadata[productTypeId].length; return metadataLength > 0 ? productTypeMetadata[productTypeId][metadataLength - 1] : Metadata("", 0); } function getProductMetadata(uint productId) external view returns (Metadata[] memory) { return productMetadata[productId]; } function getProductTypeMetadata(uint productTypeId) external view returns (Metadata[] memory) { return productTypeMetadata[productTypeId]; } function getAllowedPools(uint productId) external view returns (uint[] memory _allowedPools) { uint allowedPoolCount = allowedPools[productId].length; _allowedPools = new uint[](allowedPoolCount); for (uint i = 0; i < allowedPoolCount; i++) { _allowedPools[i] = allowedPools[productId][i]; } } function getAllowedPoolsCount(uint productId) external view returns (uint) { return allowedPools[productId].length; } function getInitialPrices( uint[] calldata productIds ) external view returns (uint[] memory initialPrices) { uint productCount = _products.length; initialPrices = new uint[](productIds.length); for (uint i = 0; i < productIds.length; i++) { uint productId = productIds[i]; if (productId >= productCount) { revert ProductNotFound(); } initialPrices[i] = _products[productId].initialPriceRatio; } } function getCapacityReductionRatios( uint[] calldata productIds ) external view returns (uint[] memory capacityReductionRatios) { uint productCount = _products.length; capacityReductionRatios = new uint[](productIds.length); for (uint i = 0; i < productIds.length; i++) { uint productId = productIds[i]; if (productId >= productCount) { revert ProductNotFound(); } capacityReductionRatios[i] = _products[productId].capacityReductionRatio; } } function prepareStakingProductsParams( ProductInitializationParams[] calldata params ) external view returns ( ProductInitializationParams[] memory validatedParams ) { uint productCount = _products.length; uint inputLength = params.length; validatedParams = new ProductInitializationParams[](inputLength); // override with initial price and check if pool is allowed for (uint i = 0; i < inputLength; i++) { uint productId = params[i].productId; if (productId >= productCount) { revert ProductNotFound(); } // if there is a list of allowed pools for this product - the new pool didn't exist yet // so the product can't be in it if (allowedPools[productId].length > 0) { revert PoolNotAllowedForThisProduct(productId); } Product memory product = _products[productId]; if (product.isDeprecated) { revert ProductDeprecated(); } validatedParams[i] = params[i]; validatedParams[i].initialPrice = product.initialPriceRatio; } } /* ========== PRODUCT CONFIGURATION ========== */ function setProducts(ProductParam[] calldata productParams) external override onlyAdvisoryBoard { uint unsupportedCoverAssetsBitmap = type(uint).max; uint globalMinPriceRatio = cover().getGlobalMinPriceRatio(); uint poolCount = stakingProducts().getStakingPoolCount(); Asset[] memory assets = pool().getAssets(); uint assetsLength = assets.length; for (uint i = 0; i < assetsLength; i++) { if (assets[i].isCoverAsset && !assets[i].isAbandoned) { // clear the bit at index i unsupportedCoverAssetsBitmap ^= 1 << i; } } for (uint i = 0; i < productParams.length; i++) { ProductParam calldata param = productParams[i]; Product calldata product = param.product; if (product.productType >= _productTypes.length) { revert ProductTypeNotFound(); } if (unsupportedCoverAssetsBitmap & product.coverAssets != 0) { revert UnsupportedCoverAssets(); } if (product.initialPriceRatio < globalMinPriceRatio) { revert InitialPriceRatioBelowGlobalMinPriceRatio(); } if (product.initialPriceRatio > PRICE_DENOMINATOR) { revert InitialPriceRatioAbove100Percent(); } if (product.capacityReductionRatio > CAPACITY_REDUCTION_DENOMINATOR) { revert CapacityReductionRatioAbove100Percent(); } if (param.allowedPools.length > 0) { for (uint j = 0; j < param.allowedPools.length; j++) { if (param.allowedPools[j] > poolCount || param.allowedPools[j] == 0) { revert StakingPoolDoesNotExist(); } } } // New product has id == uint256.max if (param.productId == type(uint256).max) { uint productId = _products.length; // the metadata is optional, do not push if empty if (bytes(param.ipfsMetadata).length > 0) { productMetadata[productId].push(Metadata(param.ipfsMetadata, block.timestamp)); } productNames[productId] = param.productName; allowedPools[productId] = param.allowedPools; _products.push(product); emit ProductSet(productId); continue; } // Existing product if (param.productId >= _products.length) { revert ProductNotFound(); } Product storage newProductValue = _products[param.productId]; newProductValue.isDeprecated = product.isDeprecated; newProductValue.coverAssets = product.coverAssets; newProductValue.initialPriceRatio = product.initialPriceRatio; newProductValue.capacityReductionRatio = product.capacityReductionRatio; allowedPools[param.productId] = param.allowedPools; if (bytes(param.productName).length > 0) { productNames[param.productId] = param.productName; } if (bytes(param.ipfsMetadata).length > 0) { productMetadata[param.productId].push(Metadata(param.ipfsMetadata, block.timestamp)); } emit ProductSet(param.productId); } } function setProductTypes(ProductTypeParam[] calldata productTypeParams) external onlyAdvisoryBoard { for (uint i = 0; i < productTypeParams.length; i++) { ProductTypeParam calldata param = productTypeParams[i]; // New product has id == uint256.max if (param.productTypeId == type(uint256).max) { uint productTypeId = _productTypes.length; // the product type metadata is mandatory if (bytes(param.ipfsMetadata).length == 0) { revert MetadataRequired(); } productTypeMetadata[productTypeId].push(Metadata(param.ipfsMetadata, block.timestamp)); productTypeNames[productTypeId] = param.productTypeName; _productTypes.push(param.productType); emit ProductTypeSet(productTypeId); continue; } if (param.productTypeId >= _productTypes.length) { revert ProductTypeNotFound(); } _productTypes[param.productTypeId].gracePeriod = param.productType.gracePeriod; if (bytes(param.productTypeName).length > 0) { productTypeNames[param.productTypeId] = param.productTypeName; } if (bytes(param.ipfsMetadata).length > 0) { productTypeMetadata[param.productTypeId].push(Metadata(param.ipfsMetadata, block.timestamp)); } emit ProductTypeSet(param.productTypeId); } } function setProductsMetadata( uint[] calldata productIds, string[] calldata ipfsMetadata ) external onlyAdvisoryBoard { if (productIds.length != ipfsMetadata.length) { revert MismatchedArrayLengths(); } uint productCount = _products.length; for (uint i = 0; i < productIds.length; i++) { uint productId = productIds[i]; if (productId >= productCount) { revert ProductNotFound(); } productMetadata[productId].push(Metadata(ipfsMetadata[i], block.timestamp)); } } function setProductTypesMetadata( uint[] calldata productTypeIds, string[] calldata ipfsMetadata ) external onlyAdvisoryBoard { if (productTypeIds.length != ipfsMetadata.length) { revert MismatchedArrayLengths(); } uint productTypeCount = _productTypes.length; for (uint i = 0; i < productTypeIds.length; i++) { uint productTypeId = productTypeIds[i]; if (productTypeId >= productTypeCount) { revert ProductTypeNotFound(); } if (bytes(ipfsMetadata[i]).length == 0) { revert MetadataRequired(); } productTypeMetadata[productTypeId].push(Metadata(ipfsMetadata[i], block.timestamp)); } } /* ========== COVER ASSETS HELPERS ========== */ // Returns true if the product exists and the pool is authorized to have the product function isPoolAllowed(uint productId, uint poolId) public view returns (bool) { uint poolCount = allowedPools[productId].length; // If no pools are specified, every pool is allowed if (poolCount == 0) { return true; } for (uint i = 0; i < poolCount; i++) { if (allowedPools[productId][i] == poolId) { return true; } } // Product has allow list and pool is not in it return false; } function requirePoolIsAllowed(uint[] calldata productIds, uint poolId) external view { for (uint i = 0; i < productIds.length; i++) { if (!isPoolAllowed(productIds[i], poolId) ) { revert PoolNotAllowedForThisProduct(productIds[i]); } } } /* ========== DEPENDENCIES ========== */ function migrateCoverProducts() external { require(_products.length == 0, "CoverProducts: _products already migrated"); require(_productTypes.length == 0, "CoverProducts: _productTypes already migrated"); ILegacyCover _cover = ILegacyCover(address(cover())); IStakingPoolFactory _stakingPoolFactory = IStakingPoolFactory(_cover.stakingPoolFactory()); Product[] memory _productsToMigrate = _cover.getProducts(); uint _productTypeCount = _cover.productTypesCount(); uint stakingPoolCount = _stakingPoolFactory.stakingPoolCount(); for (uint i = 0; i < _productsToMigrate.length; i++) { _products.push(_productsToMigrate[i]); productNames[i] = _cover.productNames(i); uint[] storage _allowedPools = allowedPools[i]; if (!_productsToMigrate[i].useFixedPrice || _productsToMigrate[i].isDeprecated) { continue; } for (uint j = 0; j < stakingPoolCount; j++) { try _cover.allowedPools(i, j) returns (uint poolId) { _allowedPools.push(poolId); } catch { break; } } } for (uint i = 0; i < _productTypeCount; i++) { ProductType memory _productTypeToMigrate = _cover.productTypes(i); _productTypes.push(_productTypeToMigrate); productTypeNames[i] = _cover.productTypeNames(i); } } /* ========== DEPENDENCIES ========== */ function pool() internal view returns (IPool) { return IPool(internalContracts[uint(ID.P1)]); } function cover() internal view returns (ICover) { return ICover(internalContracts[uint(ID.CO)]); } function stakingProducts() internal view returns (IStakingProducts) { return IStakingProducts(internalContracts[uint(ID.SP)]); } function changeDependentContractAddress() public { internalContracts[uint(ID.P1)] = master.getLatestAddress("P1"); internalContracts[uint(ID.CO)] = master.getLatestAddress("CO"); internalContracts[uint(ID.MR)] = master.getLatestAddress("MR"); internalContracts[uint(ID.SP)] = master.getLatestAddress("SP"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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.6.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.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } 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)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } 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"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } 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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 * ==== * * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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/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: GPL-3.0-only pragma solidity ^0.8.18; import "../interfaces/ISAFURAMaster.sol"; import "../interfaces/IMasterAwareV2.sol"; import "../interfaces/IMemberRoles.sol"; abstract contract MasterAwareV2 is IMasterAwareV2 { ISAFURAMaster public master; mapping(uint => address payable) public internalContracts; modifier onlyMember { require( IMemberRoles(internalContracts[uint(ID.MR)]).checkRole( msg.sender, uint(IMemberRoles.Role.Member) ), "Caller is not a member" ); _; } modifier onlyAdvisoryBoard { require( IMemberRoles(internalContracts[uint(ID.MR)]).checkRole( msg.sender, uint(IMemberRoles.Role.AdvisoryBoard) ), "Caller is not an advisory board member" ); _; } modifier onlyInternal { require(master.isInternal(msg.sender), "Caller is not an internal contract"); _; } modifier onlyMaster { if (address(master) != address(0)) { require(address(master) == msg.sender, "Not master"); } _; } modifier onlyGovernance { require( master.checkIsAuthToGoverned(msg.sender), "Caller is not authorized to govern" ); _; } modifier onlyEmergencyAdmin { require( msg.sender == master.emergencyAdmin(), "Caller is not emergency admin" ); _; } modifier whenPaused { require(master.isPause(), "System is not paused"); _; } modifier whenNotPaused { require(!master.isPause(), "System is paused"); _; } function getInternalContractAddress(ID id) internal view returns (address payable) { return internalContracts[uint(id)]; } function changeMasterAddress(address masterAddress) public onlyMaster { master = ISAFURAMaster(masterAddress); } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.18; abstract contract Multicall { error RevertedWithoutReason(uint index); // WARNING: Do not set this function as payable function multicall(bytes[] calldata data) external returns (bytes[] memory results) { uint callCount = data.length; results = new bytes[](callCount); for (uint i = 0; i < callCount; i++) { (bool ok, bytes memory result) = address(this).delegatecall(data[i]); if (!ok) { uint length = result.length; // 0 length returned from empty revert() / require(false) if (length == 0) { revert RevertedWithoutReason(i); } assembly { revert(add(result, 0x20), length) } } results[i] = result; } } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./IStakingPoolFactory.sol"; /** * @dev IStakingPoolFactory is missing the changeOperator() and operator() functions. * @dev Any change to the original interface will affect staking pool addresses * @dev This interface is created to add the missing functions so it can be used in other contracts. */ interface ICompleteStakingPoolFactory is IStakingPoolFactory { function operator() external view returns (address); function changeOperator(address newOperator) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./ICoverNFT.sol"; import "./IStakingNFT.sol"; import "./IStakingPool.sol"; import "./ICompleteStakingPoolFactory.sol"; /* io structs */ enum ClaimMethod { IndividualClaims, YieldTokenIncidents } struct PoolAllocationRequest { uint40 poolId; bool skip; uint coverAmountInAsset; } struct BuyCoverParams { uint coverId; address owner; uint24 productId; uint8 coverAsset; uint96 amount; uint32 period; uint maxPremiumInAsset; uint8 paymentAsset; uint16 commissionRatio; address commissionDestination; string ipfsData; } /* storage structs */ struct PoolAllocation { uint40 poolId; uint96 coverAmountInNXM; uint96 premiumInNXM; uint24 allocationId; } struct CoverData { uint24 productId; uint8 coverAsset; uint96 amountPaidOut; } struct CoverSegment { uint96 amount; uint32 start; uint32 period; // seconds uint32 gracePeriod; // seconds uint24 globalRewardsRatio; uint24 globalCapacityRatio; } interface ICover { /* ========== DATA STRUCTURES ========== */ /* internal structs */ struct RequestAllocationVariables { uint previousPoolAllocationsLength; uint previousPremiumInNXM; uint refund; uint coverAmountInNXM; } /* storage structs */ struct ActiveCover { // Global active cover amount per asset. uint192 totalActiveCoverInAsset; // The last time activeCoverExpirationBuckets was updated uint64 lastBucketUpdateId; } /* ========== VIEWS ========== */ function coverData(uint coverId) external view returns (CoverData memory); function coverDataCount() external view returns (uint); function coverSegmentsCount(uint coverId) external view returns (uint); function coverSegments(uint coverId) external view returns (CoverSegment[] memory); function coverSegmentWithRemainingAmount( uint coverId, uint segmentId ) external view returns (CoverSegment memory); function recalculateActiveCoverInAsset(uint coverAsset) external; function totalActiveCoverInAsset(uint coverAsset) external view returns (uint); function getGlobalCapacityRatio() external view returns (uint); function getGlobalRewardsRatio() external view returns (uint); function getGlobalMinPriceRatio() external pure returns (uint); function getGlobalCapacityAndPriceRatios() external view returns ( uint _globalCapacityRatio, uint _globalMinPriceRatio ); function GLOBAL_MIN_PRICE_RATIO() external view returns (uint); /* === MUTATIVE FUNCTIONS ==== */ function buyCover( BuyCoverParams calldata params, PoolAllocationRequest[] calldata coverChunkRequests ) external payable returns (uint coverId); function burnStake( uint coverId, uint segmentId, uint amount ) external returns (address coverOwner); function changeStakingPoolFactoryOperator() external; function coverNFT() external returns (ICoverNFT); function stakingNFT() external returns (IStakingNFT); function stakingPoolFactory() external returns (ICompleteStakingPoolFactory); /* ========== EVENTS ========== */ event CoverEdited(uint indexed coverId, uint indexed productId, uint indexed segmentId, address buyer, string ipfsMetadata); // Auth error OnlyOwnerOrApproved(); // Cover details error CoverPeriodTooShort(); error CoverPeriodTooLong(); error CoverOutsideOfTheGracePeriod(); error CoverAmountIsZero(); // Products error ProductNotFound(); error ProductDeprecated(); error UnexpectedProductId(); // Cover and payment assets error CoverAssetNotSupported(); error InvalidPaymentAsset(); error UnexpectedCoverAsset(); error UnexpectedEthSent(); error EditNotSupported(); // Price & Commission error PriceExceedsMaxPremiumInAsset(); error CommissionRateTooHigh(); // ETH transfers error InsufficientEthSent(); error SendingEthToPoolFailed(); error SendingEthToCommissionDestinationFailed(); error ReturningEthRemainderToSenderFailed(); // Misc error ExpiredCoversCannotBeEdited(); error CoverNotYetExpired(uint coverId); error InsufficientCoverAmountAllocated(); error UnexpectedPoolId(); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "@openzeppelin/contracts-v4/token/ERC721/IERC721.sol"; interface ICoverNFT is IERC721 { function isApprovedOrOwner(address spender, uint tokenId) external returns (bool); function mint(address to) external returns (uint tokenId); function changeOperator(address newOperator) external; function changeNFTDescriptor(address newNFTDescriptor) external; function totalSupply() external view returns (uint); function name() external view returns (string memory); error NotOperator(); error NotMinted(); error WrongFrom(); error InvalidRecipient(); error InvalidNewOperatorAddress(); error InvalidNewNFTDescriptorAddress(); error NotAuthorized(); error UnsafeRecipient(); error AlreadyMinted(); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./ICover.sol"; /* io structs */ struct ProductInitializationParams { uint productId; uint8 weight; uint96 initialPrice; uint96 targetPrice; } /* storage structs */ struct Product { uint16 productType; address yieldTokenAddress; // cover assets bitmap. each bit represents whether the asset with // the index of that bit is enabled as a cover asset for this product uint32 coverAssets; uint16 initialPriceRatio; uint16 capacityReductionRatio; bool isDeprecated; bool useFixedPrice; } struct ProductType { uint8 claimMethod; uint32 gracePeriod; } interface ICoverProducts { /* storage structs */ struct Metadata { string ipfsHash; uint timestamp; } /* io structs */ struct ProductParam { string productName; uint productId; string ipfsMetadata; Product product; uint[] allowedPools; } struct ProductTypeParam { string productTypeName; uint productTypeId; string ipfsMetadata; ProductType productType; } /* ========== VIEWS ========== */ function getProductType(uint productTypeId) external view returns (ProductType memory); function getProductTypeName(uint productTypeId) external view returns (string memory); function getProductTypeCount() external view returns (uint); function getProductTypes() external view returns (ProductType[] memory); function getProduct(uint productId) external view returns (Product memory); function getProductName(uint productTypeId) external view returns (string memory); function getProductCount() external view returns (uint); function getProducts() external view returns (Product[] memory); // add grace period function? function getProductWithType(uint productId) external view returns (Product memory, ProductType memory); function getLatestProductMetadata(uint productId) external view returns (Metadata memory); function getLatestProductTypeMetadata(uint productTypeId) external view returns (Metadata memory); function getProductMetadata(uint productId) external view returns (Metadata[] memory); function getProductTypeMetadata(uint productTypeId) external view returns (Metadata[] memory); function getAllowedPools(uint productId) external view returns (uint[] memory _allowedPools); function getAllowedPoolsCount(uint productId) external view returns (uint); function isPoolAllowed(uint productId, uint poolId) external view returns (bool); function requirePoolIsAllowed(uint[] calldata productIds, uint poolId) external view; function getCapacityReductionRatios(uint[] calldata productIds) external view returns (uint[] memory); function getInitialPrices(uint[] calldata productIds) external view returns (uint[] memory); function prepareStakingProductsParams( ProductInitializationParams[] calldata params ) external returns ( ProductInitializationParams[] memory validatedParams ); /* === MUTATIVE FUNCTIONS ==== */ function setProductTypes(ProductTypeParam[] calldata productTypes) external; function setProducts(ProductParam[] calldata params) external; /* ========== EVENTS ========== */ event ProductSet(uint id); event ProductTypeSet(uint id); // Products and product types error ProductNotFound(); error ProductTypeNotFound(); error ProductDeprecated(); error PoolNotAllowedForThisProduct(uint productId); error StakingPoolDoesNotExist(); error MismatchedArrayLengths(); error MetadataRequired(); // Misc error UnsupportedCoverAssets(); error InitialPriceRatioBelowGlobalMinPriceRatio(); error InitialPriceRatioAbove100Percent(); error CapacityReductionRatioAbove100Percent(); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./ICoverProducts.sol"; interface ILegacyCover { function stakingPoolFactory() external view returns (address); function getProducts() external view returns (Product[] memory); function productTypesCount() external view returns (uint); function productNames(uint productId) external view returns (string memory); function allowedPools(uint productId, uint index) external view returns (uint); function productTypes(uint id) external view returns (ProductType memory); function productTypeNames(uint id) external view returns (string memory); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IMasterAwareV2 { // TODO: if you update this enum, update lib/constants.js as well enum ID { TC, // TokenController.sol P1, // Pool.sol MR, // MemberRoles.sol MC, // MCR.sol CO, // Cover.sol SP, // StakingProducts.sol PS, // LegacyPooledStaking.sol GV, // Governance.sol GW, // LegacyGateway.sol - removed CL, // CoverMigrator.sol - removed AS, // Assessment.sol CI, // IndividualClaims.sol - Claims for Individuals CG, // YieldTokenIncidents.sol - Claims for Groups RA, // Ramm.sol ST, // SafeTracker.sol CP // CoverProducts.sol } function changeMasterAddress(address masterAddress) external; function changeDependentContractAddress() external; function internalContracts(uint) external view returns (address payable); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IMemberRoles { enum Role {Unassigned, AdvisoryBoard, Member, Owner, Auditor} function join(address _userAddress, uint nonce, bytes calldata signature) external payable; function switchMembership(address _newAddress) external; function switchMembershipAndAssets( address newAddress, uint[] calldata coverIds, uint[] calldata stakingTokenIds ) external; function switchMembershipOf(address member, address _newAddress) external; function totalRoles() external view returns (uint256); function changeAuthorized(uint _roleId, address _newAuthorized) external; function setKycAuthAddress(address _add) external; function members(uint _memberRoleId) external view returns (uint, address[] memory memberArray); function numberOfMembers(uint _memberRoleId) external view returns (uint); function authorized(uint _memberRoleId) external view returns (address); function roles(address _memberAddress) external view returns (uint[] memory); function checkRole(address _memberAddress, uint _roleId) external view returns (bool); function getMemberLengthForAllRoles() external view returns (uint[] memory totalMembers); function memberAtIndex(uint _memberRoleId, uint index) external view returns (address, bool); function membersLength(uint _memberRoleId) external view returns (uint); event MemberRole(uint256 indexed roleId, bytes32 roleName, string roleDescription); event MemberJoined(address indexed newMember, uint indexed nonce); event switchedMembership(address indexed previousMember, address indexed newMember, uint timeStamp); event MembershipWithdrawn(address indexed member, uint timestamp); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./IPriceFeedOracle.sol"; struct SwapDetails { uint104 minAmount; uint104 maxAmount; uint32 lastSwapTime; // 2 decimals of precision. 0.01% -> 0.0001 -> 1e14 uint16 maxSlippageRatio; } struct Asset { address assetAddress; bool isCoverAsset; bool isAbandoned; } interface IPool { function swapOperator() external view returns (address); function getAsset(uint assetId) external view returns (Asset memory); function getAssets() external view returns (Asset[] memory); function transferAssetToSwapOperator(address asset, uint amount) external; function setSwapDetailsLastSwapTime(address asset, uint32 lastSwapTime) external; function getAssetSwapDetails(address assetAddress) external view returns (SwapDetails memory); function sendPayout(uint assetIndex, address payable payoutAddress, uint amount, uint ethDepositAmount) external; function sendEth(address payoutAddress, uint amount) external; function upgradeCapitalPool(address payable newPoolAddress) external; function priceFeedOracle() external view returns (IPriceFeedOracle); function getPoolValueInEth() external view returns (uint); function calculateMCRRatio(uint totalAssetValue, uint mcrEth) external pure returns (uint); function getInternalTokenPriceInAsset(uint assetId) external view returns (uint tokenPrice); function getInternalTokenPriceInAssetAndUpdateTwap(uint assetId) external returns (uint tokenPrice); function getTokenPrice() external view returns (uint tokenPrice); function getMCRRatio() external view returns (uint); function setSwapValue(uint value) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface Aggregator { function decimals() external view returns (uint8); function latestAnswer() external view returns (int); } interface IPriceFeedOracle { struct OracleAsset { Aggregator aggregator; uint8 decimals; } function ETH() external view returns (address); function assets(address) external view returns (Aggregator, uint8); function getAssetToEthRate(address asset) external view returns (uint); function getAssetForEth(address asset, uint ethIn) external view returns (uint); function getEthForAsset(address asset, uint amount) external view returns (uint); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface ISAFURAMaster { function tokenAddress() external view returns (address); function owner() external view returns (address); function emergencyAdmin() external view returns (address); function masterInitialized() external view returns (bool); function isInternal(address _add) external view returns (bool); function isPause() external view returns (bool check); function isMember(address _add) external view returns (bool); function checkIsAuthToGoverned(address _add) external view returns (bool); function getLatestAddress(bytes2 _contractName) external view returns (address payable contractAddress); function contractAddresses(bytes2 code) external view returns (address payable); function upgradeMultipleContracts( bytes2[] calldata _contractCodes, address payable[] calldata newAddresses ) external; function removeContracts(bytes2[] calldata contractCodesToRemove) external; function addNewInternalContracts( bytes2[] calldata _contractCodes, address payable[] calldata newAddresses, uint[] calldata _types ) external; function updateOwnerParameters(bytes8 code, address payable val) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "@openzeppelin/contracts-v4/token/ERC721/IERC721.sol"; interface IStakingNFT is IERC721 { function isApprovedOrOwner(address spender, uint tokenId) external returns (bool); function mint(uint poolId, address to) external returns (uint tokenId); function changeOperator(address newOperator) external; function changeNFTDescriptor(address newNFTDescriptor) external; function totalSupply() external returns (uint); function tokenInfo(uint tokenId) external view returns (uint poolId, address owner); function stakingPoolOf(uint tokenId) external view returns (uint poolId); function stakingPoolFactory() external view returns (address); function name() external view returns (string memory); error NotOperator(); error NotMinted(); error WrongFrom(); error InvalidRecipient(); error InvalidNewOperatorAddress(); error InvalidNewNFTDescriptorAddress(); error NotAuthorized(); error UnsafeRecipient(); error AlreadyMinted(); error NotStakingPool(); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; /* structs for io */ struct AllocationRequest { uint productId; uint coverId; uint allocationId; uint period; uint gracePeriod; bool useFixedPrice; uint previousStart; uint previousExpiration; uint previousRewardsRatio; uint globalCapacityRatio; uint capacityReductionRatio; uint rewardRatio; uint globalMinPrice; } struct BurnStakeParams { uint allocationId; uint productId; uint start; uint period; uint deallocationAmount; } interface IStakingPool { /* structs for storage */ // stakers are grouped in tranches based on the timelock expiration // tranche index is calculated based on the expiration date // the initial proposal is to have 4 tranches per year (1 tranche per quarter) struct Tranche { uint128 stakeShares; uint128 rewardsShares; } struct ExpiredTranche { uint96 accNxmPerRewardShareAtExpiry; uint96 stakeAmountAtExpiry; // nxm total supply is 6.7e24 and uint96.max is 7.9e28 uint128 stakeSharesSupplyAtExpiry; } struct Deposit { uint96 lastAccNxmPerRewardShare; uint96 pendingRewards; uint128 stakeShares; uint128 rewardsShares; } function initialize( bool isPrivatePool, uint initialPoolFee, uint maxPoolFee, uint _poolId, string memory ipfsDescriptionHash ) external; function processExpirations(bool updateUntilCurrentTimestamp) external; function requestAllocation( uint amount, uint previousPremium, AllocationRequest calldata request ) external returns (uint premium, uint allocationId); function burnStake(uint amount, BurnStakeParams calldata params) external; function depositTo( uint amount, uint trancheId, uint requestTokenId, address destination ) external returns (uint tokenId); function withdraw( uint tokenId, bool withdrawStake, bool withdrawRewards, uint[] memory trancheIds ) external returns (uint withdrawnStake, uint withdrawnRewards); function isPrivatePool() external view returns (bool); function isHalted() external view returns (bool); function manager() external view returns (address); function getPoolId() external view returns (uint); function getPoolFee() external view returns (uint); function getMaxPoolFee() external view returns (uint); function getActiveStake() external view returns (uint); function getStakeSharesSupply() external view returns (uint); function getRewardsSharesSupply() external view returns (uint); function getRewardPerSecond() external view returns (uint); function getAccNxmPerRewardsShare() external view returns (uint); function getLastAccNxmUpdate() external view returns (uint); function getFirstActiveTrancheId() external view returns (uint); function getFirstActiveBucketId() external view returns (uint); function getNextAllocationId() external view returns (uint); function getDeposit(uint tokenId, uint trancheId) external view returns ( uint lastAccNxmPerRewardShare, uint pendingRewards, uint stakeShares, uint rewardsShares ); function getTranche(uint trancheId) external view returns ( uint stakeShares, uint rewardsShares ); function getExpiredTranche(uint trancheId) external view returns ( uint accNxmPerRewardShareAtExpiry, uint stakeAmountAtExpiry, uint stakeShareSupplyAtExpiry ); function setPoolFee(uint newFee) external; function setPoolPrivacy(bool isPrivatePool) external; function getActiveAllocations( uint productId ) external view returns (uint[] memory trancheAllocations); function getTrancheCapacities( uint productId, uint firstTrancheId, uint trancheCount, uint capacityRatio, uint reductionRatio ) external view returns (uint[] memory trancheCapacities); /* ========== EVENTS ========== */ event StakeDeposited(address indexed user, uint256 amount, uint256 trancheId, uint256 tokenId); event DepositExtended(address indexed user, uint256 tokenId, uint256 initialTrancheId, uint256 newTrancheId, uint256 topUpAmount); event PoolPrivacyChanged(address indexed manager, bool isPrivate); event PoolFeeChanged(address indexed manager, uint newFee); event PoolDescriptionSet(string ipfsDescriptionHash); event Withdraw(address indexed user, uint indexed tokenId, uint tranche, uint amountStakeWithdrawn, uint amountRewardsWithdrawn); event StakeBurned(uint amount); event Deallocated(uint productId); event BucketExpired(uint bucketId); event TrancheExpired(uint trancheId); // Auth error OnlyCoverContract(); error OnlyStakingProductsContract(); error OnlyManager(); error PrivatePool(); error SystemPaused(); error PoolHalted(); // Fees error PoolFeeExceedsMax(); error MaxPoolFeeAbove100(); // Voting error NxmIsLockedForGovernanceVote(); error ManagerNxmIsLockedForGovernanceVote(); // Deposit error InsufficientDepositAmount(); error RewardRatioTooHigh(); // Staking NFTs error InvalidTokenId(); error NotTokenOwnerOrApproved(); error InvalidStakingPoolForToken(); // Tranche & capacity error NewTrancheEndsBeforeInitialTranche(); error RequestedTrancheIsNotYetActive(); error RequestedTrancheIsExpired(); error InsufficientCapacity(); // Allocation error AlreadyDeallocated(uint allocationId); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; interface IStakingPoolFactory { function stakingPoolCount() external view returns (uint); function beacon() external view returns (address); function create(address beacon) external returns (uint poolId, address stakingPoolAddress); event StakingPoolCreated(uint indexed poolId, address indexed stakingPoolAddress); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.0; import "./ICoverProducts.sol"; import "./IStakingPool.sol"; interface IStakingProducts { struct StakedProductParam { uint productId; bool recalculateEffectiveWeight; bool setTargetWeight; uint8 targetWeight; bool setTargetPrice; uint96 targetPrice; } struct Weights { uint32 totalEffectiveWeight; uint32 totalTargetWeight; } struct StakedProduct { uint16 lastEffectiveWeight; uint8 targetWeight; uint96 targetPrice; uint96 bumpedPrice; uint32 bumpedPriceUpdateTime; } /* ============= PRODUCT FUNCTIONS ============= */ function setProducts(uint poolId, StakedProductParam[] memory params) external; function getProductTargetWeight(uint poolId, uint productId) external view returns (uint); function getTotalTargetWeight(uint poolId) external view returns (uint); function getTotalEffectiveWeight(uint poolId) external view returns (uint); function getProduct(uint poolId, uint productId) external view returns ( uint lastEffectiveWeight, uint targetWeight, uint targetPrice, uint bumpedPrice, uint bumpedPriceUpdateTime ); /* ============= PRICING FUNCTIONS ============= */ function getPremium( uint poolId, uint productId, uint period, uint coverAmount, uint initialCapacityUsed, uint totalCapacity, uint globalMinPrice, bool useFixedPrice, uint nxmPerAllocationUnit, uint allocationUnitsPerNxm ) external returns (uint premium); function calculateFixedPricePremium( uint coverAmount, uint period, uint fixedPrice, uint nxmPerAllocationUnit, uint targetPriceDenominator ) external pure returns (uint); function calculatePremium( StakedProduct memory product, uint period, uint coverAmount, uint initialCapacityUsed, uint totalCapacity, uint targetPrice, uint currentBlockTimestamp, uint nxmPerAllocationUnit, uint allocationUnitsPerNxm, uint targetPriceDenominator ) external pure returns (uint premium, StakedProduct memory); function calculatePremiumPerYear( uint basePrice, uint coverAmount, uint initialCapacityUsed, uint totalCapacity, uint nxmPerAllocationUnit, uint allocationUnitsPerNxm, uint targetPriceDenominator ) external pure returns (uint); // Calculates the premium for a given cover amount starting with the surge point function calculateSurgePremium( uint amountOnSurge, uint totalCapacity, uint allocationUnitsPerNxm ) external pure returns (uint); /* ========== STAKING POOL CREATION ========== */ function stakingPool(uint poolId) external view returns (IStakingPool); function getStakingPoolCount() external view returns (uint); function createStakingPool( bool isPrivatePool, uint initialPoolFee, uint maxPoolFee, ProductInitializationParams[] calldata productInitParams, string calldata ipfsDescriptionHash ) external returns (uint poolId, address stakingPoolAddress); function changeStakingPoolFactoryOperator(address newOperator) external; /* ============= EVENTS ============= */ event ProductUpdated(uint productId, uint8 targetWeight, uint96 targetPrice); /* ============= ERRORS ============= */ // Auth error OnlyStakingPool(); error OnlyCoverContract(); error OnlyManager(); // Products & weights error MustSetPriceForNewProducts(); error MustSetWeightForNewProducts(); error TargetPriceTooHigh(); error TargetPriceBelowMin(); error TargetWeightTooHigh(); error MustRecalculateEffectiveWeight(); error TotalTargetWeightExceeded(); error TotalEffectiveWeightExceeded(); // Staking Pool creation error ProductDoesntExistOrIsDeprecated(); error InvalidProductType(); error TargetPriceBelowGlobalMinPriceRatio(); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract ABI
API[{"inputs":[],"name":"CapacityReductionRatioAbove100Percent","type":"error"},{"inputs":[],"name":"InitialPriceRatioAbove100Percent","type":"error"},{"inputs":[],"name":"InitialPriceRatioBelowGlobalMinPriceRatio","type":"error"},{"inputs":[],"name":"MetadataRequired","type":"error"},{"inputs":[],"name":"MismatchedArrayLengths","type":"error"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"PoolNotAllowedForThisProduct","type":"error"},{"inputs":[],"name":"ProductDeprecated","type":"error"},{"inputs":[],"name":"ProductNotFound","type":"error"},{"inputs":[],"name":"ProductTypeNotFound","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"RevertedWithoutReason","type":"error"},{"inputs":[],"name":"StakingPoolDoesNotExist","type":"error"},{"inputs":[],"name":"UnsupportedCoverAssets","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ProductSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ProductTypeSet","type":"event"},{"inputs":[],"name":"changeDependentContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"masterAddress","type":"address"}],"name":"changeMasterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"getAllowedPools","outputs":[{"internalType":"uint256[]","name":"_allowedPools","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"getAllowedPoolsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"productIds","type":"uint256[]"}],"name":"getCapacityReductionRatios","outputs":[{"internalType":"uint256[]","name":"capacityReductionRatios","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"productIds","type":"uint256[]"}],"name":"getInitialPrices","outputs":[{"internalType":"uint256[]","name":"initialPrices","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"getLatestProductMetadata","outputs":[{"components":[{"internalType":"string","name":"ipfsHash","type":"string"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct ICoverProducts.Metadata","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productTypeId","type":"uint256"}],"name":"getLatestProductTypeMetadata","outputs":[{"components":[{"internalType":"string","name":"ipfsHash","type":"string"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct ICoverProducts.Metadata","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"getProduct","outputs":[{"components":[{"internalType":"uint16","name":"productType","type":"uint16"},{"internalType":"address","name":"yieldTokenAddress","type":"address"},{"internalType":"uint32","name":"coverAssets","type":"uint32"},{"internalType":"uint16","name":"initialPriceRatio","type":"uint16"},{"internalType":"uint16","name":"capacityReductionRatio","type":"uint16"},{"internalType":"bool","name":"isDeprecated","type":"bool"},{"internalType":"bool","name":"useFixedPrice","type":"bool"}],"internalType":"struct Product","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProductCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"getProductMetadata","outputs":[{"components":[{"internalType":"string","name":"ipfsHash","type":"string"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct ICoverProducts.Metadata[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"getProductName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productTypeId","type":"uint256"}],"name":"getProductType","outputs":[{"components":[{"internalType":"uint8","name":"claimMethod","type":"uint8"},{"internalType":"uint32","name":"gracePeriod","type":"uint32"}],"internalType":"struct ProductType","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProductTypeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productTypeId","type":"uint256"}],"name":"getProductTypeMetadata","outputs":[{"components":[{"internalType":"string","name":"ipfsHash","type":"string"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct ICoverProducts.Metadata[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productTypeId","type":"uint256"}],"name":"getProductTypeName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProductTypes","outputs":[{"components":[{"internalType":"uint8","name":"claimMethod","type":"uint8"},{"internalType":"uint32","name":"gracePeriod","type":"uint32"}],"internalType":"struct ProductType[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"getProductWithType","outputs":[{"components":[{"internalType":"uint16","name":"productType","type":"uint16"},{"internalType":"address","name":"yieldTokenAddress","type":"address"},{"internalType":"uint32","name":"coverAssets","type":"uint32"},{"internalType":"uint16","name":"initialPriceRatio","type":"uint16"},{"internalType":"uint16","name":"capacityReductionRatio","type":"uint16"},{"internalType":"bool","name":"isDeprecated","type":"bool"},{"internalType":"bool","name":"useFixedPrice","type":"bool"}],"internalType":"struct Product","name":"product","type":"tuple"},{"components":[{"internalType":"uint8","name":"claimMethod","type":"uint8"},{"internalType":"uint32","name":"gracePeriod","type":"uint32"}],"internalType":"struct ProductType","name":"productType","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProducts","outputs":[{"components":[{"internalType":"uint16","name":"productType","type":"uint16"},{"internalType":"address","name":"yieldTokenAddress","type":"address"},{"internalType":"uint32","name":"coverAssets","type":"uint32"},{"internalType":"uint16","name":"initialPriceRatio","type":"uint16"},{"internalType":"uint16","name":"capacityReductionRatio","type":"uint16"},{"internalType":"bool","name":"isDeprecated","type":"bool"},{"internalType":"bool","name":"useFixedPrice","type":"bool"}],"internalType":"struct Product[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"internalContracts","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"isPoolAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"master","outputs":[{"internalType":"contract ISAFURAMaster","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"migrateCoverProducts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"productId","type":"uint256"},{"internalType":"uint8","name":"weight","type":"uint8"},{"internalType":"uint96","name":"initialPrice","type":"uint96"},{"internalType":"uint96","name":"targetPrice","type":"uint96"}],"internalType":"struct ProductInitializationParams[]","name":"params","type":"tuple[]"}],"name":"prepareStakingProductsParams","outputs":[{"components":[{"internalType":"uint256","name":"productId","type":"uint256"},{"internalType":"uint8","name":"weight","type":"uint8"},{"internalType":"uint96","name":"initialPrice","type":"uint96"},{"internalType":"uint96","name":"targetPrice","type":"uint96"}],"internalType":"struct ProductInitializationParams[]","name":"validatedParams","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"productIds","type":"uint256[]"},{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"requirePoolIsAllowed","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"productTypeName","type":"string"},{"internalType":"uint256","name":"productTypeId","type":"uint256"},{"internalType":"string","name":"ipfsMetadata","type":"string"},{"components":[{"internalType":"uint8","name":"claimMethod","type":"uint8"},{"internalType":"uint32","name":"gracePeriod","type":"uint32"}],"internalType":"struct ProductType","name":"productType","type":"tuple"}],"internalType":"struct ICoverProducts.ProductTypeParam[]","name":"productTypeParams","type":"tuple[]"}],"name":"setProductTypes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"productTypeIds","type":"uint256[]"},{"internalType":"string[]","name":"ipfsMetadata","type":"string[]"}],"name":"setProductTypesMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"productName","type":"string"},{"internalType":"uint256","name":"productId","type":"uint256"},{"internalType":"string","name":"ipfsMetadata","type":"string"},{"components":[{"internalType":"uint16","name":"productType","type":"uint16"},{"internalType":"address","name":"yieldTokenAddress","type":"address"},{"internalType":"uint32","name":"coverAssets","type":"uint32"},{"internalType":"uint16","name":"initialPriceRatio","type":"uint16"},{"internalType":"uint16","name":"capacityReductionRatio","type":"uint16"},{"internalType":"bool","name":"isDeprecated","type":"bool"},{"internalType":"bool","name":"useFixedPrice","type":"bool"}],"internalType":"struct Product","name":"product","type":"tuple"},{"internalType":"uint256[]","name":"allowedPools","type":"uint256[]"}],"internalType":"struct ICoverProducts.ProductParam[]","name":"productParams","type":"tuple[]"}],"name":"setProducts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"productIds","type":"uint256[]"},{"internalType":"string[]","name":"ipfsMetadata","type":"string[]"}],"name":"setProductsMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50613edd806100206000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c8063ac9650d811610104578063d1f5e21f116100a2578063ee97f7f311610071578063ee97f7f314610461578063fb9523a314610474578063fd32763e14610487578063ff10ca34146104a757600080fd5b8063d1f5e21f146103e7578063d4179cbd146103fa578063d46655f41461040d578063eb9623601461042057600080fd5b8063bfe94713116100de578063bfe94713146103a4578063c0c3a4a5146103b7578063c29b2f20146103ca578063c6a36630146103df57600080fd5b8063ac9650d814610343578063b6c700c014610363578063b9db15b41461038457600080fd5b80634a348da91161017c5780638c7e6dec1161014b5780638c7e6dec146102d057806394e5f369146102e35780639d26bd1c146103035780639e62e7951461032357600080fd5b80634a348da9146102855780636739d3d5146102975780636bcd0d0a146102aa5780637f0f36e3146102bd57600080fd5b806316076e76116101b857806316076e761461021a578063168d3dc41461022f57806319cc31c41461024f5780632c328aa61461026257600080fd5b8063077fce96146101df5780630ea9c984146101e957806314073e32146101f1575b600080fd5b6101e76104c7565b005b6101e7610b54565b6102046101ff366004612ec2565b610e0b565b6040516102119190612f54565b60405180910390f35b610222610f3b565b6040516102119190612f67565b61024261023d366004613012565b610fac565b6040516102119190613053565b61020461025d366004612ec2565b6110a9565b610275610270366004613097565b61110c565b6040519015158152602001610211565b6002545b604051908152602001610211565b6102426102a5366004612ec2565b611194565b6101e76102b83660046130b9565b611256565b6101e76102cb3660046130b9565b61146f565b6101e76102de366004613012565b611642565b6102f66102f1366004613124565b611e9c565b6040516102119190613198565b610316610311366004612ec2565b6120ee565b60405161021191906131fe565b610336610331366004612ec2565b6121fc565b6040516102119190613260565b610356610351366004613012565b61229e565b6040516102119190613273565b610376610371366004612ec2565b6123db565b604051610211929190613328565b610397610392366004612ec2565b612516565b6040516102119190613357565b6103366103b2366004612ec2565b6125f3565b6101e76103c5366004613012565b612610565b6103d2612a16565b6040516102119190613365565b600354610289565b6103166103f5366004612ec2565b612ad7565b6101e76104083660046133a7565b612bda565b6101e761041b36600461340a565b612c58565b61044961042e366004612ec2565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610211565b600054610449906001600160a01b031681565b610242610482366004613012565b612cd2565b610289610495366004612ec2565b60009081526006602052604090205490565b6104ba6104b5366004612ec2565b612dc7565b6040516102119190613427565b6002541561052e5760405162461bcd60e51b815260206004820152602960248201527f436f76657250726f64756374733a205f70726f647563747320616c7265616479604482015268081b5a59dc985d195960ba1b60648201526084015b60405180910390fd5b600354156105945760405162461bcd60e51b815260206004820152602d60248201527f436f76657250726f64756374733a205f70726f64756374547970657320616c7260448201526c1958591e481b5a59dc985d1959609a1b6064820152608401610525565b600061059e612e24565b90506000816001600160a01b031663a1b8adcb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106049190613447565b90506000826001600160a01b031663c29b2f206040518163ffffffff1660e01b8152600401600060405180830381865afa158015610646573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261066e9190810190613562565b90506000836001600160a01b03166365e90a286040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d49190613685565b90506000836001600160a01b0316632dd96be96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073a9190613685565b905060005b83518110156109d757600284828151811061075c5761075c61369e565b6020908102919091018101518254600181018455600093845292829020815193018054928201516040808401516060850151608086015160a087015160c0909701511515600160f81b026001600160f81b03971515600160f01b0260ff60f01b1961ffff938416600160e01b021662ffffff60e01b19948416600160d01b0261ffff60d01b1963ffffffff909716600160b01b029690961665ffffffffffff60b01b196001600160a01b03998a1662010000026001600160b01b0319909d1695909d16949094179a909a179a909a169190911792909217169590951795909517929092169290921790915590516372ca814160e11b8152600481018390529087169063e595028290602401600060405180830381865afa158015610884573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108ac91908101906136b4565b6000828152600460205260409020906108c590826137c7565b50600081815260066020526040902084518590839081106108e8576108e861369e565b602002602001015160c00151158061091a575084828151811061090d5761090d61369e565b602002602001015160a001515b1561092557506109c5565b60005b838110156109c25760405163e57315cb60e01b815260048101849052602481018290526001600160a01b0389169063e57315cb90604401602060405180830381865afa925050508015610998575060408051601f3d908101601f1916820190925261099591810190613685565b60015b156109c25782546001810184556000848152602090200155806109ba8161389c565b915050610928565b50505b806109cf8161389c565b91505061073f565b5060005b82811015610b4c57604051637c09b0bb60e01b8152600481018290526000906001600160a01b03881690637c09b0bb906024016040805180830381865afa158015610a2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4e91906138c4565b6003805460018101825560009190915281517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054602084015163ffffffff166101000264ffffffffff1990911660ff909316929092179190911790556040516367b7397360e01b8152600481018490529091506001600160a01b038816906367b7397390602401600060405180830381865afa158015610af6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b1e91908101906136b4565b600083815260056020526040902090610b3790826137c7565b50508080610b449061389c565b9150506109db565b505050505050565b6000546040516227050b60e31b815261503160f01b60048201526001600160a01b0390911690630138285890602401602060405180830381865afa158015610ba0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc49190613447565b600160008181526020919091527fcc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792f80546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b815261434f60f01b6004820152911690630138285890602401602060405180830381865afa158015610c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c739190613447565b6004600081815260016020527fedc95719e9a3b28dd8e80877cb5880a9be7de1a13fc8b05e7999683b6b56764380546001600160a01b039485166001600160a01b0319909116179055546040516227050b60e31b81526126a960f11b9281019290925290911690630138285890602401602060405180830381865afa158015610d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d249190613447565b600260009081526001602052600080516020613e8883398151915280546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b815261053560f41b6004820152911690630138285890602401602060405180830381865afa158015610d9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc09190613447565b600560005260016020527fe2689cd4a84e23ad2f564004f1c9013e9589d260bde6380aba3ca7e09e4df40c80546001600160a01b0319166001600160a01b0392909216919091179055565b60408051808201909152606081526000602082015260008281526008602052604090205480610e555760408051606081018252600091810182815281526020810191909152610f34565b6000838152600860205260409020610e6e600183613922565b81548110610e7e57610e7e61369e565b9060005260206000209060020201604051806040016040529081600082018054610ea790613747565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed390613747565b8015610f205780601f10610ef557610100808354040283529160200191610f20565b820191906000526020600020905b815481529060010190602001808311610f0357829003601f168201915b505050505081526020016001820154815250505b9392505050565b60606003805480602002602001604051908101604052809291908181526020016000905b82821015610fa3576000848152602090819020604080518082019091529084015460ff81168252610100900463ffffffff1681830152825260019092019101610f5f565b50505050905090565b600254606090826001600160401b03811115610fca57610fca613464565b604051908082528060200260200182016040528015610ff3578160200160208202803683370190505b50915060005b838110156110a15760008585838181106110155761101561369e565b90506020020135905082811061103e576040516379de4af560e01b815260040160405180910390fd5b600281815481106110515761105161369e565b90600052602060002001600001601a9054906101000a900461ffff1661ffff168483815181106110835761108361369e565b602090810291909101015250806110998161389c565b915050610ff9565b505092915050565b604080518082019091526060815260006020820152600082815260076020526040902054806110f35760408051606081018252600091810182815281526020810191909152610f34565b6000838152600760205260409020610e6e600183613922565b60008281526006602052604081205480820361112c57600191505061118e565b60005b8181101561118757600085815260066020526040902080548591908390811061115a5761115a61369e565b9060005260206000200154036111755760019250505061118e565b8061117f8161389c565b91505061112f565b5060009150505b92915050565b600081815260066020526040902054606090806001600160401b038111156111be576111be613464565b6040519080825280602002602001820160405280156111e7578160200160208202803683370190505b50915060005b8181101561124f5760008481526006602052604090208054829081106112155761121561369e565b90600052602060002001548382815181106112325761123261369e565b6020908102919091010152806112478161389c565b9150506111ed565b5050919050565b600260005260016020819052600080516020613e888339815191525460405163505ef22f60e01b815233600482015260248101929092526001600160a01b03169063505ef22f90604401602060405180830381865afa1580156112bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e19190613935565b6112fd5760405162461bcd60e51b815260040161052590613952565b82811461131d57604051632b477e7160e11b815260040160405180910390fd5b60035460005b84811015610b4c57600086868381811061133f5761133f61369e565b9050602002013590508281106113685760405163c3af0fb960e01b815260040160405180910390fd5b84848381811061137a5761137a61369e565b905060200281019061138c9190613998565b90506000036113ae57604051635c1cf85760e11b815260040160405180910390fd5b6008600082815260200190815260200160002060405180604001604052808787868181106113de576113de61369e565b90506020028101906113f09190613998565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093855250504260209384015250835460018101855593815220815191926002020190819061144e90826137c7565b506020820151816001015550505080806114679061389c565b915050611323565b600260005260016020819052600080516020613e888339815191525460405163505ef22f60e01b815233600482015260248101929092526001600160a01b03169063505ef22f90604401602060405180830381865afa1580156114d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fa9190613935565b6115165760405162461bcd60e51b815260040161052590613952565b82811461153657604051632b477e7160e11b815260040160405180910390fd5b60025460005b84811015610b4c5760008686838181106115585761155861369e565b905060200201359050828110611581576040516379de4af560e01b815260040160405180910390fd5b6007600082815260200190815260200160002060405180604001604052808787868181106115b1576115b161369e565b90506020028101906115c39190613998565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093855250504260209384015250835460018101855593815220815191926002020190819061162190826137c7565b5060208201518160010155505050808061163a9061389c565b91505061153c565b600260005260016020819052600080516020613e888339815191525460405163505ef22f60e01b815233600482015260248101929092526001600160a01b03169063505ef22f90604401602060405180830381865afa1580156116a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cd9190613935565b6116e95760405162461bcd60e51b815260040161052590613952565b60001960006116f6612e24565b6001600160a01b0316631246da396040518163ffffffff1660e01b8152600401602060405180830381865afa158015611733573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117579190613685565b90506000611763612e4b565b6001600160a01b0316639bf00f186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c49190613685565b905060006117d0612e57565b6001600160a01b03166367e4ac2c6040518163ffffffff1660e01b8152600401600060405180830381865afa15801561180d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261183591908101906139de565b805190915060005b818110156118ab578281815181106118575761185761369e565b602002602001015160200151801561188a575082818151811061187c5761187c61369e565b602002602001015160400151155b1561189957806001901b861895505b806118a38161389c565b91505061183d565b5060005b86811015611e9257368888838181106118ca576118ca61369e565b90506020028101906118dc9190613aaa565b60035490915060608201906118f46080840183613acb565b61ffff16106119165760405163c3af0fb960e01b815260040160405180910390fd5b6119266060820160408301613ae8565b881663ffffffff161561194c57604051636a5b237960e11b815260040160405180910390fd5b8661195d6080830160608401613acb565b61ffff1610156119805760405163ac50244b60e01b815260040160405180910390fd5b6127106119936080830160608401613acb565b61ffff1611156119b6576040516306e1b30360e11b815260040160405180910390fd5b6127106119c960a0830160808401613acb565b61ffff1611156119ec5760405163267f61c960e21b815260040160405180910390fd5b60006119fc610140840184613b05565b90501115611aa65760005b611a15610140840184613b05565b9050811015611aa45786611a2d610140850185613b05565b83818110611a3d57611a3d61369e565b905060200201351180611a745750611a59610140840184613b05565b82818110611a6957611a6961369e565b905060200201356000145b15611a925760405163e050b05160e01b815260040160405180910390fd5b80611a9c8161389c565b915050611a07565b505b600019826020013503611c28576002546000611ac56040850185613998565b90501115611b6057600081815260076020526040908190208151808301835290918190611af490870187613998565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505042602093840152508354600181018555938152208151919260020201908190611b5290826137c7565b506020820151816001015550505b611b6a8380613998565b600083815260046020526040902091611b84919083613b4e565b50611b93610140840184613b05565b6000838152600660205260409020611bac929091612e62565b506002805460018101825560009190915282907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace01611beb8282613c28565b50506040518181527fe757b28b33896bc8918816faf8078f9ec27409af77ad80806d7196478897149b9060200160405180910390a1505050611e80565b600254602083013510611c4e576040516379de4af560e01b815260040160405180910390fd5b60006002836020013581548110611c6757611c6761369e565b60009182526020909120019050611c8460c0830160a08401613d6c565b8154901515600160f01b0260ff60f01b19909116178155611cab6060830160408401613ae8565b815463ffffffff91909116600160b01b0263ffffffff60b01b19909116178155611cdb6080830160608401613acb565b815461ffff91909116600160d01b0261ffff60d01b19909116178155611d0760a0830160808401613acb565b815461ffff91909116600160e01b0261ffff60e01b19909116178155611d31610140840184613b05565b6020808601356000908152600690915260409020611d50929091612e62565b506000611d5d8480613998565b90501115611d9157611d6f8380613998565b602080860135600090815260049091526040902091611d8f919083613b4e565b505b6000611da06040850185613998565b90501115611e465760076000846020013581526020019081526020016000206040518060400160405280858060400190611dda9190613998565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505042602093840152508354600181018555938152208151919260020201908190611e3890826137c7565b506020820151816001015550505b60405160208085013582527fe757b28b33896bc8918816faf8078f9ec27409af77ad80806d7196478897149b910160405180910390a15050505b80611e8a8161389c565b9150506118af565b5050505050505050565b60025460609082806001600160401b03811115611ebb57611ebb613464565b604051908082528060200260200182016040528015611f0d57816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181611ed95790505b50925060005b818110156120e5576000868683818110611f2f57611f2f61369e565b905060800201600001359050838110611f5b576040516379de4af560e01b815260040160405180910390fd5b60008181526006602052604090205415611f8b57604051635d46ff4160e01b815260048101829052602401610525565b600060028281548110611fa057611fa061369e565b60009182526020918290206040805160e081018252919092015461ffff80821683526001600160a01b03620100008304169483019490945263ffffffff600160b01b82041692820192909252600160d01b820483166060820152600160e01b8204909216608083015260ff600160f01b8204811615801560a0850152600160f81b90920416151560c083015290915061204c57604051631340cecb60e21b815260040160405180910390fd5b87878481811061205e5761205e61369e565b9050608002018036038101906120749190613da0565b8684815181106120865761208661369e565b6020026020010181905250806060015161ffff168684815181106120ac576120ac61369e565b6020026020010151604001906001600160601b031690816001600160601b031681525050505080806120dd9061389c565b915050611f13565b50505092915050565b606060076000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156121f1578382906000526020600020906002020160405180604001604052908160008201805461215690613747565b80601f016020809104026020016040519081016040528092919081815260200182805461218290613747565b80156121cf5780601f106121a4576101008083540402835291602001916121cf565b820191906000526020600020905b8154815290600101906020018083116121b257829003601f168201915b5050505050815260200160018201548152505081526020019060010190612123565b505050509050919050565b600081815260046020526040902080546060919061221990613747565b80601f016020809104026020016040519081016040528092919081815260200182805461224590613747565b80156122925780601f1061226757610100808354040283529160200191612292565b820191906000526020600020905b81548152906001019060200180831161227557829003601f168201915b50505050509050919050565b606081806001600160401b038111156122b9576122b9613464565b6040519080825280602002602001820160405280156122ec57816020015b60608152602001906001900390816122d75790505b50915060005b818110156110a157600080308787858181106123105761231061369e565b90506020028101906123229190613998565b604051612330929190613e17565b600060405180830381855af49150503d806000811461236b576040519150601f19603f3d011682016040523d82523d6000602084013e612370565b606091505b5091509150816123a857805160008190036123a15760405163f1a8c42d60e01b815260048101859052602401610525565b8060208301fd5b808584815181106123bb576123bb61369e565b6020026020010181905250505080806123d39061389c565b9150506122f2565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915260408051808201909152600080825260208201526002838154811061243b5761243b61369e565b60009182526020918290206040805160e081018252929091015461ffff8082168085526001600160a01b03620100008404169585019590955263ffffffff600160b01b83041692840192909252600160d01b810482166060840152600160e01b8104909116608083015260ff600160f01b82048116151560a0840152600160f81b90910416151560c082015260038054919450919081106124de576124de61369e565b60009182526020918290206040805180820190915291015460ff81168252610100900463ffffffff1691810191909152919391925050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152600282815481106125625761256261369e565b60009182526020918290206040805160e081018252919092015461ffff80821683526001600160a01b03620100008304169483019490945263ffffffff600160b01b82041692820192909252600160d01b820483166060820152600160e01b8204909216608083015260ff600160f01b82048116151560a0840152600160f81b90910416151560c082015292915050565b600081815260056020526040902080546060919061221990613747565b600260005260016020819052600080516020613e888339815191525460405163505ef22f60e01b815233600482015260248101929092526001600160a01b03169063505ef22f90604401602060405180830381865afa158015612677573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269b9190613935565b6126b75760405162461bcd60e51b815260040161052590613952565b60005b81811015612a1157368383838181106126d5576126d561369e565b90506020028101906126e79190613e27565b905060001981602001350361285d576003546127066040830183613998565b905060000361272857604051635c1cf85760e11b815260040160405180910390fd5b60008181526008602052604090819020815180830183529091819061274f90860186613998565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050426020938401525083546001810185559381522081519192600202019081906127ad90826137c7565b50602091909101516001909101556127c58280613998565b6000838152600560205260409020916127df919083613b4e565b506003805460018101825560009190915260608301907fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b016128218282613e3d565b50506040518181527fd88b8450ea1e752935616a2e6cb78fbb30e68c5fb6859a9edcb110a95e5f882a9060200160405180910390a150506129ff565b6003546020820135106128835760405163c3af0fb960e01b815260040160405180910390fd5b61289360a0820160808301613ae8565b60038260200135815481106128aa576128aa61369e565b60009182526020822001805463ffffffff939093166101000264ffffffff0019909316929092179091556128de8280613998565b90501115612912576128f08180613998565b602080840135600090815260059091526040902091612910919083613b4e565b505b60006129216040830183613998565b905011156129c7576008600082602001358152602001908152602001600020604051806040016040528083806040019061295b9190613998565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050426020938401525083546001810185559381522081519192600202019081906129b990826137c7565b506020820151816001015550505b60405160208083013582527fd88b8450ea1e752935616a2e6cb78fbb30e68c5fb6859a9edcb110a95e5f882a910160405180910390a1505b80612a098161389c565b9150506126ba565b505050565b60606002805480602002602001604051908101604052809291908181526020016000905b82821015610fa35760008481526020908190206040805160e0810182529185015461ffff80821684526001600160a01b03620100008304168486015263ffffffff600160b01b83041692840192909252600160d01b810482166060840152600160e01b8104909116608083015260ff600160f01b82048116151560a0840152600160f81b90910416151560c0820152825260019092019101612a3a565b606060086000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156121f15783829060005260206000209060020201604051806040016040529081600082018054612b3f90613747565b80601f0160208091040260200160405190810160405280929190818152602001828054612b6b90613747565b8015612bb85780601f10612b8d57610100808354040283529160200191612bb8565b820191906000526020600020905b815481529060010190602001808311612b9b57829003601f168201915b5050505050815260200160018201548152505081526020019060010190612b0c565b60005b82811015612c5257612c07848483818110612bfa57612bfa61369e565b905060200201358361110c565b612c4057838382818110612c1d57612c1d61369e565b90506020020135604051635d46ff4160e01b815260040161052591815260200190565b80612c4a8161389c565b915050612bdd565b50505050565b6000546001600160a01b031615612cb0576000546001600160a01b03163314612cb05760405162461bcd60e51b815260206004820152600a6024820152692737ba1036b0b9ba32b960b11b6044820152606401610525565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254606090826001600160401b03811115612cf057612cf0613464565b604051908082528060200260200182016040528015612d19578160200160208202803683370190505b50915060005b838110156110a1576000858583818110612d3b57612d3b61369e565b905060200201359050828110612d64576040516379de4af560e01b815260040160405180910390fd5b60028181548110612d7757612d7761369e565b90600052602060002001600001601c9054906101000a900461ffff1661ffff16848381518110612da957612da961369e565b60209081029190910101525080612dbf8161389c565b915050612d1f565b604080518082019091526000808252602082015260038281548110612dee57612dee61369e565b60009182526020918290206040805180820190915291015460ff81168252610100900463ffffffff169181019190915292915050565b600060018160045b81526020810191909152604001600020546001600160a01b0316919050565b60006001816005612e2c565b600060018181612e2c565b828054828255906000526020600020908101928215612e9d579160200282015b82811115612e9d578235825591602001919060010190612e82565b50612ea9929150612ead565b5090565b5b80821115612ea95760008155600101612eae565b600060208284031215612ed457600080fd5b5035919050565b60005b83811015612ef6578181015183820152602001612ede565b50506000910152565b60008151808452612f17816020860160208601612edb565b601f01601f19169290920160200192915050565b6000815160408452612f406040850182612eff565b602093840151949093019390935250919050565b602081526000610f346020830184612f2b565b602080825282518282018190526000919060409081850190868401855b82811015612fba57612faa848351805160ff16825260209081015163ffffffff16910152565b9284019290850190600101612f84565b5091979650505050505050565b60008083601f840112612fd957600080fd5b5081356001600160401b03811115612ff057600080fd5b6020830191508360208260051b850101111561300b57600080fd5b9250929050565b6000806020838503121561302557600080fd5b82356001600160401b0381111561303b57600080fd5b61304785828601612fc7565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561308b5783518352928401929184019160010161306f565b50909695505050505050565b600080604083850312156130aa57600080fd5b50508035926020909101359150565b600080600080604085870312156130cf57600080fd5b84356001600160401b03808211156130e657600080fd5b6130f288838901612fc7565b9096509450602087013591508082111561310b57600080fd5b5061311887828801612fc7565b95989497509550505050565b6000806020838503121561313757600080fd5b82356001600160401b038082111561314e57600080fd5b818501915085601f83011261316257600080fd5b81358181111561317157600080fd5b8660208260071b850101111561318657600080fd5b60209290920196919550909350505050565b602080825282518282018190526000919060409081850190868401855b82811015612fba578151805185528681015160ff1687860152858101516001600160601b03908116878701526060918201511690850152608090930192908501906001016131b5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561325357603f19888603018452613241858351612f2b565b94509285019290850190600101613225565b5092979650505050505050565b602081526000610f346020830184612eff565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561325357603f198886030184526132b6858351612eff565b9450928501929085019060010161329a565b61ffff80825116835260018060a01b03602083015116602084015263ffffffff60408301511660408401528060608301511660608401528060808301511660808401525060a0810151151560a083015260c0810151151560c08301525050565b610120810161333782856132c8565b825160ff1660e0830152602083015163ffffffff16610100830152610f34565b60e0810161118e82846132c8565b6020808252825182820181905260009190848201906040850190845b8181101561308b576133948385516132c8565b9284019260e09290920191600101613381565b6000806000604084860312156133bc57600080fd5b83356001600160401b038111156133d257600080fd5b6133de86828701612fc7565b909790965060209590950135949350505050565b6001600160a01b038116811461340757600080fd5b50565b60006020828403121561341c57600080fd5b8135610f34816133f2565b815160ff16815260208083015163ffffffff16908201526040810161118e565b60006020828403121561345957600080fd5b8151610f34816133f2565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b038111828210171561349c5761349c613464565b60405290565b604051606081016001600160401b038111828210171561349c5761349c613464565b604051601f8201601f191681016001600160401b03811182821017156134ec576134ec613464565b604052919050565b60006001600160401b0382111561350d5761350d613464565b5060051b60200190565b61ffff8116811461340757600080fd5b805161353281613517565b919050565b63ffffffff8116811461340757600080fd5b801515811461340757600080fd5b805161353281613549565b6000602080838503121561357557600080fd5b82516001600160401b0381111561358b57600080fd5b8301601f8101851361359c57600080fd5b80516135af6135aa826134f4565b6134c4565b81815260e091820283018401918482019190888411156135ce57600080fd5b938501935b838510156136795780858a0312156135eb5760008081fd5b6135f361347a565b85516135fe81613517565b81528587015161360d816133f2565b8188015260408681015161362081613537565b9082015260608681015161363381613517565b908201526080613644878201613527565b9082015260a0613655878201613557565b9082015260c0613666878201613557565b90820152835293840193918501916135d3565b50979650505050505050565b60006020828403121561369757600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156136c657600080fd5b81516001600160401b03808211156136dd57600080fd5b818401915084601f8301126136f157600080fd5b81518181111561370357613703613464565b613716601f8201601f19166020016134c4565b915080825285602082850101111561372d57600080fd5b61373e816020840160208601612edb565b50949350505050565b600181811c9082168061375b57607f821691505b60208210810361377b57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612a1157600081815260208120601f850160051c810160208610156137a85750805b601f850160051c820191505b81811015610b4c578281556001016137b4565b81516001600160401b038111156137e0576137e0613464565b6137f4816137ee8454613747565b84613781565b602080601f83116001811461382957600084156138115750858301515b600019600386901b1c1916600185901b178555610b4c565b600085815260208120601f198616915b8281101561385857888601518255948401946001909101908401613839565b50858210156138765787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b6000600182016138ae576138ae613886565b5060010190565b60ff8116811461340757600080fd5b6000604082840312156138d657600080fd5b604051604081018181106001600160401b03821117156138f8576138f8613464565b6040528251613906816138b5565b8152602083015161391681613537565b60208201529392505050565b8181038181111561118e5761118e613886565b60006020828403121561394757600080fd5b8151610f3481613549565b60208082526026908201527f43616c6c6572206973206e6f7420616e2061647669736f727920626f6172642060408201526536b2b6b132b960d11b606082015260800190565b6000808335601e198436030181126139af57600080fd5b8301803591506001600160401b038211156139c957600080fd5b60200191503681900382131561300b57600080fd5b600060208083850312156139f157600080fd5b82516001600160401b03811115613a0757600080fd5b8301601f81018513613a1857600080fd5b8051613a266135aa826134f4565b81815260609182028301840191848201919088841115613a4557600080fd5b938501935b838510156136795780858a031215613a625760008081fd5b613a6a6134a2565b8551613a75816133f2565b815285870151613a8481613549565b81880152604086810151613a9781613549565b9082015283529384019391850191613a4a565b6000823561015e19833603018112613ac157600080fd5b9190910192915050565b600060208284031215613add57600080fd5b8135610f3481613517565b600060208284031215613afa57600080fd5b8135610f3481613537565b6000808335601e19843603018112613b1c57600080fd5b8301803591506001600160401b03821115613b3657600080fd5b6020019150600581901b360382131561300b57600080fd5b6001600160401b03831115613b6557613b65613464565b613b7983613b738354613747565b83613781565b6000601f841160018114613bad5760008515613b955750838201355b600019600387901b1c1916600186901b178355613c07565b600083815260209020601f19861690835b82811015613bde5786850135825560209485019460019092019101613bbe565b5086821015613bfb5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b6000813561118e81613517565b6000813561118e81613549565b8135613c3381613517565b61ffff8116905081548161ffff1982161783556020840135613c54816133f2565b62010000600160b01b0360109190911b166001600160b01b031982168317811784556040850135613c8481613537565b6001600160d01b0319929092169092179190911760b09190911b63ffffffff60b01b16178155613cd9613cb960608401613c0e565b82805461ffff60d01b191660d09290921b61ffff60d01b16919091179055565b613d08613ce860808401613c0e565b82805461ffff60e01b191660e09290921b61ffff60e01b16919091179055565b613d35613d1760a08401613c1b565b82805460ff60f01b191691151560f01b60ff60f01b16919091179055565b613d68613d4460c08401613c1b565b8280546001600160f81b031691151560f81b6001600160f81b031916919091179055565b5050565b600060208284031215613d7e57600080fd5b8135610f3481613549565b80356001600160601b038116811461353257600080fd5b600060808284031215613db257600080fd5b604051608081018181106001600160401b0382111715613dd457613dd4613464565b604052823581526020830135613de9816138b5565b6020820152613dfa60408401613d89565b6040820152613e0b60608401613d89565b60608201529392505050565b8183823760009101908152919050565b60008235609e19833603018112613ac157600080fd5b8135613e48816138b5565b60ff8116905081548160ff1982161783556020840135613e6781613537565b64ffffffff008160081b168364ffffffffff19841617178455505050505056fed9d16d34ffb15ba3a3d852f0d403e2ce1d691fb54de27ac87cd2f993f3ec330fa2646970667358221220e671c93f59e321b3a5af114a7fc22efeda785a6b62ffeb90af959229ad2d670e64736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c8063ac9650d811610104578063d1f5e21f116100a2578063ee97f7f311610071578063ee97f7f314610461578063fb9523a314610474578063fd32763e14610487578063ff10ca34146104a757600080fd5b8063d1f5e21f146103e7578063d4179cbd146103fa578063d46655f41461040d578063eb9623601461042057600080fd5b8063bfe94713116100de578063bfe94713146103a4578063c0c3a4a5146103b7578063c29b2f20146103ca578063c6a36630146103df57600080fd5b8063ac9650d814610343578063b6c700c014610363578063b9db15b41461038457600080fd5b80634a348da91161017c5780638c7e6dec1161014b5780638c7e6dec146102d057806394e5f369146102e35780639d26bd1c146103035780639e62e7951461032357600080fd5b80634a348da9146102855780636739d3d5146102975780636bcd0d0a146102aa5780637f0f36e3146102bd57600080fd5b806316076e76116101b857806316076e761461021a578063168d3dc41461022f57806319cc31c41461024f5780632c328aa61461026257600080fd5b8063077fce96146101df5780630ea9c984146101e957806314073e32146101f1575b600080fd5b6101e76104c7565b005b6101e7610b54565b6102046101ff366004612ec2565b610e0b565b6040516102119190612f54565b60405180910390f35b610222610f3b565b6040516102119190612f67565b61024261023d366004613012565b610fac565b6040516102119190613053565b61020461025d366004612ec2565b6110a9565b610275610270366004613097565b61110c565b6040519015158152602001610211565b6002545b604051908152602001610211565b6102426102a5366004612ec2565b611194565b6101e76102b83660046130b9565b611256565b6101e76102cb3660046130b9565b61146f565b6101e76102de366004613012565b611642565b6102f66102f1366004613124565b611e9c565b6040516102119190613198565b610316610311366004612ec2565b6120ee565b60405161021191906131fe565b610336610331366004612ec2565b6121fc565b6040516102119190613260565b610356610351366004613012565b61229e565b6040516102119190613273565b610376610371366004612ec2565b6123db565b604051610211929190613328565b610397610392366004612ec2565b612516565b6040516102119190613357565b6103366103b2366004612ec2565b6125f3565b6101e76103c5366004613012565b612610565b6103d2612a16565b6040516102119190613365565b600354610289565b6103166103f5366004612ec2565b612ad7565b6101e76104083660046133a7565b612bda565b6101e761041b36600461340a565b612c58565b61044961042e366004612ec2565b6001602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610211565b600054610449906001600160a01b031681565b610242610482366004613012565b612cd2565b610289610495366004612ec2565b60009081526006602052604090205490565b6104ba6104b5366004612ec2565b612dc7565b6040516102119190613427565b6002541561052e5760405162461bcd60e51b815260206004820152602960248201527f436f76657250726f64756374733a205f70726f647563747320616c7265616479604482015268081b5a59dc985d195960ba1b60648201526084015b60405180910390fd5b600354156105945760405162461bcd60e51b815260206004820152602d60248201527f436f76657250726f64756374733a205f70726f64756374547970657320616c7260448201526c1958591e481b5a59dc985d1959609a1b6064820152608401610525565b600061059e612e24565b90506000816001600160a01b031663a1b8adcb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106049190613447565b90506000826001600160a01b031663c29b2f206040518163ffffffff1660e01b8152600401600060405180830381865afa158015610646573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261066e9190810190613562565b90506000836001600160a01b03166365e90a286040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d49190613685565b90506000836001600160a01b0316632dd96be96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073a9190613685565b905060005b83518110156109d757600284828151811061075c5761075c61369e565b6020908102919091018101518254600181018455600093845292829020815193018054928201516040808401516060850151608086015160a087015160c0909701511515600160f81b026001600160f81b03971515600160f01b0260ff60f01b1961ffff938416600160e01b021662ffffff60e01b19948416600160d01b0261ffff60d01b1963ffffffff909716600160b01b029690961665ffffffffffff60b01b196001600160a01b03998a1662010000026001600160b01b0319909d1695909d16949094179a909a179a909a169190911792909217169590951795909517929092169290921790915590516372ca814160e11b8152600481018390529087169063e595028290602401600060405180830381865afa158015610884573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108ac91908101906136b4565b6000828152600460205260409020906108c590826137c7565b50600081815260066020526040902084518590839081106108e8576108e861369e565b602002602001015160c00151158061091a575084828151811061090d5761090d61369e565b602002602001015160a001515b1561092557506109c5565b60005b838110156109c25760405163e57315cb60e01b815260048101849052602481018290526001600160a01b0389169063e57315cb90604401602060405180830381865afa925050508015610998575060408051601f3d908101601f1916820190925261099591810190613685565b60015b156109c25782546001810184556000848152602090200155806109ba8161389c565b915050610928565b50505b806109cf8161389c565b91505061073f565b5060005b82811015610b4c57604051637c09b0bb60e01b8152600481018290526000906001600160a01b03881690637c09b0bb906024016040805180830381865afa158015610a2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4e91906138c4565b6003805460018101825560009190915281517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054602084015163ffffffff166101000264ffffffffff1990911660ff909316929092179190911790556040516367b7397360e01b8152600481018490529091506001600160a01b038816906367b7397390602401600060405180830381865afa158015610af6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b1e91908101906136b4565b600083815260056020526040902090610b3790826137c7565b50508080610b449061389c565b9150506109db565b505050505050565b6000546040516227050b60e31b815261503160f01b60048201526001600160a01b0390911690630138285890602401602060405180830381865afa158015610ba0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc49190613447565b600160008181526020919091527fcc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792f80546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b815261434f60f01b6004820152911690630138285890602401602060405180830381865afa158015610c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c739190613447565b6004600081815260016020527fedc95719e9a3b28dd8e80877cb5880a9be7de1a13fc8b05e7999683b6b56764380546001600160a01b039485166001600160a01b0319909116179055546040516227050b60e31b81526126a960f11b9281019290925290911690630138285890602401602060405180830381865afa158015610d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d249190613447565b600260009081526001602052600080516020613e8883398151915280546001600160a01b039384166001600160a01b0319909116179055546040516227050b60e31b815261053560f41b6004820152911690630138285890602401602060405180830381865afa158015610d9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc09190613447565b600560005260016020527fe2689cd4a84e23ad2f564004f1c9013e9589d260bde6380aba3ca7e09e4df40c80546001600160a01b0319166001600160a01b0392909216919091179055565b60408051808201909152606081526000602082015260008281526008602052604090205480610e555760408051606081018252600091810182815281526020810191909152610f34565b6000838152600860205260409020610e6e600183613922565b81548110610e7e57610e7e61369e565b9060005260206000209060020201604051806040016040529081600082018054610ea790613747565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed390613747565b8015610f205780601f10610ef557610100808354040283529160200191610f20565b820191906000526020600020905b815481529060010190602001808311610f0357829003601f168201915b505050505081526020016001820154815250505b9392505050565b60606003805480602002602001604051908101604052809291908181526020016000905b82821015610fa3576000848152602090819020604080518082019091529084015460ff81168252610100900463ffffffff1681830152825260019092019101610f5f565b50505050905090565b600254606090826001600160401b03811115610fca57610fca613464565b604051908082528060200260200182016040528015610ff3578160200160208202803683370190505b50915060005b838110156110a15760008585838181106110155761101561369e565b90506020020135905082811061103e576040516379de4af560e01b815260040160405180910390fd5b600281815481106110515761105161369e565b90600052602060002001600001601a9054906101000a900461ffff1661ffff168483815181106110835761108361369e565b602090810291909101015250806110998161389c565b915050610ff9565b505092915050565b604080518082019091526060815260006020820152600082815260076020526040902054806110f35760408051606081018252600091810182815281526020810191909152610f34565b6000838152600760205260409020610e6e600183613922565b60008281526006602052604081205480820361112c57600191505061118e565b60005b8181101561118757600085815260066020526040902080548591908390811061115a5761115a61369e565b9060005260206000200154036111755760019250505061118e565b8061117f8161389c565b91505061112f565b5060009150505b92915050565b600081815260066020526040902054606090806001600160401b038111156111be576111be613464565b6040519080825280602002602001820160405280156111e7578160200160208202803683370190505b50915060005b8181101561124f5760008481526006602052604090208054829081106112155761121561369e565b90600052602060002001548382815181106112325761123261369e565b6020908102919091010152806112478161389c565b9150506111ed565b5050919050565b600260005260016020819052600080516020613e888339815191525460405163505ef22f60e01b815233600482015260248101929092526001600160a01b03169063505ef22f90604401602060405180830381865afa1580156112bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e19190613935565b6112fd5760405162461bcd60e51b815260040161052590613952565b82811461131d57604051632b477e7160e11b815260040160405180910390fd5b60035460005b84811015610b4c57600086868381811061133f5761133f61369e565b9050602002013590508281106113685760405163c3af0fb960e01b815260040160405180910390fd5b84848381811061137a5761137a61369e565b905060200281019061138c9190613998565b90506000036113ae57604051635c1cf85760e11b815260040160405180910390fd5b6008600082815260200190815260200160002060405180604001604052808787868181106113de576113de61369e565b90506020028101906113f09190613998565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093855250504260209384015250835460018101855593815220815191926002020190819061144e90826137c7565b506020820151816001015550505080806114679061389c565b915050611323565b600260005260016020819052600080516020613e888339815191525460405163505ef22f60e01b815233600482015260248101929092526001600160a01b03169063505ef22f90604401602060405180830381865afa1580156114d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fa9190613935565b6115165760405162461bcd60e51b815260040161052590613952565b82811461153657604051632b477e7160e11b815260040160405180910390fd5b60025460005b84811015610b4c5760008686838181106115585761155861369e565b905060200201359050828110611581576040516379de4af560e01b815260040160405180910390fd5b6007600082815260200190815260200160002060405180604001604052808787868181106115b1576115b161369e565b90506020028101906115c39190613998565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093855250504260209384015250835460018101855593815220815191926002020190819061162190826137c7565b5060208201518160010155505050808061163a9061389c565b91505061153c565b600260005260016020819052600080516020613e888339815191525460405163505ef22f60e01b815233600482015260248101929092526001600160a01b03169063505ef22f90604401602060405180830381865afa1580156116a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cd9190613935565b6116e95760405162461bcd60e51b815260040161052590613952565b60001960006116f6612e24565b6001600160a01b0316631246da396040518163ffffffff1660e01b8152600401602060405180830381865afa158015611733573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117579190613685565b90506000611763612e4b565b6001600160a01b0316639bf00f186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c49190613685565b905060006117d0612e57565b6001600160a01b03166367e4ac2c6040518163ffffffff1660e01b8152600401600060405180830381865afa15801561180d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261183591908101906139de565b805190915060005b818110156118ab578281815181106118575761185761369e565b602002602001015160200151801561188a575082818151811061187c5761187c61369e565b602002602001015160400151155b1561189957806001901b861895505b806118a38161389c565b91505061183d565b5060005b86811015611e9257368888838181106118ca576118ca61369e565b90506020028101906118dc9190613aaa565b60035490915060608201906118f46080840183613acb565b61ffff16106119165760405163c3af0fb960e01b815260040160405180910390fd5b6119266060820160408301613ae8565b881663ffffffff161561194c57604051636a5b237960e11b815260040160405180910390fd5b8661195d6080830160608401613acb565b61ffff1610156119805760405163ac50244b60e01b815260040160405180910390fd5b6127106119936080830160608401613acb565b61ffff1611156119b6576040516306e1b30360e11b815260040160405180910390fd5b6127106119c960a0830160808401613acb565b61ffff1611156119ec5760405163267f61c960e21b815260040160405180910390fd5b60006119fc610140840184613b05565b90501115611aa65760005b611a15610140840184613b05565b9050811015611aa45786611a2d610140850185613b05565b83818110611a3d57611a3d61369e565b905060200201351180611a745750611a59610140840184613b05565b82818110611a6957611a6961369e565b905060200201356000145b15611a925760405163e050b05160e01b815260040160405180910390fd5b80611a9c8161389c565b915050611a07565b505b600019826020013503611c28576002546000611ac56040850185613998565b90501115611b6057600081815260076020526040908190208151808301835290918190611af490870187613998565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505042602093840152508354600181018555938152208151919260020201908190611b5290826137c7565b506020820151816001015550505b611b6a8380613998565b600083815260046020526040902091611b84919083613b4e565b50611b93610140840184613b05565b6000838152600660205260409020611bac929091612e62565b506002805460018101825560009190915282907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace01611beb8282613c28565b50506040518181527fe757b28b33896bc8918816faf8078f9ec27409af77ad80806d7196478897149b9060200160405180910390a1505050611e80565b600254602083013510611c4e576040516379de4af560e01b815260040160405180910390fd5b60006002836020013581548110611c6757611c6761369e565b60009182526020909120019050611c8460c0830160a08401613d6c565b8154901515600160f01b0260ff60f01b19909116178155611cab6060830160408401613ae8565b815463ffffffff91909116600160b01b0263ffffffff60b01b19909116178155611cdb6080830160608401613acb565b815461ffff91909116600160d01b0261ffff60d01b19909116178155611d0760a0830160808401613acb565b815461ffff91909116600160e01b0261ffff60e01b19909116178155611d31610140840184613b05565b6020808601356000908152600690915260409020611d50929091612e62565b506000611d5d8480613998565b90501115611d9157611d6f8380613998565b602080860135600090815260049091526040902091611d8f919083613b4e565b505b6000611da06040850185613998565b90501115611e465760076000846020013581526020019081526020016000206040518060400160405280858060400190611dda9190613998565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505042602093840152508354600181018555938152208151919260020201908190611e3890826137c7565b506020820151816001015550505b60405160208085013582527fe757b28b33896bc8918816faf8078f9ec27409af77ad80806d7196478897149b910160405180910390a15050505b80611e8a8161389c565b9150506118af565b5050505050505050565b60025460609082806001600160401b03811115611ebb57611ebb613464565b604051908082528060200260200182016040528015611f0d57816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181611ed95790505b50925060005b818110156120e5576000868683818110611f2f57611f2f61369e565b905060800201600001359050838110611f5b576040516379de4af560e01b815260040160405180910390fd5b60008181526006602052604090205415611f8b57604051635d46ff4160e01b815260048101829052602401610525565b600060028281548110611fa057611fa061369e565b60009182526020918290206040805160e081018252919092015461ffff80821683526001600160a01b03620100008304169483019490945263ffffffff600160b01b82041692820192909252600160d01b820483166060820152600160e01b8204909216608083015260ff600160f01b8204811615801560a0850152600160f81b90920416151560c083015290915061204c57604051631340cecb60e21b815260040160405180910390fd5b87878481811061205e5761205e61369e565b9050608002018036038101906120749190613da0565b8684815181106120865761208661369e565b6020026020010181905250806060015161ffff168684815181106120ac576120ac61369e565b6020026020010151604001906001600160601b031690816001600160601b031681525050505080806120dd9061389c565b915050611f13565b50505092915050565b606060076000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156121f1578382906000526020600020906002020160405180604001604052908160008201805461215690613747565b80601f016020809104026020016040519081016040528092919081815260200182805461218290613747565b80156121cf5780601f106121a4576101008083540402835291602001916121cf565b820191906000526020600020905b8154815290600101906020018083116121b257829003601f168201915b5050505050815260200160018201548152505081526020019060010190612123565b505050509050919050565b600081815260046020526040902080546060919061221990613747565b80601f016020809104026020016040519081016040528092919081815260200182805461224590613747565b80156122925780601f1061226757610100808354040283529160200191612292565b820191906000526020600020905b81548152906001019060200180831161227557829003601f168201915b50505050509050919050565b606081806001600160401b038111156122b9576122b9613464565b6040519080825280602002602001820160405280156122ec57816020015b60608152602001906001900390816122d75790505b50915060005b818110156110a157600080308787858181106123105761231061369e565b90506020028101906123229190613998565b604051612330929190613e17565b600060405180830381855af49150503d806000811461236b576040519150601f19603f3d011682016040523d82523d6000602084013e612370565b606091505b5091509150816123a857805160008190036123a15760405163f1a8c42d60e01b815260048101859052602401610525565b8060208301fd5b808584815181106123bb576123bb61369e565b6020026020010181905250505080806123d39061389c565b9150506122f2565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915260408051808201909152600080825260208201526002838154811061243b5761243b61369e565b60009182526020918290206040805160e081018252929091015461ffff8082168085526001600160a01b03620100008404169585019590955263ffffffff600160b01b83041692840192909252600160d01b810482166060840152600160e01b8104909116608083015260ff600160f01b82048116151560a0840152600160f81b90910416151560c082015260038054919450919081106124de576124de61369e565b60009182526020918290206040805180820190915291015460ff81168252610100900463ffffffff1691810191909152919391925050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152600282815481106125625761256261369e565b60009182526020918290206040805160e081018252919092015461ffff80821683526001600160a01b03620100008304169483019490945263ffffffff600160b01b82041692820192909252600160d01b820483166060820152600160e01b8204909216608083015260ff600160f01b82048116151560a0840152600160f81b90910416151560c082015292915050565b600081815260056020526040902080546060919061221990613747565b600260005260016020819052600080516020613e888339815191525460405163505ef22f60e01b815233600482015260248101929092526001600160a01b03169063505ef22f90604401602060405180830381865afa158015612677573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269b9190613935565b6126b75760405162461bcd60e51b815260040161052590613952565b60005b81811015612a1157368383838181106126d5576126d561369e565b90506020028101906126e79190613e27565b905060001981602001350361285d576003546127066040830183613998565b905060000361272857604051635c1cf85760e11b815260040160405180910390fd5b60008181526008602052604090819020815180830183529091819061274f90860186613998565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050426020938401525083546001810185559381522081519192600202019081906127ad90826137c7565b50602091909101516001909101556127c58280613998565b6000838152600560205260409020916127df919083613b4e565b506003805460018101825560009190915260608301907fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b016128218282613e3d565b50506040518181527fd88b8450ea1e752935616a2e6cb78fbb30e68c5fb6859a9edcb110a95e5f882a9060200160405180910390a150506129ff565b6003546020820135106128835760405163c3af0fb960e01b815260040160405180910390fd5b61289360a0820160808301613ae8565b60038260200135815481106128aa576128aa61369e565b60009182526020822001805463ffffffff939093166101000264ffffffff0019909316929092179091556128de8280613998565b90501115612912576128f08180613998565b602080840135600090815260059091526040902091612910919083613b4e565b505b60006129216040830183613998565b905011156129c7576008600082602001358152602001908152602001600020604051806040016040528083806040019061295b9190613998565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050426020938401525083546001810185559381522081519192600202019081906129b990826137c7565b506020820151816001015550505b60405160208083013582527fd88b8450ea1e752935616a2e6cb78fbb30e68c5fb6859a9edcb110a95e5f882a910160405180910390a1505b80612a098161389c565b9150506126ba565b505050565b60606002805480602002602001604051908101604052809291908181526020016000905b82821015610fa35760008481526020908190206040805160e0810182529185015461ffff80821684526001600160a01b03620100008304168486015263ffffffff600160b01b83041692840192909252600160d01b810482166060840152600160e01b8104909116608083015260ff600160f01b82048116151560a0840152600160f81b90910416151560c0820152825260019092019101612a3a565b606060086000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156121f15783829060005260206000209060020201604051806040016040529081600082018054612b3f90613747565b80601f0160208091040260200160405190810160405280929190818152602001828054612b6b90613747565b8015612bb85780601f10612b8d57610100808354040283529160200191612bb8565b820191906000526020600020905b815481529060010190602001808311612b9b57829003601f168201915b5050505050815260200160018201548152505081526020019060010190612b0c565b60005b82811015612c5257612c07848483818110612bfa57612bfa61369e565b905060200201358361110c565b612c4057838382818110612c1d57612c1d61369e565b90506020020135604051635d46ff4160e01b815260040161052591815260200190565b80612c4a8161389c565b915050612bdd565b50505050565b6000546001600160a01b031615612cb0576000546001600160a01b03163314612cb05760405162461bcd60e51b815260206004820152600a6024820152692737ba1036b0b9ba32b960b11b6044820152606401610525565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254606090826001600160401b03811115612cf057612cf0613464565b604051908082528060200260200182016040528015612d19578160200160208202803683370190505b50915060005b838110156110a1576000858583818110612d3b57612d3b61369e565b905060200201359050828110612d64576040516379de4af560e01b815260040160405180910390fd5b60028181548110612d7757612d7761369e565b90600052602060002001600001601c9054906101000a900461ffff1661ffff16848381518110612da957612da961369e565b60209081029190910101525080612dbf8161389c565b915050612d1f565b604080518082019091526000808252602082015260038281548110612dee57612dee61369e565b60009182526020918290206040805180820190915291015460ff81168252610100900463ffffffff169181019190915292915050565b600060018160045b81526020810191909152604001600020546001600160a01b0316919050565b60006001816005612e2c565b600060018181612e2c565b828054828255906000526020600020908101928215612e9d579160200282015b82811115612e9d578235825591602001919060010190612e82565b50612ea9929150612ead565b5090565b5b80821115612ea95760008155600101612eae565b600060208284031215612ed457600080fd5b5035919050565b60005b83811015612ef6578181015183820152602001612ede565b50506000910152565b60008151808452612f17816020860160208601612edb565b601f01601f19169290920160200192915050565b6000815160408452612f406040850182612eff565b602093840151949093019390935250919050565b602081526000610f346020830184612f2b565b602080825282518282018190526000919060409081850190868401855b82811015612fba57612faa848351805160ff16825260209081015163ffffffff16910152565b9284019290850190600101612f84565b5091979650505050505050565b60008083601f840112612fd957600080fd5b5081356001600160401b03811115612ff057600080fd5b6020830191508360208260051b850101111561300b57600080fd5b9250929050565b6000806020838503121561302557600080fd5b82356001600160401b0381111561303b57600080fd5b61304785828601612fc7565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561308b5783518352928401929184019160010161306f565b50909695505050505050565b600080604083850312156130aa57600080fd5b50508035926020909101359150565b600080600080604085870312156130cf57600080fd5b84356001600160401b03808211156130e657600080fd5b6130f288838901612fc7565b9096509450602087013591508082111561310b57600080fd5b5061311887828801612fc7565b95989497509550505050565b6000806020838503121561313757600080fd5b82356001600160401b038082111561314e57600080fd5b818501915085601f83011261316257600080fd5b81358181111561317157600080fd5b8660208260071b850101111561318657600080fd5b60209290920196919550909350505050565b602080825282518282018190526000919060409081850190868401855b82811015612fba578151805185528681015160ff1687860152858101516001600160601b03908116878701526060918201511690850152608090930192908501906001016131b5565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561325357603f19888603018452613241858351612f2b565b94509285019290850190600101613225565b5092979650505050505050565b602081526000610f346020830184612eff565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561325357603f198886030184526132b6858351612eff565b9450928501929085019060010161329a565b61ffff80825116835260018060a01b03602083015116602084015263ffffffff60408301511660408401528060608301511660608401528060808301511660808401525060a0810151151560a083015260c0810151151560c08301525050565b610120810161333782856132c8565b825160ff1660e0830152602083015163ffffffff16610100830152610f34565b60e0810161118e82846132c8565b6020808252825182820181905260009190848201906040850190845b8181101561308b576133948385516132c8565b9284019260e09290920191600101613381565b6000806000604084860312156133bc57600080fd5b83356001600160401b038111156133d257600080fd5b6133de86828701612fc7565b909790965060209590950135949350505050565b6001600160a01b038116811461340757600080fd5b50565b60006020828403121561341c57600080fd5b8135610f34816133f2565b815160ff16815260208083015163ffffffff16908201526040810161118e565b60006020828403121561345957600080fd5b8151610f34816133f2565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b038111828210171561349c5761349c613464565b60405290565b604051606081016001600160401b038111828210171561349c5761349c613464565b604051601f8201601f191681016001600160401b03811182821017156134ec576134ec613464565b604052919050565b60006001600160401b0382111561350d5761350d613464565b5060051b60200190565b61ffff8116811461340757600080fd5b805161353281613517565b919050565b63ffffffff8116811461340757600080fd5b801515811461340757600080fd5b805161353281613549565b6000602080838503121561357557600080fd5b82516001600160401b0381111561358b57600080fd5b8301601f8101851361359c57600080fd5b80516135af6135aa826134f4565b6134c4565b81815260e091820283018401918482019190888411156135ce57600080fd5b938501935b838510156136795780858a0312156135eb5760008081fd5b6135f361347a565b85516135fe81613517565b81528587015161360d816133f2565b8188015260408681015161362081613537565b9082015260608681015161363381613517565b908201526080613644878201613527565b9082015260a0613655878201613557565b9082015260c0613666878201613557565b90820152835293840193918501916135d3565b50979650505050505050565b60006020828403121561369757600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156136c657600080fd5b81516001600160401b03808211156136dd57600080fd5b818401915084601f8301126136f157600080fd5b81518181111561370357613703613464565b613716601f8201601f19166020016134c4565b915080825285602082850101111561372d57600080fd5b61373e816020840160208601612edb565b50949350505050565b600181811c9082168061375b57607f821691505b60208210810361377b57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612a1157600081815260208120601f850160051c810160208610156137a85750805b601f850160051c820191505b81811015610b4c578281556001016137b4565b81516001600160401b038111156137e0576137e0613464565b6137f4816137ee8454613747565b84613781565b602080601f83116001811461382957600084156138115750858301515b600019600386901b1c1916600185901b178555610b4c565b600085815260208120601f198616915b8281101561385857888601518255948401946001909101908401613839565b50858210156138765787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b6000600182016138ae576138ae613886565b5060010190565b60ff8116811461340757600080fd5b6000604082840312156138d657600080fd5b604051604081018181106001600160401b03821117156138f8576138f8613464565b6040528251613906816138b5565b8152602083015161391681613537565b60208201529392505050565b8181038181111561118e5761118e613886565b60006020828403121561394757600080fd5b8151610f3481613549565b60208082526026908201527f43616c6c6572206973206e6f7420616e2061647669736f727920626f6172642060408201526536b2b6b132b960d11b606082015260800190565b6000808335601e198436030181126139af57600080fd5b8301803591506001600160401b038211156139c957600080fd5b60200191503681900382131561300b57600080fd5b600060208083850312156139f157600080fd5b82516001600160401b03811115613a0757600080fd5b8301601f81018513613a1857600080fd5b8051613a266135aa826134f4565b81815260609182028301840191848201919088841115613a4557600080fd5b938501935b838510156136795780858a031215613a625760008081fd5b613a6a6134a2565b8551613a75816133f2565b815285870151613a8481613549565b81880152604086810151613a9781613549565b9082015283529384019391850191613a4a565b6000823561015e19833603018112613ac157600080fd5b9190910192915050565b600060208284031215613add57600080fd5b8135610f3481613517565b600060208284031215613afa57600080fd5b8135610f3481613537565b6000808335601e19843603018112613b1c57600080fd5b8301803591506001600160401b03821115613b3657600080fd5b6020019150600581901b360382131561300b57600080fd5b6001600160401b03831115613b6557613b65613464565b613b7983613b738354613747565b83613781565b6000601f841160018114613bad5760008515613b955750838201355b600019600387901b1c1916600186901b178355613c07565b600083815260209020601f19861690835b82811015613bde5786850135825560209485019460019092019101613bbe565b5086821015613bfb5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b6000813561118e81613517565b6000813561118e81613549565b8135613c3381613517565b61ffff8116905081548161ffff1982161783556020840135613c54816133f2565b62010000600160b01b0360109190911b166001600160b01b031982168317811784556040850135613c8481613537565b6001600160d01b0319929092169092179190911760b09190911b63ffffffff60b01b16178155613cd9613cb960608401613c0e565b82805461ffff60d01b191660d09290921b61ffff60d01b16919091179055565b613d08613ce860808401613c0e565b82805461ffff60e01b191660e09290921b61ffff60e01b16919091179055565b613d35613d1760a08401613c1b565b82805460ff60f01b191691151560f01b60ff60f01b16919091179055565b613d68613d4460c08401613c1b565b8280546001600160f81b031691151560f81b6001600160f81b031916919091179055565b5050565b600060208284031215613d7e57600080fd5b8135610f3481613549565b80356001600160601b038116811461353257600080fd5b600060808284031215613db257600080fd5b604051608081018181106001600160401b0382111715613dd457613dd4613464565b604052823581526020830135613de9816138b5565b6020820152613dfa60408401613d89565b6040820152613e0b60608401613d89565b60608201529392505050565b8183823760009101908152919050565b60008235609e19833603018112613ac157600080fd5b8135613e48816138b5565b60ff8116905081548160ff1982161783556020840135613e6781613537565b64ffffffff008160081b168364ffffffffff19841617178455505050505056fed9d16d34ffb15ba3a3d852f0d403e2ce1d691fb54de27ac87cd2f993f3ec330fa2646970667358221220e671c93f59e321b3a5af114a7fc22efeda785a6b62ffeb90af959229ad2d670e64736f6c63430008120033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.