Overview
POL Balance
0 POL
POL Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 16 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL | |||
40069404 | 645 days ago | Contract Creation | 0 POL |
Loading...
Loading
Contract Name:
ZeemcoinDeployer
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.16; import {ZeemcoinToken} from "./ZeemcoinToken.sol"; import {ZeemcoinDistributionVaultAllocation} from "./ZeemcoinDistributionVaultAllocation.sol"; import {ZeemcoinDistributionVaultMerkle} from "./ZeemcoinDistributionVaultMerkle.sol"; import {ZeemcoinDistributionVaultMerkleVesting} from "./ZeemcoinDistributionVaultMerkleVesting.sol"; import {ZeemcoinStaking} from "./ZeemcoinStaking.sol"; import {ZeemcoinFarming} from "./ZeemcoinFarming.sol"; import {ERC1967Proxy} from "openzeppelin-contracts/proxy/ERC1967/ERC1967Proxy.sol"; import {IERC20Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import {SafeERC20Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; uint256 constant ONE_YEAR = 365 days; uint256 constant ONE_MONTH = 30 days; address constant UV2_FACTORY = address(0xc35DADB65012eC5796536bD9864eD8773aBc74C4); address constant UV2_ROUTER = address(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506); address constant IDO = address(0xb2D987F2a5FE094ef1C7377287481dB4ECdaA05b); address constant RESERVES = address(0x3f95Eac04c1E3E7fFebe8FBaDc026545D71db865); address constant MARKETING = address(0x0d0509102C23BFeca208782dC5E48fC652b5c7EA); address constant ADVISORS = address(0x86E4068356aCB128E3BecEbEDC13bAeFc32b4d22); uint256 constant TOKEN_POOL_AMOUNT = 1e5 ether; contract ZeemcoinDeployer { using SafeERC20Upgradeable for IERC20Upgradeable; IERC20Upgradeable public token; address public privateVault; address public advisorsVault; address public airdropsVault; address public marketingVault; address public rewardsVault; address public teamVault; address public yieldVault; address public staking; address public farming; address public pool; constructor(address ms, uint256 timestamp, address feed, IERC20Upgradeable wbtc) { { ZeemcoinToken tokenImplementation = new ZeemcoinToken(); bytes memory tokenInitializeData = abi.encodeWithSelector(ZeemcoinToken.initialize.selector, ms); address tokenAddress = _createProxy(address(tokenImplementation), tokenInitializeData); token = IERC20Upgradeable(tokenAddress); } address merkleVestingImplementationAddress = address(new ZeemcoinDistributionVaultMerkleVesting()); address allocationImplementationAddress = address(new ZeemcoinDistributionVaultAllocation()); address merkleImplementationAddress = address(new ZeemcoinDistributionVaultMerkle()); if (timestamp == 0) { // solhint-disable-next-line timestamp = block.timestamp; } { uint256 idoAmount = 833333 ether; token.safeTransfer(IDO, idoAmount); } { uint256 privateAmount = 12e6 ether; uint256 tgePercentage = 0.1 ether; uint256 startDate = timestamp - (tgePercentage * 11 * ONE_MONTH / (1 ether - tgePercentage)); bytes memory privateInitializeData = abi.encodeWithSelector( ZeemcoinDistributionVaultMerkleVesting.initialize.selector, ms, address(token), startDate, timestamp + (11 * ONE_MONTH), bytes32(0xde5b16da8ce8ab6c94f577d9f68f29b494412cb8f8f05d123c3ad0f2724bc2ef), "ipfs://QmU7AxRNYTG9JvXZM2fRP13Ui5zVs8WT2fMJ8Q6CCeUCHQ" ); privateVault = _createProxy(merkleVestingImplementationAddress, privateInitializeData); token.safeTransfer(privateVault, privateAmount); } { uint256 advisorsAmount = 4e6 ether; bytes memory advisorsInitializeData = abi.encodeWithSelector( ZeemcoinDistributionVaultAllocation.initialize.selector, ms, address(token), 1, advisorsAmount, timestamp, timestamp + (5 * ONE_YEAR) ); advisorsVault = _createProxy(allocationImplementationAddress, advisorsInitializeData); token.safeTransfer(advisorsVault, advisorsAmount); } { uint256 airdropsAmount = 4e5 ether; bytes memory airdropsInitializeData = abi.encodeWithSelector(ZeemcoinDistributionVaultMerkle.initialize.selector, ms, address(token)); airdropsVault = _createProxy(merkleImplementationAddress, airdropsInitializeData); token.safeTransfer(airdropsVault, airdropsAmount); } { uint256 marketingAmount = 665e4 ether; bytes memory marketingInitializeData = abi.encodeWithSelector( ZeemcoinDistributionVaultAllocation.initialize.selector, ms, address(token), 1, marketingAmount, timestamp, timestamp + (2 * ONE_YEAR) ); marketingVault = _createProxy(allocationImplementationAddress, marketingInitializeData); token.safeTransfer(marketingVault, marketingAmount); } { uint256 rewardsAmount = 3e7 ether; bytes memory rewardsInitializeData = abi.encodeWithSelector(ZeemcoinDistributionVaultMerkle.initialize.selector, ms, address(token)); rewardsVault = _createProxy(merkleImplementationAddress, rewardsInitializeData); token.safeTransfer(rewardsVault, rewardsAmount); } { uint256 yieldAmount = 3e7 ether; bytes memory yieldInitializeData = abi.encodeWithSelector( ZeemcoinDistributionVaultAllocation.initialize.selector, ms, address(token), 2, yieldAmount, timestamp, timestamp + (5 * ONE_YEAR) ); yieldVault = _createProxy(allocationImplementationAddress, yieldInitializeData); token.safeTransfer(yieldVault, yieldAmount); } { uint256 teamAmount = 1e7 ether; bytes32 emptyMerkle; string memory emptyUri; bytes memory teamInitializeData = abi.encodeWithSelector( ZeemcoinDistributionVaultMerkleVesting.initialize.selector, ms, address(token), timestamp + (8 * ONE_MONTH), timestamp + (20 * ONE_MONTH), emptyMerkle, emptyUri ); teamVault = _createProxy(merkleVestingImplementationAddress, teamInitializeData); token.safeTransfer(teamVault, teamAmount); } { address stakingImplementationAddress = address(new ZeemcoinStaking()); bytes memory stakingInitializeData = abi.encodeWithSelector( ZeemcoinStaking.initialize.selector, ms, yieldVault, token, 30 days, 0.1 ether, 10 ether ); staking = _createProxy(stakingImplementationAddress, stakingInitializeData); } uint256 wbtcAmount; { AggregatorV3Interface aggregatorInterface = AggregatorV3Interface(feed); uint256 decimals = aggregatorInterface.decimals(); //8 int256 answer = aggregatorInterface.latestAnswer(); uint256 btcToUsdPrice = uint256(answer) * 1 ether / (10 ** decimals); wbtcAmount = TOKEN_POOL_AMOUNT * 1e8 * uint256(25) / uint256(100) / btcToUsdPrice; //2e5 ZEEM * WBTC_decimals * ZEEM_USD_PRICE / BTC_USD_PRICE wbtc.safeTransferFrom(ms, address(this), wbtcAmount); wbtc.approve(UV2_ROUTER, wbtcAmount); token.approve(UV2_ROUTER, TOKEN_POOL_AMOUNT); } { IUniswapV2Router01 router = IUniswapV2Router01(UV2_ROUTER); require(wbtcAmount != 0, ""); (,, uint256 liquidity) = router.addLiquidity( address(token), address(wbtc), TOKEN_POOL_AMOUNT, wbtcAmount, TOKEN_POOL_AMOUNT, wbtcAmount, RESERVES, // solhint-disable-next-line block.timestamp + 5 minutes ); IUniswapV2Factory factory = IUniswapV2Factory(UV2_FACTORY); pool = factory.getPair(address(token), address(wbtc)); require(pool != address(0), ""); IERC20Upgradeable lpToken = IERC20Upgradeable(pool); uint256 lpBalance = lpToken.balanceOf(RESERVES); require(lpBalance == liquidity, ""); token.safeTransfer(RESERVES, token.balanceOf(address(this))); } { address farmingImplementationAddress = address(new ZeemcoinFarming()); bytes memory farmingInitializeData = abi.encodeWithSelector(ZeemcoinFarming.initialize.selector, ms, yieldVault, pool); farming = _createProxy(farmingImplementationAddress, farmingInitializeData); } { uint256[] memory allocations = new uint256[](uint256(1)); allocations[0] = 100 ether; ZeemcoinDistributionVaultAllocation(yieldVault).addAccount(farming, allocations); uint256[] memory allocations2 = new uint256[](uint256(2)); allocations2[0] = 75 ether; allocations2[1] = 25 ether; ZeemcoinDistributionVaultAllocation(yieldVault).addAccount(staking, allocations2); } { uint256[] memory allocations = new uint256[](uint256(1)); allocations[0] = 100 ether; ZeemcoinDistributionVaultAllocation(marketingVault).addAccount(MARKETING, allocations); } { uint256[] memory allocations = new uint256[](uint256(1)); allocations[0] = 100 ether; ZeemcoinDistributionVaultAllocation(advisorsVault).addAccount(ADVISORS, allocations); } } function _createProxy(address proxyImplementation, bytes memory initializeCalldata) private returns (address proxyAddress) { proxyAddress = address(new ERC1967Proxy(proxyImplementation, initializeCalldata)); } } interface UV2Library { function pairFor(address factory, address tokenA, address tokenB) external pure returns (address); } interface AggregatorV3Interface { function decimals() external view returns (uint8); function latestAnswer() external view returns (int256 answer); } interface IUniswapV2Factory { function getPair(address tokenA, address tokenB) external view returns (address pair); } interface IUniswapV2Router01 { function factory() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol) pragma solidity ^0.8.0; import "../Proxy.sol"; import "./ERC1967Upgrade.sol"; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. */ contract ERC1967Proxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded * function call, and allows initializing the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) payable { _upgradeToAndCall(_logic, _data, false); } /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { return ERC1967Upgrade._getImplementation(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../interfaces/draft-IERC1822.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overridden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol) pragma solidity ^0.8.0; import "./OwnableUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable { function __Ownable2Step_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable2Step_init_unchained() internal onlyInitializing { } address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() external { address sender = _msgSender(); require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner"); _transferOwnership(sender); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// 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 IERC20Upgradeable { /** * @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.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../utils/ContextUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable { function __ERC20Burnable_init() internal onlyInitializing { } function __ERC20Burnable_init_unchained() internal onlyInitializing { } /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Capped.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC20} that adds a cap to the supply of tokens. * * @custom:storage-size 51 */ abstract contract ERC20CappedUpgradeable is Initializable, ERC20Upgradeable { uint256 private _cap; /** * @dev Sets the value of the `cap`. This value is immutable, it can only be * set once during construction. */ function __ERC20Capped_init(uint256 cap_) internal onlyInitializing { __ERC20Capped_init_unchained(cap_); } function __ERC20Capped_init_unchained(uint256 cap_) internal onlyInitializing { require(cap_ > 0, "ERC20Capped: cap is 0"); _cap = cap_; } /** * @dev Returns the cap on the token's total supply. */ function cap() public view virtual returns (uint256) { return _cap; } /** * @dev See {ERC20-_mint}. */ function _mint(address account, uint256 amount) internal virtual override { require(ERC20Upgradeable.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded"); super._mint(account, amount); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../utils/ArraysUpgradeable.sol"; import "../../../utils/CountersUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and * total supply at the time are recorded for later access. * * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting. * In naive implementations it's possible to perform a "double spend" attack by reusing the same balance from different * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be * used to create an efficient ERC20 forking mechanism. * * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id * and the account address. * * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it * return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract. * * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient * alternative consider {ERC20Votes}. * * ==== Gas Costs * * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much * smaller since identical balances in subsequent snapshots are stored as a single entry. * * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent * transfers will have normal cost until the next snapshot, and so on. */ abstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable { function __ERC20Snapshot_init() internal onlyInitializing { } function __ERC20Snapshot_init_unchained() internal onlyInitializing { } // Inspired by Jordi Baylina's MiniMeToken to record historical balances: // https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol using ArraysUpgradeable for uint256[]; using CountersUpgradeable for CountersUpgradeable.Counter; // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a // Snapshot struct, but that would impede usage of functions that work on an array. struct Snapshots { uint256[] ids; uint256[] values; } mapping(address => Snapshots) private _accountBalanceSnapshots; Snapshots private _totalSupplySnapshots; // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid. CountersUpgradeable.Counter private _currentSnapshotId; /** * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created. */ event Snapshot(uint256 id); /** * @dev Creates a new snapshot and returns its snapshot id. * * Emits a {Snapshot} event that contains the same id. * * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a * set of accounts, for example using {AccessControl}, or it may be open to the public. * * [WARNING] * ==== * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking, * you must consider that it can potentially be used by attackers in two ways. * * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs * section above. * * We haven't measured the actual numbers; if this is something you're interested in please reach out to us. * ==== */ function _snapshot() internal virtual returns (uint256) { _currentSnapshotId.increment(); uint256 currentId = _getCurrentSnapshotId(); emit Snapshot(currentId); return currentId; } /** * @dev Get the current snapshotId */ function _getCurrentSnapshotId() internal view virtual returns (uint256) { return _currentSnapshotId.current(); } /** * @dev Retrieves the balance of `account` at the time `snapshotId` was created. */ function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) { (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]); return snapshotted ? value : balanceOf(account); } /** * @dev Retrieves the total supply at the time `snapshotId` was created. */ function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) { (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots); return snapshotted ? value : totalSupply(); } // Update balance and/or total supply snapshots before the values are modified. This is implemented // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations. function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); if (from == address(0)) { // mint _updateAccountSnapshot(to); _updateTotalSupplySnapshot(); } else if (to == address(0)) { // burn _updateAccountSnapshot(from); _updateTotalSupplySnapshot(); } else { // transfer _updateAccountSnapshot(from); _updateAccountSnapshot(to); } } function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) { require(snapshotId > 0, "ERC20Snapshot: id is 0"); require(snapshotId <= _getCurrentSnapshotId(), "ERC20Snapshot: nonexistent id"); // When a valid snapshot is queried, there are three possibilities: // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds // to this id is the current one. // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the // requested id, and its value is the one to return. // c) More snapshots were created after the requested one, and the queried value was later modified. There will be // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is // larger than the requested one. // // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does // exactly this. uint256 index = snapshots.ids.findUpperBound(snapshotId); if (index == snapshots.ids.length) { return (false, 0); } else { return (true, snapshots.values[index]); } } function _updateAccountSnapshot(address account) private { _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account)); } function _updateTotalSupplySnapshot() private { _updateSnapshot(_totalSupplySnapshots, totalSupply()); } function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private { uint256 currentId = _getCurrentSnapshotId(); if (_lastSnapshotId(snapshots.ids) < currentId) { snapshots.ids.push(currentId); snapshots.values.push(currentValue); } } function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) { if (ids.length == 0) { return 0; } else { return ids[ids.length - 1]; } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[46] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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 IERC20PermitUpgradeable { /** * @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.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable 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( IERC20Upgradeable 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( IERC20Upgradeable 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( IERC20Upgradeable 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( IERC20PermitUpgradeable 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(IERC20Upgradeable 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.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Arrays.sol) pragma solidity ^0.8.0; import "./StorageSlotUpgradeable.sol"; import "./math/MathUpgradeable.sol"; /** * @dev Collection of functions related to array types. */ library ArraysUpgradeable { using StorageSlotUpgradeable for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { if (array.length == 0) { return 0; } uint256 low = 0; uint256 high = array.length; while (low < high) { uint256 mid = MathUpgradeable.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds down (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.AddressSlot storage) { bytes32 slot; /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.Bytes32Slot storage) { bytes32 slot; /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlotUpgradeable.Uint256Slot storage) { bytes32 slot; /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library CountersUpgradeable { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument. mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "APPROVE_FAILED"); } }
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.9; import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; import {IERC20Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import {ERC20BurnableUpgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import {SafeERC20Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import {IDistributionVaultAllocation} from "../interfaces/IDistributionVaultAllocation.sol"; abstract contract StakingUpgradeable is Initializable { using SafeERC20Upgradeable for IERC20Upgradeable; struct User { uint256 balance; uint256 rewardDebt; } struct General { uint256 accRewardsPerShare; uint256 released; uint256 lastUpdate; uint256 balance; } address private _vault; IERC20Upgradeable private _token; General private _general; mapping(address => User) private _users; mapping(address => mapping(address => bool)) private _approvals; event InitStakingUpgradeable(address vault, address token); /// @notice Event emitted when the staking account deposits funds event Deposit(address indexed account, uint256 amount); /// @notice Event emitted when the staking account withdraws funds event Withdraw(address indexed account, uint256 amount); /// @notice Event emitted when the staking account claims rewards event Claim(address indexed account, uint256 amount); /// @notice Event emitted when the staking account claims rewards event Approval(address indexed account, address indexed approved, bool status); /// @notice Event emitted when the staking account receives rewards event Rewards(address indexed account, uint256 amount); /// @notice Event emitted when real balance and virtual balance are synced event SyncBalance(address indexed recipient, uint256 amount); /// @notice Event emitted when the staking contract is updated event Update(uint256 accRewardsPerShare, uint256 released, uint256 lastUpdate); modifier onEachAction(address account) { _onEachAction(account); _; } constructor() { _disableInitializers(); } function token() public view returns (address) { return address(_token); } function vault() public view returns (address) { return _vault; } function general() public view returns (General memory) { return _general; } function accRewardsPerShare() public view returns (uint256) { return _general.accRewardsPerShare; } function lastUpdate() public view returns (uint256) { return _general.lastUpdate; } function balance() public view returns (uint256) { return _token.balanceOf(address(this)); } function user(address account) public view returns (User memory) { return _users[account]; } function balanceOf(address account) public view returns (uint256) { return _users[account].balance; } function approval(address owner, address spender) public view returns (bool) { return _approvals[owner][spender]; } function pendingRewards(address account) public view returns (uint256) { return _pendingRewards(account); } function deposit(address account, uint256 amount) public virtual onEachAction(account) { require(account == msg.sender || _approvals[account][msg.sender], "Staking: 001"); require(amount > 0, "Staking: 002"); _users[account].balance += amount; _users[account].rewardDebt = _users[account].balance * _general.accRewardsPerShare / 1 ether; _general.balance += amount; _token.safeTransferFrom(account, address(this), amount); emit Deposit(account, amount); } function withdraw(address account, uint256 amount) public virtual onEachAction(account) { require(account == msg.sender || _approvals[account][msg.sender], "Staking: 001"); require(amount > 0, "Staking: 002"); require(amount <= _users[account].balance, "Staking: 003"); _users[account].balance -= amount; _users[account].rewardDebt = _users[account].balance * _general.accRewardsPerShare / 1 ether; _general.balance -= amount; _token.safeTransfer(account, amount); emit Withdraw(account, amount); } function claim(address account) public virtual { _update(); uint256 pending = _pendingRewards(account); require(pending != 0, "Staking: 004"); _reward(account); _users[account].rewardDebt = _users[account].balance * _general.accRewardsPerShare / 1 ether; emit Claim(account, pending); } function approve(address account) public virtual { _approvals[msg.sender][account] = true; emit Approval(msg.sender, account, true); } function disapprove(address account) public virtual { _approvals[msg.sender][account] = false; emit Approval(msg.sender, account, false); } function syncBalance(address recipient) public { _authorizeSyncBalance(); uint256 amount = _token.balanceOf(address(this)) - _general.balance; _token.safeTransfer(recipient, amount); emit SyncBalance(recipient, amount); } function _authorizeSyncBalance() internal virtual; function _pendingRewards(address account) internal view returns (uint256) { uint256 _balance = _token.balanceOf(address(this)); uint256 _accRewardsPerShare = _general.accRewardsPerShare; // solhint-disable-next-line not-rely-on-time if (_balance != 0 && block.timestamp > _general.lastUpdate) { IDistributionVaultAllocation dvInterface = IDistributionVaultAllocation(_vault); uint256 _released = dvInterface.released(address(this)) - _general.released; _accRewardsPerShare = _accRewardsPerShare + (_released * 1 ether / _balance); } return (_users[account].balance * _accRewardsPerShare / 1 ether) - _users[account].rewardDebt; } function _update() internal { uint256 balance_ = _token.balanceOf(address(this)); if (balance_ == 0) { // solhint-disable-next-line not-rely-on-time _general.lastUpdate = block.timestamp; return; } IDistributionVaultAllocation dvInterface = IDistributionVaultAllocation(_vault); uint256 released = dvInterface.released(address(this)) - _general.released; _general.released += released; _general.accRewardsPerShare = _general.accRewardsPerShare + (released * 1 ether / balance_); // solhint-disable-next-line not-rely-on-time _general.lastUpdate = block.timestamp; emit Update(_general.accRewardsPerShare, _general.released, _general.lastUpdate); } function _burnFrom(address account, uint256 amount) internal onEachAction(account) { _users[account].balance -= amount; _users[account].rewardDebt = _users[account].balance * _general.accRewardsPerShare / 1 ether; _general.balance -= amount; ERC20BurnableUpgradeable(address(_token)).burn(amount); } function _onEachAction(address account) internal { _update(); _reward(account); } function _reward(address account) internal { if (_users[account].balance > 0) { uint256 pending = (_users[account].balance * _general.accRewardsPerShare / 1 ether) - _users[account].rewardDebt; if (pending != 0) { IDistributionVaultAllocation(_vault).distribute(account, pending); emit Rewards(account, pending); } } } // solhint-disable-next-line function __StakingUpgradeable_init(address vault_, IERC20Upgradeable token_) internal onlyInitializing { __StakingUpgradeable_init_unchained(vault_, token_); } // solhint-disable-next-line function __StakingUpgradeable_init_unchained(address vault_, IERC20Upgradeable token_) internal onlyInitializing { // solhint-disable-next-line not-rely-on-time _general.lastUpdate = block.timestamp; _vault = vault_; _token = token_; emit InitStakingUpgradeable(vault_, address(token_)); } /** * This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. */ uint256[45] private __gap; }
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.9; import {StakingUpgradeable, IERC20Upgradeable} from "./StakingUpgradeable.sol"; import {ERC20BurnableUpgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; abstract contract StakingWithFeeUpgradeable is StakingUpgradeable { struct Fee { uint256 feeInterval; uint256 minFee; uint256 maxFee; uint256 endInterval; } uint256 private _feeInterval; uint256 private _minFee; uint256 private _maxFee; mapping(address => Fee) private _fees; event InitStakingWithFee(uint256 feeInterval, uint256 minFee, uint256 maxFee); /// @notice Event emitted when the staking fees are updated event UpdateFees(uint256 minFee, uint256 maxFee, uint256 feeInterval); constructor() { _disableInitializers(); } function _authorizeUpdateFees() internal view virtual; function feeInterval() public view returns (uint256) { return _feeInterval; } function minFee() public view returns (uint256) { return _minFee; } function maxFee() public view returns (uint256) { return _maxFee; } function fee(address account) public view returns (Fee memory) { return _fees[account]; } function getFee(address account) public view returns (uint256) { Fee memory _fee = _fees[account]; uint256 timeLeft = getTimeLeft(account); return _fee.feeInterval > 0 ? _fee.minFee + (_fee.maxFee - _fee.minFee) * timeLeft / _fee.feeInterval : _fee.minFee; } function getTimeLeft(address account) public view returns (uint256) { Fee memory _fee = _fees[account]; // solhint-disable-next-line not-rely-on-time return block.timestamp > _fee.endInterval ? 0 : _fee.endInterval - block.timestamp; } function maxFeeLimit() public view returns (uint256) { return _maxFeeLimit(); } function updateFees(uint256 feeInterval_, uint256 minFee_, uint256 maxFee_) public { _authorizeUpdateFees(); _updateFees(feeInterval_, minFee_, maxFee_); } function deposit(address account, uint256 amount) public virtual override { super.deposit(account, amount); // solhint-disable-next-line not-rely-on-time _fees[account].endInterval = block.timestamp + _feeInterval; _fees[account].minFee = _minFee; _fees[account].maxFee = _maxFee; _fees[account].feeInterval = _feeInterval; } function withdraw(address account, uint256 amount) public virtual override { uint256 fee_ = amount * getFee(account) / 100 ether; if (fee_ != 0) { amount -= fee_; _burnFrom(account, fee_); } super.withdraw(account, amount); } function _maxFeeLimit() internal view virtual returns (uint256); function _updateFees(uint256 feeInterval_, uint256 minFee_, uint256 maxFee_) private { require(maxFee_ <= _maxFeeLimit(), "StakingWithFee: 001"); require(minFee_ <= maxFee_, "StakingWithFee: 002"); _feeInterval = feeInterval_; _minFee = minFee_; _maxFee = maxFee_; emit UpdateFees(_minFee, _maxFee, _feeInterval); } // solhint-disable-next-line function __StakingWithFeeUpgradeable_init( address vault_, IERC20Upgradeable token_, uint256 feeInterval_, uint256 minFee_, uint256 maxFee_ ) internal onlyInitializing { __StakingUpgradeable_init(vault_, token_); __StakingWithFeeUpgradeable_init_unchained(feeInterval_, minFee_, maxFee_); } // solhint-disable-next-line function __StakingWithFeeUpgradeable_init_unchained(uint256 feeInterval_, uint256 minFee_, uint256 maxFee_) internal onlyInitializing { emit InitStakingWithFee(feeInterval_, minFee_, maxFee_); _updateFees(feeInterval_, minFee_, maxFee_); } /** * This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. */ uint256[46] private __gap; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {DistributionVaultUpgradeable} from "./base/DistributionVaultUpgradeable.sol"; import {VestingUpgradeable} from "./utils/VestingUpgradeable.sol"; abstract contract DistributionVaultAllocationUpgradeable is DistributionVaultUpgradeable { struct Info { uint256 allocation; uint256 released; } uint256 private _lastUpdate; address[] private _accounts; mapping(address => Info) private _info; event UpdateAllocation(address indexed account, uint256 allocation); constructor() { _disableInitializers(); } // solhint-disable-next-line function __DistributionVaultAllocationUpgradeable_init(address _token) internal onlyInitializing { __DistributionVaultUpgradeable_init(_token); __DistributionVaultAllocationUpgradeable_init_unchained(); } // solhint-disable-next-line function __DistributionVaultAllocationUpgradeable_init_unchained() internal onlyInitializing {} function _authorizeUpdateAllocation() internal view virtual; function _releasedRange(uint256 from, uint256 to) internal view virtual returns (uint256); function addAccount(address account, uint256[] calldata allocations) external { _authorizeUpdateAllocation(); _addAccount(account, allocations); } function updateAllocation(uint256[] calldata allocations) external { _authorizeUpdateAllocation(); _updateAllocation(allocations); } function lastUpdate() public view returns (uint256) { return _lastUpdate; } function info(address account) public view returns (uint256 allocation_, uint256 released_, uint256 distributed_) { Info memory info_ = _info[account]; allocation_ = info_.allocation; released_ = info_.released; distributed_ = distributed(account); } function available(address account) public view returns (uint256) { return _available(account); } function released(address account) public view returns (uint256) { return _released(account); } function distribute(address receiver, uint256 amount) public { address account = msg.sender; // solhint-disable-next-line require(amount <= _available(account), "DistributionVaultAllocationUpgradeable: 001"); _distribute(account, receiver, amount); } function _available(address account) internal view returns (uint256) { return _released(account) - distributed(account); } function _released(address account) internal view returns (uint256) { Info memory accountInfo = _info[account]; // solhint-disable-next-line return accountInfo.released // solhint-disable-next-line + (_releasedRange(_lastUpdate, block.timestamp) * accountInfo.allocation / 100 ether); } function _addAccount(address account, uint256[] calldata allocations) private { _accounts.push(account); _updateAllocation(allocations); } function _updateAllocation(uint256[] calldata allocations) private { uint256 sum; uint256 length = _accounts.length; for (uint256 i; i < length; ++i) { address account = _accounts[i]; _info[account].released = _released(account); _info[account].allocation = allocations[i]; sum += allocations[i]; emit UpdateAllocation(account, allocations[i]); } // solhint-disable-next-line require(sum == 100 ether, "DistributionVaultAllocationUpgradeable: 002"); // solhint-disable-next-line _lastUpdate = block.timestamp; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[47] private __gap; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {MerkleVerificatorUpgradeable} from "./utils/MerkleVerificatorUpgradeable.sol"; import {DistributionVaultUpgradeable} from "./base/DistributionVaultUpgradeable.sol"; abstract contract DistributionVaultMerkleUpgradeable is DistributionVaultUpgradeable, MerkleVerificatorUpgradeable { constructor() { _disableInitializers(); } // solhint-disable-next-line function __DistributionVaultMerkleUpgradeable_init(address _token, bytes32 merkleRoot_, string memory uri_) internal onlyInitializing { __DistributionVaultUpgradeable_init(_token); __MerkleVerificator_init(merkleRoot_, uri_); __DistributionVaultMerkleUpgradeable_init_unchained(); } // solhint-disable-next-line function __DistributionVaultMerkleUpgradeable_init_unchained() internal onlyInitializing {} function available(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external view virtual returns (uint256) { return _available(index, account, amount, merkleProof); } function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external virtual { uint256 available_ = _available(index, account, amount, merkleProof); _distribute(index, account, amount, merkleProof, account, available_); } function distribute( uint256 index, uint256 amount, bytes32[] calldata merkleProof, address receiver, uint256 amount2 ) external virtual { _distribute(index, msg.sender, amount, merkleProof, receiver, amount2); } function _distribute( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof, address receiver, uint256 amount2 ) internal virtual { uint256 available_ = _available(index, account, amount, merkleProof); // solhint-disable-next-line reason-string require(available_ != 0, "DistributionVaultMerkleUpgradeable: No available amount"); // solhint-disable-next-line reason-string require(available_ >= amount2, "DistributionVaultMerkleUpgradeable: Invalid amount"); _distribute(account, receiver, amount2); } function _available(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) internal view virtual returns (uint256) { // solhint-disable-next-line reason-string require(_verify(index, account, amount, merkleProof), "DistributionVaultMerkleUpgradeable: Invalid proof"); return amount - distributed(account); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {DistributionVaultMerkleUpgradeable} from "./DistributionVaultMerkleUpgradeable.sol"; abstract contract DistributionVaultMerkleVestingUpgradeable is DistributionVaultMerkleUpgradeable { uint256 private _startDate; uint256 private _endDate; event UpdateDates(uint256 startDate, uint256 endDate); constructor() { _disableInitializers(); } // solhint-disable-next-line function __DistributionVaultMerkleVestingUpgradeable_init( address _token, bytes32 merkleRoot_, string memory uri_, uint256 startDate_, uint256 endDate_ ) internal onlyInitializing { __DistributionVaultMerkleUpgradeable_init(_token, merkleRoot_, uri_); __DistributionVaultMerkleVestingUpgradeable_init_unchained(startDate_, endDate_); } // solhint-disable-next-line function __DistributionVaultMerkleVestingUpgradeable_init_unchained(uint256 startDate_, uint256 endDate_) internal onlyInitializing { _updateDates(startDate_, endDate_); } function _authorizeUpdateDates() internal view virtual; function updateDates(uint256 startDate_, uint256 endDate_) external { _authorizeUpdateDates(); _updateDates(startDate_, endDate_); } function startDate() public view returns (uint256) { return _startDate; } function endDate() public view returns (uint256) { return _endDate; } function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external virtual override { uint256 available_ = _available(index, account, amount, merkleProof); // solhint-disable-next-line require(available_ != 0, "DistributionVaultMerkleVestingUpgradeable: No available amount"); _distribute(account, account, available_); } function _updateDates(uint256 startDate_, uint256 endDate_) private { _startDate = startDate_; _endDate = endDate_; emit UpdateDates(_startDate, _endDate); } function _available(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) internal view override returns (uint256) { // solhint-disable-next-line require( _verify(index, account, amount, merkleProof), "DistributionVaultMerkleVestingUpgradeable: Invalid proof" ); uint256 released_ = _released(amount); return released_ - distributed(account); } function _released(uint256 amount) internal view returns (uint256) { // solhint-disable-next-line uint256 currentTime = block.timestamp; return currentTime > _endDate ? amount : currentTime > _startDate ? (amount * (currentTime - _startDate)) / (_endDate - _startDate) : 0; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol"; import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; abstract contract DistributionVaultUpgradeable is Initializable { using SafeTransferLib for ERC20; /// @dev Does not make sense to update token or distributed loses accountability address private _token; mapping(address => uint256) private _distributed; event InitDistributionVaultUpgradeable(address token); event Distribute(address indexed account, uint256 amount); constructor() { _disableInitializers(); } // solhint-disable-next-line function __DistributionVaultUpgradeable_init(address token_) internal onlyInitializing { __DistributionVaultUpgradeable_init_unchained(token_); } // solhint-disable-next-line function __DistributionVaultUpgradeable_init_unchained(address token_) internal onlyInitializing { _token = token_; emit InitDistributionVaultUpgradeable(_token); } function token() public view returns (address) { return _token; } function distributed(address account) public view returns (uint256) { return _distributed[account]; } function _distribute(address account, address receiver, uint256 amount) internal virtual { _distributed[account] += amount; ERC20(_token).safeTransfer(receiver, amount); emit Distribute(account, amount); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {MerkleProof} from "openzeppelin-contracts/utils/cryptography/MerkleProof.sol"; import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; abstract contract MerkleVerificatorUpgradeable is Initializable { bytes32 private _merkleRoot; string private _uri; event InitMerkleVerificatorUpgradeable(bytes32 indexed merkleRoot, string uri); event UpdateMerkleRoot(bytes32 indexed merkleRoot, string uri); constructor() { _disableInitializers(); } // solhint-disable-next-line function __MerkleVerificator_init(bytes32 merkleRoot_, string memory uri_) internal onlyInitializing { __MerkleVerificator_init_unchained(merkleRoot_, uri_); } // solhint-disable-next-line function __MerkleVerificator_init_unchained(bytes32 merkleRoot_, string memory uri_) internal onlyInitializing { _updateMerkleRoot(merkleRoot_, uri_); emit InitMerkleVerificatorUpgradeable(_merkleRoot, _uri); } function _authorizeUpdateMerkleRoot() internal view virtual; function updateMerkleRoot(bytes32 merkleRoot_, string memory uri_) external { _authorizeUpdateMerkleRoot(); _updateMerkleRoot(merkleRoot_, uri_); } function merkleRoot() public view returns (bytes32) { return _merkleRoot; } function uri() public view returns (string memory) { return _uri; } function _updateMerkleRoot(bytes32 merkleRoot_, string memory uri_) private { _merkleRoot = merkleRoot_; _uri = uri_; emit UpdateMerkleRoot(_merkleRoot, _uri); } function _verify(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) internal view returns (bool) { bytes32 node = keccak256(abi.encodePacked(index, account, amount)); return MerkleProof.verifyCalldata(merkleProof, _merkleRoot, node); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; contract VestingUpgradeable is Initializable { uint8 private _vestingType; // 1: constant, 2: linear, 3: cuadratic, 4: cubic ... uint256 private _totalAmount; uint256 private _startDate; uint256 private _endDate; uint256 private _increment; event InitVestingUpgradeable( uint8 vestingType, uint256 totalAmount, uint256 startDate, uint256 endDate, uint256 increment ); constructor() { _disableInitializers(); } function vestingType() public view returns (uint8) { return _vestingType; } function totalAmount() public view returns (uint256) { return _totalAmount; } function startDate() public view returns (uint256) { return _startDate; } function endDate() public view returns (uint256) { return _endDate; } function increment() public view returns (uint256) { return _increment; } // solhint-disable-next-line function __VestingUpgradeable_init(uint8 vestingType_, uint256 totalAmount_, uint256 startDate_, uint256 endDate_) internal onlyInitializing { __VestingUpgradeable_init_unchained(vestingType_, totalAmount_, startDate_, endDate_); } // solhint-disable-next-line function __VestingUpgradeable_init_unchained( uint8 vestingType_, uint256 totalAmount_, uint256 startDate_, uint256 endDate_ ) internal onlyInitializing { require(vestingType_ > 0, "Vesting: 001"); require(totalAmount_ > 0, "Vesting: 002"); require(startDate_ < endDate_, "Vesting: 003"); _vestingType = vestingType_; _totalAmount = totalAmount_; _startDate = startDate_; _endDate = endDate_; _increment = (vestingType_ * totalAmount_ * 1 ether) / ((endDate_ - startDate_) ** vestingType_); emit InitVestingUpgradeable(vestingType_, totalAmount_, startDate_, endDate_, _increment); } function _releasedRange(uint256 from, uint256 to) internal view virtual returns (uint256) { require(from <= to, "Vesting: 004"); if (to > _endDate) { to = _endDate; } if (from < _startDate) { from = _startDate; } uint256 comp0 = (_increment * ((to - _startDate) ** _vestingType)) / _vestingType; uint256 comp1 = (_increment * ((from - _startDate) ** _vestingType)) / _vestingType; return (comp0 - comp1) / 1 ether; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IDistributionVaultAllocation { function startDate() external view returns (uint256); function released(address account) external view returns (uint256); function available(address account) external view returns (uint256); function distribute(address receiver, uint256 amount) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.16; import {DistributionVaultAllocationUpgradeable} from "dappcomposer-contracts/contracts-upgradeable/distribute/DistributionVaultAllocationUpgradeable.sol"; import {VestingUpgradeable} from "dappcomposer-contracts/contracts-upgradeable/distribute/utils/VestingUpgradeable.sol"; import {Ownable2StepUpgradeable} from "openzeppelin-contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {UUPSUpgradeable} from "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; contract ZeemcoinDistributionVaultAllocation is DistributionVaultAllocationUpgradeable, VestingUpgradeable, Ownable2StepUpgradeable, UUPSUpgradeable { address public deployer; constructor() { _disableInitializers(); } function initialize( address owner_, address _token, uint8 vestingType, uint256 totalAmount, uint256 startDate, uint256 endDate ) public initializer { __DistributionVaultAllocationUpgradeable_init(_token); __VestingUpgradeable_init(vestingType, totalAmount, startDate, endDate); __Ownable_init(); _transferOwnership(owner_); __UUPSUpgradeable_init(); deployer = msg.sender; } function _authorizeUpgrade(address newImplementation) internal view override onlyOwner { (newImplementation); } function _authorizeUpdateAllocation() internal view override { require(msg.sender == owner() || msg.sender == deployer, ""); } function releasedRange(uint256 from, uint256 to) public view returns (uint256) { return _releasedRange(from, to); } function _releasedRange(uint256 from, uint256 to) internal view override(VestingUpgradeable, DistributionVaultAllocationUpgradeable) returns (uint256) { return VestingUpgradeable._releasedRange(from, to); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.16; import {DistributionVaultMerkleUpgradeable} from "dappcomposer-contracts/contracts-upgradeable/distribute/DistributionVaultMerkleUpgradeable.sol"; import {Ownable2StepUpgradeable} from "openzeppelin-contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {UUPSUpgradeable} from "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; contract ZeemcoinDistributionVaultMerkle is DistributionVaultMerkleUpgradeable, Ownable2StepUpgradeable, UUPSUpgradeable { constructor() { _disableInitializers(); } function initialize(address owner_, address _token) public initializer { bytes32 emptyMerkle; string memory emptyUri; __DistributionVaultMerkleUpgradeable_init(_token, emptyMerkle, emptyUri); __Ownable_init(); _transferOwnership(owner_); __UUPSUpgradeable_init(); } function _authorizeUpgrade(address newImplementation) internal view override onlyOwner { (newImplementation); } // solhint-disable-next-line function _authorizeUpdateMerkleRoot() internal view override onlyOwner {} }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.16; import {DistributionVaultMerkleVestingUpgradeable} from "dappcomposer-contracts/contracts-upgradeable/distribute/DistributionVaultMerkleVestingUpgradeable.sol"; import {Ownable2StepUpgradeable} from "openzeppelin-contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {UUPSUpgradeable} from "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; contract ZeemcoinDistributionVaultMerkleVesting is DistributionVaultMerkleVestingUpgradeable, Ownable2StepUpgradeable, UUPSUpgradeable { constructor() { _disableInitializers(); } function initialize( address owner_, address _token, uint256 startDate_, uint256 endDate_, bytes32 merkleRoot_, string memory uri_ ) public initializer { __DistributionVaultMerkleVestingUpgradeable_init(_token, merkleRoot_, uri_, startDate_, endDate_); __Ownable_init(); _transferOwnership(owner_); __UUPSUpgradeable_init(); } function _authorizeUpgrade(address newImplementation) internal view override onlyOwner { (newImplementation); } // solhint-disable-next-line function _authorizeUpdateMerkleRoot() internal view override onlyOwner {} // solhint-disable-next-line function _authorizeUpdateDates() internal view override onlyOwner {} }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.16; import { StakingUpgradeable, IERC20Upgradeable } from "dappcomposer-contracts/contracts-upgradeable/defi/StakingUpgradeable.sol"; import {Ownable2StepUpgradeable} from "openzeppelin-contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {UUPSUpgradeable} from "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; contract ZeemcoinFarming is StakingUpgradeable, Ownable2StepUpgradeable, UUPSUpgradeable { constructor() { _disableInitializers(); } function initialize(address owner_, address vault_, IERC20Upgradeable token_) public initializer { __StakingUpgradeable_init(vault_, token_); __Ownable_init(); _transferOwnership(owner_); __UUPSUpgradeable_init(); } function _authorizeUpgrade(address newImplementation) internal view override onlyOwner { (newImplementation); } // solhint-disable-next-line function _authorizeSyncBalance() internal override onlyOwner {} }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.16; import {StakingWithFeeUpgradeable} from "dappcomposer-contracts/contracts-upgradeable/defi/StakingWithFeeUpgradeable.sol"; import {IERC20Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import {Ownable2StepUpgradeable} from "openzeppelin-contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {UUPSUpgradeable} from "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; contract ZeemcoinStaking is StakingWithFeeUpgradeable, Ownable2StepUpgradeable, UUPSUpgradeable { constructor() { _disableInitializers(); } function initialize( address owner_, address vault_, IERC20Upgradeable token_, uint256 feeInterval_, uint256 minFee_, uint256 maxFee_ ) public initializer { __StakingWithFeeUpgradeable_init(vault_, token_, feeInterval_, minFee_, maxFee_); __Ownable_init(); _transferOwnership(owner_); __UUPSUpgradeable_init(); } // solhint-disable-next-line function _authorizeUpdateFees() internal view override onlyOwner {} function _authorizeUpgrade(address newImplementation) internal view override onlyOwner { (newImplementation); } // solhint-disable-next-line function _authorizeSyncBalance() internal override onlyOwner {} function _maxFeeLimit() internal pure override returns (uint256) { return 10 ether; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.16; import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; import {UUPSUpgradeable} from "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {Ownable2StepUpgradeable} from "openzeppelin-contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {PausableUpgradeable} from "openzeppelin-contracts-upgradeable/security/PausableUpgradeable.sol"; import {ERC20Upgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import {ERC20CappedUpgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/extensions/ERC20CappedUpgradeable.sol"; import {ERC20BurnableUpgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import {ERC20SnapshotUpgradeable} from "openzeppelin-contracts-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol"; contract ZeemcoinToken is Initializable, ERC20Upgradeable, ERC20CappedUpgradeable, ERC20BurnableUpgradeable, ERC20SnapshotUpgradeable, Ownable2StepUpgradeable, PausableUpgradeable, UUPSUpgradeable { /// @custom:oz-upgrades-unsafe-allow constructor uint256 public burned; constructor() { _disableInitializers(); } function initialize(address owner_) public initializer { uint256 cap_ = 100e6 ether; __ERC20_init("Zeemcoin token", "ZEEM"); __ERC20Capped_init(cap_); __ERC20Burnable_init(); __ERC20Snapshot_init(); __Ownable_init(); _transferOwnership(owner_); __Pausable_init(); __UUPSUpgradeable_init(); _mint(msg.sender, cap_); } function snapshot() public onlyOwner { _snapshot(); } function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } function burn(uint256 amount) public override { burned += amount; super.burn(amount); } function burnFrom(address account, uint256 amount) public override { burned += amount; super.burnFrom(account, amount); } function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); } function _mint(address account, uint256 amount) internal virtual override(ERC20Upgradeable, ERC20CappedUpgradeable) { ERC20CappedUpgradeable._mint(account, amount); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20Upgradeable, ERC20SnapshotUpgradeable) whenNotPaused { super._beforeTokenTransfer(from, to, amount); } function _authorizeUpgrade(address newImplementation) internal view override onlyOwner { (newImplementation); } }
{ "remappings": [ "dappcomposer-contracts/=lib/dappcomposer-contracts/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/dappcomposer-contracts/lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/dappcomposer-contracts/lib/openzeppelin-contracts/contracts/", "safe-contracts/=lib/dappcomposer-contracts/lib/safe-contracts/contracts/", "solmate/=lib/dappcomposer-contracts/lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "debug": { "revertStrings": "default" }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"ms","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"address","name":"feed","type":"address"},{"internalType":"contract IERC20Upgradeable","name":"wbtc","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"advisorsVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"airdropsVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"farming","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketingVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"privateVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"staking","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yieldVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040516200f2fc3803806200f2fc833981016040819052620000349162001820565b60006040516200004490620017a5565b604051809103906000f08015801562000061573d6000803e3d6000fd5b50604080516001600160a01b0388166024808301919091528251808303909101815260449091019091526020810180516001600160e01b0390811663189acdbd60e31b1790915291925090600090620000bf90849084906200143416565b600080546001600160a01b0319166001600160a01b0392909216919091178155604051909350620000f392509050620017b3565b604051809103906000f08015801562000110573d6000803e3d6000fd5b50905060006040516200012390620017c1565b604051809103906000f08015801562000140573d6000803e3d6000fd5b50905060006040516200015390620017cf565b604051809103906000f08015801562000170573d6000803e3d6000fd5b5090508560000362000180574295505b60005469b077128c188a23b4000090620001c5906001600160a01b031673b2d987f2a5fe094ef1c7377287481db4ecdaa05b8362001478602090811b6200019b17901c565b506a09ed194db19b238c00000067016345785d8a00006000620001f182670de0b6b3a764000062001892565b62278d006200020284600b620018ae565b6200020e9190620018ae565b6200021a9190620018d0565b62000226908a62001892565b60008054919250906393acb38960e01b908c906001600160a01b0316846200025362278d00600b620018ae565b6200025f908f620018f3565b6040516001600160a01b039485166024820152939092166044840152606483015260848201527fde5b16da8ce8ab6c94f577d9f68f29b494412cb8f8f05d123c3ad0f2724bc2ef60a482015260c060c4820152603560e48201527f697066733a2f2f516d55374178524e595447394a76585a4d32665250313355696101048201527f357a567338575432664d4a3851364343655543485100000000000000000000006101248201526101440160408051808303601f190181529190526020810180516001600160e01b0319939093166001600160e01b0393841617905291506200034e90889083906200143416565b600180546001600160a01b0319166001600160a01b039283169081179091556000546200038a9216908662001478602090811b6200019b17901c565b5050600080546a034f086f3b33b6840000009350909150633bc1d41f60e01b908a906001600160a01b03166001858c620003ca6301e133806005620018ae565b620003d6908f620018f3565b6040516001600160a01b03968716602482015295909416604486015260ff9092166064850152608484015260a483015260c482015260e40160408051808303601f190181529190526020810180516001600160e01b0319939093166001600160e01b0393841617905291506200045190859083906200143416565b600280546001600160a01b0319166001600160a01b039283169081179091556000546200048d9216908462001478602090811b6200019b17901c565b5050600054604080516001600160a01b038a8116602483015290921660448084019190915281518084039091018152606490920190526020810180516001600160e01b0390811663485cc95560e01b179091526954b40b1f852bda0000009190620004fd90849083906200143416565b600380546001600160a01b0319166001600160a01b03928316908117909155600054620005399216908462001478602090811b6200019b17901c565b5050600080546a05803138ec05f9084000009190633bc1d41f60e01b908a906001600160a01b03166001858c620005766301e133806002620018ae565b62000582908f620018f3565b6040516001600160a01b03968716602482015295909416604486015260ff9092166064850152608484015260a483015260c482015260e40160408051808303601f190181529190526020810180516001600160e01b0319939093166001600160e01b039384161790529150620005fd90859083906200143416565b600480546001600160a01b0319166001600160a01b03928316908117909155600054620006399216908462001478602090811b6200019b17901c565b5050600054604080516001600160a01b038a8116602483015290921660448084019190915281518084039091018152606490920190526020810180516001600160e01b0390811663485cc95560e01b179091526a18d0bf423c03d8de0000009190620006aa90849083906200143416565b600580546001600160a01b0319166001600160a01b03928316908117909155600054620006e69216908462001478602090811b6200019b17901c565b5050600080546a18d0bf423c03d8de0000009190633bc1d41f60e01b908a906001600160a01b03166002858c620007236301e133806005620018ae565b6200072f908f620018f3565b6040516001600160a01b03968716602482015295909416604486015260ff9092166064850152608484015260a483015260c482015260e40160408051808303601f190181529190526020810180516001600160e01b0319939093166001600160e01b039384161790529150620007aa90859083906200143416565b600780546001600160a01b0319166001600160a01b03928316908117909155600054620007e69216908462001478602090811b6200019b17901c565b5050600080546a084595161401484a000000919060609082906393acb38960e01b908c906001600160a01b03166200082362278d006008620018ae565b6200082f908e620018f3565b6200083f62278d006014620018ae565b6200084b908f620018f3565b878760405160240162000864969594939291906200195d565b60408051808303601f190181529190526020810180516001600160e01b0319939093166001600160e01b039384161790529150620008a790889083906200143416565b600680546001600160a01b0319166001600160a01b03928316908117909155600054620008e39216908662001478602090811b6200019b17901c565b505050506000604051620008f790620017dd565b604051809103906000f08015801562000914573d6000803e3d6000fd5b50600754600080546040516001600160a01b03808e16602483015293841660448201529216606483015262278d00608483015267016345785d8a000060a4830152678ac7230489e8000060c48301529192506339466de560e11b9060e40160408051808303601f190181529190526020810180516001600160e01b0319939093166001600160e01b039384161790529150620009b590839083906200143416565b600880546001600160a01b0319166001600160a01b039283161790556040805163313ce56760e01b8152905160009450899350849284169163313ce5679160048083019260209291908290030181865afa15801562000a18573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a3e9190620019a8565b60ff1690506000826001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000a84573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000aaa9190620019d4565b9050600062000abb83600a62001aeb565b62000acf83670de0b6b3a7640000620018ae565b62000adb9190620018d0565b9050806064601962000afc69152d02c7e14af68000006305f5e100620018ae565b62000b089190620018ae565b62000b149190620018d0565b62000b209190620018d0565b945062000b498c30878c6001600160a01b0316620014e360201b6200020317909392919060201c565b60405163095ea7b360e01b8152731b02da8cb0d097eb8d57a175b88c7d8b479975066004820152602481018690526001600160a01b038a169063095ea7b3906044016020604051808303816000875af115801562000bab573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bd1919062001af9565b5060005460405163095ea7b360e01b8152731b02da8cb0d097eb8d57a175b88c7d8b47997506600482015269152d02c7e14af680000060248201526001600160a01b039091169063095ea7b3906044016020604051808303816000875af115801562000c41573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c67919062001af9565b50505050506000731b02da8cb0d097eb8d57a175b88c7d8b4799750690508160000362000cb55760405162461bcd60e51b815260206004820152600060248201526044015b60405180910390fd5b600080546001600160a01b038084169163e8e3370091168969152d02c7e14af6800000878181733f95eac04c1e3e7ffebe8fbadc026545d71db86562000cfe4261012c620018f3565b60405160e08a901b6001600160e01b03191681526001600160a01b039889166004820152968816602488015260448701959095526064860193909352608485019190915260a484015290921660c482015260e4810191909152610104016060604051808303816000875af115801562000d7b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000da1919062001b1d565b60005460405163e6a4390560e01b81526001600160a01b039182166004820152908b16602482015290935073c35dadb65012ec5796536bd9864ed8773abc74c4925082915063e6a4390590604401602060405180830381865afa15801562000e0d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e33919062001b4c565b600a80546001600160a01b0319166001600160a01b0392909216918217905562000e7a5760405162461bcd60e51b8152602060048201526000602482015260440162000cac565b600a546040516370a0823160e01b8152733f95eac04c1e3e7ffebe8fbadc026545d71db86560048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa15801562000edc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f029190620019d4565b905083811462000f2f5760405162461bcd60e51b8152602060048201526000602482015260440162000cac565b6000546040516370a0823160e01b815230600482015262000fd991733f95eac04c1e3e7ffebe8fbadc026545d71db865916001600160a01b03909116906370a0823190602401602060405180830381865afa15801562000f93573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000fb99190620019d4565b6000546001600160a01b0316919062001478602090811b6200019b17901c565b5050505050600060405162000fee90620017eb565b604051809103906000f0801580156200100b573d6000803e3d6000fd5b50600754600a546040516001600160a01b03808e16602483015292831660448201529116606482015290915060009063c0c53b8b60e01b9060840160408051808303601f190181529190526020810180516001600160e01b0319939093166001600160e01b0393841617905291506200108990839083906200143416565b600980546001600160a01b0319166001600160a01b039290921691909117905550506040805160018082528183019092526000916020808301908036833701905050905068056bc75e2d6310000081600081518110620010ed57620010ed62001b6c565b6020908102919091010152600754600954604051638b9d137560e01b81526001600160a01b0392831692638b9d1375926200113092911690859060040162001b82565b600060405180830381600087803b1580156200114b57600080fd5b505af115801562001160573d6000803e3d6000fd5b506000925060029150620011719050565b6040519080825280602002602001820160405280156200119b578160200160208202803683370190505b509050680410d586a20a4c000081600081518110620011be57620011be62001b6c565b60200260200101818152505068015af1d78b58c4000081600181518110620011ea57620011ea62001b6c565b6020908102919091010152600754600854604051638b9d137560e01b81526001600160a01b0392831692638b9d1375926200122d92911690859060040162001b82565b600060405180830381600087803b1580156200124857600080fd5b505af11580156200125d573d6000803e3d6000fd5b5060009450600193506200127092505050565b6040519080825280602002602001820160405280156200129a578160200160208202803683370190505b50905068056bc75e2d6310000081600081518110620012bd57620012bd62001b6c565b602090810291909101015260048054604051638b9d137560e01b81526001600160a01b0390911691638b9d1375916200130f91730d0509102c23bfeca208782dc5e48fc652b5c7ea9186910162001b82565b600060405180830381600087803b1580156200132a57600080fd5b505af11580156200133f573d6000803e3d6000fd5b50600093506001925062001351915050565b6040519080825280602002602001820160405280156200137b578160200160208202803683370190505b50905068056bc75e2d63100000816000815181106200139e576200139e62001b6c565b6020908102919091010152600254604051638b9d137560e01b81526001600160a01b0390911690638b9d137590620013f1907386e4068356acb128e3becebedc13baefc32b4d2290859060040162001b82565b600060405180830381600087803b1580156200140c57600080fd5b505af115801562001421573d6000803e3d6000fd5b5050505050505050505050505062001c33565b600082826040516200144690620017f9565b6200145392919062001bda565b604051809103906000f08015801562001470573d6000803e3d6000fd5b509392505050565b6040516001600160a01b038316602482015260448101829052620014de90849063a9059cbb60e01b906064015b60408051808303601f190181529190526020810180516001600160e01b0319939093166001600160e01b03938416179052906200152316565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526200151d9085906323b872dd60e01b90608401620014a5565b50505050565b60006200157f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200160160201b62000241179092919060201c565b805190915015620014de5780806020019051810190620015a0919062001af9565b620014de5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000cac565b60606200161284846000856200161a565b949350505050565b6060824710156200167d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000cac565b600080866001600160a01b031685876040516200169b919062001c00565b60006040518083038185875af1925050503d8060008114620016da576040519150601f19603f3d011682016040523d82523d6000602084013e620016df565b606091505b509092509050620016f387838387620016fe565b979650505050505050565b60608315620017725782516000036200176a576001600160a01b0385163b6200176a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000cac565b508162001612565b620016128383815115620017895781518083602001fd5b8060405162461bcd60e51b815260040162000cac919062001c1e565b6124c380620021bd83390190565b611e50806200468083390190565b611e5680620064d083390190565b611b51806200832683390190565b6129f38062009e7783390190565b61236b806200c86a83390190565b610727806200ebd583390190565b6001600160a01b03811681146200181d57600080fd5b50565b600080600080608085870312156200183757600080fd5b8451620018448162001807565b6020860151604087015191955093506200185e8162001807565b6060860151909250620018718162001807565b939692955090935050565b634e487b7160e01b600052601160045260246000fd5b81810381811115620018a857620018a86200187c565b92915050565b6000816000190483118215151615620018cb57620018cb6200187c565b500290565b600082620018ee57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115620018a857620018a86200187c565b60005b83811015620019265781810151838201526020016200190c565b50506000910152565b600081518084526200194981602086016020860162001909565b601f01601f19169290920160200192915050565b600060018060a01b03808916835280881660208401525085604083015284606083015283608083015260c060a08301526200199c60c08301846200192f565b98975050505050505050565b600060208284031215620019bb57600080fd5b815160ff81168114620019cd57600080fd5b9392505050565b600060208284031215620019e757600080fd5b5051919050565b600181815b8085111562001a2f57816000190482111562001a135762001a136200187c565b8085161562001a2157918102915b93841c9390800290620019f3565b509250929050565b60008262001a4857506001620018a8565b8162001a5757506000620018a8565b816001811462001a70576002811462001a7b5762001a9b565b6001915050620018a8565b60ff84111562001a8f5762001a8f6200187c565b50506001821b620018a8565b5060208310610133831016604e8410600b841016171562001ac0575081810a620018a8565b62001acc8383620019ee565b806000190482111562001ae35762001ae36200187c565b029392505050565b6000620019cd838362001a37565b60006020828403121562001b0c57600080fd5b81518015158114620019cd57600080fd5b60008060006060848603121562001b3357600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121562001b5f57600080fd5b8151620019cd8162001807565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b8181101562001bcd5784518352938301939183019160010162001baf565b5090979650505050505050565b6001600160a01b038316815260406020820181905260009062001612908301846200192f565b6000825162001c1481846020870162001909565b9190910192915050565b602081526000620019cd60208301846200192f565b61057a8062001c436000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806351405d271161007157806351405d2714610129578063554de7981461013c5780635579ed011461014f5780638ab5212b14610162578063a7f8a5e214610175578063fc0c546a1461018857600080fd5b806316f0115b146100ae578063324eeb02146100dd5780634c265a13146100f05780634cf088d9146101035780634e3ad80f14610116575b600080fd5b600a546100c1906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6002546100c1906001600160a01b031681565b6004546100c1906001600160a01b031681565b6008546100c1906001600160a01b031681565b6009546100c1906001600160a01b031681565b6001546100c1906001600160a01b031681565b6003546100c1906001600160a01b031681565b6005546100c1906001600160a01b031681565b6006546100c1906001600160a01b031681565b6007546100c1906001600160a01b031681565b6000546100c1906001600160a01b031681565b6040516001600160a01b0383166024820152604481018290526101fe90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610258565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261023b9085906323b872dd60e01b906084016101c7565b50505050565b6060610250848460008561032f565b949350505050565b60006102ad826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166102419092919063ffffffff16565b8051909150156101fe57808060200190518101906102cb91906104a8565b6101fe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b6060824710156103905760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610326565b600080866001600160a01b031685876040516103ac91906104f5565b60006040518083038185875af1925050503d80600081146103e9576040519150601f19603f3d011682016040523d82523d6000602084013e6103ee565b606091505b50915091506103ff8783838761040a565b979650505050505050565b60608315610479578251600003610472576001600160a01b0385163b6104725760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610326565b5081610250565b610250838381511561048e5781518083602001fd5b8060405162461bcd60e51b81526004016103269190610511565b6000602082840312156104ba57600080fd5b815180151581146104ca57600080fd5b9392505050565b60005b838110156104ec5781810151838201526020016104d4565b50506000910152565b600082516105078184602087016104d1565b9190910192915050565b60208152600082518060208401526105308160408501602087016104d1565b601f01601f1916919091016040019291505056fea264697066735822122010a220920c385cc65ad3a6862bd9bb8ba0d43e7637885553966373ebd3724e1464736f6c6343000810003360a06040523060805234801561001457600080fd5b5061001d610022565b6100e2565b600054610100900460ff161561008e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100e0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516123a96200011a60003960008181610663015281816106ac015281816108100152818161085001526108df01526123a96000f3fe6080604052600436106101d85760003560e01c806370a08231116101025780639711715a11610095578063c4d66de811610064578063c4d66de814610508578063dd62ed3e14610528578063e30c397814610548578063f2fde38b1461056757600080fd5b80639711715a14610493578063981b24d0146104a8578063a457c2d7146104c8578063a9059cbb146104e857600080fd5b806379cc6790116100d157806379cc6790146104175780638456cb59146104375780638da5cb5b1461044c57806395d89b411461047e57600080fd5b806370a08231146103a0578063715018a6146103d657806373f42561146103eb57806379ba50971461040257600080fd5b8063395093511161017a5780634ee2cd7e116101495780634ee2cd7e1461033f5780634f1ef2861461035f57806352d1902d146103725780635c975abb1461038757600080fd5b806339509351146102ca5780633f4ba83a146102ea57806340c10f19146102ff57806342966c681461031f57600080fd5b806323b872dd116101b657806323b872dd14610257578063313ce56714610277578063355274ea146102935780633659cfe6146102a857600080fd5b806306fdde03146101dd578063095ea7b31461020857806318160ddd14610238575b600080fd5b3480156101e957600080fd5b506101f2610587565b6040516101ff9190611e69565b60405180910390f35b34801561021457600080fd5b50610228610223366004611eb3565b610619565b60405190151581526020016101ff565b34801561024457600080fd5b506035545b6040519081526020016101ff565b34801561026357600080fd5b50610228610272366004611edd565b610633565b34801561028357600080fd5b50604051601281526020016101ff565b34801561029f57600080fd5b50606554610249565b3480156102b457600080fd5b506102c86102c3366004611f19565b610659565b005b3480156102d657600080fd5b506102286102e5366004611eb3565b610741565b3480156102f657600080fd5b506102c8610763565b34801561030b57600080fd5b506102c861031a366004611eb3565b610775565b34801561032b57600080fd5b506102c861033a366004611f34565b61078b565b34801561034b57600080fd5b5061024961035a366004611eb3565b6107ad565b6102c861036d366004611f63565b610806565b34801561037e57600080fd5b506102496108d2565b34801561039357600080fd5b506101605460ff16610228565b3480156103ac57600080fd5b506102496103bb366004611f19565b6001600160a01b031660009081526033602052604090205490565b3480156103e257600080fd5b506102c8610985565b3480156103f757600080fd5b506102496101f65481565b34801561040e57600080fd5b506102c8610997565b34801561042357600080fd5b506102c8610432366004611eb3565b610a0f565b34801561044357600080fd5b506102c8610a32565b34801561045857600080fd5b5060fc546001600160a01b03165b6040516001600160a01b0390911681526020016101ff565b34801561048a57600080fd5b506101f2610a42565b34801561049f57600080fd5b506102c8610a51565b3480156104b457600080fd5b506102496104c3366004611f34565b610a61565b3480156104d457600080fd5b506102286104e3366004611eb3565b610a8c565b3480156104f457600080fd5b50610228610503366004611eb3565b610b12565b34801561051457600080fd5b506102c8610523366004611f19565b610b20565b34801561053457600080fd5b50610249610543366004612025565b610cca565b34801561055457600080fd5b5061012e546001600160a01b0316610466565b34801561057357600080fd5b506102c8610582366004611f19565b610cf5565b60606036805461059690612058565b80601f01602080910402602001604051908101604052809291908181526020018280546105c290612058565b801561060f5780601f106105e45761010080835404028352916020019161060f565b820191906000526020600020905b8154815290600101906020018083116105f257829003601f168201915b5050505050905090565b600033610627818585610d67565b60019150505b92915050565b600033610641858285610e8b565b61064c858585610f05565b60019150505b9392505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036106aa5760405162461bcd60e51b81526004016106a190612092565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166106f360008051602061232d833981519152546001600160a01b031690565b6001600160a01b0316146107195760405162461bcd60e51b81526004016106a1906120de565b610722816110bb565b6040805160008082526020820190925261073e918391906110c3565b50565b6000336106278185856107548383610cca565b61075e9190612140565b610d67565b61076b611233565b61077361128d565b565b61077d611233565b61078782826112e0565b5050565b806101f6600082825461079e9190612140565b9091555061073e9050816112ea565b6001600160a01b038216600090815260ca60205260408120819081906107d49085906112f4565b91509150816107fb576001600160a01b0385166000908152603360205260409020546107fd565b805b95945050505050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361084e5760405162461bcd60e51b81526004016106a190612092565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661089760008051602061232d833981519152546001600160a01b031690565b6001600160a01b0316146108bd5760405162461bcd60e51b81526004016106a1906120de565b6108c6826110bb565b610787828260016110c3565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109725760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016106a1565b5060008051602061232d83398151915290565b61098d611233565b61077360006113ea565b61012e5433906001600160a01b03168114610a065760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106a1565b61073e816113ea565b806101f66000828254610a229190612140565b9091555061078790508282611404565b610a3a611233565b610773611419565b60606037805461059690612058565b610a59611233565b61073e611457565b6000806000610a718460cb6112f4565b9150915081610a8257603554610a84565b805b949350505050565b60003381610a9a8286610cca565b905083811015610afa5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016106a1565b610b078286868403610d67565b506001949350505050565b600033610627818585610f05565b600054610100900460ff1615808015610b405750600054600160ff909116105b80610b5a5750303b158015610b5a575060005460ff166001145b610bbd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106a1565b6000805460ff191660011790558015610be0576000805461ff0019166101001790555b60006a52b7d2dcc80cd2e40000009050610c3c6040518060400160405280600e81526020016d2d32b2b6b1b7b4b7103a37b5b2b760911b815250604051806040016040528060048152602001635a45454d60e01b8152506114b1565b610c45816114e2565b610c4d611512565b610c55611512565b610c5d611539565b610c66836113ea565b610c6e611568565b610c76611512565b610c8033826112e0565b508015610787576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b610cfd611233565b61012e80546001600160a01b0383166001600160a01b03199091168117909155610d2f60fc546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6001600160a01b038316610dc95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106a1565b6001600160a01b038216610e2a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106a1565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610e978484610cca565b90506000198114610eff5781811015610ef25760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016106a1565b610eff8484848403610d67565b50505050565b6001600160a01b038316610f695760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106a1565b6001600160a01b038216610fcb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106a1565b610fd6838383611597565b6001600160a01b0383166000908152603360205260409020548181101561104e5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016106a1565b6001600160a01b0380851660008181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906110ae9086815260200190565b60405180910390a3610eff565b61073e611233565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156110fb576110f6836115aa565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611155575060408051601f3d908101601f1916820190925261115291810190612153565b60015b6111b85760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016106a1565b60008051602061232d83398151915281146112275760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016106a1565b506110f6838383611646565b60fc546001600160a01b031633146107735760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106a1565b61129561166b565b610160805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61078782826116b5565b61073e3382611724565b600080600084116113405760405162461bcd60e51b815260206004820152601660248201527504552433230536e617073686f743a20696420697320360541b60448201526064016106a1565b611348611864565b8411156113975760405162461bcd60e51b815260206004820152601d60248201527f4552433230536e617073686f743a206e6f6e6578697374656e7420696400000060448201526064016106a1565b60006113a38486611874565b845490915081036113bb5760008092509250506113e3565b60018460010182815481106113d2576113d261216c565b906000526020600020015492509250505b9250929050565b61012e80546001600160a01b031916905561073e81611921565b61140f823383610e8b565b6107878282611724565b611421611973565b610160805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586112c33390565b600061146760cd80546001019055565b6000611471611864565b90507f8030e83b04d87bef53480e26263266d6ca66863aa8506aca6f2559d18aa1cb67816040516114a491815260200190565b60405180910390a1919050565b600054610100900460ff166114d85760405162461bcd60e51b81526004016106a190612182565b61078782826119ba565b600054610100900460ff166115095760405162461bcd60e51b81526004016106a190612182565b61073e816119fa565b600054610100900460ff166107735760405162461bcd60e51b81526004016106a190612182565b600054610100900460ff166115605760405162461bcd60e51b81526004016106a190612182565b610773611a6e565b600054610100900460ff1661158f5760405162461bcd60e51b81526004016106a190612182565b610773611a9e565b61159f611973565b6110f6838383611ad2565b6001600160a01b0381163b6116175760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016106a1565b60008051602061232d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61164f83611b1a565b60008251118061165c5750805b156110f657610eff8383611b5a565b6101605460ff166107735760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106a1565b606554816116c260355490565b6116cc9190612140565b111561171a5760405162461bcd60e51b815260206004820152601960248201527f45524332304361707065643a206361702065786365656465640000000000000060448201526064016106a1565b6107878282611c45565b6001600160a01b0382166117845760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016106a1565b61179082600083611597565b6001600160a01b038216600090815260336020526040902054818110156118045760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016106a1565b6001600160a01b03831660008181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b600061186f60cd5490565b905090565b815460009081036118875750600061062d565b82546000905b808210156118d45760006118a18383611d12565b600087815260209020909150859082015411156118c0578091506118ce565b6118cb816001612140565b92505b5061188d565b6000821180156119005750836118fd866118ef6001866121cd565b600091825260209091200190565b54145b15611919576119106001836121cd565b9250505061062d565b50905061062d565b60fc80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6101605460ff16156107735760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016106a1565b600054610100900460ff166119e15760405162461bcd60e51b81526004016106a190612182565b60366119ed838261222e565b5060376110f6828261222e565b600054610100900460ff16611a215760405162461bcd60e51b81526004016106a190612182565b60008111611a695760405162461bcd60e51b8152602060048201526015602482015274045524332304361707065643a20636170206973203605c1b60448201526064016106a1565b606555565b600054610100900460ff16611a955760405162461bcd60e51b81526004016106a190612182565b610773336113ea565b600054610100900460ff16611ac55760405162461bcd60e51b81526004016106a190612182565b610160805460ff19169055565b6001600160a01b038316611af157611ae982611d2d565b6110f6611d60565b6001600160a01b038216611b0857611ae983611d2d565b611b1183611d2d565b6110f682611d2d565b611b23816115aa565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b611bc25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016106a1565b600080846001600160a01b031684604051611bdd91906122ee565b600060405180830381855af49150503d8060008114611c18576040519150601f19603f3d011682016040523d82523d6000602084013e611c1d565b606091505b50915091506107fd828260405180606001604052806027815260200161234d60279139611d6e565b6001600160a01b038216611c9b5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016106a1565b611ca760008383611597565b8060356000828254611cb99190612140565b90915550506001600160a01b0382166000818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6000611d21600284841861230a565b61065290848416612140565b6001600160a01b038116600090815260ca6020908152604080832060339092529091205461073e9190611d87565b611d87565b61077360cb611d5b60355490565b60608315611d7d575081610652565b6106528383611dd1565b6000611d91611864565b905080611d9d84611dfb565b10156110f6578254600180820185556000858152602080822090930193909355938401805494850181558252902090910155565b815115611de15781518083602001fd5b8060405162461bcd60e51b81526004016106a19190611e69565b80546000908103611e0e57506000919050565b81548290611e1e906001906121cd565b81548110611e2e57611e2e61216c565b90600052602060002001549050919050565b919050565b60005b83811015611e60578181015183820152602001611e48565b50506000910152565b6020815260008251806020840152611e88816040850160208701611e45565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114611e4057600080fd5b60008060408385031215611ec657600080fd5b611ecf83611e9c565b946020939093013593505050565b600080600060608486031215611ef257600080fd5b611efb84611e9c565b9250611f0960208501611e9c565b9150604084013590509250925092565b600060208284031215611f2b57600080fd5b61065282611e9c565b600060208284031215611f4657600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215611f7657600080fd5b611f7f83611e9c565b9150602083013567ffffffffffffffff80821115611f9c57600080fd5b818501915085601f830112611fb057600080fd5b813581811115611fc257611fc2611f4d565b604051601f8201601f19908116603f01168101908382118183101715611fea57611fea611f4d565b8160405282815288602084870101111561200357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000806040838503121561203857600080fd5b61204183611e9c565b915061204f60208401611e9c565b90509250929050565b600181811c9082168061206c57607f821691505b60208210810361208c57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561062d5761062d61212a565b60006020828403121561216557600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b8181038181111561062d5761062d61212a565b601f8211156110f657600081815260208120601f850160051c810160208610156122075750805b601f850160051c820191505b8181101561222657828155600101612213565b505050505050565b815167ffffffffffffffff81111561224857612248611f4d565b61225c816122568454612058565b846121e0565b602080601f83116001811461229157600084156122795750858301515b600019600386901b1c1916600185901b178555612226565b600085815260208120601f198616915b828110156122c0578886015182559484019460019091019084016122a1565b50858210156122de5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251612300818460208701611e45565b9190910192915050565b60008261232757634e487b7160e01b600052601260045260246000fd5b50049056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220fccd0ed6248a60b86cdf99a6d72079e2eb178b7d72afd4fa4e440fe49644b08b64736f6c6343000810003360a0604052306080523480156200001557600080fd5b50620000206200004e565b6200002a6200004e565b620000346200004e565b6200003e6200004e565b620000486200004e565b62000110565b600054610100900460ff1615620000bb5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156200010e576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051611d08620001486000396000818161043c0152818161047c0152818161051b0152818161055b01526105ee0152611d086000f3fe60806040526004361061011f5760003560e01c80638da5cb5b116100a0578063e48034b511610064578063e48034b5146102ed578063e6b2c87c1461030d578063eac989f81461032d578063f2fde38b1461034f578063fc0c546a1461036f57600080fd5b80638da5cb5b1461024757806393acb38914610279578063b15fdbb614610299578063c24a0f8b146102b9578063e30c3978146102ce57600080fd5b806352d1902d116100e757806352d1902d146101b2578063578bcf35146101c7578063715018a6146101fd57806379ba5097146102125780637b244f011461022757600080fd5b80630b97bc86146101245780632e7ba6ef146101485780632eb4a7ab1461016a5780633659cfe61461017f5780634f1ef2861461019f575b600080fd5b34801561013057600080fd5b506096545b6040519081526020015b60405180910390f35b34801561015457600080fd5b506101686101633660046115cb565b610393565b005b34801561017657600080fd5b50603254610135565b34801561018b57600080fd5b5061016861019a366004611633565b610432565b6101686101ad3660046116da565b610511565b3480156101be57600080fd5b506101356105e1565b3480156101d357600080fd5b506101356101e2366004611633565b6001600160a01b031660009081526001602052604090205490565b34801561020957600080fd5b50610168610694565b34801561021e57600080fd5b506101686106a8565b34801561023357600080fd5b5061016861024236600461173c565b610720565b34801561025357600080fd5b5060fa546001600160a01b03165b6040516001600160a01b03909116815260200161013f565b34801561028557600080fd5b506101686102943660046117cc565b61072f565b3480156102a557600080fd5b506101356102b43660046115cb565b610864565b3480156102c557600080fd5b50609754610135565b3480156102da57600080fd5b5061012c546001600160a01b0316610261565b3480156102f957600080fd5b50610168610308366004611846565b61087d565b34801561031957600080fd5b50610168610328366004611883565b61088f565b34801561033957600080fd5b506103426108a1565b60405161013f91906118c9565b34801561035b57600080fd5b5061016861036a366004611633565b610933565b34801561037b57600080fd5b506000546201000090046001600160a01b0316610261565b60006103a286868686866109a5565b90508060000361041f5760405162461bcd60e51b815260206004820152603e60248201527f446973747269627574696f6e5661756c744d65726b6c6556657374696e67557060448201527f677261646561626c653a204e6f20617661696c61626c6520616d6f756e74000060648201526084015b60405180910390fd5b61042a858683610a67565b505050505050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361047a5760405162461bcd60e51b8152600401610416906118fc565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166104c3600080516020611c8c833981519152546001600160a01b031690565b6001600160a01b0316146104e95760405162461bcd60e51b815260040161041690611948565b6104f281610af9565b6040805160008082526020820190925261050e91839190610b01565b50565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036105595760405162461bcd60e51b8152600401610416906118fc565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105a2600080516020611c8c833981519152546001600160a01b031690565b6001600160a01b0316146105c85760405162461bcd60e51b815260040161041690611948565b6105d182610af9565b6105dd82826001610b01565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106815760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610416565b50600080516020611c8c83398151915290565b61069c610c71565b6106a66000610ccb565b565b61012c5433906001600160a01b031681146107175760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610416565b61050e81610ccb565b61042a86338787878787610ce5565b600054610100900460ff161580801561074f5750600054600160ff909116105b806107695750303b158015610769575060005460ff166001145b6107cc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610416565b6000805460ff1916600117905580156107ef576000805461ff0019166101001790555b6107fc8684848888610dec565b610804610e2f565b61080d87610ccb565b610815610e5e565b801561085b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b600061087386868686866109a5565b9695505050505050565b610885610e85565b6105dd8282610e8d565b610897610e85565b6105dd8282610ede565b6060603380546108b090611994565b80601f01602080910402602001604051908101604052809291908181526020018280546108dc90611994565b80156109295780601f106108fe57610100808354040283529160200191610929565b820191906000526020600020905b81548152906001019060200180831161090c57829003601f168201915b5050505050905090565b61093b610c71565b61012c80546001600160a01b0383166001600160a01b0319909116811790915561096d60fa546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60006109b48686868686610f25565b610a265760405162461bcd60e51b815260206004820152603860248201527f446973747269627574696f6e5661756c744d65726b6c6556657374696e67557060448201527f677261646561626c653a20496e76616c69642070726f6f6600000000000000006064820152608401610416565b6000610a3185610f86565b9050610a52866001600160a01b031660009081526001602052604090205490565b610a5c90826119e4565b979650505050505050565b6001600160a01b03831660009081526001602052604081208054839290610a8f9084906119f7565b9091555050600054610ab1906201000090046001600160a01b03168383610fe3565b826001600160a01b03167fc1d32ad5cca423e7dda2123dbf8c482f8e77d00b631c06e903a47f2cec1334df82604051610aec91815260200190565b60405180910390a2505050565b61050e610c71565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610b3957610b3483611061565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610b93575060408051601f3d908101601f19168201909252610b9091810190611a0a565b60015b610bf65760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610416565b600080516020611c8c8339815191528114610c655760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610416565b50610b348383836110fd565b60fa546001600160a01b031633146106a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610416565b61012c80546001600160a01b031916905561050e81611122565b6000610cf488888888886109a5565b905080600003610d6c5760405162461bcd60e51b815260206004820152603760248201527f446973747269627574696f6e5661756c744d65726b6c6555706772616465616260448201527f6c653a204e6f20617661696c61626c6520616d6f756e740000000000000000006064820152608401610416565b81811015610dd75760405162461bcd60e51b815260206004820152603260248201527f446973747269627574696f6e5661756c744d65726b6c655570677261646561626044820152711b194e88125b9d985b1a5908185b5bdd5b9d60721b6064820152608401610416565b610de2878484610a67565b5050505050505050565b600054610100900460ff16610e135760405162461bcd60e51b815260040161041690611a23565b610e1e858585611174565b610e2882826111b6565b5050505050565b600054610100900460ff16610e565760405162461bcd60e51b815260040161041690611a23565b6106a66111dd565b600054610100900460ff166106a65760405162461bcd60e51b815260040161041690611a23565b6106a6610c71565b60328290556033610e9e8282611ab4565b506032547f6746d20118e403b63707d33894226f34b7f86abb8560997d1a6e57230337270c6033604051610ed29190611b74565b60405180910390a25050565b6096829055609781905560408051838152602081018390527fb7ea0458b9d52a933f4ca5316b67d2d2a3b46c88ca36ff5e0c3193302e11c989910160405180910390a15050565b600080868686604051602001610f609392919092835260609190911b6bffffffffffffffffffffffff19166020830152603482015260540190565b604051602081830303815290604052805190602001209050610a5c84846032548461120d565b60975460009042908111610fda576096548111610fa4576000610fdc565b609654609754610fb491906119e4565b609654610fc190836119e4565b610fcb9085611bff565b610fd59190611c1e565b610fdc565b825b9392505050565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d116001600051141617169150508061105b5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610416565b50505050565b6001600160a01b0381163b6110ce5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610416565b600080516020611c8c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61110683611225565b6000825111806111135750805b15610b345761105b8383611265565b60fa80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661119b5760405162461bcd60e51b815260040161041690611a23565b6111a48361135b565b6111ae828261138b565b610b34610e5e565b600054610100900460ff166108975760405162461bcd60e51b815260040161041690611a23565b600054610100900460ff166112045760405162461bcd60e51b815260040161041690611a23565b6106a633610ccb565b60008261121b8686856113bc565b1495945050505050565b61122e81611061565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6112cd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610416565b600080846001600160a01b0316846040516112e89190611c40565b600060405180830381855af49150503d8060008114611323576040519150601f19603f3d011682016040523d82523d6000602084013e611328565b606091505b50915091506113508282604051806060016040528060278152602001611cac60279139611408565b925050505b92915050565b600054610100900460ff166113825760405162461bcd60e51b815260040161041690611a23565b61050e81611421565b600054610100900460ff166113b25760405162461bcd60e51b815260040161041690611a23565b6105dd82826114a9565b600081815b848110156113ff576113eb828787848181106113df576113df611c5c565b9050602002013561150d565b9150806113f781611c72565b9150506113c1565b50949350505050565b60608315611417575081610fdc565b610fdc8383611539565b600054610100900460ff166114485760405162461bcd60e51b815260040161041690611a23565b6000805462010000600160b01b031916620100006001600160a01b038481168202929092179283905560405192041681527fca2461d31e00485b1c8eb7f0e3b7013d247e2007e230a4253c105247888cbcbe9060200160405180910390a150565b600054610100900460ff166114d05760405162461bcd60e51b815260040161041690611a23565b6114da8282610e8d565b6032547f995c3917f97d15fde55c215b9beda34b4ee1049fb0b46c1f9e6d93440da2e40a6033604051610ed29190611b74565b6000818310611529576000828152602084905260409020610fdc565b5060009182526020526040902090565b8151156115495781518083602001fd5b8060405162461bcd60e51b815260040161041691906118c9565b80356001600160a01b038116811461157a57600080fd5b919050565b60008083601f84011261159157600080fd5b50813567ffffffffffffffff8111156115a957600080fd5b6020830191508360208260051b85010111156115c457600080fd5b9250929050565b6000806000806000608086880312156115e357600080fd5b853594506115f360208701611563565b935060408601359250606086013567ffffffffffffffff81111561161657600080fd5b6116228882890161157f565b969995985093965092949392505050565b60006020828403121561164557600080fd5b610fdc82611563565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561167f5761167f61164e565b604051601f8501601f19908116603f011681019082821181831017156116a7576116a761164e565b816040528093508581528686860111156116c057600080fd5b858560208301376000602087830101525050509392505050565b600080604083850312156116ed57600080fd5b6116f683611563565b9150602083013567ffffffffffffffff81111561171257600080fd5b8301601f8101851361172357600080fd5b61173285823560208401611664565b9150509250929050565b60008060008060008060a0878903121561175557600080fd5b8635955060208701359450604087013567ffffffffffffffff81111561177a57600080fd5b61178689828a0161157f565b9095509350611799905060608801611563565b9150608087013590509295509295509295565b600082601f8301126117bd57600080fd5b610fdc83833560208501611664565b60008060008060008060c087890312156117e557600080fd5b6117ee87611563565b95506117fc60208801611563565b945060408701359350606087013592506080870135915060a087013567ffffffffffffffff81111561182d57600080fd5b61183989828a016117ac565b9150509295509295509295565b6000806040838503121561185957600080fd5b82359150602083013567ffffffffffffffff81111561187757600080fd5b611732858286016117ac565b6000806040838503121561189657600080fd5b50508035926020909101359150565b60005b838110156118c05781810151838201526020016118a8565b50506000910152565b60208152600082518060208401526118e88160408501602087016118a5565b601f01601f19169190910160400192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c908216806119a857607f821691505b6020821081036119c857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115611355576113556119ce565b80820180821115611355576113556119ce565b600060208284031215611a1c57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f821115610b3457600081815260208120601f850160051c81016020861015611a955750805b601f850160051c820191505b8181101561042a57828155600101611aa1565b815167ffffffffffffffff811115611ace57611ace61164e565b611ae281611adc8454611994565b84611a6e565b602080601f831160018114611b175760008415611aff5750858301515b600019600386901b1c1916600185901b17855561042a565b600085815260208120601f198616915b82811015611b4657888601518255948401946001909101908401611b27565b5085821015611b645787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000602080835260008454611b8881611994565b80848701526040600180841660008114611ba95760018114611bc357611bf1565b60ff1985168984015283151560051b890183019550611bf1565b896000528660002060005b85811015611be95781548b8201860152908301908801611bce565b8a0184019650505b509398975050505050505050565b6000816000190483118215151615611c1957611c196119ce565b500290565b600082611c3b57634e487b7160e01b600052601260045260246000fd5b500490565b60008251611c528184602087016118a5565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b600060018201611c8457611c846119ce565b506001019056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220f2d98e4c90516be26ccaf4e34d90c5eee48badfccfc15e081724259d75d766e564736f6c6343000810003360a0604052306080523480156200001557600080fd5b506200002062000044565b6200002a62000044565b6200003462000044565b6200003e62000044565b62000106565b600054610100900460ff1615620000b15760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101562000104576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051611d186200013e600039600081816104d701528181610520015281816107250152818161076501526107f40152611d186000f3fe6080604052600436106101665760003560e01c806379ba5097116100d1578063d09de08a1161008a578063f00e8bc211610064578063f00e8bc214610436578063f2fde38b14610458578063fb93210814610478578063fc0c546a1461049857600080fd5b8063d09de08a146103e2578063d5f39488146103f7578063e30c39781461041857600080fd5b806379ba5097146103315780638b9d1375146103465780638da5cb5b146103665780639852595c14610398578063c0463711146103b8578063c24a0f8b146103cd57600080fd5b80633bc1d41f116101235780633bc1d41f1461027e5780634f1ef2861461029e57806352d1902d146102b1578063578bcf35146102c65780636867aac5146102fc578063715018a61461031c57600080fd5b80630aae7a6b1461016b5780630b97bc86146101e857806310098ad5146102075780631a39d8ef146102275780633659cfe61461023c57806337cb9e671461025e575b600080fd5b34801561017757600080fd5b506101c8610186366004611706565b6001600160a01b031660008181526034602090815260408083208151808301835281548082526001928301549185018290529585529252909120549192909190565b604080519384526020840192909252908201526060015b60405180910390f35b3480156101f457600080fd5b506066545b6040519081526020016101df565b34801561021357600080fd5b506101f9610222366004611706565b6104bc565b34801561023357600080fd5b506065546101f9565b34801561024857600080fd5b5061025c610257366004611706565b6104cd565b005b34801561026a57600080fd5b5061025c61027936600461176d565b6105b5565b34801561028a57600080fd5b5061025c6102993660046117af565b6105cb565b61025c6102ac36600461182c565b61071b565b3480156102bd57600080fd5b506101f96107e7565b3480156102d257600080fd5b506101f96102e1366004611706565b6001600160a01b031660009081526001602052604090205490565b34801561030857600080fd5b506101f96103173660046118ee565b61089a565b34801561032857600080fd5b5061025c6108ad565b34801561033d57600080fd5b5061025c6108c1565b34801561035257600080fd5b5061025c610361366004611910565b610938565b34801561037257600080fd5b5060c8546001600160a01b03165b6040516001600160a01b0390911681526020016101df565b3480156103a457600080fd5b506101f96103b3366004611706565b610950565b3480156103c457600080fd5b506032546101f9565b3480156103d957600080fd5b506067546101f9565b3480156103ee57600080fd5b506068546101f9565b34801561040357600080fd5b5061019054610380906001600160a01b031681565b34801561042457600080fd5b5060fa546001600160a01b0316610380565b34801561044257600080fd5b5060645460405160ff90911681526020016101df565b34801561046457600080fd5b5061025c610473366004611706565b61095b565b34801561048457600080fd5b5061025c610493366004611963565b6109cc565b3480156104a457600080fd5b506000546201000090046001600160a01b0316610380565b60006104c782610a44565b92915050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361051e5760405162461bcd60e51b81526004016105159061198d565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610567600080516020611c9c833981519152546001600160a01b031690565b6001600160a01b03161461058d5760405162461bcd60e51b8152600401610515906119d9565b61059681610a70565b604080516000808252602082019092526105b291839190610a78565b50565b6105bd610be3565b6105c78282610c2d565b5050565b600054610100900460ff16158080156105eb5750600054600160ff909116105b806106055750303b158015610605575060005460ff166001145b6106685760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610515565b6000805460ff19166001179055801561068b576000805461ff0019166101001790555b61069486610dcf565b6106a085858585610e07565b6106a8610e40565b6106b187610e6f565b6106b9610e88565b61019080546001600160a01b031916331790558015610712576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036107635760405162461bcd60e51b81526004016105159061198d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107ac600080516020611c9c833981519152546001600160a01b031690565b6001600160a01b0316146107d25760405162461bcd60e51b8152600401610515906119d9565b6107db82610a70565b6105c782826001610a78565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108875760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610515565b50600080516020611c9c83398151915290565b60006108a68383610eaf565b9392505050565b6108b5610ebb565b6108bf6000610e6f565b565b60fa5433906001600160a01b0316811461092f5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610515565b6105b281610e6f565b610940610be3565b61094b838383610f15565b505050565b60006104c782610f6a565b610963610ebb565b60fa80546001600160a01b0383166001600160a01b0319909116811790915561099460c8546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b336109d681610a44565b821115610a395760405162461bcd60e51b815260206004820152602b60248201527f446973747269627574696f6e5661756c74416c6c6f636174696f6e557067726160448201526a646561626c653a2030303160a81b6064820152608401610515565b61094b818484610fdc565b6001600160a01b038116600090815260016020526040812054610a6683610f6a565b6104c79190611a3b565b6105b2610ebb565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610aab5761094b8361106e565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610b05575060408051601f3d908101601f19168201909252610b0291810190611a4e565b60015b610b685760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610515565b600080516020611c9c8339815191528114610bd75760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610515565b5061094b83838361110a565b60c8546001600160a01b0316331480610c075750610190546001600160a01b031633145b6108bf5760405162461bcd60e51b81526020600482015260006024820152604401610515565b603354600090815b81811015610d5857600060338281548110610c5257610c52611a67565b6000918252602090912001546001600160a01b03169050610c7281610f6a565b6001600160a01b038216600090815260346020526040902060010155858583818110610ca057610ca0611a67565b6001600160a01b03841660009081526034602090815260409091209102929092013590915550858583818110610cd857610cd8611a67565b9050602002013584610cea9190611a7d565b9350806001600160a01b03167f575db113df1f1e13b1df1ef4754e3e20f895deed50cdbbd9ab76c3eff78bdb05878785818110610d2957610d29611a67565b90506020020135604051610d3f91815260200190565b60405180910390a250610d5181611a90565b9050610c35565b508168056bc75e2d6310000014610dc55760405162461bcd60e51b815260206004820152602b60248201527f446973747269627574696f6e5661756c74416c6c6f636174696f6e557067726160448201526a3232b0b136329d1018181960a91b6064820152608401610515565b5050426032555050565b600054610100900460ff16610df65760405162461bcd60e51b815260040161051590611aa9565b610dff8161112f565b6105b2610e88565b600054610100900460ff16610e2e5760405162461bcd60e51b815260040161051590611aa9565b610e3a8484848461115f565b50505050565b600054610100900460ff16610e675760405162461bcd60e51b815260040161051590611aa9565b6108bf6112fd565b60fa80546001600160a01b03191690556105b28161132d565b600054610100900460ff166108bf5760405162461bcd60e51b815260040161051590611aa9565b60006108a6838361137f565b60c8546001600160a01b031633146108bf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610515565b603380546001810182556000919091527f82a75bdeeae8604d839476ae9efd8b0e15aa447e21bfd7f41283bb54e22c9a820180546001600160a01b0319166001600160a01b03851617905561094b8282610c2d565b6001600160a01b03811660009081526034602090815260408083208151808301909252805480835260019091015492820192909252603254909168056bc75e2d6310000091610fb99042610eaf565b610fc39190611af4565b610fcd9190611b13565b81602001516108a69190611a7d565b6001600160a01b03831660009081526001602052604081208054839290611004908490611a7d565b9091555050600054611026906201000090046001600160a01b03168383611481565b826001600160a01b03167fc1d32ad5cca423e7dda2123dbf8c482f8e77d00b631c06e903a47f2cec1334df8260405161106191815260200190565b60405180910390a2505050565b6001600160a01b0381163b6110db5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610515565b600080516020611c9c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b611113836114f9565b6000825111806111205750805b1561094b57610e3a8383611539565b600054610100900460ff166111565760405162461bcd60e51b815260040161051590611aa9565b6105b281611624565b600054610100900460ff166111865760405162461bcd60e51b815260040161051590611aa9565b60008460ff16116111c85760405162461bcd60e51b815260206004820152600c60248201526b56657374696e673a2030303160a01b6044820152606401610515565b600083116112075760405162461bcd60e51b815260206004820152600c60248201526b2b32b9ba34b7339d1018181960a11b6044820152606401610515565b8082106112455760405162461bcd60e51b815260206004820152600c60248201526b56657374696e673a2030303360a01b6044820152606401610515565b6064805460ff191660ff86161790556065839055606682905560678190558361126e8383611a3b565b6112789190611c19565b6112858460ff8716611af4565b61129790670de0b6b3a7640000611af4565b6112a19190611b13565b60688190556040805160ff8716815260208101869052808201859052606081018490526080810192909252517ffa3c9f61caab0174618bc28a1809a500bcf39b64c4f6682b6d22c884c61e1cbd9181900360a00190a150505050565b600054610100900460ff166113245760405162461bcd60e51b815260040161051590611aa9565b6108bf33610e6f565b60c880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000818311156113c05760405162461bcd60e51b815260206004820152600c60248201526b15995cdd1a5b99ce880c0c0d60a21b6044820152606401610515565b6067548211156113d05760675491505b6066548310156113e05760665492505b60645460665460009160ff169081906113f99086611a3b565b6114039190611c19565b6068546114109190611af4565b61141a9190611b13565b60645460665491925060009160ff9091169081906114389088611a3b565b6114429190611c19565b60685461144f9190611af4565b6114599190611b13565b9050670de0b6b3a764000061146e8284611a3b565b6114789190611b13565b95945050505050565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610e3a5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610515565b6115028161106e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6115a15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610515565b600080846001600160a01b0316846040516115bc9190611c4c565b600060405180830381855af49150503d80600081146115f7576040519150601f19603f3d011682016040523d82523d6000602084013e6115fc565b606091505b50915091506114788282604051806060016040528060278152602001611cbc602791396116ac565b600054610100900460ff1661164b5760405162461bcd60e51b815260040161051590611aa9565b6000805462010000600160b01b031916620100006001600160a01b038481168202929092179283905560405192041681527fca2461d31e00485b1c8eb7f0e3b7013d247e2007e230a4253c105247888cbcbe9060200160405180910390a150565b606083156116bb5750816108a6565b6108a683838151156116d05781518083602001fd5b8060405162461bcd60e51b81526004016105159190611c68565b80356001600160a01b038116811461170157600080fd5b919050565b60006020828403121561171857600080fd5b6108a6826116ea565b60008083601f84011261173357600080fd5b50813567ffffffffffffffff81111561174b57600080fd5b6020830191508360208260051b850101111561176657600080fd5b9250929050565b6000806020838503121561178057600080fd5b823567ffffffffffffffff81111561179757600080fd5b6117a385828601611721565b90969095509350505050565b60008060008060008060c087890312156117c857600080fd5b6117d1876116ea565b95506117df602088016116ea565b9450604087013560ff811681146117f557600080fd5b959894975094956060810135955060808101359460a0909101359350915050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561183f57600080fd5b611848836116ea565b9150602083013567ffffffffffffffff8082111561186557600080fd5b818501915085601f83011261187957600080fd5b81358181111561188b5761188b611816565b604051601f8201601f19908116603f011681019083821181831017156118b3576118b3611816565b816040528281528860208487010111156118cc57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000806040838503121561190157600080fd5b50508035926020909101359150565b60008060006040848603121561192557600080fd5b61192e846116ea565b9250602084013567ffffffffffffffff81111561194a57600080fd5b61195686828701611721565b9497909650939450505050565b6000806040838503121561197657600080fd5b61197f836116ea565b946020939093013593505050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b818103818111156104c7576104c7611a25565b600060208284031215611a6057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b808201808211156104c7576104c7611a25565b600060018201611aa257611aa2611a25565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000816000190483118215151615611b0e57611b0e611a25565b500290565b600082611b3057634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115611b70578160001904821115611b5657611b56611a25565b80851615611b6357918102915b93841c9390800290611b3a565b509250929050565b600082611b87575060016104c7565b81611b94575060006104c7565b8160018114611baa5760028114611bb457611bd0565b60019150506104c7565b60ff841115611bc557611bc5611a25565b50506001821b6104c7565b5060208310610133831016604e8410600b8410161715611bf3575081810a6104c7565b611bfd8383611b35565b8060001904821115611c1157611c11611a25565b029392505050565b60006108a660ff841683611b78565b60005b83811015611c43578181015183820152602001611c2b565b50506000910152565b60008251611c5e818460208701611c28565b9190910192915050565b6020815260008251806020840152611c87816040850160208701611c28565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212205df3426e8b1d3c527fb809b26b454c3bba7371fce56f31a729e4284d0d4663c764736f6c6343000810003360a0604052306080523480156200001557600080fd5b506200002062000044565b6200002a62000044565b6200003462000044565b6200003e62000044565b62000106565b600054610100900460ff1615620000b15760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101562000104576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051611a136200013e60003960008181610359015281816103a201528181610576015281816105b601526106490152611a136000f3fe6080604052600436106100fe5760003560e01c806379ba509711610095578063e30c397811610064578063e30c397814610283578063e48034b5146102a1578063eac989f8146102c1578063f2fde38b146102e3578063fc0c546a1461030357600080fd5b806379ba5097146101fc5780637b244f01146102115780638da5cb5b14610231578063b15fdbb61461026357600080fd5b80634f1ef286116100d15780634f1ef2861461018957806352d1902d1461019c578063578bcf35146101b1578063715018a6146101e757600080fd5b80632e7ba6ef146101035780632eb4a7ab146101255780633659cfe614610149578063485cc95514610169575b600080fd5b34801561010f57600080fd5b5061012361011e3660046113ac565b610327565b005b34801561013157600080fd5b506032545b6040519081526020015b60405180910390f35b34801561015557600080fd5b50610123610164366004611414565b61034f565b34801561017557600080fd5b5061012361018436600461142f565b610437565b6101236101973660046114ee565b61056c565b3480156101a857600080fd5b5061013661063c565b3480156101bd57600080fd5b506101366101cc366004611414565b6001600160a01b031660009081526001602052604090205490565b3480156101f357600080fd5b506101236106ef565b34801561020857600080fd5b50610123610703565b34801561021d57600080fd5b5061012361022c366004611550565b61077a565b34801561023d57600080fd5b5060c8546001600160a01b03165b6040516001600160a01b039091168152602001610140565b34801561026f57600080fd5b5061013661027e3660046113ac565b610789565b34801561028f57600080fd5b5060fa546001600160a01b031661024b565b3480156102ad57600080fd5b506101236102bc3660046115c0565b6107a2565b3480156102cd57600080fd5b506102d66107b4565b6040516101409190611615565b3480156102ef57600080fd5b506101236102fe366004611414565b610846565b34801561030f57600080fd5b506000546201000090046001600160a01b031661024b565b600061033686868686866108b7565b905061034786868686868a8761094f565b505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036103a05760405162461bcd60e51b815260040161039790611648565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166103e9600080516020611997833981519152546001600160a01b031690565b6001600160a01b03161461040f5760405162461bcd60e51b815260040161039790611694565b61041881610a56565b6040805160008082526020820190925261043491839190610a5e565b50565b600054610100900460ff16158080156104575750600054600160ff909116105b806104715750303b158015610471575060005460ff166001145b6104d45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610397565b6000805460ff1916600117905580156104f7576000805461ff0019166101001790555b60006060610506848383610bc9565b61050e610c0b565b61051785610c3a565b61051f610c53565b50508015610567576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036105b45760405162461bcd60e51b815260040161039790611648565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105fd600080516020611997833981519152546001600160a01b031690565b6001600160a01b0316146106235760405162461bcd60e51b815260040161039790611694565b61062c82610a56565b61063882826001610a5e565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106dc5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610397565b5060008051602061199783398151915290565b6106f7610c7a565b6107016000610c3a565b565b60fa5433906001600160a01b031681146107715760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610397565b61043481610c3a565b6103478633878787878761094f565b600061079886868686866108b7565b9695505050505050565b6107aa610cd4565b6106388282610cdc565b6060603380546107c3906116e0565b80601f01602080910402602001604051908101604052809291908181526020018280546107ef906116e0565b801561083c5780601f106108115761010080835404028352916020019161083c565b820191906000526020600020905b81548152906001019060200180831161081f57829003601f168201915b5050505050905090565b61084e610c7a565b60fa80546001600160a01b0383166001600160a01b0319909116811790915561087f60c8546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60006108c68686868686610d2d565b61092c5760405162461bcd60e51b815260206004820152603160248201527f446973747269627574696f6e5661756c744d65726b6c6555706772616465616260448201527036329d1024b73b30b634b210383937b7b360791b6064820152608401610397565b6001600160a01b0385166000908152600160205260409020546107989085611730565b600061095e88888888886108b7565b9050806000036109d65760405162461bcd60e51b815260206004820152603760248201527f446973747269627574696f6e5661756c744d65726b6c6555706772616465616260448201527f6c653a204e6f20617661696c61626c6520616d6f756e740000000000000000006064820152608401610397565b81811015610a415760405162461bcd60e51b815260206004820152603260248201527f446973747269627574696f6e5661756c744d65726b6c655570677261646561626044820152711b194e88125b9d985b1a5908185b5bdd5b9d60721b6064820152608401610397565b610a4c878484610d99565b5050505050505050565b610434610c7a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610a915761056783610e2b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610aeb575060408051601f3d908101601f19168201909252610ae891810190611743565b60015b610b4e5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610397565b6000805160206119978339815191528114610bbd5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610397565b50610567838383610ec7565b600054610100900460ff16610bf05760405162461bcd60e51b81526004016103979061175c565b610bf983610ef2565b610c038282610f22565b610567610c53565b600054610100900460ff16610c325760405162461bcd60e51b81526004016103979061175c565b610701610f53565b60fa80546001600160a01b031916905561043481610f83565b600054610100900460ff166107015760405162461bcd60e51b81526004016103979061175c565b60c8546001600160a01b031633146107015760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610397565b610701610c7a565b60328290556033610ced82826117ed565b506032547f6746d20118e403b63707d33894226f34b7f86abb8560997d1a6e57230337270c6033604051610d2191906118ad565b60405180910390a25050565b600080868686604051602001610d689392919092835260609190911b6bffffffffffffffffffffffff19166020830152603482015260540190565b604051602081830303815290604052805190602001209050610d8e848460325484610fd5565b979650505050505050565b6001600160a01b03831660009081526001602052604081208054839290610dc1908490611938565b9091555050600054610de3906201000090046001600160a01b03168383610fed565b826001600160a01b03167fc1d32ad5cca423e7dda2123dbf8c482f8e77d00b631c06e903a47f2cec1334df82604051610e1e91815260200190565b60405180910390a2505050565b6001600160a01b0381163b610e985760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610397565b60008051602061199783398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b610ed083611065565b600082511180610edd5750805b1561056757610eec83836110a5565b50505050565b600054610100900460ff16610f195760405162461bcd60e51b81526004016103979061175c565b6104348161119b565b600054610100900460ff16610f495760405162461bcd60e51b81526004016103979061175c565b6106388282611223565b600054610100900460ff16610f7a5760405162461bcd60e51b81526004016103979061175c565b61070133610c3a565b60c880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600082610fe3868685611287565b1495945050505050565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610eec5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610397565b61106e81610e2b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61110d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610397565b600080846001600160a01b031684604051611128919061194b565b600060405180830381855af49150503d8060008114611163576040519150601f19603f3d011682016040523d82523d6000602084013e611168565b606091505b509150915061119082826040518060600160405280602781526020016119b7602791396112d5565b925050505b92915050565b600054610100900460ff166111c25760405162461bcd60e51b81526004016103979061175c565b6000805462010000600160b01b031916620100006001600160a01b038481168202929092179283905560405192041681527fca2461d31e00485b1c8eb7f0e3b7013d247e2007e230a4253c105247888cbcbe9060200160405180910390a150565b600054610100900460ff1661124a5760405162461bcd60e51b81526004016103979061175c565b6112548282610cdc565b6032547f995c3917f97d15fde55c215b9beda34b4ee1049fb0b46c1f9e6d93440da2e40a6033604051610d2191906118ad565b600081815b848110156112ca576112b6828787848181106112aa576112aa611967565b905060200201356112ee565b9150806112c28161197d565b91505061128c565b5090505b9392505050565b606083156112e45750816112ce565b6112ce838361131a565b600081831061130a5760008281526020849052604090206112ce565b5060009182526020526040902090565b81511561132a5781518083602001fd5b8060405162461bcd60e51b81526004016103979190611615565b80356001600160a01b038116811461135b57600080fd5b919050565b60008083601f84011261137257600080fd5b50813567ffffffffffffffff81111561138a57600080fd5b6020830191508360208260051b85010111156113a557600080fd5b9250929050565b6000806000806000608086880312156113c457600080fd5b853594506113d460208701611344565b935060408601359250606086013567ffffffffffffffff8111156113f757600080fd5b61140388828901611360565b969995985093965092949392505050565b60006020828403121561142657600080fd5b6112ce82611344565b6000806040838503121561144257600080fd5b61144b83611344565b915061145960208401611344565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561149357611493611462565b604051601f8501601f19908116603f011681019082821181831017156114bb576114bb611462565b816040528093508581528686860111156114d457600080fd5b858560208301376000602087830101525050509392505050565b6000806040838503121561150157600080fd5b61150a83611344565b9150602083013567ffffffffffffffff81111561152657600080fd5b8301601f8101851361153757600080fd5b61154685823560208401611478565b9150509250929050565b60008060008060008060a0878903121561156957600080fd5b8635955060208701359450604087013567ffffffffffffffff81111561158e57600080fd5b61159a89828a01611360565b90955093506115ad905060608801611344565b9150608087013590509295509295509295565b600080604083850312156115d357600080fd5b82359150602083013567ffffffffffffffff81111561152657600080fd5b60005b8381101561160c5781810151838201526020016115f4565b50506000910152565b60208152600082518060208401526116348160408501602087016115f1565b601f01601f19169190910160400192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600181811c908216806116f457607f821691505b60208210810361171457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156111955761119561171a565b60006020828403121561175557600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f82111561056757600081815260208120601f850160051c810160208610156117ce5750805b601f850160051c820191505b81811015610347578281556001016117da565b815167ffffffffffffffff81111561180757611807611462565b61181b8161181584546116e0565b846117a7565b602080601f83116001811461185057600084156118385750858301515b600019600386901b1c1916600185901b178555610347565b600085815260208120601f198616915b8281101561187f57888601518255948401946001909101908401611860565b508582101561189d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020808352600084546118c1816116e0565b808487015260406001808416600081146118e257600181146118fc5761192a565b60ff1985168984015283151560051b89018301955061192a565b896000528660002060005b858110156119225781548b8201860152908301908801611907565b8a0184019650505b509398975050505050505050565b808201808211156111955761119561171a565b6000825161195d8184602087016115f1565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b60006001820161198f5761198f61171a565b506001019056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204025389b1fc5a66a3ce90ceb67278ea8161787ad3ab1675efdda89bbdb703f1a64736f6c6343000810003360a0604052306080523480156200001557600080fd5b50620000206200003a565b6200002a6200003a565b620000346200003a565b620000fc565b600054610100900460ff1615620000a75760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000fa576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516128bf620001346000396000818161086d015281816108ad0152818161099c015281816109dc0152610a6f01526128bf6000f3fe6080604052600436106101ee5760003560e01c806379ba50971161010d578063daea85c5116100a0578063f2fde38b1161006f578063f2fde38b146105d2578063f3fef3a3146105f2578063fbfa77cf14610612578063fc0c546a14610636578063fc66e7841461065457600080fd5b8063daea85c51461051b578063e0adaca21461053b578063e1270b6e1461055b578063e30c3978146105b457600080fd5b80639993e3c8116100dc5780639993e3c8146104bc578063b69ef8a8146104d1578063b88c9148146104e6578063c04637111461050657600080fd5b806379ba5097146103e35780637cbaccd5146103f857806381e7e20e1461040d5780638da5cb5b1461048a57600080fd5b806347e7ef24116101855780636fcca69b116101545780636fcca69b1461034b57806370a0823114610378578063715018a6146103ae578063728cdbca146103c357600080fd5b806347e7ef24146102ee5780634f1ef2861461030e57806352d1902d1461032157806366b0bebc1461033657600080fd5b806322429085116101c1578063224290851461027957806324ec75901461029957806331d7a262146102ae5780633659cfe6146102ce57600080fd5b806301f59d16146101f3578063111eb8b11461021757806315770d99146102375780631e83409a14610259575b600080fd5b3480156101ff57600080fd5b506037545b6040519081526020015b60405180910390f35b34801561022357600080fd5b5061020461023236600461241c565b61066f565b34801561024357600080fd5b5061025761025236600461241c565b6106de565b005b34801561026557600080fd5b5061025761027436600461241c565b610741565b34801561028557600080fd5b50610257610294366004612439565b61083a565b3480156102a557600080fd5b50603654610204565b3480156102ba57600080fd5b506102046102c936600461241c565b610852565b3480156102da57600080fd5b506102576102e936600461241c565b610863565b3480156102fa57600080fd5b50610257610309366004612465565b610942565b61025761031c3660046124a7565b610992565b34801561032d57600080fd5b50610204610a62565b34801561034257600080fd5b50603554610204565b34801561035757600080fd5b5061036b61036636600461241c565b610b15565b60405161020e919061256b565b34801561038457600080fd5b5061020461039336600461241c565b6001600160a01b031660009081526006602052604090205490565b3480156103ba57600080fd5b50610257610b8e565b3480156103cf57600080fd5b506102576103de366004612596565b610ba2565b3480156103ef57600080fd5b50610257610cd7565b34801561040457600080fd5b50600254610204565b34801561041957600080fd5b5061046f61042836600461241c565b6040805180820190915260008082526020820152506001600160a01b0316600090815260066020908152604091829020825180840190935280548352600101549082015290565b6040805182518152602092830151928101929092520161020e565b34801561049657600080fd5b506099546001600160a01b03165b6040516001600160a01b03909116815260200161020e565b3480156104c857600080fd5b5061036b610d4e565b3480156104dd57600080fd5b50610204610da6565b3480156104f257600080fd5b5061020461050136600461241c565b610e18565b34801561051257600080fd5b50600454610204565b34801561052757600080fd5b5061025761053636600461241c565b610ebf565b34801561054757600080fd5b5061025761055636600461241c565b610f23565b34801561056757600080fd5b506105a46105763660046125fb565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b604051901515815260200161020e565b3480156105c057600080fd5b5060cb546001600160a01b03166104a4565b3480156105de57600080fd5b506102576105ed36600461241c565b610ffb565b3480156105fe57600080fd5b5061025761060d366004612465565b61106c565b34801561061e57600080fd5b506000546201000090046001600160a01b03166104a4565b34801561064257600080fd5b506001546001600160a01b03166104a4565b34801561066057600080fd5b50678ac7230489e80000610204565b6001600160a01b0381166000908152603860209081526040808320815160808101835281548152600182015493810193909352600281015491830191909152600301546060820181905242116106d4574281606001516106cf919061264a565b6106d7565b60005b9392505050565b3360008181526007602090815260408083206001600160a01b038616808552908352818420805460ff19169055905192835292917f1d3e246ebbc933bf65d3290db9f93d67ab91a12d2b19308a35806e04d1c174c591015b60405180910390a350565b6107496110bd565b600061075482611257565b90508060000361079a5760405162461bcd60e51b815260206004820152600c60248201526b14dd185ada5b99ce880c0c0d60a21b60448201526064015b60405180910390fd5b6107a3826113db565b6002546001600160a01b038316600090815260066020526040902054670de0b6b3a7640000916107d29161265d565b6107dc919061267c565b6001600160a01b038316600081815260066020526040908190206001019290925590517f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49061082e9084815260200190565b60405180910390a25050565b6108426114f5565b61084d8383836114fd565b505050565b600061085d82611257565b92915050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036108ab5760405162461bcd60e51b81526004016107919061269e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108f4600080516020612843833981519152546001600160a01b031690565b6001600160a01b03161461091a5760405162461bcd60e51b8152600401610791906126ea565b610923816115de565b6040805160008082526020820190925261093f918391906115e6565b50565b61094c8282611751565b6035546109599042612736565b6001600160a01b039092166000908152603860205260409020600381019290925550603654600182015560375460028201556035549055565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036109da5760405162461bcd60e51b81526004016107919061269e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a23600080516020612843833981519152546001600160a01b031690565b6001600160a01b031614610a495760405162461bcd60e51b8152600401610791906126ea565b610a52826115de565b610a5e828260016115e6565b5050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b025760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610791565b5060008051602061284383398151915290565b610b406040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b0316600090815260386020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b610b9661190b565b610ba06000611965565b565b600054610100900460ff1615808015610bc25750600054600160ff909116105b80610bdc5750303b158015610bdc575060005460ff166001145b610c3f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610791565b6000805460ff191660011790558015610c62576000805461ff0019166101001790555b610c6f868686868661197e565b610c776119c1565b610c8087611965565b610c886119f0565b8015610cce576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b60cb5433906001600160a01b03168114610d455760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610791565b61093f81611965565b610d796040518060800160405280600081526020016000815260200160008152602001600081525090565b50604080516080810182526002548152600354602082015260045491810191909152600554606082015290565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610def573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e139190612749565b905090565b6001600160a01b038116600090815260386020908152604080832081516080810183528154815260018201549381019390935260028101549183019190915260030154606082015281610e6a8461066f565b8251909150610e7d578160200151610eb7565b8151602083015160408401518391610e949161264a565b610e9e919061265d565b610ea8919061267c565b8260200151610eb79190612736565b949350505050565b3360008181526007602090815260408083206001600160a01b03861680855290835292819020805460ff1916600190811790915590519081529192917f1d3e246ebbc933bf65d3290db9f93d67ab91a12d2b19308a35806e04d1c174c59101610736565b610f2b6114f5565b6005546001546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c9190612749565b610fa6919061264a565b600154909150610fc0906001600160a01b03168383611a17565b816001600160a01b03167fd43c97094d4b3522923f3751f896fb88ef95d5e1d310aea58b936625fd7c5d0c8260405161082e91815260200190565b61100361190b565b60cb80546001600160a01b0383166001600160a01b031990911681179091556110346099546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600068056bc75e2d6310000061108184610e18565b61108b908461265d565b611095919061267c565b905080156110b3576110a7818361264a565b91506110b38382611a7a565b61084d8383611b7a565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112a9190612749565b90508060000361113b575042600455565b60008054600354604051632614965760e21b8152306004820152620100009092046001600160a01b031692918390639852595c90602401602060405180830381865afa15801561118f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b39190612749565b6111bd919061264a565b905080600260010160008282546111d49190612736565b909155508390506111ed82670de0b6b3a764000061265d565b6111f7919061267c565b6002546112049190612736565b60028190554260048190556003546040805193845260208401919091528201527f40c2d32ec54ffac45999120b79eb2516538010ed69ffd59c3f8a184d83b1309e906060015b60405180910390a1505050565b6001546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156112a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c89190612749565b60025490915081158015906112de575060045442115b156113935760008054600354604051632614965760e21b8152306004820152620100009092046001600160a01b031692918390639852595c90602401602060405180830381865afa158015611337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135b9190612749565b611365919061264a565b90508361137a82670de0b6b3a764000061265d565b611384919061267c565b61138e9084612736565b925050505b6001600160a01b038416600090815260066020526040902060018101549054670de0b6b3a7640000906113c790849061265d565b6113d1919061267c565b610eb7919061264a565b6001600160a01b0381166000908152600660205260409020541561093f576001600160a01b0381166000908152600660205260408120600181015460025491549091670de0b6b3a764000091611431919061265d565b61143b919061267c565b611445919061264a565b90508015610a5e57600054604051631f72642160e31b81526001600160a01b03848116600483015260248201849052620100009092049091169063fb93210890604401600060405180830381600087803b1580156114a257600080fd5b505af11580156114b6573d6000803e3d6000fd5b50505050816001600160a01b03167fc083a1647e3ee591bf42b82564ffb4d16fdbb26068f0080da911c8d8300fd84a8260405161082e91815260200190565b610ba061190b565b678ac7230489e8000081111561154b5760405162461bcd60e51b81526020600482015260136024820152725374616b696e67576974684665653a2030303160681b6044820152606401610791565b808211156115915760405162461bcd60e51b815260206004820152601360248201527229ba30b5b4b733abb4ba342332b29d1018181960691b6044820152606401610791565b60358390556036829055603781905560408051838152602081018390529081018490527f9fef908e44cc0f51b9e9f7fd26bc506a50448657da0dc10a9661e37bc1c4a3929060600161124a565b61093f61190b565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156116195761084d83611d7d565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611673575060408051601f3d908101601f1916820190925261167091810190612749565b60015b6116d65760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610791565b60008051602061284383398151915281146117455760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610791565b5061084d838383611e19565b8161175b81611e44565b6001600160a01b03831633148061179557506001600160a01b038316600090815260076020908152604080832033845290915290205460ff165b6117d05760405162461bcd60e51b815260206004820152600c60248201526b5374616b696e673a2030303160a01b6044820152606401610791565b6000821161180f5760405162461bcd60e51b815260206004820152600c60248201526b29ba30b5b4b7339d1018181960a11b6044820152606401610791565b6001600160a01b03831660009081526006602052604081208054849290611837908490612736565b90915550506002546001600160a01b038416600090815260066020526040902054670de0b6b3a76400009161186b9161265d565b611875919061267c565b6001600160a01b038416600090815260066020526040812060010191909155600580548492906118a6908490612736565b90915550506001546118c3906001600160a01b0316843085611e55565b826001600160a01b03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c836040516118fe91815260200190565b60405180910390a2505050565b6099546001600160a01b03163314610ba05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610791565b60cb80546001600160a01b031916905561093f81611e8d565b600054610100900460ff166119a55760405162461bcd60e51b815260040161079190612762565b6119af8585611edf565b6119ba838383611f10565b5050505050565b600054610100900460ff166119e85760405162461bcd60e51b815260040161079190612762565b610ba0611f83565b600054610100900460ff16610ba05760405162461bcd60e51b815260040161079190612762565b6040516001600160a01b03831660248201526044810182905261084d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fb3565b81611a8481611e44565b6001600160a01b03831660009081526006602052604081208054849290611aac90849061264a565b90915550506002546001600160a01b038416600090815260066020526040902054670de0b6b3a764000091611ae09161265d565b611aea919061267c565b6001600160a01b03841660009081526006602052604081206001019190915560058054849290611b1b90849061264a565b9091555050600154604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015611b6657600080fd5b505af1158015610cce573d6000803e3d6000fd5b81611b8481611e44565b6001600160a01b038316331480611bbe57506001600160a01b038316600090815260076020908152604080832033845290915290205460ff165b611bf95760405162461bcd60e51b815260206004820152600c60248201526b5374616b696e673a2030303160a01b6044820152606401610791565b60008211611c385760405162461bcd60e51b815260206004820152600c60248201526b29ba30b5b4b7339d1018181960a11b6044820152606401610791565b6001600160a01b038316600090815260066020526040902054821115611c8f5760405162461bcd60e51b815260206004820152600c60248201526b5374616b696e673a2030303360a01b6044820152606401610791565b6001600160a01b03831660009081526006602052604081208054849290611cb790849061264a565b90915550506002546001600160a01b038416600090815260066020526040902054670de0b6b3a764000091611ceb9161265d565b611cf5919061267c565b6001600160a01b03841660009081526006602052604081206001019190915560058054849290611d2690849061264a565b9091555050600154611d42906001600160a01b03168484611a17565b826001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364836040516118fe91815260200190565b6001600160a01b0381163b611dea5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610791565b60008051602061284383398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b611e2283612085565b600082511180611e2f5750805b1561084d57611e3e83836120c5565b50505050565b611e4c6110bd565b61093f816113db565b6040516001600160a01b0380851660248301528316604482015260648101829052611e3e9085906323b872dd60e01b90608401611a43565b609980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16611f065760405162461bcd60e51b815260040161079190612762565b610a5e82826121b9565b600054610100900460ff16611f375760405162461bcd60e51b815260040161079190612762565b60408051848152602081018490529081018290527f2893e657394a41d7b1665f9c73ffa5d51d04c4959e9433c74f85c83227198aa89060600160405180910390a161084d8383836114fd565b600054610100900460ff16611faa5760405162461bcd60e51b815260040161079190612762565b610ba033611965565b6000612008826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122619092919063ffffffff16565b80519091501561084d578080602001905181019061202691906127ad565b61084d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610791565b61208e81611d7d565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61212d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610791565b600080846001600160a01b03168460405161214891906127f3565b600060405180830381855af49150503d8060008114612183576040519150601f19603f3d011682016040523d82523d6000602084013e612188565b606091505b50915091506121b0828260405180606001604052806027815260200161286360279139612270565b95945050505050565b600054610100900460ff166121e05760405162461bcd60e51b815260040161079190612762565b426004556000805462010000600160b01b031916620100006001600160a01b0385811691820292909217909255600180546001600160a01b03191691841691821790556040805192835260208301919091527f42972240a0414a25ec1f1fdc1a6c4d3e09716989e87d2ef862e36eb3d4f12276910160405180910390a15050565b6060610eb78484600085612289565b6060831561227f5750816106d7565b6106d78383612364565b6060824710156122ea5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610791565b600080866001600160a01b0316858760405161230691906127f3565b60006040518083038185875af1925050503d8060008114612343576040519150601f19603f3d011682016040523d82523d6000602084013e612348565b606091505b50915091506123598783838761238e565b979650505050505050565b8151156123745781518083602001fd5b8060405162461bcd60e51b8152600401610791919061280f565b606083156123fd5782516000036123f6576001600160a01b0385163b6123f65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610791565b5081610eb7565b610eb78383612364565b6001600160a01b038116811461093f57600080fd5b60006020828403121561242e57600080fd5b81356106d781612407565b60008060006060848603121561244e57600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561247857600080fd5b823561248381612407565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156124ba57600080fd5b82356124c581612407565b9150602083013567ffffffffffffffff808211156124e257600080fd5b818501915085601f8301126124f657600080fd5b81358181111561250857612508612491565b604051601f8201601f19908116603f0116810190838211818310171561253057612530612491565b8160405282815288602084870101111561254957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b815181526020808301519082015260408083015190820152606080830151908201526080810161085d565b60008060008060008060c087890312156125af57600080fd5b86356125ba81612407565b955060208701356125ca81612407565b945060408701356125da81612407565b959894975094956060810135955060808101359460a0909101359350915050565b6000806040838503121561260e57600080fd5b823561261981612407565b9150602083013561262981612407565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561085d5761085d612634565b600081600019048311821515161561267757612677612634565b500290565b60008261269957634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b8082018082111561085d5761085d612634565b60006020828403121561275b57600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156127bf57600080fd5b815180151581146106d757600080fd5b60005b838110156127ea5781810151838201526020016127d2565b50506000910152565b600082516128058184602087016127cf565b9190910192915050565b602081526000825180602084015261282e8160408501602087016127cf565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209eafbc564b30df2ead2e23574a25b3fd59286cade230a53a97dcad192d78d45964736f6c6343000810003360a0604052306080523480156200001557600080fd5b506200002062000030565b6200002a62000030565b620000f2565b600054610100900460ff16156200009d5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000f0576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516122416200012a600039600081816106ae015281816106ee01528181610947015281816109870152610a1a01526122416000f3fe6080604052600436106101665760003560e01c80638da5cb5b116100d1578063e0adaca21161008a578063f2fde38b11610064578063f2fde38b146104b5578063f3fef3a3146104d5578063fbfa77cf146104f5578063fc0c546a1461051957600080fd5b8063e0adaca21461041e578063e1270b6e1461043e578063e30c39781461049757600080fd5b80638da5cb5b1461033a5780639993e3c81461036c578063b69ef8a8146103b4578063c0463711146103c9578063c0c53b8b146103de578063daea85c5146103fe57600080fd5b806352d1902d1161012357806352d1902d1461023357806370a0823114610248578063715018a61461027e57806379ba5097146102935780637cbaccd5146102a857806381e7e20e146102bd57600080fd5b806315770d991461016b5780631e83409a1461018d57806331d7a262146101ad5780633659cfe6146101e057806347e7ef24146102005780634f1ef28614610220575b600080fd5b34801561017757600080fd5b5061018b610186366004611e0f565b610537565b005b34801561019957600080fd5b5061018b6101a8366004611e0f565b61059a565b3480156101b957600080fd5b506101cd6101c8366004611e0f565b610693565b6040519081526020015b60405180910390f35b3480156101ec57600080fd5b5061018b6101fb366004611e0f565b6106a4565b34801561020c57600080fd5b5061018b61021b366004611e2c565b610783565b61018b61022e366004611e6e565b61093d565b34801561023f57600080fd5b506101cd610a0d565b34801561025457600080fd5b506101cd610263366004611e0f565b6001600160a01b031660009081526006602052604090205490565b34801561028a57600080fd5b5061018b610ac0565b34801561029f57600080fd5b5061018b610ad4565b3480156102b457600080fd5b506002546101cd565b3480156102c957600080fd5b5061031f6102d8366004611e0f565b6040805180820190915260008082526020820152506001600160a01b0316600090815260066020908152604091829020825180840190935280548352600101549082015290565b604080518251815260209283015192810192909252016101d7565b34801561034657600080fd5b506067546001600160a01b03165b6040516001600160a01b0390911681526020016101d7565b34801561037857600080fd5b50610381610b4b565b6040516101d791908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b3480156103c057600080fd5b506101cd610ba3565b3480156103d557600080fd5b506004546101cd565b3480156103ea57600080fd5b5061018b6103f9366004611f32565b610c15565b34801561040a57600080fd5b5061018b610419366004611e0f565b610d44565b34801561042a57600080fd5b5061018b610439366004611e0f565b610da8565b34801561044a57600080fd5b50610487610459366004611f7d565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b60405190151581526020016101d7565b3480156104a357600080fd5b506099546001600160a01b0316610354565b3480156104c157600080fd5b5061018b6104d0366004611e0f565b610e80565b3480156104e157600080fd5b5061018b6104f0366004611e2c565b610ef1565b34801561050157600080fd5b506000546201000090046001600160a01b0316610354565b34801561052557600080fd5b506001546001600160a01b0316610354565b3360008181526007602090815260408083206001600160a01b038616808552908352818420805460ff19169055905192835292917f1d3e246ebbc933bf65d3290db9f93d67ab91a12d2b19308a35806e04d1c174c591015b60405180910390a350565b6105a26110f4565b60006105ad8261128d565b9050806000036105f35760405162461bcd60e51b815260206004820152600c60248201526b14dd185ada5b99ce880c0c0d60a21b60448201526064015b60405180910390fd5b6105fc82611419565b6002546001600160a01b038316600090815260066020526040902054670de0b6b3a76400009161062b91611fcc565b6106359190611feb565b6001600160a01b038316600081815260066020526040908190206001019290925590517f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d4906106879084815260200190565b60405180910390a25050565b600061069e8261128d565b92915050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036106ec5760405162461bcd60e51b81526004016105ea9061200d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107356000805160206121c5833981519152546001600160a01b031690565b6001600160a01b03161461075b5760405162461bcd60e51b81526004016105ea90612059565b61076481611533565b604080516000808252602082019092526107809183919061153b565b50565b8161078d816116ab565b6001600160a01b0383163314806107c757506001600160a01b038316600090815260076020908152604080832033845290915290205460ff165b6108025760405162461bcd60e51b815260206004820152600c60248201526b5374616b696e673a2030303160a01b60448201526064016105ea565b600082116108415760405162461bcd60e51b815260206004820152600c60248201526b29ba30b5b4b7339d1018181960a11b60448201526064016105ea565b6001600160a01b038316600090815260066020526040812080548492906108699084906120a5565b90915550506002546001600160a01b038416600090815260066020526040902054670de0b6b3a76400009161089d91611fcc565b6108a79190611feb565b6001600160a01b038416600090815260066020526040812060010191909155600580548492906108d89084906120a5565b90915550506001546108f5906001600160a01b03168430856116bc565b826001600160a01b03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c8360405161093091815260200190565b60405180910390a2505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036109855760405162461bcd60e51b81526004016105ea9061200d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166109ce6000805160206121c5833981519152546001600160a01b031690565b6001600160a01b0316146109f45760405162461bcd60e51b81526004016105ea90612059565b6109fd82611533565b610a098282600161153b565b5050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610aad5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016105ea565b506000805160206121c583398151915290565b610ac8611727565b610ad26000611781565b565b60995433906001600160a01b03168114610b425760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016105ea565b61078081611781565b610b766040518060800160405280600081526020016000815260200160008152602001600081525090565b50604080516080810182526002548152600354602082015260045491810191909152600554606082015290565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610bec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1091906120b8565b905090565b600054610100900460ff1615808015610c355750600054600160ff909116105b80610c4f5750303b158015610c4f575060005460ff166001145b610cb25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ea565b6000805460ff191660011790558015610cd5576000805461ff0019166101001790555b610cdf838361179a565b610ce76117cb565b610cf084611781565b610cf86117fa565b8015610d3e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b3360008181526007602090815260408083206001600160a01b03861680855290835292819020805460ff1916600190811790915590519081529192917f1d3e246ebbc933bf65d3290db9f93d67ab91a12d2b19308a35806e04d1c174c5910161058f565b610db0611821565b6005546001546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2191906120b8565b610e2b91906120d1565b600154909150610e45906001600160a01b03168383611829565b816001600160a01b03167fd43c97094d4b3522923f3751f896fb88ef95d5e1d310aea58b936625fd7c5d0c8260405161068791815260200190565b610e88611727565b609980546001600160a01b0383166001600160a01b03199091168117909155610eb96067546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b81610efb816116ab565b6001600160a01b038316331480610f3557506001600160a01b038316600090815260076020908152604080832033845290915290205460ff165b610f705760405162461bcd60e51b815260206004820152600c60248201526b5374616b696e673a2030303160a01b60448201526064016105ea565b60008211610faf5760405162461bcd60e51b815260206004820152600c60248201526b29ba30b5b4b7339d1018181960a11b60448201526064016105ea565b6001600160a01b0383166000908152600660205260409020548211156110065760405162461bcd60e51b815260206004820152600c60248201526b5374616b696e673a2030303360a01b60448201526064016105ea565b6001600160a01b0383166000908152600660205260408120805484929061102e9084906120d1565b90915550506002546001600160a01b038416600090815260066020526040902054670de0b6b3a76400009161106291611fcc565b61106c9190611feb565b6001600160a01b0384166000908152600660205260408120600101919091556005805484929061109d9084906120d1565b90915550506001546110b9906001600160a01b03168484611829565b826001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648360405161093091815260200190565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561113d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116191906120b8565b905080600003611172575042600455565b60008054600354604051632614965760e21b8152306004820152620100009092046001600160a01b031692918390639852595c90602401602060405180830381865afa1580156111c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ea91906120b8565b6111f491906120d1565b9050806002600101600082825461120b91906120a5565b9091555083905061122482670de0b6b3a7640000611fcc565b61122e9190611feb565b60025461123b91906120a5565b60028190554260048190556003546040805193845260208401919091528201527f40c2d32ec54ffac45999120b79eb2516538010ed69ffd59c3f8a184d83b1309e9060600160405180910390a1505050565b6001546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156112da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fe91906120b8565b6002549091508115801590611314575060045442115b156113c95760008054600354604051632614965760e21b8152306004820152620100009092046001600160a01b031692918390639852595c90602401602060405180830381865afa15801561136d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139191906120b8565b61139b91906120d1565b9050836113b082670de0b6b3a7640000611fcc565b6113ba9190611feb565b6113c490846120a5565b925050505b6001600160a01b038416600090815260066020526040902060018101549054670de0b6b3a7640000906113fd908490611fcc565b6114079190611feb565b61141191906120d1565b949350505050565b6001600160a01b03811660009081526006602052604090205415610780576001600160a01b0381166000908152600660205260408120600181015460025491549091670de0b6b3a76400009161146f9190611fcc565b6114799190611feb565b61148391906120d1565b90508015610a0957600054604051631f72642160e31b81526001600160a01b03848116600483015260248201849052620100009092049091169063fb93210890604401600060405180830381600087803b1580156114e057600080fd5b505af11580156114f4573d6000803e3d6000fd5b50505050816001600160a01b03167fc083a1647e3ee591bf42b82564ffb4d16fdbb26068f0080da911c8d8300fd84a8260405161068791815260200190565b610780611727565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156115735761156e83611859565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156115cd575060408051601f3d908101601f191682019092526115ca918101906120b8565b60015b6116305760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016105ea565b6000805160206121c5833981519152811461169f5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016105ea565b5061156e8383836118f5565b6116b36110f4565b61078081611419565b6040516001600160a01b0380851660248301528316604482015260648101829052610d3e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261191a565b6067546001600160a01b03163314610ad25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105ea565b609980546001600160a01b0319169055610780816119ec565b600054610100900460ff166117c15760405162461bcd60e51b81526004016105ea906120e4565b610a098282611a3e565b600054610100900460ff166117f25760405162461bcd60e51b81526004016105ea906120e4565b610ad2611ae6565b600054610100900460ff16610ad25760405162461bcd60e51b81526004016105ea906120e4565b610ad2611727565b6040516001600160a01b03831660248201526044810182905261156e90849063a9059cbb60e01b906064016116f0565b6001600160a01b0381163b6118c65760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016105ea565b6000805160206121c583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6118fe83611b16565b60008251118061190b5750805b1561156e57610d3e8383611b56565b600061196f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c4a9092919063ffffffff16565b80519091501561156e578080602001905181019061198d919061212f565b61156e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105ea565b606780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16611a655760405162461bcd60e51b81526004016105ea906120e4565b426004556000805462010000600160b01b031916620100006001600160a01b0385811691820292909217909255600180546001600160a01b03191691841691821790556040805192835260208301919091527f42972240a0414a25ec1f1fdc1a6c4d3e09716989e87d2ef862e36eb3d4f12276910160405180910390a15050565b600054610100900460ff16611b0d5760405162461bcd60e51b81526004016105ea906120e4565b610ad233611781565b611b1f81611859565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b611bbe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016105ea565b600080846001600160a01b031684604051611bd99190612175565b600060405180830381855af49150503d8060008114611c14576040519150601f19603f3d011682016040523d82523d6000602084013e611c19565b606091505b5091509150611c4182826040518060600160405280602781526020016121e560279139611c63565b95945050505050565b6060611c598484600085611c7c565b90505b9392505050565b60608315611c72575081611c5c565b611c5c8383611d57565b606082471015611cdd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105ea565b600080866001600160a01b03168587604051611cf99190612175565b60006040518083038185875af1925050503d8060008114611d36576040519150601f19603f3d011682016040523d82523d6000602084013e611d3b565b606091505b5091509150611d4c87838387611d81565b979650505050505050565b815115611d675781518083602001fd5b8060405162461bcd60e51b81526004016105ea9190612191565b60608315611df0578251600003611de9576001600160a01b0385163b611de95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ea565b5081611411565b6114118383611d57565b6001600160a01b038116811461078057600080fd5b600060208284031215611e2157600080fd5b8135611c5c81611dfa565b60008060408385031215611e3f57600080fd5b8235611e4a81611dfa565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215611e8157600080fd5b8235611e8c81611dfa565b9150602083013567ffffffffffffffff80821115611ea957600080fd5b818501915085601f830112611ebd57600080fd5b813581811115611ecf57611ecf611e58565b604051601f8201601f19908116603f01168101908382118183101715611ef757611ef7611e58565b81604052828152886020848701011115611f1057600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080600060608486031215611f4757600080fd5b8335611f5281611dfa565b92506020840135611f6281611dfa565b91506040840135611f7281611dfa565b809150509250925092565b60008060408385031215611f9057600080fd5b8235611f9b81611dfa565b91506020830135611fab81611dfa565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611fe657611fe6611fb6565b500290565b60008261200857634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b8082018082111561069e5761069e611fb6565b6000602082840312156120ca57600080fd5b5051919050565b8181038181111561069e5761069e611fb6565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561214157600080fd5b81518015158114611c5c57600080fd5b60005b8381101561216c578181015183820152602001612154565b50506000910152565b60008251612187818460208701612151565b9190910192915050565b60208152600082518060208401526121b0816040850160208701612151565b601f01601f1916919091016040019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220f5bbc69be046e67025e98a6640051bce5a1db4767c8ff84108c97fc730e9245d64736f6c63430008100033608060405260405161072738038061072783398101604081905261002291610319565b61002e82826000610035565b5050610436565b61003e8361006b565b60008251118061004b5750805b156100665761006483836100ab60201b6100291760201c565b505b505050565b610074816100d7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100d08383604051806060016040528060278152602001610700602791396101a9565b9392505050565b6100ea8161022260201b6100551760201c565b6101515760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806101887f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b61023160201b6100641760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b0316856040516101c691906103e7565b600060405180830381855af49150503d8060008114610201576040519150601f19603f3d011682016040523d82523d6000602084013e610206565b606091505b50909250905061021886838387610234565b9695505050505050565b6001600160a01b03163b151590565b90565b606083156102a357825160000361029c576001600160a01b0385163b61029c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610148565b50816102ad565b6102ad83836102b5565b949350505050565b8151156102c55781518083602001fd5b8060405162461bcd60e51b81526004016101489190610403565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103105781810151838201526020016102f8565b50506000910152565b6000806040838503121561032c57600080fd5b82516001600160a01b038116811461034357600080fd5b60208401519092506001600160401b038082111561036057600080fd5b818501915085601f83011261037457600080fd5b815181811115610386576103866102df565b604051601f8201601f19908116603f011681019083821181831017156103ae576103ae6102df565b816040528281528860208487010111156103c757600080fd5b6103d88360208301602088016102f5565b80955050505050509250929050565b600082516103f98184602087016102f5565b9190910192915050565b60208152600082518060208401526104228160408501602087016102f5565b601f01601f19169190910160400192915050565b6102bb806104456000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610067565b61009f565b565b606061004e838360405180606001604052806027815260200161025f602791396100c3565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b3660008037600080366000845af43d6000803e8080156100be573d6000f35b3d6000fd5b6060600080856001600160a01b0316856040516100e0919061020f565b600060405180830381855af49150503d806000811461011b576040519150601f19603f3d011682016040523d82523d6000602084013e610120565b606091505b50915091506101318683838761013b565b9695505050505050565b606083156101af5782516000036101a8576001600160a01b0385163b6101a85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b50816101b9565b6101b983836101c1565b949350505050565b8151156101d15781518083602001fd5b8060405162461bcd60e51b815260040161019f919061022b565b60005b838110156102065781810151838201526020016101ee565b50506000910152565b600082516102218184602087016101eb565b9190910192915050565b602081526000825180602084015261024a8160408501602087016101eb565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220cdfcb66b4b7f6df0dcc2dffdd672b471e6eab1f8bbca53a45bdceede6cfef95164736f6c63430008100033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c656400000000000000000000000088a6f9c58e12f798d47ba080606f064e124456f80000000000000000000000000000000000000000000000000000000064072941000000000000000000000000c907e116054ad103354f2d350fd2514433d57f6f0000000000000000000000001bfd67037b42cf73acf2047067bd4f2c47d9bfd6
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806351405d271161007157806351405d2714610129578063554de7981461013c5780635579ed011461014f5780638ab5212b14610162578063a7f8a5e214610175578063fc0c546a1461018857600080fd5b806316f0115b146100ae578063324eeb02146100dd5780634c265a13146100f05780634cf088d9146101035780634e3ad80f14610116575b600080fd5b600a546100c1906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6002546100c1906001600160a01b031681565b6004546100c1906001600160a01b031681565b6008546100c1906001600160a01b031681565b6009546100c1906001600160a01b031681565b6001546100c1906001600160a01b031681565b6003546100c1906001600160a01b031681565b6005546100c1906001600160a01b031681565b6006546100c1906001600160a01b031681565b6007546100c1906001600160a01b031681565b6000546100c1906001600160a01b031681565b6040516001600160a01b0383166024820152604481018290526101fe90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610258565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261023b9085906323b872dd60e01b906084016101c7565b50505050565b6060610250848460008561032f565b949350505050565b60006102ad826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166102419092919063ffffffff16565b8051909150156101fe57808060200190518101906102cb91906104a8565b6101fe5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b6060824710156103905760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610326565b600080866001600160a01b031685876040516103ac91906104f5565b60006040518083038185875af1925050503d80600081146103e9576040519150601f19603f3d011682016040523d82523d6000602084013e6103ee565b606091505b50915091506103ff8783838761040a565b979650505050505050565b60608315610479578251600003610472576001600160a01b0385163b6104725760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610326565b5081610250565b610250838381511561048e5781518083602001fd5b8060405162461bcd60e51b81526004016103269190610511565b6000602082840312156104ba57600080fd5b815180151581146104ca57600080fd5b9392505050565b60005b838110156104ec5781810151838201526020016104d4565b50506000910152565b600082516105078184602087016104d1565b9190910192915050565b60208152600082518060208401526105308160408501602087016104d1565b601f01601f1916919091016040019291505056fea264697066735822122010a220920c385cc65ad3a6862bd9bb8ba0d43e7637885553966373ebd3724e1464736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000088a6f9c58e12f798d47ba080606f064e124456f80000000000000000000000000000000000000000000000000000000064072941000000000000000000000000c907e116054ad103354f2d350fd2514433d57f6f0000000000000000000000001bfd67037b42cf73acf2047067bd4f2c47d9bfd6
-----Decoded View---------------
Arg [0] : ms (address): 0x88A6f9c58E12F798d47ba080606F064E124456f8
Arg [1] : timestamp (uint256): 1678190913
Arg [2] : feed (address): 0xc907E116054Ad103354f2D350FD2514433D57F6f
Arg [3] : wbtc (address): 0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000088a6f9c58e12f798d47ba080606f064e124456f8
Arg [1] : 0000000000000000000000000000000000000000000000000000000064072941
Arg [2] : 000000000000000000000000c907e116054ad103354f2d350fd2514433d57f6f
Arg [3] : 0000000000000000000000001bfd67037b42cf73acf2047067bd4f2c47d9bfd6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 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.