ERC-721
Overview
Max Total Supply
256 DIGI
Holders
168
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 DIGILoading...
Loading
Loading...
Loading
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Reliquary
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 100 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; import "./ReliquaryEvents.sol"; import "./interfaces/IReliquary.sol"; import "./interfaces/IEmissionCurve.sol"; import "./interfaces/IRewarder.sol"; import "./interfaces/INFTDescriptor.sol"; import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; import "openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "openzeppelin-contracts/contracts/utils/Multicall.sol"; import "openzeppelin-contracts/contracts/access/AccessControlEnumerable.sol"; import "openzeppelin-contracts/contracts/security/ReentrancyGuard.sol"; /** * @title Reliquary * @author Justin Bebis, Zokunei & the Byte Masons team * * @notice This system is designed to manage incentives for deposited assets such that * behaviors can be programmed on a per-pool basis using maturity levels. Stake in a * pool, also referred to as "position," is represented by means of an NFT called a * "Relic." Each position has a "maturity" which captures the age of the position. * * @notice Deposits are tracked by Relic ID instead of by user. This allows for * increased composability without affecting accounting logic too much, and users can * trade their Relics without withdrawing liquidity or affecting the position's maturity. */ contract Reliquary is IReliquary, ERC721Burnable, ERC721Enumerable, AccessControlEnumerable, Multicall, ReentrancyGuard { using SafeERC20 for IERC20; /// @dev Access control roles. bytes32 public constant OPERATOR = keccak256("OPERATOR"); bytes32 public constant EMISSION_CURVE = keccak256("EMISSION_CURVE"); /// @dev Indicates whether tokens are being added to, or removed from, a pool. enum Kind { DEPOSIT, WITHDRAW, OTHER } /// @dev Level of precision rewards are calculated to. uint private constant ACC_REWARD_PRECISION = 1e12; /// @dev Nonce to use for new relicId. uint private idNonce; /// @notice Address of the reward token contract. address public immutable rewardToken; /// @notice Address of each NFTDescriptor contract. address[] public nftDescriptor; /// @notice Address of EmissionCurve contract. address public emissionCurve; /// @notice Info of each Reliquary pool. PoolInfo[] private poolInfo; /// @notice Level system for each Reliquary pool. LevelInfo[] private levels; /// @notice Address of the LP token for each Reliquary pool. address[] public poolToken; /// @notice Address of IRewarder contract for each Reliquary pool. address[] public rewarder; /// @notice Info of each staked position. mapping(uint => PositionInfo) internal positionForId; /// @dev Total allocation points. Must be the sum of all allocation points in all pools. uint public totalAllocPoint; error NonExistentRelic(); error BurningPrincipal(); error BurningRewards(); error RewardTokenAsPoolToken(); error EmptyArray(); error ArrayLengthMismatch(); error NonZeroFirstMaturity(); error UnsortedMaturityLevels(); error ZeroTotalAllocPoint(); error NonExistentPool(); error ZeroAmount(); error NotOwner(); error DuplicateRelicIds(); error RelicsNotOfSamePool(); error MergingEmptyRelics(); error MaxEmissionRateExceeded(); error NotApprovedOrOwner(); error PartialWithdrawalsDisabled(); /** * @dev Constructs and initializes the contract. * @param _rewardToken The reward token contract address. * @param _emissionCurve The contract address for the EmissionCurve, which will return the emission rate. */ constructor(address _rewardToken, address _emissionCurve, string memory name, string memory symbol) ERC721(name, symbol) { rewardToken = _rewardToken; emissionCurve = _emissionCurve; _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); } /// @notice Sets a new EmissionCurve for overall rewardToken emissions. Can only be called with the proper role. /// @param _emissionCurve The contract address for the EmissionCurve, which will return the base emission rate. function setEmissionCurve(address _emissionCurve) external override onlyRole(EMISSION_CURVE) { emissionCurve = _emissionCurve; emit ReliquaryEvents.LogSetEmissionCurve(_emissionCurve); } /** * @notice Add a new pool for the specified LP. Can only be called by an operator. * @param allocPoint The allocation points for the new pool. * @param _poolToken Address of the pooled ERC-20 token. * @param _rewarder Address of the rewarder delegate. * @param requiredMaturities Array of maturity (in seconds) required to achieve each level for this pool. * @param levelMultipliers The multipliers applied to the amount of `_poolToken` for each level within this pool. * @param name Name of pool to be displayed in NFT image. * @param _nftDescriptor The contract address for NFTDescriptor, which will return the token URI. * @param allowPartialWithdrawals Whether users can withdraw less than their entire position. A value of false * will also disable shift and split functionality. This is useful for adding pools with decreasing levelMultipliers. */ function addPool( uint allocPoint, address _poolToken, address _rewarder, uint[] calldata requiredMaturities, uint[] calldata levelMultipliers, string memory name, address _nftDescriptor, bool allowPartialWithdrawals ) external override onlyRole(DEFAULT_ADMIN_ROLE) { if (_poolToken == rewardToken) revert RewardTokenAsPoolToken(); if (requiredMaturities.length == 0) revert EmptyArray(); if (requiredMaturities.length != levelMultipliers.length) revert ArrayLengthMismatch(); if (requiredMaturities[0] != 0) revert NonZeroFirstMaturity(); if (requiredMaturities.length > 1) { uint highestMaturity; for (uint i = 1; i < requiredMaturities.length;) { if (requiredMaturities[i] <= highestMaturity) revert UnsortedMaturityLevels(); highestMaturity = requiredMaturities[i]; unchecked { ++i; } } } for (uint i; i < poolLength();) { _updatePool(i); unchecked { ++i; } } uint totalAlloc = totalAllocPoint + allocPoint; if (totalAlloc == 0) revert ZeroTotalAllocPoint(); totalAllocPoint = totalAlloc; poolToken.push(_poolToken); rewarder.push(_rewarder); nftDescriptor.push(_nftDescriptor); poolInfo.push( PoolInfo({ allocPoint: allocPoint, lastRewardTime: block.timestamp, accRewardPerShare: 0, name: name, allowPartialWithdrawals: allowPartialWithdrawals }) ); levels.push( LevelInfo({ requiredMaturities: requiredMaturities, multipliers: levelMultipliers, balance: new uint[](levelMultipliers.length) }) ); emit ReliquaryEvents.LogPoolAddition( (poolToken.length - 1), allocPoint, _poolToken, _rewarder, _nftDescriptor, allowPartialWithdrawals ); } /** * @notice Modify the given pool's properties. Can only be called by an operator. * @param pid The index of the pool. See poolInfo. * @param allocPoint New AP of the pool. * @param _rewarder Address of the rewarder delegate. * @param name Name of pool to be displayed in NFT image. * @param _nftDescriptor The contract address for NFTDescriptor, which will return the token URI. * @param overwriteRewarder True if _rewarder should be set. Otherwise _rewarder is ignored. */ function modifyPool( uint pid, uint allocPoint, address _rewarder, string calldata name, address _nftDescriptor, bool overwriteRewarder ) external override onlyRole(OPERATOR) { if (pid >= poolInfo.length) revert NonExistentPool(); uint length = poolLength(); for (uint i; i < length;) { _updatePool(i); unchecked { ++i; } } PoolInfo storage pool = poolInfo[pid]; uint totalAlloc = totalAllocPoint + allocPoint - pool.allocPoint; if (totalAlloc == 0) revert ZeroTotalAllocPoint(); totalAllocPoint = totalAlloc; pool.allocPoint = allocPoint; if (overwriteRewarder) { rewarder[pid] = _rewarder; } pool.name = name; nftDescriptor[pid] = _nftDescriptor; emit ReliquaryEvents.LogPoolModified( pid, allocPoint, overwriteRewarder ? _rewarder : rewarder[pid], _nftDescriptor ); } /// @notice Update reward variables for all pools. Be careful of gas spending! /// @param pids Pool IDs of all to be updated. Make sure to update all active pools. function massUpdatePools(uint[] calldata pids) external override nonReentrant { for (uint i; i < pids.length;) { _updatePool(pids[i]); unchecked { ++i; } } } /// @notice Update reward variables of the given pool. /// @param pid The index of the pool. See poolInfo. function updatePool(uint pid) external override nonReentrant { _updatePool(pid); } /** * @notice Deposit pool tokens to Reliquary for reward token allocation. * @param amount Token amount to deposit. * @param relicId NFT ID of the position being deposited to. */ function deposit(uint amount, uint relicId) external override nonReentrant { _requireApprovedOrOwner(relicId); _deposit(amount, relicId); } /** * @notice Withdraw pool tokens. * @param amount token amount to withdraw. * @param relicId NFT ID of the position being withdrawn. */ function withdraw(uint amount, uint relicId) external override nonReentrant { if (amount == 0) revert ZeroAmount(); _requireApprovedOrOwner(relicId); (uint poolId,) = _updatePosition(amount, relicId, Kind.WITHDRAW, address(0)); IERC20(poolToken[poolId]).safeTransfer(msg.sender, amount); emit ReliquaryEvents.Withdraw(poolId, amount, msg.sender, relicId); } /** * @notice Harvest proceeds for transaction sender to owner of Relic `relicId`. * @param relicId NFT ID of the position being harvested. * @param harvestTo Address to send rewards to (zero address if harvest should not be performed). */ function harvest(uint relicId, address harvestTo) external override nonReentrant { _requireApprovedOrOwner(relicId); (uint poolId, uint receivedReward) = _updatePosition(0, relicId, Kind.OTHER, harvestTo); emit ReliquaryEvents.Harvest(poolId, receivedReward, harvestTo, relicId); } /** * @notice Withdraw pool tokens and harvest proceeds for transaction sender to owner of Relic `relicId`. * @param amount token amount to withdraw. * @param relicId NFT ID of the position being withdrawn and harvested. * @param harvestTo Address to send rewards to (zero address if harvest should not be performed). */ function withdrawAndHarvest(uint amount, uint relicId, address harvestTo) external override nonReentrant { if (amount == 0) revert ZeroAmount(); _requireApprovedOrOwner(relicId); (uint poolId, uint receivedReward) = _updatePosition(amount, relicId, Kind.WITHDRAW, harvestTo); IERC20(poolToken[poolId]).safeTransfer(msg.sender, amount); emit ReliquaryEvents.Withdraw(poolId, amount, msg.sender, relicId); emit ReliquaryEvents.Harvest(poolId, receivedReward, harvestTo, relicId); } /** * @notice Withdraw without caring about rewards. EMERGENCY ONLY. * @param relicId NFT ID of the position to emergency withdraw from and burn. */ function emergencyWithdraw(uint relicId) external override nonReentrant { address to = ownerOf(relicId); if (to != msg.sender) revert NotOwner(); PositionInfo storage position = positionForId[relicId]; uint amount = position.amount; uint poolId = position.poolId; levels[poolId].balance[position.level] -= amount; _burn(relicId); delete positionForId[relicId]; IERC20(poolToken[poolId]).safeTransfer(to, amount); emit ReliquaryEvents.EmergencyWithdraw(poolId, amount, to, relicId); } /// @notice Update position without performing a deposit/withdraw/harvest. /// @param relicId The NFT ID of the position being updated. function updatePosition(uint relicId) external override nonReentrant { if (!_exists(relicId)) revert NonExistentRelic(); _updatePosition(0, relicId, Kind.OTHER, address(0)); } /// @notice Returns a PositionInfo object for the given relicId. function getPositionForId(uint relicId) external view override returns (PositionInfo memory position) { position = positionForId[relicId]; } /// @notice Returns a PoolInfo object for pool ID `pid`. function getPoolInfo(uint pid) external view override returns (PoolInfo memory pool) { pool = poolInfo[pid]; } /// @notice Returns a LevelInfo object for pool ID `pid`. function getLevelInfo(uint pid) external view override returns (LevelInfo memory levelInfo) { levelInfo = levels[pid]; } /** * @notice View function to retrieve the relicIds, poolIds, and pendingReward for each Relic owned by an address. * @param owner Address of the owner to retrieve info for. * @return pendingRewards Array of PendingReward objects. */ function pendingRewardsOfOwner(address owner) external view override returns (PendingReward[] memory pendingRewards) { uint balance = balanceOf(owner); pendingRewards = new PendingReward[](balance); for (uint i; i < balance;) { uint relicId = tokenOfOwnerByIndex(owner, i); pendingRewards[i] = PendingReward({ relicId: relicId, poolId: positionForId[relicId].poolId, pendingReward: pendingReward(relicId) }); unchecked { ++i; } } } /** * @notice View function to retrieve owned positions for an address. * @param owner Address of the owner to retrieve info for. * @return relicIds Each relicId owned by the given address. * @return positionInfos The PositionInfo object for each relicId. */ function relicPositionsOfOwner(address owner) external view override returns (uint[] memory relicIds, PositionInfo[] memory positionInfos) { uint balance = balanceOf(owner); relicIds = new uint[](balance); positionInfos = new PositionInfo[](balance); for (uint i; i < balance;) { relicIds[i] = tokenOfOwnerByIndex(owner, i); positionInfos[i] = positionForId[relicIds[i]]; unchecked { ++i; } } } /// @notice Returns whether `spender` is allowed to manage Relic `relicId`. function isApprovedOrOwner(address spender, uint relicId) external view override returns (bool) { return _isApprovedOrOwner(spender, relicId); } /** * @notice Create a new Relic NFT and deposit into this position. * @param to Address to mint the Relic to. * @param pid The index of the pool. See poolInfo. * @param amount Token amount to deposit. */ function createRelicAndDeposit(address to, uint pid, uint amount) public virtual override nonReentrant returns (uint id) { if (pid >= poolInfo.length) revert NonExistentPool(); id = _mint(to); PositionInfo storage position = positionForId[id]; position.poolId = pid; _deposit(amount, id); emit ReliquaryEvents.CreateRelic(pid, to, id); } /** * @notice Split an owned Relic into a new one, while maintaining maturity. * @param fromId The NFT ID of the Relic to split from. * @param amount Amount to move from existing Relic into the new one. * @param to Address to mint the Relic to. * @return newId The NFT ID of the new Relic. */ function split(uint fromId, uint amount, address to) public virtual override nonReentrant returns (uint newId) { if (amount == 0) revert ZeroAmount(); _requireApprovedOrOwner(fromId); PositionInfo storage fromPosition = positionForId[fromId]; uint poolId = fromPosition.poolId; if (!poolInfo[poolId].allowPartialWithdrawals) revert PartialWithdrawalsDisabled(); uint fromAmount = fromPosition.amount; uint newFromAmount = fromAmount - amount; fromPosition.amount = newFromAmount; newId = _mint(to); PositionInfo storage newPosition = positionForId[newId]; newPosition.amount = amount; newPosition.entry = fromPosition.entry; uint level = fromPosition.level; newPosition.level = level; newPosition.poolId = poolId; uint multiplier = _updatePool(poolId) * levels[poolId].multipliers[level]; uint pendingFrom = fromAmount * multiplier / ACC_REWARD_PRECISION - fromPosition.rewardDebt; if (pendingFrom != 0) { fromPosition.rewardCredit += pendingFrom; } fromPosition.rewardDebt = newFromAmount * multiplier / ACC_REWARD_PRECISION; newPosition.rewardDebt = amount * multiplier / ACC_REWARD_PRECISION; emit ReliquaryEvents.CreateRelic(poolId, to, newId); emit ReliquaryEvents.Split(fromId, newId, amount); } struct LocalVariables_shift { uint fromAmount; uint poolId; uint toAmount; uint newFromAmount; uint newToAmount; uint fromLevel; uint oldToLevel; uint newToLevel; uint accRewardPerShare; uint fromMultiplier; uint pendingFrom; uint pendingTo; } /** * @notice Transfer amount from one Relic into another, updating maturity in the receiving Relic. * @param fromId The NFT ID of the Relic to transfer from. * @param toId The NFT ID of the Relic being transferred to. * @param amount The amount being transferred. */ function shift(uint fromId, uint toId, uint amount) public virtual override nonReentrant { if (amount == 0) revert ZeroAmount(); if (fromId == toId) revert DuplicateRelicIds(); _requireApprovedOrOwner(fromId); _requireApprovedOrOwner(toId); LocalVariables_shift memory vars; PositionInfo storage fromPosition = positionForId[fromId]; vars.poolId = fromPosition.poolId; if (!poolInfo[vars.poolId].allowPartialWithdrawals) revert PartialWithdrawalsDisabled(); PositionInfo storage toPosition = positionForId[toId]; if (vars.poolId != toPosition.poolId) revert RelicsNotOfSamePool(); vars.fromAmount = fromPosition.amount; vars.toAmount = toPosition.amount; toPosition.entry = (vars.fromAmount * fromPosition.entry + vars.toAmount * toPosition.entry) / (vars.fromAmount + vars.toAmount); vars.newFromAmount = vars.fromAmount - amount; fromPosition.amount = vars.newFromAmount; vars.newToAmount = vars.toAmount + amount; toPosition.amount = vars.newToAmount; (vars.fromLevel, vars.oldToLevel, vars.newToLevel) = _shiftLevelBalances(fromId, toId, vars.poolId, amount, vars.toAmount, vars.newToAmount); vars.accRewardPerShare = _updatePool(vars.poolId); vars.fromMultiplier = vars.accRewardPerShare * levels[vars.poolId].multipliers[vars.fromLevel]; vars.pendingFrom = vars.fromAmount * vars.fromMultiplier / ACC_REWARD_PRECISION - fromPosition.rewardDebt; if (vars.pendingFrom != 0) { fromPosition.rewardCredit += vars.pendingFrom; } vars.pendingTo = vars.toAmount * levels[vars.poolId].multipliers[vars.oldToLevel] * vars.accRewardPerShare / ACC_REWARD_PRECISION - toPosition.rewardDebt; if (vars.pendingTo != 0) { toPosition.rewardCredit += vars.pendingTo; } fromPosition.rewardDebt = vars.newFromAmount * vars.fromMultiplier / ACC_REWARD_PRECISION; toPosition.rewardDebt = vars.newToAmount * vars.accRewardPerShare * levels[vars.poolId].multipliers[vars.newToLevel] / ACC_REWARD_PRECISION; emit ReliquaryEvents.Shift(fromId, toId, amount); } /** * @notice Transfer entire position (including rewards) from one Relic into another, burning it * and updating maturity in the receiving Relic. * @param fromId The NFT ID of the Relic to transfer from. * @param toId The NFT ID of the Relic being transferred to. */ function merge(uint fromId, uint toId) public virtual override nonReentrant { if (fromId == toId) revert DuplicateRelicIds(); _requireApprovedOrOwner(fromId); _requireApprovedOrOwner(toId); PositionInfo storage fromPosition = positionForId[fromId]; uint fromAmount = fromPosition.amount; uint poolId = fromPosition.poolId; PositionInfo storage toPosition = positionForId[toId]; if (poolId != toPosition.poolId) revert RelicsNotOfSamePool(); uint toAmount = toPosition.amount; uint newToAmount = toAmount + fromAmount; if (newToAmount == 0) revert MergingEmptyRelics(); toPosition.entry = (fromAmount * fromPosition.entry + toAmount * toPosition.entry) / newToAmount; toPosition.amount = newToAmount; (uint fromLevel, uint oldToLevel, uint newToLevel) = _shiftLevelBalances(fromId, toId, poolId, fromAmount, toAmount, newToAmount); uint accRewardPerShare = _updatePool(poolId); uint pendingTo = accRewardPerShare * (fromAmount * levels[poolId].multipliers[fromLevel] + toAmount * levels[poolId].multipliers[oldToLevel]) / ACC_REWARD_PRECISION + fromPosition.rewardCredit - fromPosition.rewardDebt - toPosition.rewardDebt; if (pendingTo != 0) { toPosition.rewardCredit += pendingTo; } toPosition.rewardDebt = newToAmount * accRewardPerShare * levels[poolId].multipliers[newToLevel] / ACC_REWARD_PRECISION; _burn(fromId); delete positionForId[fromId]; emit ReliquaryEvents.Merge(fromId, toId, fromAmount); } /// @notice Burns the Relic with ID `tokenId`. Cannot be called if there is any principal or rewards in the Relic. function burn(uint tokenId) public virtual override(IReliquary, ERC721Burnable) { if (positionForId[tokenId].amount != 0) revert BurningPrincipal(); if (pendingReward(tokenId) != 0) revert BurningRewards(); super.burn(tokenId); } /** * @notice View function to see pending reward tokens on frontend. * @param relicId ID of the position. * @return pending reward amount for a given position owner. */ function pendingReward(uint relicId) public view override returns (uint pending) { PositionInfo storage position = positionForId[relicId]; uint poolId = position.poolId; PoolInfo storage pool = poolInfo[poolId]; uint accRewardPerShare = pool.accRewardPerShare; uint lpSupply = _poolBalance(position.poolId); uint lastRewardTime = pool.lastRewardTime; uint secondsSinceReward = block.timestamp - lastRewardTime; if (secondsSinceReward != 0 && lpSupply != 0) { uint reward = secondsSinceReward * _baseEmissionsPerSecond(lastRewardTime) * pool.allocPoint / totalAllocPoint; accRewardPerShare += reward * ACC_REWARD_PRECISION / lpSupply; } uint leveledAmount = position.amount * levels[poolId].multipliers[position.level]; pending = leveledAmount * accRewardPerShare / ACC_REWARD_PRECISION + position.rewardCredit - position.rewardDebt; } /** * @notice View function to see level of position if it were to be updated. * @param relicId ID of the position. * @return level Level for given position upon update. */ function levelOnUpdate(uint relicId) public view override returns (uint level) { PositionInfo storage position = positionForId[relicId]; LevelInfo storage levelInfo = levels[position.poolId]; uint length = levelInfo.requiredMaturities.length; if (length == 1) { return 0; } uint maturity = block.timestamp - position.entry; for (level = length - 1; true;) { if (maturity >= levelInfo.requiredMaturities[level]) { break; } unchecked { --level; } } } /// @notice Returns the number of Reliquary pools. function poolLength() public view override returns (uint pools) { pools = poolInfo.length; } /** * @notice Returns the ERC721 tokenURI given by the pool's NFTDescriptor. * @dev Can be gas expensive if used in a transaction and the NFTDescriptor is complex. * @param tokenId The NFT ID of the Relic to get the tokenURI for. */ function tokenURI(uint tokenId) public view override(ERC721) returns (string memory) { if (!_exists(tokenId)) revert NonExistentRelic(); return INFTDescriptor(nftDescriptor[positionForId[tokenId].poolId]).constructTokenURI(tokenId); } /// @dev Implement ERC165 to return which interfaces this contract conforms to function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, AccessControlEnumerable, ERC721, ERC721Enumerable) returns (bool) { return interfaceId == type(IReliquary).interfaceId || super.supportsInterface(interfaceId); } /// @dev Internal _updatePool function without nonReentrant modifier. function _updatePool(uint pid) internal returns (uint accRewardPerShare) { if (pid >= poolLength()) revert NonExistentPool(); PoolInfo storage pool = poolInfo[pid]; uint timestamp = block.timestamp; uint lastRewardTime = pool.lastRewardTime; uint secondsSinceReward = timestamp - lastRewardTime; accRewardPerShare = pool.accRewardPerShare; if (secondsSinceReward != 0) { uint lpSupply = _poolBalance(pid); if (lpSupply != 0) { uint reward = secondsSinceReward * _baseEmissionsPerSecond(lastRewardTime) * pool.allocPoint / totalAllocPoint; accRewardPerShare += reward * ACC_REWARD_PRECISION / lpSupply; pool.accRewardPerShare = accRewardPerShare; } pool.lastRewardTime = timestamp; emit ReliquaryEvents.LogUpdatePool(pid, timestamp, lpSupply, accRewardPerShare); } } /// @dev Internal deposit function that assumes relicId is valid. function _deposit(uint amount, uint relicId) internal { if (amount == 0) revert ZeroAmount(); (uint poolId,) = _updatePosition(amount, relicId, Kind.DEPOSIT, address(0)); IERC20(poolToken[poolId]).safeTransferFrom(msg.sender, address(this), amount); emit ReliquaryEvents.Deposit(poolId, amount, ownerOf(relicId), relicId); } struct LocalVariables_updatePosition { uint accRewardPerShare; uint oldAmount; uint newAmount; uint oldLevel; uint newLevel; bool harvest; } /** * @dev Internal function called whenever a position's state needs to be modified. * @param amount Amount of poolToken to deposit/withdraw. * @param relicId The NFT ID of the position being updated. * @param kind Indicates whether tokens are being added to, or removed from, a pool. * @param harvestTo Address to send rewards to (zero address if harvest should not be performed). * @return poolId Pool ID of the given position. * @return received Amount of reward token dispensed to `harvestTo` on harvest. */ function _updatePosition(uint amount, uint relicId, Kind kind, address harvestTo) internal returns (uint poolId, uint received) { LocalVariables_updatePosition memory vars; PositionInfo storage position = positionForId[relicId]; poolId = position.poolId; vars.accRewardPerShare = _updatePool(poolId); vars.oldAmount = position.amount; if (kind == Kind.DEPOSIT) { _updateEntry(amount, relicId); vars.newAmount = vars.oldAmount + amount; position.amount = vars.newAmount; } else if (kind == Kind.WITHDRAW) { if (amount != vars.oldAmount && !poolInfo[poolId].allowPartialWithdrawals) { revert PartialWithdrawalsDisabled(); } vars.newAmount = vars.oldAmount - amount; position.amount = vars.newAmount; } else { vars.newAmount = vars.oldAmount; } vars.oldLevel = position.level; vars.newLevel = _updateLevel(relicId, vars.oldLevel); if (vars.oldLevel != vars.newLevel) { levels[poolId].balance[vars.oldLevel] -= vars.oldAmount; levels[poolId].balance[vars.newLevel] += vars.newAmount; } else if (kind == Kind.DEPOSIT) { levels[poolId].balance[vars.oldLevel] += amount; } else if (kind == Kind.WITHDRAW) { levels[poolId].balance[vars.oldLevel] -= amount; } uint _pendingReward = vars.oldAmount * levels[poolId].multipliers[vars.oldLevel] * vars.accRewardPerShare / ACC_REWARD_PRECISION - position.rewardDebt; position.rewardDebt = vars.newAmount * levels[poolId].multipliers[vars.newLevel] * vars.accRewardPerShare / ACC_REWARD_PRECISION; vars.harvest = harvestTo != address(0); if (!vars.harvest && _pendingReward != 0) { position.rewardCredit += _pendingReward; } else if (vars.harvest) { uint total = _pendingReward + position.rewardCredit; received = _receivedReward(total); position.rewardCredit = total - received; if (received != 0) { IERC20(rewardToken).safeTransfer(harvestTo, received); } address _rewarder = rewarder[poolId]; if (_rewarder != address(0)) { IRewarder(_rewarder).onReward(relicId, received, harvestTo); } } if (kind == Kind.DEPOSIT) { address _rewarder = rewarder[poolId]; if (_rewarder != address(0)) { IRewarder(_rewarder).onDeposit(relicId, amount); } } else if (kind == Kind.WITHDRAW) { address _rewarder = rewarder[poolId]; if (_rewarder != address(0)) { IRewarder(_rewarder).onWithdraw(relicId, amount); } } } /** * @notice Updates the user's entry time based on the weight of their deposit or withdrawal. * @param amount The amount of the deposit / withdrawal. * @param relicId The NFT ID of the position being updated. */ function _updateEntry(uint amount, uint relicId) internal { PositionInfo storage position = positionForId[relicId]; uint amountBefore = position.amount; if (amountBefore == 0) { position.entry = block.timestamp; } else { uint weight = _findWeight(amount, amountBefore); uint entryBefore = position.entry; uint maturity = block.timestamp - entryBefore; position.entry = entryBefore + maturity * weight / 1e12; } } /** * @notice Updates the position's level based on entry time. * @param relicId The NFT ID of the position being updated. * @param oldLevel Level of position before update. * @return newLevel Level of position after update. */ function _updateLevel(uint relicId, uint oldLevel) internal returns (uint newLevel) { newLevel = levelOnUpdate(relicId); PositionInfo storage position = positionForId[relicId]; if (oldLevel != newLevel) { position.level = newLevel; emit ReliquaryEvents.LevelChanged(relicId, newLevel); } } /// @dev Ensure the behavior of ERC721Enumerable _beforeTokenTransfer is preserved. function _beforeTokenTransfer(address from, address to, uint tokenId, uint batchSize) internal override(ERC721, ERC721Enumerable) { ERC721Enumerable._beforeTokenTransfer(from, to, tokenId, batchSize); } /** * @notice Calculate how much the owner will actually receive on harvest, given available reward tokens. * @param _pendingReward Amount of reward token owed. * @return received The minimum between amount owed and amount available. */ function _receivedReward(uint _pendingReward) internal view returns (uint received) { uint available = IERC20(rewardToken).balanceOf(address(this)); received = (available > _pendingReward) ? _pendingReward : available; } /// @notice Gets the base emission rate from external, upgradable contract. function _baseEmissionsPerSecond(uint lastRewardTime) internal view returns (uint rate) { rate = IEmissionCurve(emissionCurve).getRate(lastRewardTime); if (rate > 6e18) revert MaxEmissionRateExceeded(); } /** * @notice returns The total deposits of the pool's token, weighted by maturity level allocation. * @param pid The index of the pool. See poolInfo. * @return total The amount of pool tokens held by the contract. */ function _poolBalance(uint pid) internal view returns (uint total) { LevelInfo storage levelInfo = levels[pid]; uint length = levelInfo.balance.length; for (uint i; i < length;) { total += levelInfo.balance[i] * levelInfo.multipliers[i]; unchecked { ++i; } } } /// @notice Require the sender is either the owner of the Relic or approved to transfer it. /// @param relicId The NFT ID of the Relic. function _requireApprovedOrOwner(uint relicId) internal view { if (!_isApprovedOrOwner(msg.sender, relicId)) revert NotApprovedOrOwner(); } /** * @notice Used in `_updateEntry` to find weights without any underflows or zero division problems. * @param addedValue New value being added. * @param oldValue Current amount of x. */ function _findWeight(uint addedValue, uint oldValue) internal pure returns (uint weightNew) { if (oldValue < addedValue) { weightNew = 1e12 - oldValue * 1e12 / (addedValue + oldValue); } else if (addedValue < oldValue) { weightNew = addedValue * 1e12 / (addedValue + oldValue); } else { weightNew = 5e11; } } /// @dev Handle updating balances for each affected tranche when shifting and merging. function _shiftLevelBalances(uint fromId, uint toId, uint poolId, uint amount, uint toAmount, uint newToAmount) private returns (uint fromLevel, uint oldToLevel, uint newToLevel) { fromLevel = positionForId[fromId].level; oldToLevel = positionForId[toId].level; newToLevel = _updateLevel(toId, oldToLevel); if (fromLevel != newToLevel) { levels[poolId].balance[fromLevel] -= amount; } if (oldToLevel != newToLevel) { levels[poolId].balance[oldToLevel] -= toAmount; } if (fromLevel != newToLevel && oldToLevel != newToLevel) { levels[poolId].balance[newToLevel] += newToAmount; } else if (fromLevel != newToLevel) { levels[poolId].balance[newToLevel] += amount; } else if (oldToLevel != newToLevel) { levels[poolId].balance[newToLevel] += toAmount; } } /// @dev Increments the ID nonce and mints a new Relic to `to`. function _mint(address to) private returns (uint id) { id = ++idNonce; _safeMint(to, id); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; library ReliquaryEvents { event CreateRelic(uint indexed pid, address indexed to, uint indexed relicId); event Deposit(uint indexed pid, uint amount, address indexed to, uint indexed relicId); event Withdraw(uint indexed pid, uint amount, address indexed to, uint indexed relicId); event EmergencyWithdraw(uint indexed pid, uint amount, address indexed to, uint indexed relicId); event Harvest(uint indexed pid, uint amount, address indexed to, uint indexed relicId); event LogPoolAddition( uint indexed pid, uint allocPoint, address indexed poolToken, address indexed rewarder, address nftDescriptor, bool allowPartialWithdrawals ); event LogPoolModified(uint indexed pid, uint allocPoint, address indexed rewarder, address nftDescriptor); event LogUpdatePool(uint indexed pid, uint lastRewardTime, uint lpSupply, uint accRewardPerShare); event LogSetEmissionCurve(address indexed emissionCurveAddress); event LevelChanged(uint indexed relicId, uint newLevel); event Split(uint indexed fromId, uint indexed toId, uint amount); event Shift(uint indexed fromId, uint indexed toId, uint amount); event Merge(uint indexed fromId, uint indexed toId, uint amount); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; import "openzeppelin-contracts/contracts/access/IAccessControlEnumerable.sol"; import "openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; /** * @notice Info for each Reliquary position. * `amount` LP token amount the position owner has provided. * `rewardDebt` Amount of reward token accumalated before the position's entry or last harvest. * `rewardCredit` Amount of reward token owed to the user on next harvest. * `entry` Used to determine the maturity of the position. * `poolId` ID of the pool to which this position belongs. * `level` Index of this position's level within the pool's array of levels. */ struct PositionInfo { uint amount; uint rewardDebt; uint rewardCredit; uint entry; // position owner's relative entry into the pool. uint poolId; // ensures that a single Relic is only used for one pool. uint level; } /** * @notice Info of each Reliquary pool. * `accRewardPerShare` Accumulated reward tokens per share of pool (1 / 1e12). * `lastRewardTime` Last timestamp the accumulated reward was updated. * `allocPoint` Pool's individual allocation - ratio of the total allocation. * `name` Name of pool to be displayed in NFT image. * `allowPartialWithdrawals` Whether users can withdraw less than their entire position. * A value of false will also disable shift and split functionality. */ struct PoolInfo { uint accRewardPerShare; uint lastRewardTime; uint allocPoint; string name; bool allowPartialWithdrawals; } /** * @notice Info for each level in a pool that determines how maturity is rewarded. * `requiredMaturities` The minimum maturity (in seconds) required to reach each Level. * `multipliers` Multiplier for each level applied to amount of incentivized token when calculating rewards in the pool. * This is applied to both the numerator and denominator in the calculation such that the size of a user's position * is effectively considered to be the actual number of tokens times the multiplier for their level. * Also note that these multipliers do not affect the overall emission rate. * `balance` Total (actual) number of tokens deposited in positions at each level. */ struct LevelInfo { uint[] requiredMaturities; uint[] multipliers; uint[] balance; } /** * @notice Object representing pending rewards and related data for a position. * `relicId` The NFT ID of the given position. * `poolId` ID of the pool to which this position belongs. * `pendingReward` pending reward amount for a given position. */ struct PendingReward { uint relicId; uint poolId; uint pendingReward; } interface IReliquary is IAccessControlEnumerable, IERC721Enumerable { function setEmissionCurve(address _emissionCurve) external; function addPool( uint allocPoint, address _poolToken, address _rewarder, uint[] calldata requiredMaturity, uint[] calldata levelMultipliers, string memory name, address _nftDescriptor, bool allowPartialWithdrawals ) external; function modifyPool( uint pid, uint allocPoint, address _rewarder, string calldata name, address _nftDescriptor, bool overwriteRewarder ) external; function massUpdatePools(uint[] calldata pids) external; function updatePool(uint pid) external; function deposit(uint amount, uint relicId) external; function withdraw(uint amount, uint relicId) external; function harvest(uint relicId, address harvestTo) external; function withdrawAndHarvest(uint amount, uint relicId, address harvestTo) external; function emergencyWithdraw(uint relicId) external; function updatePosition(uint relicId) external; function getPositionForId(uint) external view returns (PositionInfo memory); function getPoolInfo(uint) external view returns (PoolInfo memory); function getLevelInfo(uint) external view returns (LevelInfo memory); function pendingRewardsOfOwner(address owner) external view returns (PendingReward[] memory pendingRewards); function relicPositionsOfOwner(address owner) external view returns (uint[] memory relicIds, PositionInfo[] memory positionInfos); function isApprovedOrOwner(address, uint) external view returns (bool); function createRelicAndDeposit(address to, uint pid, uint amount) external returns (uint id); function split(uint relicId, uint amount, address to) external returns (uint newId); function shift(uint fromId, uint toId, uint amount) external; function merge(uint fromId, uint toId) external; function burn(uint tokenId) external; function pendingReward(uint relicId) external view returns (uint pending); function levelOnUpdate(uint relicId) external view returns (uint level); function poolLength() external view returns (uint); function rewardToken() external view returns (address); function nftDescriptor(uint) external view returns (address); function emissionCurve() external view returns (address); function poolToken(uint) external view returns (address); function rewarder(uint) external view returns (address); function totalAllocPoint() external view returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; interface IEmissionCurve { function getRate(uint lastRewardTime) external view returns (uint rate); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; interface IRewarder { function onReward(uint relicId, uint rewardAmount, address to) external; function onDeposit(uint relicId, uint depositAmount) external; function onWithdraw(uint relicId, uint withdrawalAmount) external; function pendingTokens(uint relicId, uint rewardAmount) external view returns (address[] memory, uint[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.15; interface INFTDescriptor { function constructTokenURI(uint relicId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _burn(tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev See {ERC721-_beforeTokenTransfer}. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual override { super._beforeTokenTransfer(from, to, firstTokenId, batchSize); if (batchSize > 1) { // Will only trigger during construction. Batch transferring (minting) is not available afterwards. revert("ERC721Enumerable: consecutive transfers not supported"); } uint256 tokenId = firstTokenId; if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol) pragma solidity ^0.8.0; import "./Address.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ abstract contract Multicall { /** * @dev Receives and executes a batch of function calls on this contract. */ function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.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 ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings 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. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: invalid token ID"); 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) { _requireMinted(tokenId); 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 overridden 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 = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); 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: caller is not token owner or 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: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @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 _ownerOf(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) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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, 1); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _balances[owner] -= 1; } delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId, 1); } /** * @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(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _balances[from] -= 1; _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {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 Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such * that `ownerOf(tokenId)` is `a`. */ // solhint-disable-next-line func-name-mixedcase function __unsafe_increaseBalance(address account, uint256 amount) internal { _balances[account] += amount; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * 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 AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (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 IERC721Receiver { /** * @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 `IERC721Receiver.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 "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
{ "remappings": [ "base64/=lib/base64/", "ds-test/=lib/solmate/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/vault-v2/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "oz-upgradeable/=lib/vault-v2/lib/openzeppelin-contracts-upgradeable/contracts/", "oz/=lib/vault-v2/lib/openzeppelin-contracts/contracts/", "solmate/=lib/solmate/src/", "v2-core/=lib/v2-core/contracts/", "vault-v2/=lib/vault-v2/src/" ], "optimizer": { "enabled": true, "runs": 100 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_emissionCurve","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"BurningPrincipal","type":"error"},{"inputs":[],"name":"BurningRewards","type":"error"},{"inputs":[],"name":"DuplicateRelicIds","type":"error"},{"inputs":[],"name":"EmptyArray","type":"error"},{"inputs":[],"name":"MaxEmissionRateExceeded","type":"error"},{"inputs":[],"name":"MergingEmptyRelics","type":"error"},{"inputs":[],"name":"NonExistentPool","type":"error"},{"inputs":[],"name":"NonExistentRelic","type":"error"},{"inputs":[],"name":"NonZeroFirstMaturity","type":"error"},{"inputs":[],"name":"NotApprovedOrOwner","type":"error"},{"inputs":[],"name":"NotOwner","type":"error"},{"inputs":[],"name":"PartialWithdrawalsDisabled","type":"error"},{"inputs":[],"name":"RelicsNotOfSamePool","type":"error"},{"inputs":[],"name":"RewardTokenAsPoolToken","type":"error"},{"inputs":[],"name":"UnsortedMaturityLevels","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"ZeroTotalAllocPoint","type":"error"},{"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":"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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EMISSION_CURVE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"address","name":"_poolToken","type":"address"},{"internalType":"address","name":"_rewarder","type":"address"},{"internalType":"uint256[]","name":"requiredMaturities","type":"uint256[]"},{"internalType":"uint256[]","name":"levelMultipliers","type":"uint256[]"},{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"_nftDescriptor","type":"address"},{"internalType":"bool","name":"allowPartialWithdrawals","type":"bool"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"createRelicAndDeposit","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emissionCurve","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"uint256","name":"pid","type":"uint256"}],"name":"getLevelInfo","outputs":[{"components":[{"internalType":"uint256[]","name":"requiredMaturities","type":"uint256[]"},{"internalType":"uint256[]","name":"multipliers","type":"uint256[]"},{"internalType":"uint256[]","name":"balance","type":"uint256[]"}],"internalType":"struct LevelInfo","name":"levelInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"getPoolInfo","outputs":[{"components":[{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"bool","name":"allowPartialWithdrawals","type":"bool"}],"internalType":"struct PoolInfo","name":"pool","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"getPositionForId","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"rewardCredit","type":"uint256"},{"internalType":"uint256","name":"entry","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"level","type":"uint256"}],"internalType":"struct PositionInfo","name":"position","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","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":[{"internalType":"uint256","name":"relicId","type":"uint256"},{"internalType":"address","name":"harvestTo","type":"address"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"isApprovedOrOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"levelOnUpdate","outputs":[{"internalType":"uint256","name":"level","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pids","type":"uint256[]"}],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromId","type":"uint256"},{"internalType":"uint256","name":"toId","type":"uint256"}],"name":"merge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"address","name":"_rewarder","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"_nftDescriptor","type":"address"},{"internalType":"bool","name":"overwriteRewarder","type":"bool"}],"name":"modifyPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftDescriptor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"pending","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"pendingRewardsOfOwner","outputs":[{"components":[{"internalType":"uint256","name":"relicId","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"pendingReward","type":"uint256"}],"internalType":"struct PendingReward[]","name":"pendingRewards","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"pools","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"relicPositionsOfOwner","outputs":[{"internalType":"uint256[]","name":"relicIds","type":"uint256[]"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"rewardCredit","type":"uint256"},{"internalType":"uint256","name":"entry","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"level","type":"uint256"}],"internalType":"struct PositionInfo[]","name":"positionInfos","type":"tuple[]"}],"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":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_emissionCurve","type":"address"}],"name":"setEmissionCurve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromId","type":"uint256"},{"internalType":"uint256","name":"toId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"shift","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"split","outputs":[{"internalType":"uint256","name":"newId","type":"uint256"}],"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":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint256","name":"pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"updatePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"relicId","type":"uint256"},{"internalType":"address","name":"harvestTo","type":"address"}],"name":"withdrawAndHarvest","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b506040516200635b3803806200635b8339810160408190526200003491620002d3565b81816000620000448382620003f1565b506001620000538282620003f1565b50506001600c55506001600160a01b03848116608052600f80546001600160a01b0319169185169190911790556200008d60003362000097565b50505050620004bd565b620000ae8282620000da60201b62002e051760201c565b6000828152600b60209081526040909120620000d591839062002e8b6200017f821b17901c565b505050565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff166200017b576000828152600a602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200013a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000196836001600160a01b0384166200019f565b90505b92915050565b6000818152600183016020526040812054620001e85750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000199565b50600062000199565b80516001600160a01b03811681146200020957600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023657600080fd5b81516001600160401b03808211156200025357620002536200020e565b604051601f8301601f19908116603f011681019082821181831017156200027e576200027e6200020e565b816040528381526020925086838588010111156200029b57600080fd5b600091505b83821015620002bf5785820183015181830184015290820190620002a0565b600093810190920192909252949350505050565b60008060008060808587031215620002ea57600080fd5b620002f585620001f1565b93506200030560208601620001f1565b60408601519093506001600160401b03808211156200032357600080fd5b620003318883890162000224565b935060608701519150808211156200034857600080fd5b50620003578782880162000224565b91505092959194509250565b600181811c908216806200037857607f821691505b6020821081036200039957634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620000d557600081815260208120601f850160051c81016020861015620003c85750805b601f850160051c820191505b81811015620003e957828155600101620003d4565b505050505050565b81516001600160401b038111156200040d576200040d6200020e565b62000425816200041e845462000363565b846200039f565b602080601f8311600181146200045d5760008415620004445750858301515b600019600386901b1c1916600185901b178555620003e9565b600085815260208120601f198616915b828110156200048e578886015182559484019460019091019084016200046d565b5085821015620004ad5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051615e6d620004ee600039600081816107df0152818161182701528181613435015261418c0152615e6d6000f3fe608060405234801561001057600080fd5b506004361061030e5760003560e01c80636e7d40191161019e578063ac9650d8116100ef578063d14d0a1a1161009d578063d14d0a1a1461073a578063d1abb9071461075b578063d1c2babb1461076e578063d547741f14610781578063e2bbb15814610794578063e48dc135146107a7578063e985e9c5146107c7578063f7c618c1146107da57600080fd5b8063ac9650d81461069b578063b88d4fde146106bb578063b9be8cd5146106ce578063bd75fd6c146106e1578063c346253d14610701578063c87b56dd14610714578063ca15c8731461072757600080fd5b806391d148541161014c57806391d148541461061857806395d89b411461062b578063983d2737146106335780639a67759b1461065a578063a217fddf1461066d578063a22cb46514610675578063a6443e1e1461068857600080fd5b80636e7d4019146105935780636ecbae3f146105a657806370a08231146105b95780637747dd81146105cc578063778b9a07146105df5780638d74c2bf146105f25780639010d07c1461060557600080fd5b80632f2ff15d11610263578063430c208111610211578063430c2081146104fb578063441a3e701461050e5780634f6ccce71461052157806351eb05a6146105345780635312ea8e1461054757806357a5b58c1461055a5780636352211e1461056d5780636705fcf31461058057600080fd5b80632f2ff15d146104555780632f380b35146104685780632f745c59146104885780633427a44e1461049b57806336568abe146104c257806342842e0e146104d557806342966c68146104e857600080fd5b806312f7086c116102c057806312f7086c146103d557806317caf6f1146103e857806318160ddd146103f157806318fccc76146103f9578063215e83eb1461040c57806323b872dd1461041f578063248a9ca31461043257600080fd5b806301ffc9a714610313578063030101db1461033b57806306fdde031461035b578063081812fc14610370578063081e3eda1461039b578063095ea7b3146103ad57806309f1c80a146103c2575b600080fd5b610326610321366004614f7e565b610801565b60405190151581526020015b60405180910390f35b61034e610349366004614f9b565b61082c565b6040516103329190614fef565b61036361098b565b60405161033291906150a0565b61038361037e366004614f9b565b610a1d565b6040516001600160a01b039091168152602001610332565b6010545b604051908152602001610332565b6103c06103bb3660046150ca565b610a44565b005b6103c06103d0366004614f9b565b610b5e565b61039f6103e3366004614f9b565b610baa565b61039f60155481565b60085461039f565b6103c06104073660046150f4565b610d1f565b61038361041a366004614f9b565b610d9a565b6103c061042d366004615120565b610dc4565b61039f610440366004614f9b565b6000908152600a602052604090206001015490565b6103c06104633660046150f4565b610df6565b61047b610476366004614f9b565b610e1b565b604051610332919061515c565b61039f6104963660046150ca565b610f42565b61039f7ff0df1ecf66245243e1fe66eca783e2b1f173c34d37828b8788a74623e9a73e0281565b6103c06104d03660046150f4565b610fd8565b6103c06104e3366004615120565b611052565b6103c06104f6366004614f9b565b61106d565b6103266105093660046150ca565b6110ca565b6103c061051c3660046151ae565b6110dd565b61039f61052f366004614f9b565b6111a6565b6103c0610542366004614f9b565b611239565b6103c0610555366004614f9b565b611255565b6103c061056836600461521b565b6113ae565b61038361057b366004614f9b565b6113f6565b61039f61058e36600461525c565b61142b565b6103836105a1366004614f9b565b6114c5565b6103c06105b436600461528f565b6114d5565b61039f6105c736600461528f565b61154a565b61039f6105da3660046152aa565b6115d0565b6103c06105ed3660046153c3565b61181a565b6103c06106003660046154a2565b611ce8565b6103836106133660046151ae565b611f03565b6103266106263660046150f4565b611f1b565b610363611f46565b61039f7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c81565b600f54610383906001600160a01b031681565b61039f600081565b6103c0610683366004615559565b611f55565b61039f610696366004614f9b565b611f60565b6106ae6106a936600461521b565b61200f565b6040516103329190615590565b6103c06106c93660046155f2565b612103565b6103c06106dc36600461566d565b61213b565b6106f46106ef36600461528f565b6125b9565b6040516103329190615699565b61038361070f366004614f9b565b6126b7565b610363610722366004614f9b565b6126c7565b61039f610735366004614f9b565b612790565b61074d61074836600461528f565b6127a7565b60405161033292919061572c565b6103c06107693660046152aa565b612921565b6103c061077c3660046151ae565b612a15565b6103c061078f3660046150f4565b612d2c565b6103c06107a23660046151ae565b612d51565b6107ba6107b5366004614f9b565b612d76565b60405161033291906157b1565b6103266107d53660046157bf565b612dd7565b6103837f000000000000000000000000000000000000000000000000000000000000000081565b60006001600160e01b03198216630c39233960e21b1480610826575061082682612ea0565b92915050565b61085060405180606001604052806060815260200160608152602001606081525090565b60118281548110610863576108636157e9565b9060005260206000209060030201604051806060016040529081600082018054806020026020016040519081016040528092919081815260200182805480156108cb57602002820191906000526020600020905b8154815260200190600101908083116108b7575b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561092357602002820191906000526020600020905b81548152602001906001019080831161090f575b505050505081526020016002820180548060200260200160405190810160405280929190818152602001828054801561097b57602002820191906000526020600020905b815481526020019060010190808311610967575b5050505050815250509050919050565b60606000805461099a906157ff565b80601f01602080910402602001604051908101604052809291908181526020018280546109c6906157ff565b8015610a135780601f106109e857610100808354040283529160200191610a13565b820191906000526020600020905b8154815290600101906020018083116109f657829003601f168201915b5050505050905090565b6000610a2882612ec5565b506000908152600460205260409020546001600160a01b031690565b6000610a4f826113f6565b9050806001600160a01b0316836001600160a01b031603610ac15760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610add5750610add8133612dd7565b610b4f5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610ab8565b610b598383612eea565b505050565b610b66612f58565b610b6f81612fb1565b610b8c57604051631d1286b560e31b815260040160405180910390fd5b610b9b60008260026000612fce565b5050610ba76001600c55565b50565b600081815260146020526040812060048101546010805484919083908110610bd457610bd46157e9565b906000526020600020906005020190506000816000015490506000610bfc8560040154613669565b60018401549091506000610c10824261584f565b90508015801590610c2057508215155b15610c805760006015548660020154610c3885613707565b610c429085615862565b610c4c9190615862565b610c569190615879565b905083610c6864e8d4a5100083615862565b610c729190615879565b610c7c908661589b565b9450505b600060118781548110610c9557610c956157e9565b9060005260206000209060030201600101886005015481548110610cbb57610cbb6157e9565b90600052602060002001548860000154610cd59190615862565b90508760010154886002015464e8d4a510008784610cf39190615862565b610cfd9190615879565b610d07919061589b565b610d11919061584f565b9a9950505050505050505050565b610d27612f58565b610d30826137a5565b600080610d41600085600286612fce565b9150915083836001600160a01b0316837f614253edaf5943287293d855afffbb1f5f0403c51c84143aceaf27a50727b2fc84604051610d8291815260200190565b60405180910390a45050610d966001600c55565b5050565b600e8181548110610daa57600080fd5b6000918252602090912001546001600160a01b0316905081565b610dcf335b826137cc565b610deb5760405162461bcd60e51b8152600401610ab8906158ae565b610b5983838361382b565b6000828152600a6020526040902060010154610e118161398a565b610b598383613994565b610e4f6040518060a00160405280600081526020016000815260200160008152602001606081526020016000151581525090565b60108281548110610e6257610e626157e9565b90600052602060002090600502016040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382018054610ea9906157ff565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed5906157ff565b8015610f225780601f10610ef757610100808354040283529160200191610f22565b820191906000526020600020905b815481529060010190602001808311610f0557829003601f168201915b50505091835250506004919091015460ff16151560209091015292915050565b6000610f4d8361154a565b8210610faf5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610ab8565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6001600160a01b03811633146110485760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ab8565b610d9682826139b6565b610b5983838360405180602001604052806000815250612103565b6000818152601460205260409020541561109a5760405163f25a119760e01b815260040160405180910390fd5b6110a381610baa565b156110c15760405163faaea8f160e01b815260040160405180910390fd5b610ba7816139d8565b60006110d683836137cc565b9392505050565b6110e5612f58565b8160000361110657604051631f2a200560e01b815260040160405180910390fd5b61110f816137a5565b600061111f838360016000612fce565b50905061115633846012848154811061113a5761113a6157e9565b6000918252602090912001546001600160a01b03169190613a06565b81336001600160a01b0316827f191a58d19a6a9b76e2e91bdc04ecbe7553dc094a5ad7af78175a0d9f884e264a8660405161119391815260200190565b60405180910390a450610d966001600c55565b60006111b160085490565b82106112145760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610ab8565b60088281548110611227576112276157e9565b90600052602060002001549050919050565b611241612f58565b61124a81613a69565b50610ba76001600c55565b61125d612f58565b6000611268826113f6565b90506001600160a01b0381163314611293576040516330cd747160e01b815260040160405180910390fd5b60008281526014602052604090208054600482015460118054839190839081106112bf576112bf6157e9565b90600052602060002090600302016002018460050154815481106112e5576112e56157e9565b9060005260206000200160008282546112fe919061584f565b9091555061130d905085613b9d565b600085815260146020526040812081815560018101829055600281018290556003810182905560048101829055600501556012805461135b9186918591908590811061113a5761113a6157e9565b84846001600160a01b0316827f6aaee64d11e8979fa392cd6388058c820f43709933f6a297e6e1005dddca62d68560405161139891815260200190565b60405180910390a450505050610ba76001600c55565b6113b6612f58565b60005b818110156113eb576113e28383838181106113d6576113d66157e9565b90506020020135613a69565b506001016113b9565b50610d966001600c55565b6000818152600260205260408120546001600160a01b0316806108265760405162461bcd60e51b8152600401610ab8906158fb565b6000611435612f58565b60105483106114575760405163904e0f5960e01b815260040160405180910390fd5b61146084613c2e565b6000818152601460205260409020600481018590559091506114828383613c50565b81856001600160a01b0316857fb1ef6f1c5fca9fc83b81f6c18e6269a7942f041cadd830c353bb90f8680a3d4d60405160405180910390a4506110d66001600c55565b60128181548110610daa57600080fd5b7ff0df1ecf66245243e1fe66eca783e2b1f173c34d37828b8788a74623e9a73e026114ff8161398a565b600f80546001600160a01b0319166001600160a01b0384169081179091556040517f097cb0b4d8d03c9f5f6d24fdb4d1c0764243aab030e9e385b0295badfe7a73e290600090a25050565b60006001600160a01b0382166115b45760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610ab8565b506001600160a01b031660009081526003602052604090205490565b60006115da612f58565b826000036115fb57604051631f2a200560e01b815260040160405180910390fd5b611604846137a5565b60008481526014602052604090206004810154601080548290811061162b5761162b6157e9565b600091825260209091206004600590920201015460ff1661165f57604051635ea3f5c160e01b815260040160405180910390fd5b8154600061166d878361584f565b808555905061167b86613c2e565b6000818152601460205260408120898155600380880154908201556005808801549082018190556004820187905560118054949950919390929190879081106116c6576116c66157e9565b906000526020600020906003020160010182815481106116e8576116e86157e9565b90600052602060002001546116fc87613a69565b6117069190615862565b90506000876001015464e8d4a5100083886117219190615862565b61172b9190615879565b611735919061584f565b905080156117575780886002016000828254611751919061589b565b90915550505b64e8d4a510006117678387615862565b6117719190615879565b600189015564e8d4a51000611786838d615862565b6117909190615879565b600185015560405189906001600160a01b038c169089907fb1ef6f1c5fca9fc83b81f6c18e6269a7942f041cadd830c353bb90f8680a3d4d90600090a4888c7fcf0974dfd867840133a0d4b02f1672f24017796fb8892d1e0d587692e4da90ab8d60405161180091815260200190565b60405180910390a350505050505050506110d66001600c55565b60006118258161398a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168a6001600160a01b0316036118775760405163c982c8c360e01b815260040160405180910390fd5b60008790036118995760405163521299a960e01b815260040160405180910390fd5b8685146118b95760405163512509d360e11b815260040160405180910390fd5b878760008181106118cc576118cc6157e9565b905060200201356000146118f3576040516369afe63f60e11b815260040160405180910390fd5b600187111561196957600060015b8881101561196657818a8a8381811061191c5761191c6157e9565b9050602002013511611941576040516367c462f760e01b815260040160405180910390fd5b898982818110611953576119536157e9565b6020029190910135925050600101611901565b50505b60005b6010548110156119885761197f81613a69565b5060010161196c565b5060008b601554611999919061589b565b9050806000036119bc57604051632ae6f6af60e11b815260040160405180910390fd5b8060158190555060128b9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555060138a9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600e849080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555060106040518060a00160405280600081526020014281526020018e815260200187815260200185151581525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003019081611b269190615990565b50608091820151600491909101805460ff19169115159190911790556040805160208b028082018401909252606081018b8152601193919283928e918e918291908601908490808284376000920191909152505050908252506040805160208b810282810182019093528b82529283019290918c918c918291850190849080828437600092019190915250505090825250602001886001600160401b03811115611bd257611bd26152df565b604051908082528060200260200182016040528015611bfb578160200160208202803683370190505b50905281546001810183556000928352602092839020825180519394600390930290910192611c2d9284920190614ed2565b506020828101518051611c469260018501920190614ed2565b5060408201518051611c62916002840191602090910190614ed2565b50506012546001600160a01b03808d1692508d1690611c839060019061584f565b7f1af8063b2ec9698905896368410dddf34d4ef5f8fb21ddd995a7b43f69ae10678f8888604051611cd2939291909283526001600160a01b039190911660208301521515604082015260600190565b60405180910390a4505050505050505050505050565b7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c611d128161398a565b6010548810611d345760405163904e0f5960e01b815260040160405180910390fd5b6000611d3f60105490565b905060005b81811015611d5e57611d5581613a69565b50600101611d44565b50600060108a81548110611d7457611d746157e9565b90600052602060002090600502019050600081600201548a601554611d99919061589b565b611da3919061584f565b905080600003611dc657604051632ae6f6af60e11b815260040160405180910390fd5b6015819055600282018a90558415611e1b578860138c81548110611dec57611dec6157e9565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60038201611e2a888a83615a49565b5085600e8c81548110611e3f57611e3f6157e9565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555084611e9f5760138b81548110611e8557611e856157e9565b6000918252602090912001546001600160a01b0316611ea1565b885b6001600160a01b03168b7ffa4328c2a1268b2b661914d91df191c5271c699ddc97ccedda086c6d25b099f98c89604051611eee9291909182526001600160a01b0316602082015260400190565b60405180910390a35050505050505050505050565b6000828152600b602052604081206110d69083613d0b565b6000918252600a602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606001805461099a906157ff565b610d96338383613d17565b60008181526014602052604081206004810154601180548492908110611f8857611f886157e9565b6000918252602090912060039091020180549091506001819003611fb157506000949350505050565b6000836003015442611fc3919061584f565b9050611fd060018361584f565b94505b826000018581548110611fe857611fe86157e9565b90600052602060002001548110156120065760001990940193611fd3565b50505050919050565b6060816001600160401b03811115612029576120296152df565b60405190808252806020026020018201604052801561205c57816020015b60608152602001906001900390816120475790505b50905060005b828110156120fc576120cc30858584818110612080576120806157e9565b90506020028101906120929190615b02565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613de192505050565b8282815181106120de576120de6157e9565b602002602001018190525080806120f490615b48565b915050612062565b5092915050565b61210d33836137cc565b6121295760405162461bcd60e51b8152600401610ab8906158ae565b61213584848484613e06565b50505050565b612143612f58565b8060000361216457604051631f2a200560e01b815260040160405180910390fd5b81830361218457604051634cce529560e11b815260040160405180910390fd5b61218d836137a5565b612196826137a5565b6121fa6040518061018001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b600084815260146020908152604090912060048101549183018290526010805491929091811061222c5761222c6157e9565b600091825260209091206004600590920201015460ff1661226057604051635ea3f5c160e01b815260040160405180910390fd5b600084815260146020908152604090912060048101549184015190911461229a57604051634f13191b60e01b815260040160405180910390fd5b81548084528154604085018190526122b19161589b565b816003015484604001516122c59190615862565b600384015485516122d69190615862565b6122e0919061589b565b6122ea9190615879565b600382015582516122fc90859061584f565b606084018190528255604083015161231590859061589b565b608084018190528082556020840151604085015161233b92899289929091899190613e39565b60e086015260c085015260a0840152602083015161235890613a69565b6101008401526020830151601180549091908110612378576123786157e9565b90600052602060002090600302016001018360a001518154811061239e5761239e6157e9565b90600052602060002001548361010001516123b99190615862565b610120840181905260018301548451909164e8d4a51000916123db9190615862565b6123e59190615879565b6123ef919061584f565b61014084018190521561241b57826101400151826002016000828254612415919061589b565b90915550505b806001015464e8d4a510008461010001516011866020015181548110612443576124436157e9565b90600052602060002090600302016001018660c0015181548110612469576124696157e9565b906000526020600020015486604001516124839190615862565b61248d9190615862565b6124979190615879565b6124a1919061584f565b6101608401819052156124cd578261016001518160020160008282546124c7919061589b565b90915550505b64e8d4a5100083610120015184606001516124e89190615862565b6124f29190615879565b600183015560208301516011805464e8d4a5100092908110612516576125166157e9565b90600052602060002090600302016001018460e001518154811061253c5761253c6157e9565b9060005260206000200154846101000151856080015161255c9190615862565b6125669190615862565b6125709190615879565b6001820155604051848152859087907fda2a03409498a5fe8db3da030754afa618bc2228c0517ec5fa8c9b052979e9ea9060200160405180910390a3505050610b596001600c55565b606060006125c68361154a565b9050806001600160401b038111156125e0576125e06152df565b60405190808252806020026020018201604052801561263557816020015b61262260405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816125fe5790505b50915060005b818110156126b057600061264f8583610f42565b905060405180606001604052808281526020016014600084815260200190815260200160002060040154815260200161268783610baa565b81525084838151811061269c5761269c6157e9565b60209081029190910101525060010161263b565b5050919050565b60138181548110610daa57600080fd5b60606126d282612fb1565b6126ef57604051631d1286b560e31b815260040160405180910390fd5b600082815260146020526040902060040154600e80549091908110612716576127166157e9565b6000918252602090912001546040516344a5a61760e11b8152600481018490526001600160a01b039091169063894b4c2e90602401600060405180830381865afa158015612768573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108269190810190615b61565b6000818152600b602052604081206108269061400e565b60608060006127b58461154a565b9050806001600160401b038111156127cf576127cf6152df565b6040519080825280602002602001820160405280156127f8578160200160208202803683370190505b509250806001600160401b03811115612813576128136152df565b60405190808252806020026020018201604052801561284c57816020015b612839614f1d565b8152602001906001900390816128315790505b50915060005b8181101561291a576128648582610f42565b848281518110612876576128766157e9565b60200260200101818152505060146000858381518110612898576128986157e9565b602002602001015181526020019081526020016000206040518060c00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481525050838281518110612907576129076157e9565b6020908102919091010152600101612852565b5050915091565b612929612f58565b8260000361294a57604051631f2a200560e01b815260040160405180910390fd5b612953826137a5565b6000806129638585600186612fce565b9150915061297f33866012858154811061113a5761113a6157e9565b83336001600160a01b0316837f191a58d19a6a9b76e2e91bdc04ecbe7553dc094a5ad7af78175a0d9f884e264a886040516129bc91815260200190565b60405180910390a483836001600160a01b0316837f614253edaf5943287293d855afffbb1f5f0403c51c84143aceaf27a50727b2fc84604051612a0191815260200190565b60405180910390a45050610b596001600c55565b612a1d612f58565b808203612a3d57604051634cce529560e11b815260040160405180910390fd5b612a46826137a5565b612a4f816137a5565b6000828152601460205260408082208054600480830154868652939094209384015491939092918214612a9557604051634f13191b60e01b815260040160405180910390fd5b80546000612aa3858361589b565b905080600003612ac657604051636677a12d60e11b815260040160405180910390fd5b80836003015483612ad79190615862565b6003880154612ae69088615862565b612af0919061589b565b612afa9190615879565b600384015580835560008080612b148b8b898b8989613e39565b9250925092506000612b2588613a69565b9050600087600101548b600101548c6002015464e8d4a5100060118d81548110612b5157612b516157e9565b90600052602060002090600302016001018881548110612b7357612b736157e9565b90600052602060002001548b612b899190615862565b60118e81548110612b9c57612b9c6157e9565b90600052602060002090600302016001018a81548110612bbe57612bbe6157e9565b90600052602060002001548f612bd49190615862565b612bde919061589b565b612be89087615862565b612bf29190615879565b612bfc919061589b565b612c06919061584f565b612c10919061584f565b90508015612c325780886002016000828254612c2c919061589b565b90915550505b64e8d4a5100060118a81548110612c4b57612c4b6157e9565b90600052602060002090600302016001018481548110612c6d57612c6d6157e9565b90600052602060002001548388612c849190615862565b612c8e9190615862565b612c989190615879565b6001890155612ca68d613b9d565b60008d8152601460205260408082208281556001810183905560028101839055600381018390556004810183905560050191909155518c908e907f285dbc28e663286c77e3cd79d1cf1525744b4dfe015f41295fe5ae2858880bdf90612d0f908e815260200190565b60405180910390a35050505050505050505050610d966001600c55565b6000828152600a6020526040902060010154612d478161398a565b610b5983836139b6565b612d59612f58565b612d62816137a5565b612d6c8282613c50565b610d966001600c55565b612d7e614f1d565b50600090815260146020908152604091829020825160c08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b612e0f8282611f1b565b610d96576000828152600a602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612e473390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006110d6836001600160a01b038416614018565b60006001600160e01b03198216635a05180f60e01b1480610826575061082682614067565b612ece81612fb1565b610ba75760405162461bcd60e51b8152600401610ab8906158fb565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612f1f826113f6565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6002600c5403612faa5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ab8565b6002600c55565b6000908152600260205260409020546001600160a01b0316151590565b60008061300c6040518060c0016040528060008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b60008681526014602052604090206004810154935061302a84613a69565b825280546020830152600086600281111561304757613047615bce565b0361307457613056888861408c565b878260200151613066919061589b565b604083018190528155613101565b600186600281111561308857613088615bce565b036130f657816020015188141580156130c85750601084815481106130af576130af6157e9565b600091825260209091206004600590920201015460ff16155b156130e657604051635ea3f5c160e01b815260040160405180910390fd5b878260200151613066919061584f565b602082015160408301525b600581015460608301819052613118908890614104565b608083018190526060830151146131e857816020015160118581548110613141576131416157e9565b9060005260206000209060030201600201836060015181548110613167576131676157e9565b906000526020600020016000828254613180919061584f565b90915550506040820151601180548690811061319e5761319e6157e9565b90600052602060002090600302016002018360800151815481106131c4576131c46157e9565b9060005260206000200160008282546131dd919061589b565b909155506132ad9050565b60008660028111156131fc576131fc615bce565b0361323b578760118581548110613215576132156157e9565b90600052602060002090600302016002018360600151815481106131c4576131c46157e9565b600186600281111561324f5761324f615bce565b036132ad578760118581548110613268576132686157e9565b906000526020600020906003020160020183606001518154811061328e5761328e6157e9565b9060005260206000200160008282546132a7919061584f565b90915550505b6000816001015464e8d4a510008460000151601188815481106132d2576132d26157e9565b90600052602060002090600302016001018660600151815481106132f8576132f86157e9565b906000526020600020015486602001516133129190615862565b61331c9190615862565b6133269190615879565b613330919061584f565b905064e8d4a51000836000015160118781548110613350576133506157e9565b9060005260206000209060030201600101856080015181548110613376576133766157e9565b906000526020600020015485604001516133909190615862565b61339a9190615862565b6133a49190615879565b60018301556001600160a01b03861615801560a085018190526133c657508015155b156133ea57808260020160008282546133df919061589b565b909155506134fb9050565b8260a00151156134fb576000826002015482613406919061589b565b90506134118161416a565b945061341d858261584f565b6002840155841561345c5761345c6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168887613a06565b600060138781548110613471576134716157e9565b6000918252602090912001546001600160a01b0316905080156134f85760405163014a362160e71b8152600481018b9052602481018790526001600160a01b03898116604483015282169063a51b108090606401600060405180830381600087803b1580156134df57600080fd5b505af11580156134f3573d6000803e3d6000fd5b505050505b50505b600087600281111561350f5761350f615bce565b036135ae57600060138681548110613529576135296157e9565b6000918252602090912001546001600160a01b0316905080156135a8576040516303004b4760e01b8152600481018a9052602481018b90526001600160a01b038216906303004b4790604401600060405180830381600087803b15801561358f57600080fd5b505af11580156135a3573d6000803e3d6000fd5b505050505b5061365d565b60018760028111156135c2576135c2615bce565b0361365d576000601386815481106135dc576135dc6157e9565b6000918252602090912001546001600160a01b03169050801561365b576040516305f7936f60e51b8152600481018a9052602481018b90526001600160a01b0382169063bef26de090604401600060405180830381600087803b15801561364257600080fd5b505af1158015613656573d6000803e3d6000fd5b505050505b505b50505094509492505050565b6000806011838154811061367f5761367f6157e9565b600091825260208220600260039092020190810154909250905b818110156136ff578260010181815481106136b6576136b66157e9565b90600052602060002001548360020182815481106136d6576136d66157e9565b90600052602060002001546136eb9190615862565b6136f5908561589b565b9350600101613699565b505050919050565b600f546040516315dd902560e21b8152600481018390526000916001600160a01b031690635776409490602401602060405180830381865afa158015613751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137759190615be4565b90506753444835ec5800008111156137a057604051632dfc35e960e21b815260040160405180910390fd5b919050565b6137af33826137cc565b610ba75760405163390cdd9b60e21b815260040160405180910390fd5b6000806137d8836113f6565b9050806001600160a01b0316846001600160a01b031614806137ff57506137ff8185612dd7565b806138235750836001600160a01b031661381884610a1d565b6001600160a01b0316145b949350505050565b826001600160a01b031661383e826113f6565b6001600160a01b0316146138645760405162461bcd60e51b8152600401610ab890615bfd565b6001600160a01b0382166138c65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610ab8565b6138d3838383600161420d565b826001600160a01b03166138e6826113f6565b6001600160a01b03161461390c5760405162461bcd60e51b8152600401610ab890615bfd565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080546000190190559087168086528386208054600101905586865260029094528285208054909216841790915590518493600080516020615e1883398151915291a4505050565b610ba78133614219565b61399e8282612e05565b6000828152600b60205260409020610b599082612e8b565b6139c08282614272565b6000828152600b60205260409020610b5990826142d9565b6139e133610dc9565b6139fd5760405162461bcd60e51b8152600401610ab8906158ae565b610ba781613b9d565b6040516001600160a01b038316602482015260448101829052610b5990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526142ee565b6000613a7460105490565b8210613a935760405163904e0f5960e01b815260040160405180910390fd5b600060108381548110613aa857613aa86157e9565b6000918252602082206001600590920201908101549092504291613acc828461584f565b8454955090508015612006576000613ae387613669565b90508015613b495760006015548660020154613afe86613707565b613b089086615862565b613b129190615862565b613b1c9190615879565b905081613b2e64e8d4a5100083615862565b613b389190615879565b613b42908861589b565b8087559650505b60018501849055604080518581526020810183905290810187905287907fcb7325664a4a3b7c7223eefc492a97ca4fdf94d46884621e5a8fae5a04b2b9d29060600160405180910390a25050505050919050565b6000613ba8826113f6565b9050613bb881600084600161420d565b613bc1826113f6565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038516808552600384528285208054600019019055878552600290935281842080549091169055519293508492600080516020615e18833981519152908390a45050565b6000600d60008154613c3f90615b48565b918290555090506137a082826143c0565b81600003613c7157604051631f2a200560e01b815260040160405180910390fd5b6000613c808383600080612fce565b509050613cb933308560128581548110613c9c57613c9c6157e9565b6000918252602090912001546001600160a01b03169291906143da565b81613cc3836113f6565b6001600160a01b0316827f9a2a1e97e6d641080089aafc36750cfdef4c79f8b3ace6fa4c384fa2f047695986604051613cfe91815260200190565b60405180910390a4505050565b60006110d68383614412565b816001600160a01b0316836001600160a01b031603613d745760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610ab8565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60606110d68383604051806060016040528060278152602001615df16027913961443c565b613e1184848461382b565b613e1d848484846144b4565b6121355760405162461bcd60e51b8152600401610ab890615c42565b60008681526014602052604080822060059081015488845291832001549091613e628883614104565b9050808314613ec0578560118881548110613e7f57613e7f6157e9565b90600052602060002090600302016002018481548110613ea157613ea16157e9565b906000526020600020016000828254613eba919061584f565b90915550505b808214613f1c578460118881548110613edb57613edb6157e9565b90600052602060002090600302016002018381548110613efd57613efd6157e9565b906000526020600020016000828254613f16919061584f565b90915550505b808314158015613f2c5750808214155b15613f8b578360118881548110613f4557613f456157e9565b90600052602060002090600302016002018281548110613f6757613f676157e9565b906000526020600020016000828254613f80919061589b565b909155506140029050565b808314613fa6578560118881548110613f4557613f456157e9565b808214614002578460118881548110613fc157613fc16157e9565b90600052602060002090600302016002018281548110613fe357613fe36157e9565b906000526020600020016000828254613ffc919061589b565b90915550505b96509650969350505050565b6000610826825490565b600081815260018301602052604081205461405f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610826565b506000610826565b60006001600160e01b03198216637965db0b60e01b14806108265750610826826145b5565b6000818152601460205260408120805490918190036140b057426003830155612135565b60006140bc85836145da565b600384015490915060006140d0824261584f565b905064e8d4a510006140e28483615862565b6140ec9190615879565b6140f6908361589b565b600386015550505050505050565b600061410f83611f60565b60008481526014602052604090209091508282146120fc576005810182905560405182815284907f8bdaee675270281b7bc2d5b9ced20517ecf5ce96158973ef78072a7bc1491b449060200160405180910390a25092915050565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156141d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141f79190615be4565b905082811161420657806110d6565b5090919050565b61213584848484614655565b6142238282611f1b565b610d965761423081614789565b61423b83602061479b565b60405160200161424c929190615c94565b60408051601f198184030181529082905262461bcd60e51b8252610ab8916004016150a0565b61427c8282611f1b565b15610d96576000828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006110d6836001600160a01b038416614936565b6000614343826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614a299092919063ffffffff16565b805190915015610b5957808060200190518101906143619190615d03565b610b595760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610ab8565b610d96828260405180602001604052806000815250614a38565b6040516001600160a01b03808516602483015283166044820152606481018290526121359085906323b872dd60e01b90608401613a32565b6000826000018281548110614429576144296157e9565b9060005260206000200154905092915050565b6060600080856001600160a01b0316856040516144599190615d20565b600060405180830381855af49150503d8060008114614494576040519150601f19603f3d011682016040523d82523d6000602084013e614499565b606091505b50915091506144aa86838387614a6b565b9695505050505050565b60006001600160a01b0384163b156145aa57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906144f8903390899088908890600401615d3c565b6020604051808303816000875af1925050508015614533575060408051601f3d908101601f1916820190925261453091810190615d6f565b60015b614590573d808015614561576040519150601f19603f3d011682016040523d82523d6000602084013e614566565b606091505b5080516000036145885760405162461bcd60e51b8152600401610ab890615c42565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613823565b506001949350505050565b60006001600160e01b0319821663780e9d6360e01b1480610826575061082682614ae4565b60008282101561461d576145ee828461589b565b6145fd8364e8d4a51000615862565b6146079190615879565b6146169064e8d4a5100061584f565b9050610826565b818310156146485761462f828461589b565b61463e8464e8d4a51000615862565b6146169190615879565b5064746a52880092915050565b60018111156146c45760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610ab8565b816001600160a01b0385166147205761471b81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b614743565b836001600160a01b0316856001600160a01b031614614743576147438582614b34565b6001600160a01b03841661475f5761475a81614bd1565b614782565b846001600160a01b0316846001600160a01b031614614782576147828482614c80565b5050505050565b60606108266001600160a01b03831660145b606060006147aa836002615862565b6147b590600261589b565b6001600160401b038111156147cc576147cc6152df565b6040519080825280601f01601f1916602001820160405280156147f6576020820181803683370190505b509050600360fc1b81600081518110614811576148116157e9565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614840576148406157e9565b60200101906001600160f81b031916908160001a9053506000614864846002615862565b61486f90600161589b565b90505b60018111156148e7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106148a3576148a36157e9565b1a60f81b8282815181106148b9576148b96157e9565b60200101906001600160f81b031916908160001a90535060049490941c936148e081615d8c565b9050614872565b5083156110d65760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ab8565b60008181526001830160205260408120548015614a1f57600061495a60018361584f565b855490915060009061496e9060019061584f565b90508181146149d357600086600001828154811061498e5761498e6157e9565b90600052602060002001549050808760000184815481106149b1576149b16157e9565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806149e4576149e4615da3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610826565b6000915050610826565b60606138238484600085614cc4565b614a428383614d9f565b614a4f60008484846144b4565b610b595760405162461bcd60e51b8152600401610ab890615c42565b60608315614ada578251600003614ad3576001600160a01b0385163b614ad35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ab8565b5081613823565b6138238383614ea8565b60006001600160e01b031982166380ac58cd60e01b1480614b1557506001600160e01b03198216635b5e139f60e01b145b8061082657506301ffc9a760e01b6001600160e01b0319831614610826565b60006001614b418461154a565b614b4b919061584f565b600083815260076020526040902054909150808214614b9e576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090614be39060019061584f565b60008381526009602052604081205460088054939450909284908110614c0b57614c0b6157e9565b906000526020600020015490508060088381548110614c2c57614c2c6157e9565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480614c6457614c64615da3565b6001900381819060005260206000200160009055905550505050565b6000614c8b8361154a565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b606082471015614d255760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610ab8565b600080866001600160a01b03168587604051614d419190615d20565b60006040518083038185875af1925050503d8060008114614d7e576040519150601f19603f3d011682016040523d82523d6000602084013e614d83565b606091505b5091509150614d9487838387614a6b565b979650505050505050565b6001600160a01b038216614df55760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610ab8565b614dfe81612fb1565b15614e1b5760405162461bcd60e51b8152600401610ab890615db9565b614e2960008383600161420d565b614e3281612fb1565b15614e4f5760405162461bcd60e51b8152600401610ab890615db9565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b031916841790555183929190600080516020615e18833981519152908290a45050565b815115614eb85781518083602001fd5b8060405162461bcd60e51b8152600401610ab891906150a0565b828054828255906000526020600020908101928215614f0d579160200282015b82811115614f0d578251825591602001919060010190614ef2565b50614f19929150614f53565b5090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b5b80821115614f195760008155600101614f54565b6001600160e01b031981168114610ba757600080fd5b600060208284031215614f9057600080fd5b81356110d681614f68565b600060208284031215614fad57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015614fe457815187529582019590820190600101614fc8565b509495945050505050565b60208152600082516060602084015261500b6080840182614fb4565b90506020840151601f19808584030160408601526150298383614fb4565b92506040860151915080858403016060860152506150478282614fb4565b95945050505050565b60005b8381101561506b578181015183820152602001615053565b50506000910152565b6000815180845261508c816020860160208601615050565b601f01601f19169290920160200192915050565b6020815260006110d66020830184615074565b80356001600160a01b03811681146137a057600080fd5b600080604083850312156150dd57600080fd5b6150e6836150b3565b946020939093013593505050565b6000806040838503121561510757600080fd5b82359150615117602084016150b3565b90509250929050565b60008060006060848603121561513557600080fd5b61513e846150b3565b925061514c602085016150b3565b9150604084013590509250925092565b602081528151602082015260208201516040820152604082015160608201526000606083015160a0608084015261519660c0840182615074565b90506080840151151560a08401528091505092915050565b600080604083850312156151c157600080fd5b50508035926020909101359150565b60008083601f8401126151e257600080fd5b5081356001600160401b038111156151f957600080fd5b6020830191508360208260051b850101111561521457600080fd5b9250929050565b6000806020838503121561522e57600080fd5b82356001600160401b0381111561524457600080fd5b615250858286016151d0565b90969095509350505050565b60008060006060848603121561527157600080fd5b61527a846150b3565b95602085013595506040909401359392505050565b6000602082840312156152a157600080fd5b6110d6826150b3565b6000806000606084860312156152bf57600080fd5b83359250602084013591506152d6604085016150b3565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561531d5761531d6152df565b604052919050565b60006001600160401b0382111561533e5761533e6152df565b50601f01601f191660200190565b600061535f61535a84615325565b6152f5565b905082815283838301111561537357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261539b57600080fd5b6110d68383356020850161534c565b8015158114610ba757600080fd5b80356137a0816153aa565b6000806000806000806000806000806101008b8d0312156153e357600080fd5b8a3599506153f360208c016150b3565b985061540160408c016150b3565b975060608b01356001600160401b038082111561541d57600080fd5b6154298e838f016151d0565b909950975060808d013591508082111561544257600080fd5b61544e8e838f016151d0565b909750955060a08d013591508082111561546757600080fd5b506154748d828e0161538a565b93505061548360c08c016150b3565b915061549160e08c016153b8565b90509295989b9194979a5092959850565b600080600080600080600060c0888a0312156154bd57600080fd5b87359650602088013595506154d4604089016150b3565b945060608801356001600160401b03808211156154f057600080fd5b818a0191508a601f83011261550457600080fd5b81358181111561551357600080fd5b8b602082850101111561552557600080fd5b60208301965080955050505061553d608089016150b3565b915061554b60a089016153b8565b905092959891949750929550565b6000806040838503121561556c57600080fd5b615575836150b3565b91506020830135615585816153aa565b809150509250929050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156155e557603f198886030184526155d3858351615074565b945092850192908501906001016155b7565b5092979650505050505050565b6000806000806080858703121561560857600080fd5b615611856150b3565b935061561f602086016150b3565b92506040850135915060608501356001600160401b0381111561564157600080fd5b8501601f8101871361565257600080fd5b6156618782356020840161534c565b91505092959194509250565b60008060006060848603121561568257600080fd5b505081359360208301359350604090920135919050565b602080825282518282018190526000919060409081850190868401855b828110156156e557815180518552868101518786015285015185850152606090930192908501906001016156b6565b5091979650505050505050565b805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a08301525050565b604080825283519082018190526000906020906060840190828701845b8281101561576557815184529284019290840190600101615749565b5050508381038285015284518082528583019183019060005b818110156157a4576157918385516156f2565b9284019260c0929092019160010161577e565b5090979650505050505050565b60c0810161082682846156f2565b600080604083850312156157d257600080fd5b6157db836150b3565b9150615117602084016150b3565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061581357607f821691505b60208210810361583357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561082657610826615839565b808202811582820484141761082657610826615839565b60008261589657634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561082657610826615839565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b601f821115610b5957600081815260208120601f850160051c810160208610156159545750805b601f850160051c820191505b8181101561597357828155600101615960565b505050505050565b600019600383901b1c191660019190911b1790565b81516001600160401b038111156159a9576159a96152df565b6159bd816159b784546157ff565b8461592d565b602080601f8311600181146159ec57600084156159da5750858301515b6159e4858261597b565b865550615973565b600085815260208120601f198616915b82811015615a1b578886015182559484019460019091019084016159fc565b5085821015615a395787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160401b03831115615a6057615a606152df565b615a7483615a6e83546157ff565b8361592d565b6000601f841160018114615aa25760008515615a905750838201355b615a9a868261597b565b845550614782565b600083815260209020601f19861690835b82811015615ad35786850135825560209485019460019092019101615ab3565b5086821015615af05760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6000808335601e19843603018112615b1957600080fd5b8301803591506001600160401b03821115615b3357600080fd5b60200191503681900382131561521457600080fd5b600060018201615b5a57615b5a615839565b5060010190565b600060208284031215615b7357600080fd5b81516001600160401b03811115615b8957600080fd5b8201601f81018413615b9a57600080fd5b8051615ba861535a82615325565b818152856020838501011115615bbd57600080fd5b615047826020830160208601615050565b634e487b7160e01b600052602160045260246000fd5b600060208284031215615bf657600080fd5b5051919050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615cc6816017850160208801615050565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615cf7816028840160208801615050565b01602801949350505050565b600060208284031215615d1557600080fd5b81516110d6816153aa565b60008251615d32818460208701615050565b9190910192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906144aa90830184615074565b600060208284031215615d8157600080fd5b81516110d681614f68565b600081615d9b57615d9b615839565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060408201526060019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220ed276fadd4e50798d6fe4f59798d5327320ad659e3829bc3d9a46419a957a99764736f6c6343000812003300000000000000000000000000e1724885473b63bce08a9f0a52f35b0979e35a000000000000000000000000741ab99835b9bcf1bb3da95a15f01ddd3fc14ee1000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000d4469676974204465706f7369740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044449474900000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061030e5760003560e01c80636e7d40191161019e578063ac9650d8116100ef578063d14d0a1a1161009d578063d14d0a1a1461073a578063d1abb9071461075b578063d1c2babb1461076e578063d547741f14610781578063e2bbb15814610794578063e48dc135146107a7578063e985e9c5146107c7578063f7c618c1146107da57600080fd5b8063ac9650d81461069b578063b88d4fde146106bb578063b9be8cd5146106ce578063bd75fd6c146106e1578063c346253d14610701578063c87b56dd14610714578063ca15c8731461072757600080fd5b806391d148541161014c57806391d148541461061857806395d89b411461062b578063983d2737146106335780639a67759b1461065a578063a217fddf1461066d578063a22cb46514610675578063a6443e1e1461068857600080fd5b80636e7d4019146105935780636ecbae3f146105a657806370a08231146105b95780637747dd81146105cc578063778b9a07146105df5780638d74c2bf146105f25780639010d07c1461060557600080fd5b80632f2ff15d11610263578063430c208111610211578063430c2081146104fb578063441a3e701461050e5780634f6ccce71461052157806351eb05a6146105345780635312ea8e1461054757806357a5b58c1461055a5780636352211e1461056d5780636705fcf31461058057600080fd5b80632f2ff15d146104555780632f380b35146104685780632f745c59146104885780633427a44e1461049b57806336568abe146104c257806342842e0e146104d557806342966c68146104e857600080fd5b806312f7086c116102c057806312f7086c146103d557806317caf6f1146103e857806318160ddd146103f157806318fccc76146103f9578063215e83eb1461040c57806323b872dd1461041f578063248a9ca31461043257600080fd5b806301ffc9a714610313578063030101db1461033b57806306fdde031461035b578063081812fc14610370578063081e3eda1461039b578063095ea7b3146103ad57806309f1c80a146103c2575b600080fd5b610326610321366004614f7e565b610801565b60405190151581526020015b60405180910390f35b61034e610349366004614f9b565b61082c565b6040516103329190614fef565b61036361098b565b60405161033291906150a0565b61038361037e366004614f9b565b610a1d565b6040516001600160a01b039091168152602001610332565b6010545b604051908152602001610332565b6103c06103bb3660046150ca565b610a44565b005b6103c06103d0366004614f9b565b610b5e565b61039f6103e3366004614f9b565b610baa565b61039f60155481565b60085461039f565b6103c06104073660046150f4565b610d1f565b61038361041a366004614f9b565b610d9a565b6103c061042d366004615120565b610dc4565b61039f610440366004614f9b565b6000908152600a602052604090206001015490565b6103c06104633660046150f4565b610df6565b61047b610476366004614f9b565b610e1b565b604051610332919061515c565b61039f6104963660046150ca565b610f42565b61039f7ff0df1ecf66245243e1fe66eca783e2b1f173c34d37828b8788a74623e9a73e0281565b6103c06104d03660046150f4565b610fd8565b6103c06104e3366004615120565b611052565b6103c06104f6366004614f9b565b61106d565b6103266105093660046150ca565b6110ca565b6103c061051c3660046151ae565b6110dd565b61039f61052f366004614f9b565b6111a6565b6103c0610542366004614f9b565b611239565b6103c0610555366004614f9b565b611255565b6103c061056836600461521b565b6113ae565b61038361057b366004614f9b565b6113f6565b61039f61058e36600461525c565b61142b565b6103836105a1366004614f9b565b6114c5565b6103c06105b436600461528f565b6114d5565b61039f6105c736600461528f565b61154a565b61039f6105da3660046152aa565b6115d0565b6103c06105ed3660046153c3565b61181a565b6103c06106003660046154a2565b611ce8565b6103836106133660046151ae565b611f03565b6103266106263660046150f4565b611f1b565b610363611f46565b61039f7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c81565b600f54610383906001600160a01b031681565b61039f600081565b6103c0610683366004615559565b611f55565b61039f610696366004614f9b565b611f60565b6106ae6106a936600461521b565b61200f565b6040516103329190615590565b6103c06106c93660046155f2565b612103565b6103c06106dc36600461566d565b61213b565b6106f46106ef36600461528f565b6125b9565b6040516103329190615699565b61038361070f366004614f9b565b6126b7565b610363610722366004614f9b565b6126c7565b61039f610735366004614f9b565b612790565b61074d61074836600461528f565b6127a7565b60405161033292919061572c565b6103c06107693660046152aa565b612921565b6103c061077c3660046151ae565b612a15565b6103c061078f3660046150f4565b612d2c565b6103c06107a23660046151ae565b612d51565b6107ba6107b5366004614f9b565b612d76565b60405161033291906157b1565b6103266107d53660046157bf565b612dd7565b6103837f00000000000000000000000000e1724885473b63bce08a9f0a52f35b0979e35a81565b60006001600160e01b03198216630c39233960e21b1480610826575061082682612ea0565b92915050565b61085060405180606001604052806060815260200160608152602001606081525090565b60118281548110610863576108636157e9565b9060005260206000209060030201604051806060016040529081600082018054806020026020016040519081016040528092919081815260200182805480156108cb57602002820191906000526020600020905b8154815260200190600101908083116108b7575b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561092357602002820191906000526020600020905b81548152602001906001019080831161090f575b505050505081526020016002820180548060200260200160405190810160405280929190818152602001828054801561097b57602002820191906000526020600020905b815481526020019060010190808311610967575b5050505050815250509050919050565b60606000805461099a906157ff565b80601f01602080910402602001604051908101604052809291908181526020018280546109c6906157ff565b8015610a135780601f106109e857610100808354040283529160200191610a13565b820191906000526020600020905b8154815290600101906020018083116109f657829003601f168201915b5050505050905090565b6000610a2882612ec5565b506000908152600460205260409020546001600160a01b031690565b6000610a4f826113f6565b9050806001600160a01b0316836001600160a01b031603610ac15760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610add5750610add8133612dd7565b610b4f5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610ab8565b610b598383612eea565b505050565b610b66612f58565b610b6f81612fb1565b610b8c57604051631d1286b560e31b815260040160405180910390fd5b610b9b60008260026000612fce565b5050610ba76001600c55565b50565b600081815260146020526040812060048101546010805484919083908110610bd457610bd46157e9565b906000526020600020906005020190506000816000015490506000610bfc8560040154613669565b60018401549091506000610c10824261584f565b90508015801590610c2057508215155b15610c805760006015548660020154610c3885613707565b610c429085615862565b610c4c9190615862565b610c569190615879565b905083610c6864e8d4a5100083615862565b610c729190615879565b610c7c908661589b565b9450505b600060118781548110610c9557610c956157e9565b9060005260206000209060030201600101886005015481548110610cbb57610cbb6157e9565b90600052602060002001548860000154610cd59190615862565b90508760010154886002015464e8d4a510008784610cf39190615862565b610cfd9190615879565b610d07919061589b565b610d11919061584f565b9a9950505050505050505050565b610d27612f58565b610d30826137a5565b600080610d41600085600286612fce565b9150915083836001600160a01b0316837f614253edaf5943287293d855afffbb1f5f0403c51c84143aceaf27a50727b2fc84604051610d8291815260200190565b60405180910390a45050610d966001600c55565b5050565b600e8181548110610daa57600080fd5b6000918252602090912001546001600160a01b0316905081565b610dcf335b826137cc565b610deb5760405162461bcd60e51b8152600401610ab8906158ae565b610b5983838361382b565b6000828152600a6020526040902060010154610e118161398a565b610b598383613994565b610e4f6040518060a00160405280600081526020016000815260200160008152602001606081526020016000151581525090565b60108281548110610e6257610e626157e9565b90600052602060002090600502016040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382018054610ea9906157ff565b80601f0160208091040260200160405190810160405280929190818152602001828054610ed5906157ff565b8015610f225780601f10610ef757610100808354040283529160200191610f22565b820191906000526020600020905b815481529060010190602001808311610f0557829003601f168201915b50505091835250506004919091015460ff16151560209091015292915050565b6000610f4d8361154a565b8210610faf5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610ab8565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6001600160a01b03811633146110485760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ab8565b610d9682826139b6565b610b5983838360405180602001604052806000815250612103565b6000818152601460205260409020541561109a5760405163f25a119760e01b815260040160405180910390fd5b6110a381610baa565b156110c15760405163faaea8f160e01b815260040160405180910390fd5b610ba7816139d8565b60006110d683836137cc565b9392505050565b6110e5612f58565b8160000361110657604051631f2a200560e01b815260040160405180910390fd5b61110f816137a5565b600061111f838360016000612fce565b50905061115633846012848154811061113a5761113a6157e9565b6000918252602090912001546001600160a01b03169190613a06565b81336001600160a01b0316827f191a58d19a6a9b76e2e91bdc04ecbe7553dc094a5ad7af78175a0d9f884e264a8660405161119391815260200190565b60405180910390a450610d966001600c55565b60006111b160085490565b82106112145760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610ab8565b60088281548110611227576112276157e9565b90600052602060002001549050919050565b611241612f58565b61124a81613a69565b50610ba76001600c55565b61125d612f58565b6000611268826113f6565b90506001600160a01b0381163314611293576040516330cd747160e01b815260040160405180910390fd5b60008281526014602052604090208054600482015460118054839190839081106112bf576112bf6157e9565b90600052602060002090600302016002018460050154815481106112e5576112e56157e9565b9060005260206000200160008282546112fe919061584f565b9091555061130d905085613b9d565b600085815260146020526040812081815560018101829055600281018290556003810182905560048101829055600501556012805461135b9186918591908590811061113a5761113a6157e9565b84846001600160a01b0316827f6aaee64d11e8979fa392cd6388058c820f43709933f6a297e6e1005dddca62d68560405161139891815260200190565b60405180910390a450505050610ba76001600c55565b6113b6612f58565b60005b818110156113eb576113e28383838181106113d6576113d66157e9565b90506020020135613a69565b506001016113b9565b50610d966001600c55565b6000818152600260205260408120546001600160a01b0316806108265760405162461bcd60e51b8152600401610ab8906158fb565b6000611435612f58565b60105483106114575760405163904e0f5960e01b815260040160405180910390fd5b61146084613c2e565b6000818152601460205260409020600481018590559091506114828383613c50565b81856001600160a01b0316857fb1ef6f1c5fca9fc83b81f6c18e6269a7942f041cadd830c353bb90f8680a3d4d60405160405180910390a4506110d66001600c55565b60128181548110610daa57600080fd5b7ff0df1ecf66245243e1fe66eca783e2b1f173c34d37828b8788a74623e9a73e026114ff8161398a565b600f80546001600160a01b0319166001600160a01b0384169081179091556040517f097cb0b4d8d03c9f5f6d24fdb4d1c0764243aab030e9e385b0295badfe7a73e290600090a25050565b60006001600160a01b0382166115b45760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610ab8565b506001600160a01b031660009081526003602052604090205490565b60006115da612f58565b826000036115fb57604051631f2a200560e01b815260040160405180910390fd5b611604846137a5565b60008481526014602052604090206004810154601080548290811061162b5761162b6157e9565b600091825260209091206004600590920201015460ff1661165f57604051635ea3f5c160e01b815260040160405180910390fd5b8154600061166d878361584f565b808555905061167b86613c2e565b6000818152601460205260408120898155600380880154908201556005808801549082018190556004820187905560118054949950919390929190879081106116c6576116c66157e9565b906000526020600020906003020160010182815481106116e8576116e86157e9565b90600052602060002001546116fc87613a69565b6117069190615862565b90506000876001015464e8d4a5100083886117219190615862565b61172b9190615879565b611735919061584f565b905080156117575780886002016000828254611751919061589b565b90915550505b64e8d4a510006117678387615862565b6117719190615879565b600189015564e8d4a51000611786838d615862565b6117909190615879565b600185015560405189906001600160a01b038c169089907fb1ef6f1c5fca9fc83b81f6c18e6269a7942f041cadd830c353bb90f8680a3d4d90600090a4888c7fcf0974dfd867840133a0d4b02f1672f24017796fb8892d1e0d587692e4da90ab8d60405161180091815260200190565b60405180910390a350505050505050506110d66001600c55565b60006118258161398a565b7f00000000000000000000000000e1724885473b63bce08a9f0a52f35b0979e35a6001600160a01b03168a6001600160a01b0316036118775760405163c982c8c360e01b815260040160405180910390fd5b60008790036118995760405163521299a960e01b815260040160405180910390fd5b8685146118b95760405163512509d360e11b815260040160405180910390fd5b878760008181106118cc576118cc6157e9565b905060200201356000146118f3576040516369afe63f60e11b815260040160405180910390fd5b600187111561196957600060015b8881101561196657818a8a8381811061191c5761191c6157e9565b9050602002013511611941576040516367c462f760e01b815260040160405180910390fd5b898982818110611953576119536157e9565b6020029190910135925050600101611901565b50505b60005b6010548110156119885761197f81613a69565b5060010161196c565b5060008b601554611999919061589b565b9050806000036119bc57604051632ae6f6af60e11b815260040160405180910390fd5b8060158190555060128b9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555060138a9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600e849080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555060106040518060a00160405280600081526020014281526020018e815260200187815260200185151581525090806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003019081611b269190615990565b50608091820151600491909101805460ff19169115159190911790556040805160208b028082018401909252606081018b8152601193919283928e918e918291908601908490808284376000920191909152505050908252506040805160208b810282810182019093528b82529283019290918c918c918291850190849080828437600092019190915250505090825250602001886001600160401b03811115611bd257611bd26152df565b604051908082528060200260200182016040528015611bfb578160200160208202803683370190505b50905281546001810183556000928352602092839020825180519394600390930290910192611c2d9284920190614ed2565b506020828101518051611c469260018501920190614ed2565b5060408201518051611c62916002840191602090910190614ed2565b50506012546001600160a01b03808d1692508d1690611c839060019061584f565b7f1af8063b2ec9698905896368410dddf34d4ef5f8fb21ddd995a7b43f69ae10678f8888604051611cd2939291909283526001600160a01b039190911660208301521515604082015260600190565b60405180910390a4505050505050505050505050565b7f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c611d128161398a565b6010548810611d345760405163904e0f5960e01b815260040160405180910390fd5b6000611d3f60105490565b905060005b81811015611d5e57611d5581613a69565b50600101611d44565b50600060108a81548110611d7457611d746157e9565b90600052602060002090600502019050600081600201548a601554611d99919061589b565b611da3919061584f565b905080600003611dc657604051632ae6f6af60e11b815260040160405180910390fd5b6015819055600282018a90558415611e1b578860138c81548110611dec57611dec6157e9565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60038201611e2a888a83615a49565b5085600e8c81548110611e3f57611e3f6157e9565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555084611e9f5760138b81548110611e8557611e856157e9565b6000918252602090912001546001600160a01b0316611ea1565b885b6001600160a01b03168b7ffa4328c2a1268b2b661914d91df191c5271c699ddc97ccedda086c6d25b099f98c89604051611eee9291909182526001600160a01b0316602082015260400190565b60405180910390a35050505050505050505050565b6000828152600b602052604081206110d69083613d0b565b6000918252600a602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606001805461099a906157ff565b610d96338383613d17565b60008181526014602052604081206004810154601180548492908110611f8857611f886157e9565b6000918252602090912060039091020180549091506001819003611fb157506000949350505050565b6000836003015442611fc3919061584f565b9050611fd060018361584f565b94505b826000018581548110611fe857611fe86157e9565b90600052602060002001548110156120065760001990940193611fd3565b50505050919050565b6060816001600160401b03811115612029576120296152df565b60405190808252806020026020018201604052801561205c57816020015b60608152602001906001900390816120475790505b50905060005b828110156120fc576120cc30858584818110612080576120806157e9565b90506020028101906120929190615b02565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613de192505050565b8282815181106120de576120de6157e9565b602002602001018190525080806120f490615b48565b915050612062565b5092915050565b61210d33836137cc565b6121295760405162461bcd60e51b8152600401610ab8906158ae565b61213584848484613e06565b50505050565b612143612f58565b8060000361216457604051631f2a200560e01b815260040160405180910390fd5b81830361218457604051634cce529560e11b815260040160405180910390fd5b61218d836137a5565b612196826137a5565b6121fa6040518061018001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b600084815260146020908152604090912060048101549183018290526010805491929091811061222c5761222c6157e9565b600091825260209091206004600590920201015460ff1661226057604051635ea3f5c160e01b815260040160405180910390fd5b600084815260146020908152604090912060048101549184015190911461229a57604051634f13191b60e01b815260040160405180910390fd5b81548084528154604085018190526122b19161589b565b816003015484604001516122c59190615862565b600384015485516122d69190615862565b6122e0919061589b565b6122ea9190615879565b600382015582516122fc90859061584f565b606084018190528255604083015161231590859061589b565b608084018190528082556020840151604085015161233b92899289929091899190613e39565b60e086015260c085015260a0840152602083015161235890613a69565b6101008401526020830151601180549091908110612378576123786157e9565b90600052602060002090600302016001018360a001518154811061239e5761239e6157e9565b90600052602060002001548361010001516123b99190615862565b610120840181905260018301548451909164e8d4a51000916123db9190615862565b6123e59190615879565b6123ef919061584f565b61014084018190521561241b57826101400151826002016000828254612415919061589b565b90915550505b806001015464e8d4a510008461010001516011866020015181548110612443576124436157e9565b90600052602060002090600302016001018660c0015181548110612469576124696157e9565b906000526020600020015486604001516124839190615862565b61248d9190615862565b6124979190615879565b6124a1919061584f565b6101608401819052156124cd578261016001518160020160008282546124c7919061589b565b90915550505b64e8d4a5100083610120015184606001516124e89190615862565b6124f29190615879565b600183015560208301516011805464e8d4a5100092908110612516576125166157e9565b90600052602060002090600302016001018460e001518154811061253c5761253c6157e9565b9060005260206000200154846101000151856080015161255c9190615862565b6125669190615862565b6125709190615879565b6001820155604051848152859087907fda2a03409498a5fe8db3da030754afa618bc2228c0517ec5fa8c9b052979e9ea9060200160405180910390a3505050610b596001600c55565b606060006125c68361154a565b9050806001600160401b038111156125e0576125e06152df565b60405190808252806020026020018201604052801561263557816020015b61262260405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816125fe5790505b50915060005b818110156126b057600061264f8583610f42565b905060405180606001604052808281526020016014600084815260200190815260200160002060040154815260200161268783610baa565b81525084838151811061269c5761269c6157e9565b60209081029190910101525060010161263b565b5050919050565b60138181548110610daa57600080fd5b60606126d282612fb1565b6126ef57604051631d1286b560e31b815260040160405180910390fd5b600082815260146020526040902060040154600e80549091908110612716576127166157e9565b6000918252602090912001546040516344a5a61760e11b8152600481018490526001600160a01b039091169063894b4c2e90602401600060405180830381865afa158015612768573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108269190810190615b61565b6000818152600b602052604081206108269061400e565b60608060006127b58461154a565b9050806001600160401b038111156127cf576127cf6152df565b6040519080825280602002602001820160405280156127f8578160200160208202803683370190505b509250806001600160401b03811115612813576128136152df565b60405190808252806020026020018201604052801561284c57816020015b612839614f1d565b8152602001906001900390816128315790505b50915060005b8181101561291a576128648582610f42565b848281518110612876576128766157e9565b60200260200101818152505060146000858381518110612898576128986157e9565b602002602001015181526020019081526020016000206040518060c00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481525050838281518110612907576129076157e9565b6020908102919091010152600101612852565b5050915091565b612929612f58565b8260000361294a57604051631f2a200560e01b815260040160405180910390fd5b612953826137a5565b6000806129638585600186612fce565b9150915061297f33866012858154811061113a5761113a6157e9565b83336001600160a01b0316837f191a58d19a6a9b76e2e91bdc04ecbe7553dc094a5ad7af78175a0d9f884e264a886040516129bc91815260200190565b60405180910390a483836001600160a01b0316837f614253edaf5943287293d855afffbb1f5f0403c51c84143aceaf27a50727b2fc84604051612a0191815260200190565b60405180910390a45050610b596001600c55565b612a1d612f58565b808203612a3d57604051634cce529560e11b815260040160405180910390fd5b612a46826137a5565b612a4f816137a5565b6000828152601460205260408082208054600480830154868652939094209384015491939092918214612a9557604051634f13191b60e01b815260040160405180910390fd5b80546000612aa3858361589b565b905080600003612ac657604051636677a12d60e11b815260040160405180910390fd5b80836003015483612ad79190615862565b6003880154612ae69088615862565b612af0919061589b565b612afa9190615879565b600384015580835560008080612b148b8b898b8989613e39565b9250925092506000612b2588613a69565b9050600087600101548b600101548c6002015464e8d4a5100060118d81548110612b5157612b516157e9565b90600052602060002090600302016001018881548110612b7357612b736157e9565b90600052602060002001548b612b899190615862565b60118e81548110612b9c57612b9c6157e9565b90600052602060002090600302016001018a81548110612bbe57612bbe6157e9565b90600052602060002001548f612bd49190615862565b612bde919061589b565b612be89087615862565b612bf29190615879565b612bfc919061589b565b612c06919061584f565b612c10919061584f565b90508015612c325780886002016000828254612c2c919061589b565b90915550505b64e8d4a5100060118a81548110612c4b57612c4b6157e9565b90600052602060002090600302016001018481548110612c6d57612c6d6157e9565b90600052602060002001548388612c849190615862565b612c8e9190615862565b612c989190615879565b6001890155612ca68d613b9d565b60008d8152601460205260408082208281556001810183905560028101839055600381018390556004810183905560050191909155518c908e907f285dbc28e663286c77e3cd79d1cf1525744b4dfe015f41295fe5ae2858880bdf90612d0f908e815260200190565b60405180910390a35050505050505050505050610d966001600c55565b6000828152600a6020526040902060010154612d478161398a565b610b5983836139b6565b612d59612f58565b612d62816137a5565b612d6c8282613c50565b610d966001600c55565b612d7e614f1d565b50600090815260146020908152604091829020825160c08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b612e0f8282611f1b565b610d96576000828152600a602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612e473390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006110d6836001600160a01b038416614018565b60006001600160e01b03198216635a05180f60e01b1480610826575061082682614067565b612ece81612fb1565b610ba75760405162461bcd60e51b8152600401610ab8906158fb565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612f1f826113f6565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6002600c5403612faa5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ab8565b6002600c55565b6000908152600260205260409020546001600160a01b0316151590565b60008061300c6040518060c0016040528060008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b60008681526014602052604090206004810154935061302a84613a69565b825280546020830152600086600281111561304757613047615bce565b0361307457613056888861408c565b878260200151613066919061589b565b604083018190528155613101565b600186600281111561308857613088615bce565b036130f657816020015188141580156130c85750601084815481106130af576130af6157e9565b600091825260209091206004600590920201015460ff16155b156130e657604051635ea3f5c160e01b815260040160405180910390fd5b878260200151613066919061584f565b602082015160408301525b600581015460608301819052613118908890614104565b608083018190526060830151146131e857816020015160118581548110613141576131416157e9565b9060005260206000209060030201600201836060015181548110613167576131676157e9565b906000526020600020016000828254613180919061584f565b90915550506040820151601180548690811061319e5761319e6157e9565b90600052602060002090600302016002018360800151815481106131c4576131c46157e9565b9060005260206000200160008282546131dd919061589b565b909155506132ad9050565b60008660028111156131fc576131fc615bce565b0361323b578760118581548110613215576132156157e9565b90600052602060002090600302016002018360600151815481106131c4576131c46157e9565b600186600281111561324f5761324f615bce565b036132ad578760118581548110613268576132686157e9565b906000526020600020906003020160020183606001518154811061328e5761328e6157e9565b9060005260206000200160008282546132a7919061584f565b90915550505b6000816001015464e8d4a510008460000151601188815481106132d2576132d26157e9565b90600052602060002090600302016001018660600151815481106132f8576132f86157e9565b906000526020600020015486602001516133129190615862565b61331c9190615862565b6133269190615879565b613330919061584f565b905064e8d4a51000836000015160118781548110613350576133506157e9565b9060005260206000209060030201600101856080015181548110613376576133766157e9565b906000526020600020015485604001516133909190615862565b61339a9190615862565b6133a49190615879565b60018301556001600160a01b03861615801560a085018190526133c657508015155b156133ea57808260020160008282546133df919061589b565b909155506134fb9050565b8260a00151156134fb576000826002015482613406919061589b565b90506134118161416a565b945061341d858261584f565b6002840155841561345c5761345c6001600160a01b037f00000000000000000000000000e1724885473b63bce08a9f0a52f35b0979e35a168887613a06565b600060138781548110613471576134716157e9565b6000918252602090912001546001600160a01b0316905080156134f85760405163014a362160e71b8152600481018b9052602481018790526001600160a01b03898116604483015282169063a51b108090606401600060405180830381600087803b1580156134df57600080fd5b505af11580156134f3573d6000803e3d6000fd5b505050505b50505b600087600281111561350f5761350f615bce565b036135ae57600060138681548110613529576135296157e9565b6000918252602090912001546001600160a01b0316905080156135a8576040516303004b4760e01b8152600481018a9052602481018b90526001600160a01b038216906303004b4790604401600060405180830381600087803b15801561358f57600080fd5b505af11580156135a3573d6000803e3d6000fd5b505050505b5061365d565b60018760028111156135c2576135c2615bce565b0361365d576000601386815481106135dc576135dc6157e9565b6000918252602090912001546001600160a01b03169050801561365b576040516305f7936f60e51b8152600481018a9052602481018b90526001600160a01b0382169063bef26de090604401600060405180830381600087803b15801561364257600080fd5b505af1158015613656573d6000803e3d6000fd5b505050505b505b50505094509492505050565b6000806011838154811061367f5761367f6157e9565b600091825260208220600260039092020190810154909250905b818110156136ff578260010181815481106136b6576136b66157e9565b90600052602060002001548360020182815481106136d6576136d66157e9565b90600052602060002001546136eb9190615862565b6136f5908561589b565b9350600101613699565b505050919050565b600f546040516315dd902560e21b8152600481018390526000916001600160a01b031690635776409490602401602060405180830381865afa158015613751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137759190615be4565b90506753444835ec5800008111156137a057604051632dfc35e960e21b815260040160405180910390fd5b919050565b6137af33826137cc565b610ba75760405163390cdd9b60e21b815260040160405180910390fd5b6000806137d8836113f6565b9050806001600160a01b0316846001600160a01b031614806137ff57506137ff8185612dd7565b806138235750836001600160a01b031661381884610a1d565b6001600160a01b0316145b949350505050565b826001600160a01b031661383e826113f6565b6001600160a01b0316146138645760405162461bcd60e51b8152600401610ab890615bfd565b6001600160a01b0382166138c65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610ab8565b6138d3838383600161420d565b826001600160a01b03166138e6826113f6565b6001600160a01b03161461390c5760405162461bcd60e51b8152600401610ab890615bfd565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080546000190190559087168086528386208054600101905586865260029094528285208054909216841790915590518493600080516020615e1883398151915291a4505050565b610ba78133614219565b61399e8282612e05565b6000828152600b60205260409020610b599082612e8b565b6139c08282614272565b6000828152600b60205260409020610b5990826142d9565b6139e133610dc9565b6139fd5760405162461bcd60e51b8152600401610ab8906158ae565b610ba781613b9d565b6040516001600160a01b038316602482015260448101829052610b5990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526142ee565b6000613a7460105490565b8210613a935760405163904e0f5960e01b815260040160405180910390fd5b600060108381548110613aa857613aa86157e9565b6000918252602082206001600590920201908101549092504291613acc828461584f565b8454955090508015612006576000613ae387613669565b90508015613b495760006015548660020154613afe86613707565b613b089086615862565b613b129190615862565b613b1c9190615879565b905081613b2e64e8d4a5100083615862565b613b389190615879565b613b42908861589b565b8087559650505b60018501849055604080518581526020810183905290810187905287907fcb7325664a4a3b7c7223eefc492a97ca4fdf94d46884621e5a8fae5a04b2b9d29060600160405180910390a25050505050919050565b6000613ba8826113f6565b9050613bb881600084600161420d565b613bc1826113f6565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038516808552600384528285208054600019019055878552600290935281842080549091169055519293508492600080516020615e18833981519152908390a45050565b6000600d60008154613c3f90615b48565b918290555090506137a082826143c0565b81600003613c7157604051631f2a200560e01b815260040160405180910390fd5b6000613c808383600080612fce565b509050613cb933308560128581548110613c9c57613c9c6157e9565b6000918252602090912001546001600160a01b03169291906143da565b81613cc3836113f6565b6001600160a01b0316827f9a2a1e97e6d641080089aafc36750cfdef4c79f8b3ace6fa4c384fa2f047695986604051613cfe91815260200190565b60405180910390a4505050565b60006110d68383614412565b816001600160a01b0316836001600160a01b031603613d745760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610ab8565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60606110d68383604051806060016040528060278152602001615df16027913961443c565b613e1184848461382b565b613e1d848484846144b4565b6121355760405162461bcd60e51b8152600401610ab890615c42565b60008681526014602052604080822060059081015488845291832001549091613e628883614104565b9050808314613ec0578560118881548110613e7f57613e7f6157e9565b90600052602060002090600302016002018481548110613ea157613ea16157e9565b906000526020600020016000828254613eba919061584f565b90915550505b808214613f1c578460118881548110613edb57613edb6157e9565b90600052602060002090600302016002018381548110613efd57613efd6157e9565b906000526020600020016000828254613f16919061584f565b90915550505b808314158015613f2c5750808214155b15613f8b578360118881548110613f4557613f456157e9565b90600052602060002090600302016002018281548110613f6757613f676157e9565b906000526020600020016000828254613f80919061589b565b909155506140029050565b808314613fa6578560118881548110613f4557613f456157e9565b808214614002578460118881548110613fc157613fc16157e9565b90600052602060002090600302016002018281548110613fe357613fe36157e9565b906000526020600020016000828254613ffc919061589b565b90915550505b96509650969350505050565b6000610826825490565b600081815260018301602052604081205461405f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610826565b506000610826565b60006001600160e01b03198216637965db0b60e01b14806108265750610826826145b5565b6000818152601460205260408120805490918190036140b057426003830155612135565b60006140bc85836145da565b600384015490915060006140d0824261584f565b905064e8d4a510006140e28483615862565b6140ec9190615879565b6140f6908361589b565b600386015550505050505050565b600061410f83611f60565b60008481526014602052604090209091508282146120fc576005810182905560405182815284907f8bdaee675270281b7bc2d5b9ced20517ecf5ce96158973ef78072a7bc1491b449060200160405180910390a25092915050565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f00000000000000000000000000e1724885473b63bce08a9f0a52f35b0979e35a16906370a0823190602401602060405180830381865afa1580156141d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141f79190615be4565b905082811161420657806110d6565b5090919050565b61213584848484614655565b6142238282611f1b565b610d965761423081614789565b61423b83602061479b565b60405160200161424c929190615c94565b60408051601f198184030181529082905262461bcd60e51b8252610ab8916004016150a0565b61427c8282611f1b565b15610d96576000828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006110d6836001600160a01b038416614936565b6000614343826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614a299092919063ffffffff16565b805190915015610b5957808060200190518101906143619190615d03565b610b595760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610ab8565b610d96828260405180602001604052806000815250614a38565b6040516001600160a01b03808516602483015283166044820152606481018290526121359085906323b872dd60e01b90608401613a32565b6000826000018281548110614429576144296157e9565b9060005260206000200154905092915050565b6060600080856001600160a01b0316856040516144599190615d20565b600060405180830381855af49150503d8060008114614494576040519150601f19603f3d011682016040523d82523d6000602084013e614499565b606091505b50915091506144aa86838387614a6b565b9695505050505050565b60006001600160a01b0384163b156145aa57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906144f8903390899088908890600401615d3c565b6020604051808303816000875af1925050508015614533575060408051601f3d908101601f1916820190925261453091810190615d6f565b60015b614590573d808015614561576040519150601f19603f3d011682016040523d82523d6000602084013e614566565b606091505b5080516000036145885760405162461bcd60e51b8152600401610ab890615c42565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613823565b506001949350505050565b60006001600160e01b0319821663780e9d6360e01b1480610826575061082682614ae4565b60008282101561461d576145ee828461589b565b6145fd8364e8d4a51000615862565b6146079190615879565b6146169064e8d4a5100061584f565b9050610826565b818310156146485761462f828461589b565b61463e8464e8d4a51000615862565b6146169190615879565b5064746a52880092915050565b60018111156146c45760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b6064820152608401610ab8565b816001600160a01b0385166147205761471b81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b614743565b836001600160a01b0316856001600160a01b031614614743576147438582614b34565b6001600160a01b03841661475f5761475a81614bd1565b614782565b846001600160a01b0316846001600160a01b031614614782576147828482614c80565b5050505050565b60606108266001600160a01b03831660145b606060006147aa836002615862565b6147b590600261589b565b6001600160401b038111156147cc576147cc6152df565b6040519080825280601f01601f1916602001820160405280156147f6576020820181803683370190505b509050600360fc1b81600081518110614811576148116157e9565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614840576148406157e9565b60200101906001600160f81b031916908160001a9053506000614864846002615862565b61486f90600161589b565b90505b60018111156148e7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106148a3576148a36157e9565b1a60f81b8282815181106148b9576148b96157e9565b60200101906001600160f81b031916908160001a90535060049490941c936148e081615d8c565b9050614872565b5083156110d65760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ab8565b60008181526001830160205260408120548015614a1f57600061495a60018361584f565b855490915060009061496e9060019061584f565b90508181146149d357600086600001828154811061498e5761498e6157e9565b90600052602060002001549050808760000184815481106149b1576149b16157e9565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806149e4576149e4615da3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610826565b6000915050610826565b60606138238484600085614cc4565b614a428383614d9f565b614a4f60008484846144b4565b610b595760405162461bcd60e51b8152600401610ab890615c42565b60608315614ada578251600003614ad3576001600160a01b0385163b614ad35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ab8565b5081613823565b6138238383614ea8565b60006001600160e01b031982166380ac58cd60e01b1480614b1557506001600160e01b03198216635b5e139f60e01b145b8061082657506301ffc9a760e01b6001600160e01b0319831614610826565b60006001614b418461154a565b614b4b919061584f565b600083815260076020526040902054909150808214614b9e576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090614be39060019061584f565b60008381526009602052604081205460088054939450909284908110614c0b57614c0b6157e9565b906000526020600020015490508060088381548110614c2c57614c2c6157e9565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480614c6457614c64615da3565b6001900381819060005260206000200160009055905550505050565b6000614c8b8361154a565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b606082471015614d255760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610ab8565b600080866001600160a01b03168587604051614d419190615d20565b60006040518083038185875af1925050503d8060008114614d7e576040519150601f19603f3d011682016040523d82523d6000602084013e614d83565b606091505b5091509150614d9487838387614a6b565b979650505050505050565b6001600160a01b038216614df55760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610ab8565b614dfe81612fb1565b15614e1b5760405162461bcd60e51b8152600401610ab890615db9565b614e2960008383600161420d565b614e3281612fb1565b15614e4f5760405162461bcd60e51b8152600401610ab890615db9565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b031916841790555183929190600080516020615e18833981519152908290a45050565b815115614eb85781518083602001fd5b8060405162461bcd60e51b8152600401610ab891906150a0565b828054828255906000526020600020908101928215614f0d579160200282015b82811115614f0d578251825591602001919060010190614ef2565b50614f19929150614f53565b5090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b5b80821115614f195760008155600101614f54565b6001600160e01b031981168114610ba757600080fd5b600060208284031215614f9057600080fd5b81356110d681614f68565b600060208284031215614fad57600080fd5b5035919050565b600081518084526020808501945080840160005b83811015614fe457815187529582019590820190600101614fc8565b509495945050505050565b60208152600082516060602084015261500b6080840182614fb4565b90506020840151601f19808584030160408601526150298383614fb4565b92506040860151915080858403016060860152506150478282614fb4565b95945050505050565b60005b8381101561506b578181015183820152602001615053565b50506000910152565b6000815180845261508c816020860160208601615050565b601f01601f19169290920160200192915050565b6020815260006110d66020830184615074565b80356001600160a01b03811681146137a057600080fd5b600080604083850312156150dd57600080fd5b6150e6836150b3565b946020939093013593505050565b6000806040838503121561510757600080fd5b82359150615117602084016150b3565b90509250929050565b60008060006060848603121561513557600080fd5b61513e846150b3565b925061514c602085016150b3565b9150604084013590509250925092565b602081528151602082015260208201516040820152604082015160608201526000606083015160a0608084015261519660c0840182615074565b90506080840151151560a08401528091505092915050565b600080604083850312156151c157600080fd5b50508035926020909101359150565b60008083601f8401126151e257600080fd5b5081356001600160401b038111156151f957600080fd5b6020830191508360208260051b850101111561521457600080fd5b9250929050565b6000806020838503121561522e57600080fd5b82356001600160401b0381111561524457600080fd5b615250858286016151d0565b90969095509350505050565b60008060006060848603121561527157600080fd5b61527a846150b3565b95602085013595506040909401359392505050565b6000602082840312156152a157600080fd5b6110d6826150b3565b6000806000606084860312156152bf57600080fd5b83359250602084013591506152d6604085016150b3565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561531d5761531d6152df565b604052919050565b60006001600160401b0382111561533e5761533e6152df565b50601f01601f191660200190565b600061535f61535a84615325565b6152f5565b905082815283838301111561537357600080fd5b828260208301376000602084830101529392505050565b600082601f83011261539b57600080fd5b6110d68383356020850161534c565b8015158114610ba757600080fd5b80356137a0816153aa565b6000806000806000806000806000806101008b8d0312156153e357600080fd5b8a3599506153f360208c016150b3565b985061540160408c016150b3565b975060608b01356001600160401b038082111561541d57600080fd5b6154298e838f016151d0565b909950975060808d013591508082111561544257600080fd5b61544e8e838f016151d0565b909750955060a08d013591508082111561546757600080fd5b506154748d828e0161538a565b93505061548360c08c016150b3565b915061549160e08c016153b8565b90509295989b9194979a5092959850565b600080600080600080600060c0888a0312156154bd57600080fd5b87359650602088013595506154d4604089016150b3565b945060608801356001600160401b03808211156154f057600080fd5b818a0191508a601f83011261550457600080fd5b81358181111561551357600080fd5b8b602082850101111561552557600080fd5b60208301965080955050505061553d608089016150b3565b915061554b60a089016153b8565b905092959891949750929550565b6000806040838503121561556c57600080fd5b615575836150b3565b91506020830135615585816153aa565b809150509250929050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156155e557603f198886030184526155d3858351615074565b945092850192908501906001016155b7565b5092979650505050505050565b6000806000806080858703121561560857600080fd5b615611856150b3565b935061561f602086016150b3565b92506040850135915060608501356001600160401b0381111561564157600080fd5b8501601f8101871361565257600080fd5b6156618782356020840161534c565b91505092959194509250565b60008060006060848603121561568257600080fd5b505081359360208301359350604090920135919050565b602080825282518282018190526000919060409081850190868401855b828110156156e557815180518552868101518786015285015185850152606090930192908501906001016156b6565b5091979650505050505050565b805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a08301525050565b604080825283519082018190526000906020906060840190828701845b8281101561576557815184529284019290840190600101615749565b5050508381038285015284518082528583019183019060005b818110156157a4576157918385516156f2565b9284019260c0929092019160010161577e565b5090979650505050505050565b60c0810161082682846156f2565b600080604083850312156157d257600080fd5b6157db836150b3565b9150615117602084016150b3565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061581357607f821691505b60208210810361583357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561082657610826615839565b808202811582820484141761082657610826615839565b60008261589657634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561082657610826615839565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b601f821115610b5957600081815260208120601f850160051c810160208610156159545750805b601f850160051c820191505b8181101561597357828155600101615960565b505050505050565b600019600383901b1c191660019190911b1790565b81516001600160401b038111156159a9576159a96152df565b6159bd816159b784546157ff565b8461592d565b602080601f8311600181146159ec57600084156159da5750858301515b6159e4858261597b565b865550615973565b600085815260208120601f198616915b82811015615a1b578886015182559484019460019091019084016159fc565b5085821015615a395787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160401b03831115615a6057615a606152df565b615a7483615a6e83546157ff565b8361592d565b6000601f841160018114615aa25760008515615a905750838201355b615a9a868261597b565b845550614782565b600083815260209020601f19861690835b82811015615ad35786850135825560209485019460019092019101615ab3565b5086821015615af05760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6000808335601e19843603018112615b1957600080fd5b8301803591506001600160401b03821115615b3357600080fd5b60200191503681900382131561521457600080fd5b600060018201615b5a57615b5a615839565b5060010190565b600060208284031215615b7357600080fd5b81516001600160401b03811115615b8957600080fd5b8201601f81018413615b9a57600080fd5b8051615ba861535a82615325565b818152856020838501011115615bbd57600080fd5b615047826020830160208601615050565b634e487b7160e01b600052602160045260246000fd5b600060208284031215615bf657600080fd5b5051919050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615cc6816017850160208801615050565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615cf7816028840160208801615050565b01602801949350505050565b600060208284031215615d1557600080fd5b81516110d6816153aa565b60008251615d32818460208701615050565b9190910192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906144aa90830184615074565b600060208284031215615d8157600080fd5b81516110d681614f68565b600081615d9b57615d9b615839565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060408201526060019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220ed276fadd4e50798d6fe4f59798d5327320ad659e3829bc3d9a46419a957a99764736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000e1724885473b63bce08a9f0a52f35b0979e35a000000000000000000000000741ab99835b9bcf1bb3da95a15f01ddd3fc14ee1000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000d4469676974204465706f7369740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044449474900000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _rewardToken (address): 0x00e1724885473B63bCE08a9f0a52F35b0979e35A
Arg [1] : _emissionCurve (address): 0x741AB99835B9Bcf1Bb3da95a15F01DDd3fC14ee1
Arg [2] : name (string): Digit Deposit
Arg [3] : symbol (string): DIGI
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 00000000000000000000000000e1724885473b63bce08a9f0a52f35b0979e35a
Arg [1] : 000000000000000000000000741ab99835b9bcf1bb3da95a15f01ddd3fc14ee1
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [5] : 4469676974204465706f73697400000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [7] : 4449474900000000000000000000000000000000000000000000000000000000
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.