Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Sponsored
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 14871013 | 479 days 9 hrs ago | IN | Create: StakingV1 | 0 ETH | 0.07784113 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
StakingV1
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: WTFPL pragma solidity >=0.8; import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import { FixedPointMathLib } from "@rari-capital/solmate/src/utils/FixedPointMathLib.sol"; import { TransferHelper } from "@uniswap/lib/contracts/libraries/TransferHelper.sol"; import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IAccrualBondsV1 } from "../interfaces/IAccrualBondsV1.sol"; import { StakingStorageV1, Position, Pool } from "./StakingStorageV1.sol"; interface ICNV is IERC20, IERC20Permit { function mint(address guy, uint256 input) external; } interface IValueShuttle { function shuttleValue() external returns(uint256); } interface IERC721 { function tokenURI(uint256 tokenId) external view returns (string memory); } contract StakingV1 is StakingStorageV1, Initializable, AccessControlUpgradeable, PausableUpgradeable, ERC721Upgradeable { using FixedPointMathLib for uint256; //////////////////////////////////////////////////////////////////////////// // ACCESS CONTROL ROLES //////////////////////////////////////////////////////////////////////////// bytes32 public constant TREASURY_ROLE = DEFAULT_ADMIN_ROLE; bytes32 public constant POLICY_ROLE = bytes32(keccak256("POLICY_ROLE")); //////////////////////////////////////////////////////////////////////////// // EVENTS //////////////////////////////////////////////////////////////////////////// /// @notice emitted when a user locks /// @param _amount amount of CNV locked /// @param _poolID ID of the pool locked into /// @param _tokenId ID of token generated /// @param _sender address of sender event Lock( uint256 indexed _amount, uint256 indexed _poolID, uint256 indexed _tokenId, address _sender ); /// @notice emitted when a user unlocks /// @param _amount amount of CNV unlocked (principal + anti-dilutive + excess) /// @param _poolID ID of the pool locked into /// @param _owner address of NFT owner event Unlock( uint256 indexed _amount, uint256 indexed _poolID, address indexed _owner ); /// @notice emitted when a rebase occurs /// @param eStakers emissions for stakes (anti-dilutive + excess) /// @param eCOOP emissions for COOP /// @param CNVS CNV supply used for anti-dilution calculation event Rebase( uint256 indexed eStakers, uint256 indexed eCOOP, uint256 indexed CNVS ); /// @notice emitted during rebase for each pool /// @param poolID ID of pool /// @param baseObligation anti-dilution rewards for pool /// @param excessObligation excess rewards for pool /// @param balance pool balance before rebase event PoolRewarded( uint256 indexed poolID, uint256 indexed baseObligation, uint256 indexed excessObligation, uint256 balance ); //////////////////////////////////////////////////////////////////////////// // ADMIN MGMT EVENTS //////////////////////////////////////////////////////////////////////////// /// @notice emitted when MGMT creates a new pool /// @param _term length of pool term in seconds /// @param _g amount of CNV supply growth matched to pool /// @param _excessRatio ratio to calculate excess rewards for this pool /// @param _poolID ID of the pool event PoolOpened( uint64 indexed _term, uint256 indexed _g, uint256 indexed _excessRatio, uint256 _poolID ); /// @notice emitted when MGMT manages a pool /// @param _term length of pool term in seconds /// @param _g amount of CNV supply growth matched to pool /// @param _excessRatio ratio to calculate excess rewards for this pool /// @param _poolID ID of the pool event PoolManaged( uint64 indexed _term, uint256 indexed _g, uint256 indexed _excessRatio, uint256 _poolID ); /// @notice emitted when MGMT manages COOP rate /// @param _coopRatePriceControl used for COOP rate calc /// @param _haogegeControl used for COOP rate calc /// @param _coopRateMax used for COOP rate calc event CoopRateManaged( uint256 indexed _coopRatePriceControl, uint256 indexed _haogegeControl, uint256 indexed _coopRateMax ); event ExcessRewardsDistributed( uint256 indexed amountDistributed, uint256 indexed globalExcess ); /// @notice emitted when MGMT manages rebase excess apy /// @param apy apy event RebaseAPYManaged( uint256 indexed apy ); /// @notice emitted when MGMT manages rebase incentive /// @param rebaseIncentive incentive (in CNV) for calling rebase method event RebaseIncentiveManaged( uint256 indexed rebaseIncentive ); /// @notice emitted when MGMT manages rebase interval /// @param rebaseInterval interval (in seconds) between rebases event RebaseIntervalManaged( uint256 indexed rebaseInterval ); /// @notice emitted when MGMT manages minPrice /// @param minPrice minPrice used for rebase calculations event MinPriceManaged( uint256 indexed minPrice ); /// @notice emitted when MGMT manages an address /// @param _what index of address managed /// @param _address updated address event AddressManaged( uint8 indexed _what, address _address ); /* -------------------------------------------------------------------------- */ /* MODIFIERS */ /* -------------------------------------------------------------------------- */ modifier onlyRoles(bytes32 role0, bytes32 role1) { require(hasRole(role0, msg.sender) || hasRole(role1, msg.sender)); _; } /* -------------------------------------------------------------------------- */ /* INITIALIZATION */ /* -------------------------------------------------------------------------- */ /// @notice called instead of constructor on upgradeable contracts, /// sets initial storage variables, initializes inherited /// contracts, and pauses. /// @param _CNV address of CNV token /// @param _COOP address of COOP /// @param _BONDS address of BONDS contract /// @param _VALUESHUTTLE address of ValueShuttle contract function initialize( address _CNV, address _COOP, address _BONDS, address _VALUESHUTTLE, address _treasury, address _policy, uint256 _coopRatePriceControl, uint256 _haogegeControl, uint256 _coopRateMax, uint256 _minPrice, uint256 _rebaseInterval ) external virtual initializer { require(CNV == address(0), "!initialized"); CNV = _CNV; COOP = _COOP; BONDS = _BONDS; VALUESHUTTLE = _VALUESHUTTLE; coopRatePriceControl = _coopRatePriceControl; haogegeControl = _haogegeControl; coopRateMax = _coopRateMax; minPrice = _minPrice; rebaseInterval = _rebaseInterval; lastRebaseTime = block.timestamp; __Context_init(); __AccessControl_init(); __ERC165_init(); __Pausable_init(); __ERC721_init("Liquid Staked CNV", "lsdCNV"); _grantRole(TREASURY_ROLE, _treasury); _grantRole(POLICY_ROLE, _policy); _pause(); } /* -------------------------------------------------------------------------- */ /* LOCK/UNLOCK LOGIC */ /* -------------------------------------------------------------------------- */ /// @notice lock CNV into a pool using eip-2612 permit /// (https://eips.ethereum.org/EIPS/eip-2612) /// @param to address to which lock position will be assigned to /// @param input amount of CNV to lock /// @param pid pool ID to lock into /// @param permitDeadline deadline for eip-2612 signature /// @param v eip-2612 signature /// @param r eip-2612 signature /// @param s eip-2612 signature /// @return tokenId ERC721 token ID of lock function lockWithPermit( address to, uint256 input, uint256 pid, uint256 permitDeadline, uint8 v, bytes32 r, bytes32 s ) external virtual whenNotPaused returns(uint256 tokenId) { // Approve tokens for spender - https://eips.ethereum.org/EIPS/eip-2612 ICNV(CNV).permit(msg.sender, address(this), input, permitDeadline, v, r, s); tokenId = _lock(to,input,pid); } /// @notice lock CNV into a pool /// @param to address to which lock position will be assigned to /// @param input amount of CNV to lock /// @param pid pool ID to lock into /// @return tokenId ERC721 token ID of lock function lock( address to, uint256 input, uint256 pid ) external virtual whenNotPaused returns(uint256 tokenId) { tokenId = _lock(to,input,pid); } /// @notice unlock position and withdraw due CNV /// @param to address to which due CNV will be sent to /// @param tokenId ERC721 token ID of lock /// @return amountOut amount of CNV due function unlock( address to, uint256 tokenId ) external virtual whenNotPaused returns (uint256 amountOut) { // F6: CHECKS // Check that caller is owner of position to be unlocked require(ownerOf(tokenId) == msg.sender, "!OWNER"); // Fetch position storage to memory Position memory position = positions[tokenId]; // Check that position has matured require(position.maturity <= block.timestamp, "!TIME"); // F6: EFFECTS // C2: avoid reading state multiple times uint256 shares = position.shares; uint256 poolID = position.poolID; Pool storage pool = pools[poolID]; // Calculate base amount obligated to user uint256 baseObligation = shares.fmul(_poolIndex(pool.balance, pool.supply), 1e18); // Calculate excess amount obligated to user uint256 excessObligation = shares.fmul(pool.rewardsPerShare, 1e18) - position.rewardDebt; // Calculate "amountOut" due to user amountOut = baseObligation + excessObligation; lockedExcessRewards -= excessObligation; // Subtract users baseObligation and shares from pool storage pool.balance -= baseObligation; pool.supply -= shares; // C38: Delete keyword used when setting a variable to a zero value for refund delete positions[tokenId]; // Transfer user "amountOut" (baseObligation + excessObligation rewards) TransferHelper.safeTransfer(CNV, to, amountOut); // T2: Events emitted for every storage mutating function. emit Unlock(amountOut, poolID, msg.sender); } /// @notice called to assign anti-dilution and excess rewards to /// locks based on bonding that occured since last rebase /// returns vebase whether a rebase took place function rebase() external virtual whenNotPaused returns (bool vebase) { if (block.timestamp >= lastRebaseTime + rebaseInterval) { uint256 incentive = rebaseIncentive; (uint256 eCOOP, uint256 eStakers, uint256 CNVS) = _rebase(incentive); ICNV(CNV).mint(COOP, eCOOP); ICNV(CNV).mint(address(this), eStakers); ICNV(CNV).mint(msg.sender, incentive); emit Rebase(eStakers, eCOOP, CNVS); vebase = true; } } //////////////////////////////////////////////////////////////////////////// // UTILS //////////////////////////////////////////////////////////////////////////// /// @notice to view length of pools array /// returns length of pools array function lockPoolsLength() external virtual view returns (uint256) { return pools.length; } /// @notice calculate index of a pool based on balance and supply /// @param _bal balance of CNV in pool /// @param _supply supply of shares in pool /// returns index pool index function _poolIndex( uint256 _bal, uint256 _supply ) public pure virtual returns (uint256) { if (_bal + _supply == 0) return 1e18; return uint256(1e18).fmul(_bal, _supply); } //////////////////////////////////////////////////////////////////////////// // _lock logic //////////////////////////////////////////////////////////////////////////// function viewPositionRewards( uint256 tokenId ) external virtual view returns( uint256 amountDeposited, uint256 baseRewards, uint256 excessRewards, uint256 totalRewards ) { // Fetch position storage to memory Position memory position = positions[tokenId]; uint256 shares = position.shares; uint256 poolID = position.poolID; amountDeposited = position.deposit; Pool memory pool = pools[poolID]; // Calculate base amount obligated to user baseRewards = shares.fmul(_poolIndex(pool.balance, pool.supply), 1e18); // Calculate excess amount obligated to user excessRewards = shares.fmul(pool.rewardsPerShare, 1e18) - position.rewardDebt; // Calculate "totalRewards" due to user totalRewards = baseRewards + excessRewards; } /// @notice calculate how many CNV can be locked into a pool before /// it reaches a cap. /// @param poolNum index of pool /// returns cap number of CNV that can be locked in pool /// @dev /// 1 - coopRateMax - (1 - coopRateMax)/minPrice > lg/cnvs /// (1 - coopRateMax - (1 - coopRateMax)/minPrice)*cnvs > lg1 + lg2 + lg3 + lg4 /// (1 - coopRateMax - (1 - coopRateMax)/minPrice)*cnvs - lg1 - lg2 - lg3 > bal_4*g_4 /// ((1 - coopRateMax - (1 - coopRateMax)/minPrice)*cnvs - lg1 - lg2 - lg3)/g_4 > bal_4 /// 1 - coopRateMax - (1 - coopRateMax)/minPrice > lg/cnvs /// lhs > lg/cnvs /// lhs * cnvs - lg > bal_n * g_n /// (lhs * cnvs - lg)/g_n - bal_n > 0 function viewStakingCap(uint256 poolNum) public view virtual returns(uint256) { uint256 lhs = 1e18 - coopRateMax - uint256(1e18 - coopRateMax).fmul(1e18, minPrice); uint256 lgm; // Avoid fetching length each loop to save gas uint256 poolsLength = pools.length; // Iterate through pool balances to calculate lgm for (uint256 i; i < poolsLength;) { // calculate lgm for all pools except selected pool since that will // be solved for if (poolNum != i) { Pool memory lp = pools[i]; uint256 _balance = lp.balance; if (_balance != 0) lgm += _balance.fmul(lp.g, 1e18); } unchecked { ++i; } } Pool memory lp = pools[poolNum]; return (lhs * (circulatingSupply() - IAccrualBondsV1(BONDS).cnvEmitted()) / 1e18 - lgm) * 1e18/lp.g - lp.balance; } function _lock( address to, uint256 input, uint256 pid ) internal virtual returns(uint256 tokenId) { // F6: CHECKS // Fetch pool storage from pools mapping Pool storage pool = pools[pid]; // C2: avoid reading state multiple times uint256 shares = input.fmul(1e18, _poolIndex(pool.balance, pool.supply)); uint256 rewardDebt = shares.fmul(pool.rewardsPerShare, 1e18); // Pull users stake (CNV) to this contract TransferHelper.safeTransferFrom(CNV, msg.sender, address(this), input); // Optimistically mutate state to calculate lgm, REVIEW F6: possible reentrance issue pool.balance += input; pool.supply += shares; // Create lgm variable to be used in below calculation uint256 lgm; // Avoid fetching length each loop to save gas uint256 poolsLength = pools.length; // Iterate through pool balances to calculate lgm for (uint256 i; i < poolsLength;) { Pool memory lp = pools[i]; uint256 _balance = lp.balance; if (_balance != 0) lgm += _balance.fmul(lp.g, 1e18); unchecked { ++i; } } // Check that staking cap is still satisfied uint256 lhs = 1e18 - coopRateMax - uint256(1e18 - coopRateMax).fmul(1e18, minPrice); uint256 rhs = lgm.fmul(1e18, circulatingSupply() - IAccrualBondsV1(BONDS).cnvEmitted()); require(lhs > rhs, "CAP"); // F6: EFFECTS // Increment totalSupply to account for new nft unchecked { ++totalSupply; } // Set return value, users nft id tokenId = totalSupply; // Store users position info positions[tokenId] = Position( uint32(pid), uint224(shares), uint32(block.timestamp + pool.term), uint224(rewardDebt), input ); // Mint caller nft that represents their stake _mint(to, tokenId); // T2: Events emitted for every storage mutating function. emit Lock(input, pid, tokenId, msg.sender); } //////////////////////////////////////////////////////////////////////////// // REBASE //////////////////////////////////////////////////////////////////////////// function _rebase( uint256 eRI ) internal virtual returns (uint256 eCOOP, uint256 eStakers, uint256 CNVS) { uint256 value = IValueShuttle(VALUESHUTTLE).shuttleValue(); uint256 amountOut = IAccrualBondsV1(BONDS).cnvEmitted(); uint256 poolsLength = pools.length; CNVS = circulatingSupply() - amountOut; eCOOP = uint256(value - amountOut).fmul(_calculateCOOPRate(value, amountOut), 1e18); uint256 lgm; uint256 erm; for (uint256 i; i < poolsLength;) { Pool memory lp = pools[i]; uint256 balance = lp.balance; if (balance != 0) { lgm += balance.fmul(lp.g, 1e18); erm += balance.fmul(lp.excessRatio, 1e18); } unchecked { ++i; } } uint256 emissions = uint256(amountOut + eCOOP + eRI).fmul(1e18, 1e18 - lgm.fmul(1e18, CNVS)); uint256 g = emissions.fmul(1e18, CNVS); uint256 excessObligation = (value - emissions) + globalExcess; uint256 excessRewards = CNVS.fmul(apyPerRebase, 1e18); if (excessRewards > excessObligation) excessRewards = excessObligation; uint256 excessMultiplier = erm != 0 ? excessRewards.fmul(1e18, erm) : 0; (uint256 eStakersAD, uint256 excessConsumed) = _distribute(poolsLength, g, excessMultiplier); lockedExcessRewards += excessConsumed; globalExcess = excessObligation - excessConsumed; // delete cnvEmitted; require(IAccrualBondsV1(BONDS).vebase()); lastRebaseTime = block.timestamp; eStakers = eStakersAD + excessConsumed; } function _distribute( uint256 poolsLength, uint256 g, uint256 excessMultiplier ) internal virtual returns(uint256 eStakers, uint256 excessConsumed) { for (uint256 i; i < poolsLength;) { Pool storage pool = pools[i]; uint256 balance = pool.balance; uint256 supply = pool.supply; if (balance != 0 && supply != 0) { uint256 baseObligation = g.fmul(pool.g.fmul(balance, 1e18), 1e18); uint256 excessObligation = excessMultiplier.fmul(balance, 1e18).fmul(pool.excessRatio, 1e18); emit PoolRewarded( i, baseObligation, excessObligation, pool.balance ); pool.balance = balance + baseObligation; pool.rewardsPerShare += excessObligation.fmul(1e18, supply); eStakers += baseObligation; excessConsumed += excessObligation; } unchecked { ++i; } } } /// @notice calculates the effective rate of CNV for COOP on rebase /// @param _value amount of value accumulated during rebase /// @param _cnvOut amount of CNV emmitted during rebase /// returns coopRate effective rate of amount distributed to COOP function _calculateCOOPRate( uint256 _value, uint256 _cnvOut ) public view virtual returns (uint256) { if (_cnvOut == 0) return _value; uint256 _bondPrice = _value.fmul(1e18, _cnvOut); uint256 coopRate = (coopRatePriceControl * 1e18 / _bondPrice * haogegeControl) / 1e18; if (coopRate > coopRateMax) return coopRateMax; return coopRate; } /// @notice calculates available circulating CNV supply. This number /// is equal to the total amount of minted CNV minus the amount /// of CNV that has been minted to the Bond contract but has /// not yet been sold. /// returns supply available supply function circulatingSupply() public view virtual returns(uint256) { return ICNV(CNV).totalSupply() - IAccrualBondsV1(BONDS).getAvailableSupply() - lockedExcessRewards; } /* -------------------------------------------------------------------------- */ /* ERC721.tokenURI() */ /* -------------------------------------------------------------------------- */ /// @notice returns data for NFT display of lock position /// @param id ID of lock position /// returns returns lock position NFT image function tokenURI(uint256 id) public view override returns (string memory) { if (URI_ADDRESS != address(0)) return IERC721(URI_ADDRESS).tokenURI(id); } /* -------------------------------------------------------------------------- */ /* MANAGEMENT LOGIC */ /* -------------------------------------------------------------------------- */ /// @notice used by MGMT to open a new lock pool /// @param _term length of lock period in seconds /// @param _g CNV supply growth assigned to this pool /// @param _excessRatio ratio of excess rewards for this pool function openLockPool( uint64 _term, uint256 _g, uint256 _excessRatio ) external virtual onlyRole(TREASURY_ROLE) { pools.push(Pool(_term, _g, _excessRatio, 0, 0, 0)); emit PoolOpened(_term,_g,_excessRatio,pools.length-1); } /// @notice used by MGMT to edit an existing lock pool /// @param poolID ID of pool to manage /// @param _term length of lock period in seconds /// @param _g CNV supply growth assigned to this pool /// @param _excessRatio ratio of excess rewards for this pool function manageLockPool( uint256 poolID, uint64 _term, uint256 _g, uint256 _excessRatio ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { Pool storage pool = pools[poolID]; (pool.term, pool.g, pool.excessRatio) = (_term, _g, _excessRatio); emit PoolOpened(_term,_g,_excessRatio,poolID); } /// @notice used by MGMT to edit parameters used /// to calculate dynamic COOP rate /// @param _coopRatePriceControl price control /// @param _haogegeControl rate control /// @param _coopRateMax max rate function setCOOPParameters( uint256 _coopRatePriceControl, uint256 _haogegeControl, uint256 _coopRateMax ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { coopRatePriceControl = _coopRatePriceControl; haogegeControl = _haogegeControl; coopRateMax = _coopRateMax; emit CoopRateManaged(_coopRatePriceControl,_haogegeControl,_coopRateMax); } function manualExcessDistribution( uint256[] memory amounts ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { uint256 length = amounts.length; uint256 toDistribute; for (uint256 i; i < length;) { Pool storage pool = pools[i]; uint256 amount = amounts[i]; pool.rewardsPerShare += amount.fmul(1e18, pool.supply); toDistribute += amount; unchecked { ++i; } } uint256 ge = globalExcess; require(toDistribute <= ge,"EXCEEDS_EXCESS"); globalExcess = ge - toDistribute; ICNV(CNV).mint(address(this), toDistribute); emit ExcessRewardsDistributed(toDistribute,globalExcess); } /// @notice used by MGMT to update APY per rebase parameter /// @param _apy updated APY parameter function setAPYPerRebase( uint256 _apy ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { apyPerRebase = _apy; emit RebaseAPYManaged(_apy); } /// @notice used by MGMT to update rebase incentive /// @param _rebaseIncentive updated rebase incentive function setRebaseIncentive( uint256 _rebaseIncentive ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { rebaseIncentive = _rebaseIncentive; emit RebaseIncentiveManaged(rebaseIncentive); } /// @notice used by MGMT to update rebase interval /// @param _rebaseInterval updated rebase interval (seconds) function setRebaseInterval( uint256 _rebaseInterval ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { rebaseInterval = _rebaseInterval; emit RebaseIntervalManaged(rebaseInterval); } /// @notice used by MGMT to update min price for anti-dilution /// calculations /// @param _minPrice updated min price function setMinPrice( uint256 _minPrice ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { minPrice = _minPrice; emit MinPriceManaged(minPrice); } /// @notice used by MGMT to pause/unpause contract /// @param _toPause whether contract is paused function setPause( bool _toPause ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { if (_toPause) _pause(); else _unpause(); } /// @notice used by MGMT to update an address. /// 0 = CNV /// 1 = BONDS /// 2 = COOP /// 3 = VALUESHUTTLE /// 4 = URI_ADDRESS /// @param _what index of address to update /// @param _address updated address function setAddress( uint8 _what, address _address ) external virtual onlyRoles(POLICY_ROLE, TREASURY_ROLE) { require(_what < 5,"BAD"); if (_what == 0) { CNV = _address; } else if (_what == 1) { BONDS = _address; } else if (_what == 2) { COOP = _address; } else if (_what == 3) { VALUESHUTTLE = _address; } else { URI_ADDRESS = _address; } emit AddressManaged(_what, _address); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, AccessControlUpgradeable) returns (bool) { return ERC721Upgradeable.supportsInterface(interfaceId) || AccessControlUpgradeable.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; 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. * * 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 initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _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 v4.4.1 (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 Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { 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.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) 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. * - `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 tokenId ) 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[44] private __gap; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Arithmetic library with operations for fixed-point numbers. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol) library FixedPointMathLib { /*/////////////////////////////////////////////////////////////// COMMON BASE UNITS //////////////////////////////////////////////////////////////*/ uint256 internal constant YAD = 1e8; uint256 internal constant WAD = 1e18; uint256 internal constant RAY = 1e27; uint256 internal constant RAD = 1e45; /*/////////////////////////////////////////////////////////////// FIXED POINT OPERATIONS //////////////////////////////////////////////////////////////*/ function fmul( uint256 x, uint256 y, uint256 baseUnit ) internal pure returns (uint256 z) { assembly { // Store x * y in z for now. z := mul(x, y) // Equivalent to require(x == 0 || (x * y) / x == y) if iszero(or(iszero(x), eq(div(z, x), y))) { revert(0, 0) } // If baseUnit is zero this will return zero instead of reverting. z := div(z, baseUnit) } } function fdiv( uint256 x, uint256 y, uint256 baseUnit ) internal pure returns (uint256 z) { assembly { // Store x * baseUnit in z for now. z := mul(x, baseUnit) // Equivalent to require(y != 0 && (x == 0 || (x * baseUnit) / x == baseUnit)) if iszero(and(iszero(iszero(y)), or(iszero(x), eq(div(z, x), baseUnit)))) { revert(0, 0) } // We ensure y is not zero above, so there is never division by zero here. z := div(z, y) } } function fpow( uint256 x, uint256 n, uint256 baseUnit ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { // 0 ** 0 = 1 z := baseUnit } default { // 0 ** n = 0 z := 0 } } default { switch mod(n, 2) case 0 { // If n is even, store baseUnit in z for now. z := baseUnit } default { // If n is odd, store x in z for now. z := x } // Shifting right by 1 is like dividing by 2. let half := shr(1, baseUnit) for { // Shift n right by 1 before looping to halve it. n := shr(1, n) } n { // Shift n right by 1 each iteration to halve it. n := shr(1, n) } { // Revert immediately if x ** 2 would overflow. // Equivalent to iszero(eq(div(xx, x), x)) here. if shr(128, x) { revert(0, 0) } // Store x squared. let xx := mul(x, x) // Round to the nearest number. let xxRound := add(xx, half) // Revert if xx + half overflowed. if lt(xxRound, xx) { revert(0, 0) } // Set x to scaled xxRound. x := div(xxRound, baseUnit) // If n is even: if mod(n, 2) { // Compute z * x. let zx := mul(z, x) // If z * x overflowed: if iszero(eq(div(zx, x), z)) { // Revert if x is non-zero. if iszero(iszero(x)) { revert(0, 0) } } // Round to the nearest number. let zxRound := add(zx, half) // Revert if zx + half overflowed. if lt(zxRound, zx) { revert(0, 0) } // Return properly scaled zxRound. z := div(zxRound, baseUnit) } } } } } /*/////////////////////////////////////////////////////////////// GENERAL NUMBER UTILITIES //////////////////////////////////////////////////////////////*/ function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { // Start off with z at 1. z := 1 // Used below to help find a nearby power of 2. let y := x // Find the lowest power of 2 that is at least sqrt(x). if iszero(lt(y, 0x100000000000000000000000000000000)) { y := shr(128, y) // Like dividing by 2 ** 128. z := shl(64, z) } if iszero(lt(y, 0x10000000000000000)) { y := shr(64, y) // Like dividing by 2 ** 64. z := shl(32, z) } if iszero(lt(y, 0x100000000)) { y := shr(32, y) // Like dividing by 2 ** 32. z := shl(16, z) } if iszero(lt(y, 0x10000)) { y := shr(16, y) // Like dividing by 2 ** 16. z := shl(8, z) } if iszero(lt(y, 0x100)) { y := shr(8, y) // Like dividing by 2 ** 8. z := shl(4, z) } if iszero(lt(y, 0x10)) { y := shr(4, y) // Like dividing by 2 ** 4. z := shl(2, z) } if iszero(lt(y, 0x8)) { // Equivalent to 2 ** z. z := shl(1, z) } // Shifting right by 1 is like dividing by 2. z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) // Compute a rounded down version of z. let zRoundDown := div(x, z) // If zRoundDown is smaller, use it. if lt(zRoundDown, z) { z := zRoundDown } } } }
pragma solidity >=0.6.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); } function safeTransfer(address token, address to, uint value) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); } function safeTransferFrom(address token, address from, address to, uint value) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); } function safeTransferETH(address to, uint value) internal { (bool success,) = to.call{value:value}(new bytes(0)); require(success, 'TransferHelper: ETH_TRANSFER_FAILED'); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; interface IAccrualBondsV1 { /// @notice Access Control Roles function DEFAULT_ADMIN_ROLE() external view returns (bytes32); function POLICY_ROLE() external view returns (bytes32); function STAKING_ROLE() external view returns (bytes32); function TREASURY_ROLE() external view returns (bytes32); /// @notice Treasury Methods function setBeneficiary(address accrualTo) external; function setPolicyMintAllowance(uint256 mintAllowance) external; function addQuoteAsset(address token, uint256 virtualReserves, uint256 halfLife, uint256 levelBips) external; function grantRole(bytes32 role, address account) external; function revokeRole(bytes32 role, address account) external; function renounceRole(bytes32 role, address account) external; function pause() external; function unpause() external; /// @notice Treasury + Policy Methods function removeQuoteAsset(address token) external; function policyUpdate(uint256 supplyDelta, bool positiveDelta, uint256 percentToConvert, uint256 newVirtualOutputReserves, address[] memory tokens, uint256[] memory virtualReserves, uint256[] memory halfLives, uint256[] memory levelBips, bool[] memory updateElapsed) external; /// @notice User Methods function purchaseBond(address recipient, address token, uint256 input, uint256 minOutput) external returns (uint256 output); function purchaseBondUsingPermit(address recipient, address token, uint256 input, uint256 minOutput, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external returns (uint256 output); function redeemBond(address recipient, uint256 bondId) external returns (uint256 output); function redeemBondBatch(address recipient, uint256[] memory bondIds) external returns (uint256 output); function transferBond(address recipient, uint256 bondId) external; /// @notice View Methods function getAmountOut(address token, uint256 input) external view returns (uint256 output); function getAvailableSupply() external view returns (uint256); function getRoleAdmin(bytes32 role) external view returns (bytes32); function getSpotPrice(address token) external view returns (uint256); function getUserPositionCount(address guy) external view returns (uint256); function paused() external view returns (bool); function outputToken() external view returns (address); function term() external view returns (uint256); function totalAssets() external view returns (uint256); function totalDebt() external view returns (uint256); function beneficiary() external view returns (address); function cnvEmitted() external view returns (uint256); function virtualOutputReserves() external view returns (uint256); function policyMintAllowance() external view returns (uint256); function supportsInterface(bytes4 interfaceId) external view returns (bool); function hasRole(bytes32 role, address account) external view returns (bool); function positions(address, uint256) external view returns (uint256 owed, uint256 redeemed, uint256 creation); function quoteInfo(address) external view returns (uint256 virtualReserves, uint256 lastUpdate, uint256 halfLife, uint256 levelBips); /// @notice Staking Methods function vebase() external returns (bool); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >= 0.8.0; /// @dev /// A `Pool` refers to the different "pools" users can lock their CNV into. /// /// When a user locks into a `Pool`, their CNV cannot be withdrawn for a duration /// of `term` seconds. The amount a user locks determines the amount of shares /// they get of this `Pool`. This amount of shares is calculated by: /// /// shares = amount * (pool.balance / pool.supply) /// /// The pool `balance` is then increased by the amount locked, and the pool /// `supply` is increased by the amount of shares. /// /// On each rebase the percent change in CNV since last rebase is calculated, /// and `g` determines how much of that percent change will be assigned to the /// Pool. For example - if CNV supply increased by 10%, and `g` for a specific /// pool is g=100%, then that pool will obtain a 10% increase in supply. These /// are referred to as "anti-dilutive rewards". This increase in supply is /// reflected by increasing the `balance` of the pool. /// /// Additionally, on each rebase there are "excess rewards" given to each pool. /// The amount of excess rewards each pool gets is determined by `excessRatio`, /// and unlike "anti-dilutive rewards" these rewards are reflected by increasing /// the `rewardsPerShare`. /// /// When users unlock, the amount of shares they own is converted to an amount /// of CNV: /// /// amount = shares / (pool.balance / pool.supply) /// /// this amount is then reduced from pool.balance, and the shares are reduced /// from pool.supply. struct Pool { uint64 term; // length in seconds a user must lock uint256 g; // pct of CNV supply growth to be matched to this pool on each rebase uint256 excessRatio; // ratio of excess rewards for this pool on each rebase uint256 balance; // balance of CNV locked (amount locked + anti-dilutive rewards) uint256 supply; // supply of shares of this pool assigned to users when they lock uint256 rewardsPerShare; // index of excess rewards for each share } /// @dev /// A `Position` refers to a users "position" when they lock into a Pool. /// /// When a user locks into a Pool, they obtain a `Position` which contains the /// `maturity` which is used to check when they can unlock their CNV, a `poolID` /// which is used to then convert the amount of `shares` they own of that pool /// into CNV, `shares` which is the number of shares they own of that pool to be /// later converted into CNV, and `rewardDebt` which reflects the index of /// pool rewardsPerShare at the time they entered the pool. This value is used /// so that when they unlock, they only get the difference of current rewardsPerShare /// and `rewardDebt`, thus only getting excess rewards for the time they were in /// the pool and not for rewards distrobuted before they entered the Pool. struct Position { uint32 poolID; // ID of pool to which position belongs to uint224 shares; // amount of pool shares assigned to this position uint32 maturity; // timestamp when lock position can be unlocked uint224 rewardDebt; // index of rewardsPerShare at time of entering pool uint256 deposit; // amount of CNV initially deposited on lock } contract StakingStorageV1 { /// @notice address of CNV ERC20 token, used to mint CNV rewards to this contract. address public CNV; /// @notice address of Bonding contract, used to retrieve information regarding /// bonding activity in a given rebase interval. address public BONDS; /// @notice address of COOP to send COOP funds to. address public COOP; /// @notice address of `ValueShuttle` contract. When Bonding occurs on /// `Bonding` contract, it sends all incoming bonded value to `VALUESHUTTLE`. /// Then during rebase, this contract calls `VALUESHUTTLE` to obtain /// the USD denominated value of bonding activity during rebase and instructs /// `ValueShuttle` to empty the funds to the Treasury. address public VALUESHUTTLE; /// @notice address of contract in charge of displaying lock position NFT address public URI_ADDRESS; /// @notice array containing pool info Pool[] public pools; /// @notice time in seconds that must pass before next rebase uint256 public rebaseInterval; /// @notice as an incentive for the public to call the "rebase()" method, and /// to not increase the gas of lock() and unlock() methods by including rebase /// in those methods, a rebase incentive is provided. This is an amount of CNV /// that will be transferred to callers of the "rebase()" method. uint256 public rebaseIncentive; /// @notice pct of CNV supply to be rewarded as excess rewards. /// @dev /// During each rebase, after anti-dilution rewards have been assigned, an /// additional "excess rewards" are distributed. The total amount of excess /// rewards to be distributed among all pools is given as a percentage of /// total CNV supply. For example - if apyPerRebase = 10%, then 10% of total /// CNV supply will be distributed to pools as "excess rewards". uint256 public apyPerRebase; /// @notice amount of CNV available to mint without breaking backing. /// @dev /// During Bonding activity, by design there is more value being received /// than CNV minted. This difference is accounted for in `globalExcess`. /// For example, if during bonding activity $100 has been accumulated and /// 70 CNV has been minted (for bonders, DAO, and anti-dilution rewards), /// then `globalExcess` will be increased by 30. /// /// This number also determines the availability of "excess rewards" as /// determined by `apyPerRebase`. For example - if a current rebase only /// produced an excess of 10 CNV, and `apyPerRebase` indicates that 20 CNV /// should be distributed, and `globalExcess` is 30, then rebasing will /// use from `globalExcess` to distribute those rewards and thus reduce /// globalExcess to 20. /// For this same logic - this numbers serves as a floor on excess rewards /// to prevent the protocol from minting more CNV than there is value in /// the Treasury. uint256 public globalExcess; ////////////////////////////// /// @dev /// used to calculate the amount of CNV during each rebase that goes to COOP. /// see _calculateCOOPRate uint256 public coopRatePriceControl; /// @dev /// used to calculate the amount of CNV during each rebase that goes to COOP. /// see _calculateCOOPRate uint256 public haogegeControl; /// @dev /// used to calculate the amount of CNV during each rebase that goes to COOP. /// see _calculateCOOPRate uint256 public coopRateMax; /// @notice minimum CNV bond price denominated in USD (wad) /// used to calculate staking cap during _lock() uint256 public minPrice; /// @notice time of last rebase, used to determine whether a rebase is due. uint256 public lastRebaseTime; /// @notice supply of lock position NFTs, used for positionID uint256 public totalSupply; /// @notice amount of excess rewards in lock positions uint256 public lockedExcessRewards; /// @notice mapping that returns position info for a given NFT mapping(uint256 => Position) public positions; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.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 functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @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/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"_what","type":"uint8"},{"indexed":false,"internalType":"address","name":"_address","type":"address"}],"name":"AddressManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_coopRatePriceControl","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_haogegeControl","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_coopRateMax","type":"uint256"}],"name":"CoopRateManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amountDistributed","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"globalExcess","type":"uint256"}],"name":"ExcessRewardsDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_poolID","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"Lock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"minPrice","type":"uint256"}],"name":"MinPriceManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"_term","type":"uint64"},{"indexed":true,"internalType":"uint256","name":"_g","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_excessRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_poolID","type":"uint256"}],"name":"PoolManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"_term","type":"uint64"},{"indexed":true,"internalType":"uint256","name":"_g","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_excessRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_poolID","type":"uint256"}],"name":"PoolOpened","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolID","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"baseObligation","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"excessObligation","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"PoolRewarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"eStakers","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"eCOOP","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"CNVS","type":"uint256"}],"name":"Rebase","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"apy","type":"uint256"}],"name":"RebaseAPYManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"rebaseIncentive","type":"uint256"}],"name":"RebaseIncentiveManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"rebaseInterval","type":"uint256"}],"name":"RebaseIntervalManaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_poolID","type":"uint256"},{"indexed":true,"internalType":"address","name":"_owner","type":"address"}],"name":"Unlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"BONDS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CNV","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COOP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POLICY_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREASURY_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"URI_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VALUESHUTTLE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_cnvOut","type":"uint256"}],"name":"_calculateCOOPRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bal","type":"uint256"},{"internalType":"uint256","name":"_supply","type":"uint256"}],"name":"_poolIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"apyPerRebase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"circulatingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coopRateMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coopRatePriceControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalExcess","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"haogegeControl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_CNV","type":"address"},{"internalType":"address","name":"_COOP","type":"address"},{"internalType":"address","name":"_BONDS","type":"address"},{"internalType":"address","name":"_VALUESHUTTLE","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_policy","type":"address"},{"internalType":"uint256","name":"_coopRatePriceControl","type":"uint256"},{"internalType":"uint256","name":"_haogegeControl","type":"uint256"},{"internalType":"uint256","name":"_coopRateMax","type":"uint256"},{"internalType":"uint256","name":"_minPrice","type":"uint256"},{"internalType":"uint256","name":"_rebaseInterval","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRebaseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"lock","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockPoolsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"input","type":"uint256"},{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"permitDeadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"lockWithPermit","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockedExcessRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolID","type":"uint256"},{"internalType":"uint64","name":"_term","type":"uint64"},{"internalType":"uint256","name":"_g","type":"uint256"},{"internalType":"uint256","name":"_excessRatio","type":"uint256"}],"name":"manageLockPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"manualExcessDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_term","type":"uint64"},{"internalType":"uint256","name":"_g","type":"uint256"},{"internalType":"uint256","name":"_excessRatio","type":"uint256"}],"name":"openLockPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"uint64","name":"term","type":"uint64"},{"internalType":"uint256","name":"g","type":"uint256"},{"internalType":"uint256","name":"excessRatio","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"rewardsPerShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"positions","outputs":[{"internalType":"uint32","name":"poolID","type":"uint32"},{"internalType":"uint224","name":"shares","type":"uint224"},{"internalType":"uint32","name":"maturity","type":"uint32"},{"internalType":"uint224","name":"rewardDebt","type":"uint224"},{"internalType":"uint256","name":"deposit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebase","outputs":[{"internalType":"bool","name":"vebase","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rebaseIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rebaseInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_apy","type":"uint256"}],"name":"setAPYPerRebase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_what","type":"uint8"},{"internalType":"address","name":"_address","type":"address"}],"name":"setAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_coopRatePriceControl","type":"uint256"},{"internalType":"uint256","name":"_haogegeControl","type":"uint256"},{"internalType":"uint256","name":"_coopRateMax","type":"uint256"}],"name":"setCOOPParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minPrice","type":"uint256"}],"name":"setMinPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_toPause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rebaseIncentive","type":"uint256"}],"name":"setRebaseIncentive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rebaseInterval","type":"uint256"}],"name":"setRebaseInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unlock","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"viewPositionRewards","outputs":[{"internalType":"uint256","name":"amountDeposited","type":"uint256"},{"internalType":"uint256","name":"baseRewards","type":"uint256"},{"internalType":"uint256","name":"excessRewards","type":"uint256"},{"internalType":"uint256","name":"totalRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolNum","type":"uint256"}],"name":"viewStakingCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061448c806100206000396000f3fe608060405234801561001057600080fd5b50600436106103ae5760003560e01c80636d911a44116101f4578063ac4afa381161011a578063d11a57ec116100ad578063e45be8eb1161007c578063e45be8eb14610860578063e985e9c514610869578063e9c68d27146108a5578063ef037fb9146108b857600080fd5b8063d11a57ec1461074a578063d51a020b14610827578063d547741f1461083a578063e2ab691d1461084d57600080fd5b8063b88d4fde116100e9578063b88d4fde146107e6578063bbf93ba9146107f9578063bedb86fb14610801578063c87b56dd1461081457600080fd5b8063ac4afa3814610778578063af14052c146107c2578063afbf3af0146107ca578063b4abea24146107d357600080fd5b8063930003f41161019257806399fbab881161016157806399fbab88146106b7578063a217fddf1461074a578063a22cb46514610752578063a4feca061461076557600080fd5b8063930003f4146106815780639358928b1461069457806395d89b411461069c5780639785b791146106a457600080fd5b80637eee288d116101ce5780637eee288d1461063f5780638146d26c1461065257806389edeb741461066557806391d148541461066e57600080fd5b80636d911a44146105e657806370a08231146105f9578063794f762d1461060c57600080fd5b80633341145c116102d95780635374f7a8116102775780635ede9956116102465780635ede9956146105ae5780635f505a68146105b75780636352211e146105ca578063682330da146105dd57600080fd5b80635374f7a814610574578063594c3b87146105875780635c975abb146105905780635ea8cd121461059b57600080fd5b806342842e0e116102b357806342842e0e1461053257806343b358b9146105455780634a5ade5d1461054e5780634f9017db1461056157600080fd5b80633341145c146104f957806336568abe1461050c5780633d5f7e061461051f57600080fd5b80631924063e11610351578063248a9ca311610320578063248a9ca3146104b15780632f2ff15d146104d457806331693af6146104e7578063324d4f3b146104f057600080fd5b80631924063e1461046d5780631d22e65514610476578063229852461461048957806323b872dd1461049e57600080fd5b806306fdde031161038d57806306fdde0314610403578063081812fc14610418578063095ea7b31461044357806318160ddd1461045657600080fd5b80622f5fd7146103b357806301ffc9a7146103c85780630589c4e5146103f0575b600080fd5b6103c66103c1366004613ad7565b6108cb565b005b6103db6103d6366004613b98565b610adf565b60405190151581526020015b60405180910390f35b6103c66103fe366004613bc6565b610aff565b61040b610c7b565b6040516103e79190613c51565b61042b610426366004613c64565b610d0d565b6040516001600160a01b0390911681526020016103e7565b6103c6610451366004613c7d565b610da2565b61045f600f5481565b6040519081526020016103e7565b61045f600e5481565b61045f610484366004613ca7565b610eb8565b61045f60008051602061443783398151915281565b6103c66104ac366004613cc9565b610ef1565b61045f6104bf366004613c64565b60009081526077602052604090206001015490565b6103c66104e2366004613d05565b610f22565b61045f60075481565b61045f600a5481565b6103c6610507366004613d3f565b610f48565b6103c661051a366004613d05565b61100d565b61045f61052d366004613ca7565b61108b565b6103c6610540366004613cc9565b611113565b61045f600c5481565b60025461042b906001600160a01b031681565b60035461042b906001600160a01b031681565b6103c6610582366004613c64565b61112e565b61045f600b5481565b60a95460ff166103db565b6103c66105a9366004613c64565b611197565b61045f60085481565b60045461042b906001600160a01b031681565b61042b6105d8366004613c64565b611200565b61045f60095481565b6103c66105f4366004613d7a565b611277565b61045f610607366004613dad565b611417565b61061f61061a366004613c64565b61149e565b6040805194855260208501939093529183015260608201526080016103e7565b61045f61064d366004613c7d565b6115ff565b61045f610660366004613dc8565b61187f565b61045f60065481565b6103db61067c366004613d05565b611949565b61045f61068f366004613c64565b611974565b61045f611bdc565b61040b611cdc565b6103c66106b2366004613e2b565b611ceb565b61070b6106c5366004613c64565b60116020526000908152604090208054600182015460029092015463ffffffff808316936001600160e01b03640100000000948590048116949282169392909104169085565b6040805163ffffffff96871681526001600160e01b0395861660208201529590931692850192909252919091166060830152608082015260a0016103e7565b61045f600081565b6103c6610760366004613e65565b611d64565b6103c6610773366004613ee2565b611d6f565b61078b610786366004613c64565b611f35565b604080516001600160401b0390971687526020870195909552938501929092526060840152608083015260a082015260c0016103e7565b6103db611f85565b61045f60105481565b60015461042b906001600160a01b031681565b6103c66107f4366004613fa2565b612149565b60055461045f565b6103c661080f36600461404c565b612181565b61040b610822366004613c64565b6121cb565b60005461042b906001600160a01b031681565b6103c6610848366004613d05565b612253565b61045f61085b366004614069565b612279565b61045f600d5481565b6103db610877366004614087565b6001600160a01b03918216600090815260e06020908152604080832093909416825291909152205460ff1690565b6103c66108b3366004613c64565b6122af565b6103c66108c6366004613c64565b612318565b601254610100900460ff166108e65760125460ff16156108ea565b303b155b6109525760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b601254610100900460ff16158015610974576012805461ffff19166101011790555b6000546001600160a01b0316156109bc5760405162461bcd60e51b815260206004820152600c60248201526b085a5b9a5d1a585b1a5e995960a21b6044820152606401610949565b600080546001600160a01b03808f166001600160a01b031992831617909255600280548e8416908316179055600180548d841690831617905560038054928c1692909116919091179055600a869055600b859055600c849055600d839055600682905542600e55610a2b612381565b610a33612381565b610a3b612381565b610a436123aa565b610a94604051806040016040528060118152602001702634b8bab4b21029ba30b5b2b21021a72b60791b815250604051806040016040528060068152602001653639b221a72b60d11b8152506123d9565b610a9f60008961240a565b610ab76000805160206144378339815191528861240a565b610abf612490565b8015610ad1576012805461ff00191690555b505050505050505050505050565b6000610aea82612505565b80610af95750610af982612540565b92915050565b6000805160206144378339815191526000610b1a8233611949565b80610b2a5750610b2a8133611949565b610b3357600080fd5b60058460ff1610610b6c5760405162461bcd60e51b815260206004820152600360248201526210905160ea1b6044820152606401610949565b60ff8416610b9457600080546001600160a01b0319166001600160a01b038516179055610c34565b8360ff1660011415610bc057600180546001600160a01b0319166001600160a01b038516179055610c34565b8360ff1660021415610bec57600280546001600160a01b0319166001600160a01b038516179055610c34565b8360ff1660031415610c1857600380546001600160a01b0319166001600160a01b038516179055610c34565b600480546001600160a01b0319166001600160a01b0385161790555b6040516001600160a01b038416815260ff8516907fb6f7937be2862d9850d3ad8765f3973fe163a2a52fc863055e323b2f7105f4769060200160405180910390a250505050565b606060db8054610c8a906140a3565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb6906140a3565b8015610d035780601f10610cd857610100808354040283529160200191610d03565b820191906000526020600020905b815481529060010190602001808311610ce657829003601f168201915b5050505050905090565b600081815260dd60205260408120546001600160a01b0316610d865760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610949565b50600090815260df60205260409020546001600160a01b031690565b6000610dad82611200565b9050806001600160a01b0316836001600160a01b03161415610e1b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610949565b336001600160a01b0382161480610e375750610e378133610877565b610ea95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610949565b610eb38383612575565b505050565b6000610ec482846140f4565b610ed75750670de0b6b3a7640000610af9565b610eea670de0b6b3a764000084846125e3565b9392505050565b610efb33826125fe565b610f175760405162461bcd60e51b81526004016109499061410c565b610eb38383836126f1565b600082815260776020526040902060010154610f3e813361288d565b610eb3838361240a565b6000805160206144378339815191526000610f638233611949565b80610f735750610f738133611949565b610f7c57600080fd5b600060058781548110610f9157610f9161415d565b60009182526020918290206006909102016002810186905560018101879055805467ffffffffffffffff19166001600160401b03891690811782556040518a8152919350869288927fc0835ba9d8b22a00bd1e0882f4310ffcc8584796fc7eb34af630c1e61e4fcc66910160405180910390a450505050505050565b6001600160a01b038116331461107d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610949565b61108782826128f1565b5050565b600081611099575081610af9565b60006110ae84670de0b6b3a7640000856125e3565b90506000670de0b6b3a7640000600b5483600a54670de0b6b3a76400006110d59190614173565b6110df9190614192565b6110e99190614173565b6110f39190614192565b9050600c5481111561110b57600c5492505050610af9565b949350505050565b610eb383838360405180602001604052806000815250612149565b60008051602061443783398151915260006111498233611949565b8061115957506111598133611949565b61116257600080fd5b600783905560405183907f6d65f1f4e5c655d69ff5fd599236f4be4c7f1fbd8fe47cce71ad5ca049a03df690600090a2505050565b60008051602061443783398151915260006111b28233611949565b806111c257506111c28133611949565b6111cb57600080fd5b600d83905560405183907f4b2bb1be849877f717f7f73c89bd20774db6cc9a3752b916459ae23e1b09e4ac90600090a2505050565b600081815260dd60205260408120546001600160a01b031680610af95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610949565b6000611283813361288d565b6040805160c0810182526001600160401b03868116808352602083018781529383018681526000606085018181526080860182815260a0870183815260058054600180820183559582905298517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db06006909a02998a01805467ffffffffffffffff1916919099161790975597517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db188015592517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db2870155517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db386015590517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db485015593517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db5909301929092555484928692917fc0835ba9d8b22a00bd1e0882f4310ffcc8584796fc7eb34af630c1e61e4fcc6691611400916141b4565b60405190815260200160405180910390a450505050565b60006001600160a01b0382166114825760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610949565b506001600160a01b0316600090815260de602052604090205490565b6000818152601160209081526040808320815160a081018352815463ffffffff8082168084526001600160e01b0364010000000093849004811697850188905260018601549283169685019690965291900490931660608201526002909101546080820181905260058054919594859485949391929091859190839081106115285761152861415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b0316835260018101549383019390935260028301549082015260038201546060820181905260048301546080830181905260059093015460a08301529092506115ab9161159b9190610eb8565b8490670de0b6b3a76400006125e3565b965083606001516001600160e01b03166115dc8260a00151670de0b6b3a7640000866125e39092919063ffffffff16565b6115e691906141b4565b95506115f286886140f4565b9450505050509193509193565b600061160d60a95460ff1690565b1561162a5760405162461bcd60e51b8152600401610949906141cb565b3361163483611200565b6001600160a01b0316146116735760405162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b6044820152606401610949565b600082815260116020908152604091829020825160a081018452815463ffffffff80821683526001600160e01b036401000000009283900481169584019590955260018401549081169583018690520490921660608301526002015460808201529042101561170c5760405162461bcd60e51b81526020600482015260056024820152642154494d4560d81b6044820152606401610949565b600081602001516001600160e01b031690506000826000015163ffffffff1690506000600582815481106117425761174261415d565b90600052602060002090600602019050600061177961176983600301548460040154610eb8565b8590670de0b6b3a76400006125e3565b9050600085606001516001600160e01b03166117ac8460050154670de0b6b3a7640000886125e39092919063ffffffff16565b6117b691906141b4565b90506117c281836140f4565b965080601060008282546117d691906141b4565b92505081905550818360030160008282546117f191906141b4565b925050819055508483600401600082825461180c91906141b4565b909155505060008881526011602052604081208181556001810182905560020181905554611844906001600160a01b03168a89612958565b6040513390859089907ff4b5dc38d8b4dcee5e7fc6413bf0bd43c170e5179a2bce1450e21f28e183e74890600090a450505050505092915050565b600061188d60a95460ff1690565b156118aa5760405162461bcd60e51b8152600401610949906141cb565b60005460405163d505accf60e01b8152336004820152306024820152604481018990526064810187905260ff8616608482015260a4810185905260c481018490526001600160a01b039091169063d505accf9060e401600060405180830381600087803b15801561191a57600080fd5b505af115801561192e573d6000803e3d6000fd5b5050505061193d888888612a73565b98975050505050505050565b60009182526077602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000806119a3670de0b6b3a7640000600d54600c54670de0b6b3a764000061199c91906141b4565b91906125e3565b600c546119b890670de0b6b3a76400006141b4565b6119c291906141b4565b600554909150600090815b81811015611a8a57808614611a82576000600582815481106119f1576119f161415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b031683526001810154938301939093526002830154908201526003820154606082018190526004830154608083015260059092015460a082015291508015611a7f576020820151611a72908290670de0b6b3a76400006125e3565b611a7c90866140f4565b94505b50505b6001016119cd565b50600060058681548110611aa057611aa061415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b03168352600180820154848601819052600283015485850152600383015460608601819052600480850154608088015260059094015460a08701529154845163225729ed60e01b81529451959750919590948994670de0b6b3a7640000946001600160a01b039094169363225729ed938282019390929091908290030181865afa158015611b58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7c91906141f5565b611b84611bdc565b611b8e91906141b4565b611b989089614173565b611ba29190614192565b611bac91906141b4565b611bbe90670de0b6b3a7640000614173565b611bc89190614192565b611bd291906141b4565b9695505050505050565b6010546001546040805163c167d1cd60e01b81529051600093926001600160a01b03169163c167d1cd9160048083019260209291908290030181865afa158015611c2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4e91906141f5565b60008054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc391906141f5565b611ccd91906141b4565b611cd791906141b4565b905090565b606060dc8054610c8a906140a3565b6000805160206144378339815191526000611d068233611949565b80611d165750611d168133611949565b611d1f57600080fd5b600a859055600b849055600c8390556040518390859087907fdcefe023fa4e663636085ee3356cb163d79a360df1fc07686a02ed7410f8ec9190600090a45050505050565b611087338383612e17565b6000805160206144378339815191526000611d8a8233611949565b80611d9a5750611d9a8133611949565b611da357600080fd5b82516000805b82811015611e4757600060058281548110611dc657611dc661415d565b906000526020600020906006020190506000878381518110611dea57611dea61415d565b60200260200101519050611e15670de0b6b3a76400008360040154836125e39092919063ffffffff16565b826005016000828254611e2891906140f4565b90915550611e38905081856140f4565b93508260010192505050611da9565b5060095480821115611e8c5760405162461bcd60e51b815260206004820152600e60248201526d455843454544535f45584345535360901b6044820152606401610949565b611e9682826141b4565b6009556000546040516340c10f1960e01b8152306004820152602481018490526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015611ee557600080fd5b505af1158015611ef9573d6000803e3d6000fd5b50505050600954827f6dc619f0e1fed4ad5519b33c9dedac5be96861e335ba7cd43a9ef912f02fd86c60405160405180910390a3505050505050565b60058181548110611f4557600080fd5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160401b0390941695509193909286565b6000611f9360a95460ff1690565b15611fb05760405162461bcd60e51b8152600401610949906141cb565b600654600e54611fc091906140f4565b42106121465760075460008080611fd684612ee6565b6000546002546040516340c10f1960e01b81526001600160a01b0391821660048201526024810186905294975092955090935016906340c10f1990604401600060405180830381600087803b15801561202e57600080fd5b505af1158015612042573d6000803e3d6000fd5b50506000546040516340c10f1960e01b8152306004820152602481018690526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b15801561209257600080fd5b505af11580156120a6573d6000803e3d6000fd5b50506000546040516340c10f1960e01b8152336004820152602481018890526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b1580156120f657600080fd5b505af115801561210a573d6000803e3d6000fd5b505050508083837fc6642d24d84e7f3d36ca39f5cce10e75639d9b158d5193aa350e2f900653e4c060405160405180910390a460019450505050505b90565b61215333836125fe565b61216f5760405162461bcd60e51b81526004016109499061410c565b61217b84848484613299565b50505050565b600080516020614437833981519152600061219c8233611949565b806121ac57506121ac8133611949565b6121b557600080fd5b82156121c357610eb3612490565b610eb36132cc565b6004546060906001600160a01b03161561224e576004805460405163c87b56dd60e01b81529182018490526001600160a01b03169063c87b56dd90602401600060405180830381865afa158015612226573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610af9919081019061420e565b919050565b60008281526077602052604090206001015461226f813361288d565b610eb383836128f1565b600061228760a95460ff1690565b156122a45760405162461bcd60e51b8152600401610949906141cb565b61110b848484612a73565b60008051602061443783398151915260006122ca8233611949565b806122da57506122da8133611949565b6122e357600080fd5b600883905560405183907fd1f0338b5b84ec92ed0ba1801c9c404be68e30988c482460b73cf5688d066d2390600090a2505050565b60008051602061443783398151915260006123338233611949565b8061234357506123438133611949565b61234c57600080fd5b600683905560405183907f237c8b5cd8bc1143c45f932ec876dadddbba3784d09fec6ffd3df2e58f9928f990600090a2505050565b601254610100900460ff166123a85760405162461bcd60e51b815260040161094990614284565b565b601254610100900460ff166123d15760405162461bcd60e51b815260040161094990614284565b6123a8613346565b601254610100900460ff166124005760405162461bcd60e51b815260040161094990614284565b6110878282613379565b6124148282611949565b6110875760008281526077602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561244c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60a95460ff16156124b35760405162461bcd60e51b8152600401610949906141cb565b60a9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586124e83390565b6040516001600160a01b03909116815260200160405180910390a1565b60006001600160e01b031982166380ac58cd60e01b1480610aea57506001600160e01b03198216635b5e139f60e01b1480610af95750610af9825b60006001600160e01b03198216637965db0b60e01b1480610af957506301ffc9a760e01b6001600160e01b0319831614610af9565b600081815260df6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906125aa82611200565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b82820283158482048414176125f757600080fd5b0492915050565b600081815260dd60205260408120546001600160a01b03166126775760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610949565b600061268283611200565b9050806001600160a01b0316846001600160a01b031614806126bd5750836001600160a01b03166126b284610d0d565b6001600160a01b0316145b8061110b57506001600160a01b03808216600090815260e0602090815260408083209388168352929052205460ff1661110b565b826001600160a01b031661270482611200565b6001600160a01b0316146127685760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610949565b6001600160a01b0382166127ca5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610949565b6127d5600082612575565b6001600160a01b038316600090815260de602052604081208054600192906127fe9084906141b4565b90915550506001600160a01b038216600090815260de6020526040812080546001929061282c9084906140f4565b9091555050600081815260dd602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6128978282611949565b611087576128af816001600160a01b031660146133c7565b6128ba8360206133c7565b6040516020016128cb9291906142cf565b60408051601f198184030181529082905262461bcd60e51b825261094991600401613c51565b6128fb8282611949565b156110875760008281526077602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916129b49190614344565b6000604051808303816000865af19150503d80600081146129f1576040519150601f19603f3d011682016040523d82523d6000602084013e6129f6565b606091505b5091509150818015612a20575080511580612a20575080806020019051810190612a209190614360565b612a6c5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610949565b5050505050565b60008060058381548110612a8957612a8961415d565b906000526020600020906006020190506000612ac1670de0b6b3a7640000612ab984600301548560040154610eb8565b8791906125e3565b90506000612ae68360050154670de0b6b3a7640000846125e39092919063ffffffff16565b600054909150612b01906001600160a01b0316333089613562565b85836003016000828254612b1591906140f4565b9250508190555081836004016000828254612b3091906140f4565b9091555050600554600090815b81811015612bf257600060058281548110612b5a57612b5a61415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b031683526001810154938301939093526002830154908201526003820154606082018190526004830154608083015260059092015460a082015291508015612be8576020820151612bdb908290670de0b6b3a76400006125e3565b612be590866140f4565b94505b5050600101612b3d565b506000612c1a670de0b6b3a7640000600d54600c54670de0b6b3a764000061199c91906141b4565b600c54612c2f90670de0b6b3a76400006141b4565b612c3991906141b4565b90506000612cda670de0b6b3a7640000600160009054906101000a90046001600160a01b03166001600160a01b031663225729ed6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc091906141f5565b612cc8611bdc565b612cd291906141b4565b8691906125e3565b9050808211612d115760405162461bcd60e51b815260206004820152600360248201526204341560ec1b6044820152606401610949565b600f8054600101908190556040805160a08101825263ffffffff8c1681526001600160e01b03891660208201528954929a509190820190612d5b906001600160401b0316426140f4565b63ffffffff90811682526001600160e01b0388811660208085019190915260409384018f905260008d815260118252849020855191860151918416640100000000928416830217815593850151606086015193169290911602176001820155608090910151600290910155612dd08b89613692565b60405133815288908a908c907f114cc376d25215fb3215218ecf58c7fd5434f680efa149f1ef0b5ce3e7ca06fc9060200160405180910390a4505050505050509392505050565b816001600160a01b0316836001600160a01b03161415612e795760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610949565b6001600160a01b03838116600081815260e06020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600080600080600360009054906101000a90046001600160a01b03166001600160a01b0316637e2f3eb56040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612f41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6591906141f5565b90506000600160009054906101000a90046001600160a01b03166001600160a01b031663225729ed6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe091906141f5565b60055490915081612fef611bdc565b612ff991906141b4565b935061301b613008848461108b565b670de0b6b3a764000061199c85876141b4565b955060008060005b838110156130fe576000600582815481106130405761304061415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b031683526001810154938301939093526002830154908201526003820154606082018190526004830154608083015260059092015460a0820152915080156130f45760208201516130c1908290670de0b6b3a76400006125e3565b6130cb90866140f4565b60408301519095506130e7908290670de0b6b3a76400006125e3565b6130f190856140f4565b93505b5050600101613023565b50600061313f670de0b6b3a764000061311885828b6125e3565b61312a90670de0b6b3a76400006141b4565b8c6131358d8a6140f4565b61199c91906140f4565b9050600061315682670de0b6b3a76400008a6125e3565b90506000600954838961316991906141b4565b61317391906140f4565b90506000613196600854670de0b6b3a76400008c6125e39092919063ffffffff16565b9050818111156131a35750805b6000856131b15760006131c4565b6131c482670de0b6b3a7640000886125e3565b90506000806131d48a87856137d4565b9150915080601060008282546131ea91906140f4565b909155506131fa905081866141b4565b60095560015460408051631aa5913360e31b815290516001600160a01b039092169163d52c89989160048082019260209290919082900301816000875af1158015613249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061326d9190614360565b61327657600080fd5b42600e5561328481836140f4565b9d505050505050505050505050509193909250565b6132a48484846126f1565b6132b084848484613929565b61217b5760405162461bcd60e51b81526004016109499061437d565b60a95460ff166133155760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610949565b60a9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336124e8565b601254610100900460ff1661336d5760405162461bcd60e51b815260040161094990614284565b60a9805460ff19169055565b601254610100900460ff166133a05760405162461bcd60e51b815260040161094990614284565b81516133b39060db906020850190613a27565b508051610eb39060dc906020840190613a27565b606060006133d6836002614173565b6133e19060026140f4565b6001600160401b038111156133f8576133f8613e9c565b6040519080825280601f01601f191660200182016040528015613422576020820181803683370190505b509050600360fc1b8160008151811061343d5761343d61415d565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061346c5761346c61415d565b60200101906001600160f81b031916908160001a9053506000613490846002614173565b61349b9060016140f4565b90505b6001811115613513576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106134cf576134cf61415d565b1a60f81b8282815181106134e5576134e561415d565b60200101906001600160f81b031916908160001a90535060049490941c9361350c816143cf565b905061349e565b508315610eea5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610949565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916135c69190614344565b6000604051808303816000865af19150503d8060008114613603576040519150601f19603f3d011682016040523d82523d6000602084013e613608565b606091505b50915091508180156136325750805115806136325750808060200190518101906136329190614360565b61368a5760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610949565b505050505050565b6001600160a01b0382166136e85760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610949565b600081815260dd60205260409020546001600160a01b03161561374d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610949565b6001600160a01b038216600090815260de602052604081208054600192906137769084906140f4565b9091555050600081815260dd602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008060005b85811015613920576000600582815481106137f7576137f761415d565b600091825260209091206006909102016003810154600482015491925090811580159061382357508015155b15613912576001830154600090613857906138479085670de0b6b3a76400006125e3565b8a90670de0b6b3a76400006125e3565b600285015490915060009061387a90670de0b6b3a764000061199c8c88836125e3565b90508082877f1f0fae980e736e95466eb059734f223baa1ce38572b29987d01f29879ef3658a88600301546040516138b491815260200190565b60405180910390a46138c682856140f4565b60038601556138de81670de0b6b3a7640000856125e3565b8560050160008282546138f191906140f4565b90915550613901905082896140f4565b975061390d81886140f4565b965050505b8360010193505050506137da565b50935093915050565b60006001600160a01b0384163b15613a1c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061396d9033908990889088906004016143e6565b6020604051808303816000875af19250505080156139a8575060408051601f3d908101601f191682019092526139a591810190614419565b60015b613a02573d8080156139d6576040519150601f19603f3d011682016040523d82523d6000602084013e6139db565b606091505b5080516139fa5760405162461bcd60e51b81526004016109499061437d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061110b565b506001949350505050565b828054613a33906140a3565b90600052602060002090601f016020900481019282613a555760008555613a9b565b82601f10613a6e57805160ff1916838001178555613a9b565b82800160010185558215613a9b579182015b82811115613a9b578251825591602001919060010190613a80565b50613aa7929150613aab565b5090565b5b80821115613aa75760008155600101613aac565b80356001600160a01b038116811461224e57600080fd5b60008060008060008060008060008060006101608c8e031215613af957600080fd5b613b028c613ac0565b9a50613b1060208d01613ac0565b9950613b1e60408d01613ac0565b9850613b2c60608d01613ac0565b9750613b3a60808d01613ac0565b9650613b4860a08d01613ac0565b9a9d999c50979a9699959895975050505060c08401359360e081013593610100820135935061012082013592506101409091013590565b6001600160e01b031981168114613b9557600080fd5b50565b600060208284031215613baa57600080fd5b8135610eea81613b7f565b803560ff8116811461224e57600080fd5b60008060408385031215613bd957600080fd5b613be283613bb5565b9150613bf060208401613ac0565b90509250929050565b60005b83811015613c14578181015183820152602001613bfc565b8381111561217b5750506000910152565b60008151808452613c3d816020860160208601613bf9565b601f01601f19169290920160200192915050565b602081526000610eea6020830184613c25565b600060208284031215613c7657600080fd5b5035919050565b60008060408385031215613c9057600080fd5b613c9983613ac0565b946020939093013593505050565b60008060408385031215613cba57600080fd5b50508035926020909101359150565b600080600060608486031215613cde57600080fd5b613ce784613ac0565b9250613cf560208501613ac0565b9150604084013590509250925092565b60008060408385031215613d1857600080fd5b82359150613bf060208401613ac0565b80356001600160401b038116811461224e57600080fd5b60008060008060808587031215613d5557600080fd5b84359350613d6560208601613d28565b93969395505050506040820135916060013590565b600080600060608486031215613d8f57600080fd5b613d9884613d28565b95602085013595506040909401359392505050565b600060208284031215613dbf57600080fd5b610eea82613ac0565b600080600080600080600060e0888a031215613de357600080fd5b613dec88613ac0565b9650602088013595506040880135945060608801359350613e0f60808901613bb5565b925060a0880135915060c0880135905092959891949750929550565b600080600060608486031215613e4057600080fd5b505081359360208301359350604090920135919050565b8015158114613b9557600080fd5b60008060408385031215613e7857600080fd5b613e8183613ac0565b91506020830135613e9181613e57565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613eda57613eda613e9c565b604052919050565b60006020808385031215613ef557600080fd5b82356001600160401b0380821115613f0c57600080fd5b818501915085601f830112613f2057600080fd5b813581811115613f3257613f32613e9c565b8060051b9150613f43848301613eb2565b8181529183018401918481019088841115613f5d57600080fd5b938501935b8385101561193d57843582529385019390850190613f62565b60006001600160401b03821115613f9457613f94613e9c565b50601f01601f191660200190565b60008060008060808587031215613fb857600080fd5b613fc185613ac0565b9350613fcf60208601613ac0565b92506040850135915060608501356001600160401b03811115613ff157600080fd5b8501601f8101871361400257600080fd5b803561401561401082613f7b565b613eb2565b81815288602083850101111561402a57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60006020828403121561405e57600080fd5b8135610eea81613e57565b60008060006060848603121561407e57600080fd5b613d9884613ac0565b6000806040838503121561409a57600080fd5b613be283613ac0565b600181811c908216806140b757607f821691505b602082108114156140d857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115614107576141076140de565b500190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b600081600019048311821515161561418d5761418d6140de565b500290565b6000826141af57634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156141c6576141c66140de565b500390565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60006020828403121561420757600080fd5b5051919050565b60006020828403121561422057600080fd5b81516001600160401b0381111561423657600080fd5b8201601f8101841361424757600080fd5b805161425561401082613f7b565b81815285602083850101111561426a57600080fd5b61427b826020830160208601613bf9565b95945050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614307816017850160208801613bf9565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614338816028840160208801613bf9565b01602801949350505050565b60008251614356818460208701613bf9565b9190910192915050565b60006020828403121561437257600080fd5b8151610eea81613e57565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000816143de576143de6140de565b506000190190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611bd290830184613c25565b60006020828403121561442b57600080fd5b8151610eea81613b7f56fefb5864e8ff833c3cb2d2d08505e82ff02a43554c74a35d4f5a64e85261278311a2646970667358221220c89b22c32edfe9539ea9a7692a10d6b87eb61d9d765373ee1019620607c41abf64736f6c634300080b0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103ae5760003560e01c80636d911a44116101f4578063ac4afa381161011a578063d11a57ec116100ad578063e45be8eb1161007c578063e45be8eb14610860578063e985e9c514610869578063e9c68d27146108a5578063ef037fb9146108b857600080fd5b8063d11a57ec1461074a578063d51a020b14610827578063d547741f1461083a578063e2ab691d1461084d57600080fd5b8063b88d4fde116100e9578063b88d4fde146107e6578063bbf93ba9146107f9578063bedb86fb14610801578063c87b56dd1461081457600080fd5b8063ac4afa3814610778578063af14052c146107c2578063afbf3af0146107ca578063b4abea24146107d357600080fd5b8063930003f41161019257806399fbab881161016157806399fbab88146106b7578063a217fddf1461074a578063a22cb46514610752578063a4feca061461076557600080fd5b8063930003f4146106815780639358928b1461069457806395d89b411461069c5780639785b791146106a457600080fd5b80637eee288d116101ce5780637eee288d1461063f5780638146d26c1461065257806389edeb741461066557806391d148541461066e57600080fd5b80636d911a44146105e657806370a08231146105f9578063794f762d1461060c57600080fd5b80633341145c116102d95780635374f7a8116102775780635ede9956116102465780635ede9956146105ae5780635f505a68146105b75780636352211e146105ca578063682330da146105dd57600080fd5b80635374f7a814610574578063594c3b87146105875780635c975abb146105905780635ea8cd121461059b57600080fd5b806342842e0e116102b357806342842e0e1461053257806343b358b9146105455780634a5ade5d1461054e5780634f9017db1461056157600080fd5b80633341145c146104f957806336568abe1461050c5780633d5f7e061461051f57600080fd5b80631924063e11610351578063248a9ca311610320578063248a9ca3146104b15780632f2ff15d146104d457806331693af6146104e7578063324d4f3b146104f057600080fd5b80631924063e1461046d5780631d22e65514610476578063229852461461048957806323b872dd1461049e57600080fd5b806306fdde031161038d57806306fdde0314610403578063081812fc14610418578063095ea7b31461044357806318160ddd1461045657600080fd5b80622f5fd7146103b357806301ffc9a7146103c85780630589c4e5146103f0575b600080fd5b6103c66103c1366004613ad7565b6108cb565b005b6103db6103d6366004613b98565b610adf565b60405190151581526020015b60405180910390f35b6103c66103fe366004613bc6565b610aff565b61040b610c7b565b6040516103e79190613c51565b61042b610426366004613c64565b610d0d565b6040516001600160a01b0390911681526020016103e7565b6103c6610451366004613c7d565b610da2565b61045f600f5481565b6040519081526020016103e7565b61045f600e5481565b61045f610484366004613ca7565b610eb8565b61045f60008051602061443783398151915281565b6103c66104ac366004613cc9565b610ef1565b61045f6104bf366004613c64565b60009081526077602052604090206001015490565b6103c66104e2366004613d05565b610f22565b61045f60075481565b61045f600a5481565b6103c6610507366004613d3f565b610f48565b6103c661051a366004613d05565b61100d565b61045f61052d366004613ca7565b61108b565b6103c6610540366004613cc9565b611113565b61045f600c5481565b60025461042b906001600160a01b031681565b60035461042b906001600160a01b031681565b6103c6610582366004613c64565b61112e565b61045f600b5481565b60a95460ff166103db565b6103c66105a9366004613c64565b611197565b61045f60085481565b60045461042b906001600160a01b031681565b61042b6105d8366004613c64565b611200565b61045f60095481565b6103c66105f4366004613d7a565b611277565b61045f610607366004613dad565b611417565b61061f61061a366004613c64565b61149e565b6040805194855260208501939093529183015260608201526080016103e7565b61045f61064d366004613c7d565b6115ff565b61045f610660366004613dc8565b61187f565b61045f60065481565b6103db61067c366004613d05565b611949565b61045f61068f366004613c64565b611974565b61045f611bdc565b61040b611cdc565b6103c66106b2366004613e2b565b611ceb565b61070b6106c5366004613c64565b60116020526000908152604090208054600182015460029092015463ffffffff808316936001600160e01b03640100000000948590048116949282169392909104169085565b6040805163ffffffff96871681526001600160e01b0395861660208201529590931692850192909252919091166060830152608082015260a0016103e7565b61045f600081565b6103c6610760366004613e65565b611d64565b6103c6610773366004613ee2565b611d6f565b61078b610786366004613c64565b611f35565b604080516001600160401b0390971687526020870195909552938501929092526060840152608083015260a082015260c0016103e7565b6103db611f85565b61045f60105481565b60015461042b906001600160a01b031681565b6103c66107f4366004613fa2565b612149565b60055461045f565b6103c661080f36600461404c565b612181565b61040b610822366004613c64565b6121cb565b60005461042b906001600160a01b031681565b6103c6610848366004613d05565b612253565b61045f61085b366004614069565b612279565b61045f600d5481565b6103db610877366004614087565b6001600160a01b03918216600090815260e06020908152604080832093909416825291909152205460ff1690565b6103c66108b3366004613c64565b6122af565b6103c66108c6366004613c64565b612318565b601254610100900460ff166108e65760125460ff16156108ea565b303b155b6109525760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b601254610100900460ff16158015610974576012805461ffff19166101011790555b6000546001600160a01b0316156109bc5760405162461bcd60e51b815260206004820152600c60248201526b085a5b9a5d1a585b1a5e995960a21b6044820152606401610949565b600080546001600160a01b03808f166001600160a01b031992831617909255600280548e8416908316179055600180548d841690831617905560038054928c1692909116919091179055600a869055600b859055600c849055600d839055600682905542600e55610a2b612381565b610a33612381565b610a3b612381565b610a436123aa565b610a94604051806040016040528060118152602001702634b8bab4b21029ba30b5b2b21021a72b60791b815250604051806040016040528060068152602001653639b221a72b60d11b8152506123d9565b610a9f60008961240a565b610ab76000805160206144378339815191528861240a565b610abf612490565b8015610ad1576012805461ff00191690555b505050505050505050505050565b6000610aea82612505565b80610af95750610af982612540565b92915050565b6000805160206144378339815191526000610b1a8233611949565b80610b2a5750610b2a8133611949565b610b3357600080fd5b60058460ff1610610b6c5760405162461bcd60e51b815260206004820152600360248201526210905160ea1b6044820152606401610949565b60ff8416610b9457600080546001600160a01b0319166001600160a01b038516179055610c34565b8360ff1660011415610bc057600180546001600160a01b0319166001600160a01b038516179055610c34565b8360ff1660021415610bec57600280546001600160a01b0319166001600160a01b038516179055610c34565b8360ff1660031415610c1857600380546001600160a01b0319166001600160a01b038516179055610c34565b600480546001600160a01b0319166001600160a01b0385161790555b6040516001600160a01b038416815260ff8516907fb6f7937be2862d9850d3ad8765f3973fe163a2a52fc863055e323b2f7105f4769060200160405180910390a250505050565b606060db8054610c8a906140a3565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb6906140a3565b8015610d035780601f10610cd857610100808354040283529160200191610d03565b820191906000526020600020905b815481529060010190602001808311610ce657829003601f168201915b5050505050905090565b600081815260dd60205260408120546001600160a01b0316610d865760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610949565b50600090815260df60205260409020546001600160a01b031690565b6000610dad82611200565b9050806001600160a01b0316836001600160a01b03161415610e1b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610949565b336001600160a01b0382161480610e375750610e378133610877565b610ea95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610949565b610eb38383612575565b505050565b6000610ec482846140f4565b610ed75750670de0b6b3a7640000610af9565b610eea670de0b6b3a764000084846125e3565b9392505050565b610efb33826125fe565b610f175760405162461bcd60e51b81526004016109499061410c565b610eb38383836126f1565b600082815260776020526040902060010154610f3e813361288d565b610eb3838361240a565b6000805160206144378339815191526000610f638233611949565b80610f735750610f738133611949565b610f7c57600080fd5b600060058781548110610f9157610f9161415d565b60009182526020918290206006909102016002810186905560018101879055805467ffffffffffffffff19166001600160401b03891690811782556040518a8152919350869288927fc0835ba9d8b22a00bd1e0882f4310ffcc8584796fc7eb34af630c1e61e4fcc66910160405180910390a450505050505050565b6001600160a01b038116331461107d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610949565b61108782826128f1565b5050565b600081611099575081610af9565b60006110ae84670de0b6b3a7640000856125e3565b90506000670de0b6b3a7640000600b5483600a54670de0b6b3a76400006110d59190614173565b6110df9190614192565b6110e99190614173565b6110f39190614192565b9050600c5481111561110b57600c5492505050610af9565b949350505050565b610eb383838360405180602001604052806000815250612149565b60008051602061443783398151915260006111498233611949565b8061115957506111598133611949565b61116257600080fd5b600783905560405183907f6d65f1f4e5c655d69ff5fd599236f4be4c7f1fbd8fe47cce71ad5ca049a03df690600090a2505050565b60008051602061443783398151915260006111b28233611949565b806111c257506111c28133611949565b6111cb57600080fd5b600d83905560405183907f4b2bb1be849877f717f7f73c89bd20774db6cc9a3752b916459ae23e1b09e4ac90600090a2505050565b600081815260dd60205260408120546001600160a01b031680610af95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610949565b6000611283813361288d565b6040805160c0810182526001600160401b03868116808352602083018781529383018681526000606085018181526080860182815260a0870183815260058054600180820183559582905298517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db06006909a02998a01805467ffffffffffffffff1916919099161790975597517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db188015592517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db2870155517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db386015590517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db485015593517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db5909301929092555484928692917fc0835ba9d8b22a00bd1e0882f4310ffcc8584796fc7eb34af630c1e61e4fcc6691611400916141b4565b60405190815260200160405180910390a450505050565b60006001600160a01b0382166114825760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610949565b506001600160a01b0316600090815260de602052604090205490565b6000818152601160209081526040808320815160a081018352815463ffffffff8082168084526001600160e01b0364010000000093849004811697850188905260018601549283169685019690965291900490931660608201526002909101546080820181905260058054919594859485949391929091859190839081106115285761152861415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b0316835260018101549383019390935260028301549082015260038201546060820181905260048301546080830181905260059093015460a08301529092506115ab9161159b9190610eb8565b8490670de0b6b3a76400006125e3565b965083606001516001600160e01b03166115dc8260a00151670de0b6b3a7640000866125e39092919063ffffffff16565b6115e691906141b4565b95506115f286886140f4565b9450505050509193509193565b600061160d60a95460ff1690565b1561162a5760405162461bcd60e51b8152600401610949906141cb565b3361163483611200565b6001600160a01b0316146116735760405162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b6044820152606401610949565b600082815260116020908152604091829020825160a081018452815463ffffffff80821683526001600160e01b036401000000009283900481169584019590955260018401549081169583018690520490921660608301526002015460808201529042101561170c5760405162461bcd60e51b81526020600482015260056024820152642154494d4560d81b6044820152606401610949565b600081602001516001600160e01b031690506000826000015163ffffffff1690506000600582815481106117425761174261415d565b90600052602060002090600602019050600061177961176983600301548460040154610eb8565b8590670de0b6b3a76400006125e3565b9050600085606001516001600160e01b03166117ac8460050154670de0b6b3a7640000886125e39092919063ffffffff16565b6117b691906141b4565b90506117c281836140f4565b965080601060008282546117d691906141b4565b92505081905550818360030160008282546117f191906141b4565b925050819055508483600401600082825461180c91906141b4565b909155505060008881526011602052604081208181556001810182905560020181905554611844906001600160a01b03168a89612958565b6040513390859089907ff4b5dc38d8b4dcee5e7fc6413bf0bd43c170e5179a2bce1450e21f28e183e74890600090a450505050505092915050565b600061188d60a95460ff1690565b156118aa5760405162461bcd60e51b8152600401610949906141cb565b60005460405163d505accf60e01b8152336004820152306024820152604481018990526064810187905260ff8616608482015260a4810185905260c481018490526001600160a01b039091169063d505accf9060e401600060405180830381600087803b15801561191a57600080fd5b505af115801561192e573d6000803e3d6000fd5b5050505061193d888888612a73565b98975050505050505050565b60009182526077602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000806119a3670de0b6b3a7640000600d54600c54670de0b6b3a764000061199c91906141b4565b91906125e3565b600c546119b890670de0b6b3a76400006141b4565b6119c291906141b4565b600554909150600090815b81811015611a8a57808614611a82576000600582815481106119f1576119f161415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b031683526001810154938301939093526002830154908201526003820154606082018190526004830154608083015260059092015460a082015291508015611a7f576020820151611a72908290670de0b6b3a76400006125e3565b611a7c90866140f4565b94505b50505b6001016119cd565b50600060058681548110611aa057611aa061415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b03168352600180820154848601819052600283015485850152600383015460608601819052600480850154608088015260059094015460a08701529154845163225729ed60e01b81529451959750919590948994670de0b6b3a7640000946001600160a01b039094169363225729ed938282019390929091908290030181865afa158015611b58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7c91906141f5565b611b84611bdc565b611b8e91906141b4565b611b989089614173565b611ba29190614192565b611bac91906141b4565b611bbe90670de0b6b3a7640000614173565b611bc89190614192565b611bd291906141b4565b9695505050505050565b6010546001546040805163c167d1cd60e01b81529051600093926001600160a01b03169163c167d1cd9160048083019260209291908290030181865afa158015611c2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4e91906141f5565b60008054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc391906141f5565b611ccd91906141b4565b611cd791906141b4565b905090565b606060dc8054610c8a906140a3565b6000805160206144378339815191526000611d068233611949565b80611d165750611d168133611949565b611d1f57600080fd5b600a859055600b849055600c8390556040518390859087907fdcefe023fa4e663636085ee3356cb163d79a360df1fc07686a02ed7410f8ec9190600090a45050505050565b611087338383612e17565b6000805160206144378339815191526000611d8a8233611949565b80611d9a5750611d9a8133611949565b611da357600080fd5b82516000805b82811015611e4757600060058281548110611dc657611dc661415d565b906000526020600020906006020190506000878381518110611dea57611dea61415d565b60200260200101519050611e15670de0b6b3a76400008360040154836125e39092919063ffffffff16565b826005016000828254611e2891906140f4565b90915550611e38905081856140f4565b93508260010192505050611da9565b5060095480821115611e8c5760405162461bcd60e51b815260206004820152600e60248201526d455843454544535f45584345535360901b6044820152606401610949565b611e9682826141b4565b6009556000546040516340c10f1960e01b8152306004820152602481018490526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015611ee557600080fd5b505af1158015611ef9573d6000803e3d6000fd5b50505050600954827f6dc619f0e1fed4ad5519b33c9dedac5be96861e335ba7cd43a9ef912f02fd86c60405160405180910390a3505050505050565b60058181548110611f4557600080fd5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160401b0390941695509193909286565b6000611f9360a95460ff1690565b15611fb05760405162461bcd60e51b8152600401610949906141cb565b600654600e54611fc091906140f4565b42106121465760075460008080611fd684612ee6565b6000546002546040516340c10f1960e01b81526001600160a01b0391821660048201526024810186905294975092955090935016906340c10f1990604401600060405180830381600087803b15801561202e57600080fd5b505af1158015612042573d6000803e3d6000fd5b50506000546040516340c10f1960e01b8152306004820152602481018690526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b15801561209257600080fd5b505af11580156120a6573d6000803e3d6000fd5b50506000546040516340c10f1960e01b8152336004820152602481018890526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b1580156120f657600080fd5b505af115801561210a573d6000803e3d6000fd5b505050508083837fc6642d24d84e7f3d36ca39f5cce10e75639d9b158d5193aa350e2f900653e4c060405160405180910390a460019450505050505b90565b61215333836125fe565b61216f5760405162461bcd60e51b81526004016109499061410c565b61217b84848484613299565b50505050565b600080516020614437833981519152600061219c8233611949565b806121ac57506121ac8133611949565b6121b557600080fd5b82156121c357610eb3612490565b610eb36132cc565b6004546060906001600160a01b03161561224e576004805460405163c87b56dd60e01b81529182018490526001600160a01b03169063c87b56dd90602401600060405180830381865afa158015612226573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610af9919081019061420e565b919050565b60008281526077602052604090206001015461226f813361288d565b610eb383836128f1565b600061228760a95460ff1690565b156122a45760405162461bcd60e51b8152600401610949906141cb565b61110b848484612a73565b60008051602061443783398151915260006122ca8233611949565b806122da57506122da8133611949565b6122e357600080fd5b600883905560405183907fd1f0338b5b84ec92ed0ba1801c9c404be68e30988c482460b73cf5688d066d2390600090a2505050565b60008051602061443783398151915260006123338233611949565b8061234357506123438133611949565b61234c57600080fd5b600683905560405183907f237c8b5cd8bc1143c45f932ec876dadddbba3784d09fec6ffd3df2e58f9928f990600090a2505050565b601254610100900460ff166123a85760405162461bcd60e51b815260040161094990614284565b565b601254610100900460ff166123d15760405162461bcd60e51b815260040161094990614284565b6123a8613346565b601254610100900460ff166124005760405162461bcd60e51b815260040161094990614284565b6110878282613379565b6124148282611949565b6110875760008281526077602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561244c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60a95460ff16156124b35760405162461bcd60e51b8152600401610949906141cb565b60a9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586124e83390565b6040516001600160a01b03909116815260200160405180910390a1565b60006001600160e01b031982166380ac58cd60e01b1480610aea57506001600160e01b03198216635b5e139f60e01b1480610af95750610af9825b60006001600160e01b03198216637965db0b60e01b1480610af957506301ffc9a760e01b6001600160e01b0319831614610af9565b600081815260df6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906125aa82611200565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b82820283158482048414176125f757600080fd5b0492915050565b600081815260dd60205260408120546001600160a01b03166126775760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610949565b600061268283611200565b9050806001600160a01b0316846001600160a01b031614806126bd5750836001600160a01b03166126b284610d0d565b6001600160a01b0316145b8061110b57506001600160a01b03808216600090815260e0602090815260408083209388168352929052205460ff1661110b565b826001600160a01b031661270482611200565b6001600160a01b0316146127685760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610949565b6001600160a01b0382166127ca5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610949565b6127d5600082612575565b6001600160a01b038316600090815260de602052604081208054600192906127fe9084906141b4565b90915550506001600160a01b038216600090815260de6020526040812080546001929061282c9084906140f4565b9091555050600081815260dd602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6128978282611949565b611087576128af816001600160a01b031660146133c7565b6128ba8360206133c7565b6040516020016128cb9291906142cf565b60408051601f198184030181529082905262461bcd60e51b825261094991600401613c51565b6128fb8282611949565b156110875760008281526077602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916129b49190614344565b6000604051808303816000865af19150503d80600081146129f1576040519150601f19603f3d011682016040523d82523d6000602084013e6129f6565b606091505b5091509150818015612a20575080511580612a20575080806020019051810190612a209190614360565b612a6c5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610949565b5050505050565b60008060058381548110612a8957612a8961415d565b906000526020600020906006020190506000612ac1670de0b6b3a7640000612ab984600301548560040154610eb8565b8791906125e3565b90506000612ae68360050154670de0b6b3a7640000846125e39092919063ffffffff16565b600054909150612b01906001600160a01b0316333089613562565b85836003016000828254612b1591906140f4565b9250508190555081836004016000828254612b3091906140f4565b9091555050600554600090815b81811015612bf257600060058281548110612b5a57612b5a61415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b031683526001810154938301939093526002830154908201526003820154606082018190526004830154608083015260059092015460a082015291508015612be8576020820151612bdb908290670de0b6b3a76400006125e3565b612be590866140f4565b94505b5050600101612b3d565b506000612c1a670de0b6b3a7640000600d54600c54670de0b6b3a764000061199c91906141b4565b600c54612c2f90670de0b6b3a76400006141b4565b612c3991906141b4565b90506000612cda670de0b6b3a7640000600160009054906101000a90046001600160a01b03166001600160a01b031663225729ed6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc091906141f5565b612cc8611bdc565b612cd291906141b4565b8691906125e3565b9050808211612d115760405162461bcd60e51b815260206004820152600360248201526204341560ec1b6044820152606401610949565b600f8054600101908190556040805160a08101825263ffffffff8c1681526001600160e01b03891660208201528954929a509190820190612d5b906001600160401b0316426140f4565b63ffffffff90811682526001600160e01b0388811660208085019190915260409384018f905260008d815260118252849020855191860151918416640100000000928416830217815593850151606086015193169290911602176001820155608090910151600290910155612dd08b89613692565b60405133815288908a908c907f114cc376d25215fb3215218ecf58c7fd5434f680efa149f1ef0b5ce3e7ca06fc9060200160405180910390a4505050505050509392505050565b816001600160a01b0316836001600160a01b03161415612e795760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610949565b6001600160a01b03838116600081815260e06020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600080600080600360009054906101000a90046001600160a01b03166001600160a01b0316637e2f3eb56040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612f41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6591906141f5565b90506000600160009054906101000a90046001600160a01b03166001600160a01b031663225729ed6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe091906141f5565b60055490915081612fef611bdc565b612ff991906141b4565b935061301b613008848461108b565b670de0b6b3a764000061199c85876141b4565b955060008060005b838110156130fe576000600582815481106130405761304061415d565b60009182526020918290206040805160c081018252600690930290910180546001600160401b031683526001810154938301939093526002830154908201526003820154606082018190526004830154608083015260059092015460a0820152915080156130f45760208201516130c1908290670de0b6b3a76400006125e3565b6130cb90866140f4565b60408301519095506130e7908290670de0b6b3a76400006125e3565b6130f190856140f4565b93505b5050600101613023565b50600061313f670de0b6b3a764000061311885828b6125e3565b61312a90670de0b6b3a76400006141b4565b8c6131358d8a6140f4565b61199c91906140f4565b9050600061315682670de0b6b3a76400008a6125e3565b90506000600954838961316991906141b4565b61317391906140f4565b90506000613196600854670de0b6b3a76400008c6125e39092919063ffffffff16565b9050818111156131a35750805b6000856131b15760006131c4565b6131c482670de0b6b3a7640000886125e3565b90506000806131d48a87856137d4565b9150915080601060008282546131ea91906140f4565b909155506131fa905081866141b4565b60095560015460408051631aa5913360e31b815290516001600160a01b039092169163d52c89989160048082019260209290919082900301816000875af1158015613249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061326d9190614360565b61327657600080fd5b42600e5561328481836140f4565b9d505050505050505050505050509193909250565b6132a48484846126f1565b6132b084848484613929565b61217b5760405162461bcd60e51b81526004016109499061437d565b60a95460ff166133155760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610949565b60a9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336124e8565b601254610100900460ff1661336d5760405162461bcd60e51b815260040161094990614284565b60a9805460ff19169055565b601254610100900460ff166133a05760405162461bcd60e51b815260040161094990614284565b81516133b39060db906020850190613a27565b508051610eb39060dc906020840190613a27565b606060006133d6836002614173565b6133e19060026140f4565b6001600160401b038111156133f8576133f8613e9c565b6040519080825280601f01601f191660200182016040528015613422576020820181803683370190505b509050600360fc1b8160008151811061343d5761343d61415d565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061346c5761346c61415d565b60200101906001600160f81b031916908160001a9053506000613490846002614173565b61349b9060016140f4565b90505b6001811115613513576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106134cf576134cf61415d565b1a60f81b8282815181106134e5576134e561415d565b60200101906001600160f81b031916908160001a90535060049490941c9361350c816143cf565b905061349e565b508315610eea5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610949565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916135c69190614344565b6000604051808303816000865af19150503d8060008114613603576040519150601f19603f3d011682016040523d82523d6000602084013e613608565b606091505b50915091508180156136325750805115806136325750808060200190518101906136329190614360565b61368a5760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610949565b505050505050565b6001600160a01b0382166136e85760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610949565b600081815260dd60205260409020546001600160a01b03161561374d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610949565b6001600160a01b038216600090815260de602052604081208054600192906137769084906140f4565b9091555050600081815260dd602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008060005b85811015613920576000600582815481106137f7576137f761415d565b600091825260209091206006909102016003810154600482015491925090811580159061382357508015155b15613912576001830154600090613857906138479085670de0b6b3a76400006125e3565b8a90670de0b6b3a76400006125e3565b600285015490915060009061387a90670de0b6b3a764000061199c8c88836125e3565b90508082877f1f0fae980e736e95466eb059734f223baa1ce38572b29987d01f29879ef3658a88600301546040516138b491815260200190565b60405180910390a46138c682856140f4565b60038601556138de81670de0b6b3a7640000856125e3565b8560050160008282546138f191906140f4565b90915550613901905082896140f4565b975061390d81886140f4565b965050505b8360010193505050506137da565b50935093915050565b60006001600160a01b0384163b15613a1c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061396d9033908990889088906004016143e6565b6020604051808303816000875af19250505080156139a8575060408051601f3d908101601f191682019092526139a591810190614419565b60015b613a02573d8080156139d6576040519150601f19603f3d011682016040523d82523d6000602084013e6139db565b606091505b5080516139fa5760405162461bcd60e51b81526004016109499061437d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061110b565b506001949350505050565b828054613a33906140a3565b90600052602060002090601f016020900481019282613a555760008555613a9b565b82601f10613a6e57805160ff1916838001178555613a9b565b82800160010185558215613a9b579182015b82811115613a9b578251825591602001919060010190613a80565b50613aa7929150613aab565b5090565b5b80821115613aa75760008155600101613aac565b80356001600160a01b038116811461224e57600080fd5b60008060008060008060008060008060006101608c8e031215613af957600080fd5b613b028c613ac0565b9a50613b1060208d01613ac0565b9950613b1e60408d01613ac0565b9850613b2c60608d01613ac0565b9750613b3a60808d01613ac0565b9650613b4860a08d01613ac0565b9a9d999c50979a9699959895975050505060c08401359360e081013593610100820135935061012082013592506101409091013590565b6001600160e01b031981168114613b9557600080fd5b50565b600060208284031215613baa57600080fd5b8135610eea81613b7f565b803560ff8116811461224e57600080fd5b60008060408385031215613bd957600080fd5b613be283613bb5565b9150613bf060208401613ac0565b90509250929050565b60005b83811015613c14578181015183820152602001613bfc565b8381111561217b5750506000910152565b60008151808452613c3d816020860160208601613bf9565b601f01601f19169290920160200192915050565b602081526000610eea6020830184613c25565b600060208284031215613c7657600080fd5b5035919050565b60008060408385031215613c9057600080fd5b613c9983613ac0565b946020939093013593505050565b60008060408385031215613cba57600080fd5b50508035926020909101359150565b600080600060608486031215613cde57600080fd5b613ce784613ac0565b9250613cf560208501613ac0565b9150604084013590509250925092565b60008060408385031215613d1857600080fd5b82359150613bf060208401613ac0565b80356001600160401b038116811461224e57600080fd5b60008060008060808587031215613d5557600080fd5b84359350613d6560208601613d28565b93969395505050506040820135916060013590565b600080600060608486031215613d8f57600080fd5b613d9884613d28565b95602085013595506040909401359392505050565b600060208284031215613dbf57600080fd5b610eea82613ac0565b600080600080600080600060e0888a031215613de357600080fd5b613dec88613ac0565b9650602088013595506040880135945060608801359350613e0f60808901613bb5565b925060a0880135915060c0880135905092959891949750929550565b600080600060608486031215613e4057600080fd5b505081359360208301359350604090920135919050565b8015158114613b9557600080fd5b60008060408385031215613e7857600080fd5b613e8183613ac0565b91506020830135613e9181613e57565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613eda57613eda613e9c565b604052919050565b60006020808385031215613ef557600080fd5b82356001600160401b0380821115613f0c57600080fd5b818501915085601f830112613f2057600080fd5b813581811115613f3257613f32613e9c565b8060051b9150613f43848301613eb2565b8181529183018401918481019088841115613f5d57600080fd5b938501935b8385101561193d57843582529385019390850190613f62565b60006001600160401b03821115613f9457613f94613e9c565b50601f01601f191660200190565b60008060008060808587031215613fb857600080fd5b613fc185613ac0565b9350613fcf60208601613ac0565b92506040850135915060608501356001600160401b03811115613ff157600080fd5b8501601f8101871361400257600080fd5b803561401561401082613f7b565b613eb2565b81815288602083850101111561402a57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60006020828403121561405e57600080fd5b8135610eea81613e57565b60008060006060848603121561407e57600080fd5b613d9884613ac0565b6000806040838503121561409a57600080fd5b613be283613ac0565b600181811c908216806140b757607f821691505b602082108114156140d857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115614107576141076140de565b500190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b600081600019048311821515161561418d5761418d6140de565b500290565b6000826141af57634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156141c6576141c66140de565b500390565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60006020828403121561420757600080fd5b5051919050565b60006020828403121561422057600080fd5b81516001600160401b0381111561423657600080fd5b8201601f8101841361424757600080fd5b805161425561401082613f7b565b81815285602083850101111561426a57600080fd5b61427b826020830160208601613bf9565b95945050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614307816017850160208801613bf9565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614338816028840160208801613bf9565b01602801949350505050565b60008251614356818460208701613bf9565b9190910192915050565b60006020828403121561437257600080fd5b8151610eea81613e57565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6000816143de576143de6140de565b506000190190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611bd290830184613c25565b60006020828403121561442b57600080fd5b8151610eea81613b7f56fefb5864e8ff833c3cb2d2d08505e82ff02a43554c74a35d4f5a64e85261278311a2646970667358221220c89b22c32edfe9539ea9a7692a10d6b87eb61d9d765373ee1019620607c41abf64736f6c634300080b0033
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
[ 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.