maBEETS Deposit (maBEETS)
Overview
TokenID
674
Total Transfers
-
Market
Onchain Market Cap
-
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
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 Source Code Verified (Exact Match)
Contract Name:
Reliquary
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun 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 private constant OPERATOR = keccak256("OPERATOR"); bytes32 private 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(); /** * @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) ERC721("maBEETS Deposit", "maBEETS") { 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. */ function addPool( uint allocPoint, address _poolToken, address _rewarder, uint[] calldata requiredMaturities, uint[] calldata levelMultipliers, string memory name, address _nftDescriptor ) external override onlyRole(OPERATOR) { 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; } } } uint length = poolLength(); for (uint i; i < length; ) { _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 }) ); levels.push( LevelInfo({ requiredMaturities: requiredMaturities, multipliers: levelMultipliers, balance: new uint[](levelMultipliers.length) }) ); emit ReliquaryEvents.LogPoolAddition((poolToken.length - 1), allocPoint, _poolToken, _rewarder, _nftDescriptor); } /** * @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 _pendingReward) = _updatePosition(0, relicId, Kind.OTHER, harvestTo); emit ReliquaryEvents.Harvest(poolId, _pendingReward, 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 _pendingReward) = _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, _pendingReward, 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 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; uint poolId = fromPosition.poolId; 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); } /** * @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); 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; toPosition.entry = (fromAmount * fromPosition.entry + toAmount * toPosition.entry) / (fromAmount + toAmount); uint newFromAmount = fromAmount - amount; fromPosition.amount = newFromAmount; uint newToAmount = toAmount + amount; toPosition.amount = newToAmount; (uint fromLevel, uint oldToLevel, uint newToLevel) = _shiftLevelBalances( fromId, toId, poolId, amount, toAmount, newToAmount ); uint accRewardPerShare = _updatePool(poolId); uint fromMultiplier = accRewardPerShare * levels[poolId].multipliers[fromLevel]; uint pendingFrom = (fromAmount * fromMultiplier) / ACC_REWARD_PRECISION - fromPosition.rewardDebt; if (pendingFrom != 0) { fromPosition.rewardCredit += pendingFrom; } uint pendingTo = (toAmount * levels[poolId].multipliers[oldToLevel] * accRewardPerShare) / ACC_REWARD_PRECISION - toPosition.rewardDebt; if (pendingTo != 0) { toPosition.rewardCredit += pendingTo; } fromPosition.rewardDebt = (newFromAmount * fromMultiplier) / ACC_REWARD_PRECISION; toPosition.rewardDebt = (newToAmount * accRewardPerShare * levels[poolId].multipliers[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); } /** * @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 _pendingReward Pending reward for given position owner. */ function _updatePosition( uint amount, uint relicId, Kind kind, address harvestTo ) internal returns (uint poolId, uint _pendingReward) { PositionInfo storage position = positionForId[relicId]; poolId = position.poolId; uint accRewardPerShare = _updatePool(poolId); uint oldAmount = position.amount; uint newAmount; if (kind == Kind.DEPOSIT) { _updateEntry(amount, relicId); newAmount = oldAmount + amount; position.amount = newAmount; } else if (kind == Kind.WITHDRAW) { newAmount = oldAmount - amount; position.amount = newAmount; } else { newAmount = oldAmount; } uint oldLevel = position.level; uint newLevel = _updateLevel(relicId); if (oldLevel != newLevel) { levels[poolId].balance[oldLevel] -= oldAmount; levels[poolId].balance[newLevel] += newAmount; } else if (kind == Kind.DEPOSIT) { levels[poolId].balance[oldLevel] += amount; } else if (kind == Kind.WITHDRAW) { levels[poolId].balance[oldLevel] -= amount; } _pendingReward = (oldAmount * levels[poolId].multipliers[oldLevel] * accRewardPerShare) / ACC_REWARD_PRECISION - position.rewardDebt; position.rewardDebt = (newAmount * levels[poolId].multipliers[newLevel] * accRewardPerShare) / ACC_REWARD_PRECISION; bool _harvest = harvestTo != address(0); if (!_harvest && _pendingReward != 0) { position.rewardCredit += _pendingReward; } else if (_harvest) { uint total = _pendingReward + position.rewardCredit; uint 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 weight = _findWeight(amount, position.amount); uint maturity = block.timestamp - position.entry; position.entry += (maturity * weight) / 1e18; } /** * @notice Updates the position's level based on entry time. * @param relicId The NFT ID of the position being updated. * @return newLevel Level of position after update. */ function _updateLevel(uint relicId) internal returns (uint newLevel) { newLevel = levelOnUpdate(relicId); PositionInfo storage position = positionForId[relicId]; if (position.level != 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) internal override(ERC721, ERC721Enumerable) { ERC721Enumerable._beforeTokenTransfer(from, to, tokenId); } /** * @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 Utility function 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 == 0) { weightNew = 1e18; } else { if (oldValue < addedValue) { uint weightOld = (oldValue * 1e18) / (addedValue + oldValue); weightNew = 1e18 - weightOld; } else if (addedValue < oldValue) { weightNew = (addedValue * 1e18) / (addedValue + oldValue); } else { weightNew = 1e18 / 2; } } } /// @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); 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 ); 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/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. */ struct PoolInfo { uint accRewardPerShare; uint lastRewardTime; uint allocPoint; string name; } /** * @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 IERC721Enumerable { function setEmissionCurve(address _emissionCurve) external; function addPool( uint allocPoint, address _poolToken, address _rewarder, uint[] calldata requiredMaturity, uint[] calldata allocPoints, string memory name, address _nftDescriptor ) 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.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/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 v4.4.1 (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 Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); 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 v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } 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 (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.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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 = _owners[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 whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { 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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * 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); // Clear approvals delete _tokenApprovals[tokenId]; _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits 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. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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.7.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.7.0) (utils/structs/EnumerableSet.sol) 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) { return _values(set._inner); } // 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 on 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 (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @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 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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); }
{ "remappings": [ "base64/=lib/base64/", "cache_path /= 'forge-cache'/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "libs /= ['lib']/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "out /= 'out'/", "script /= 'scripts'/", "src /= 'contracts'/", "test /= 'test/foundry'/", "v2-core/=lib/v2-core/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": true, "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"}],"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":"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":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"CreateRelic","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"relicId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLevel","type":"uint256"}],"name":"LevelChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":true,"internalType":"address","name":"poolToken","type":"address"},{"indexed":true,"internalType":"address","name":"rewarder","type":"address"},{"indexed":false,"internalType":"address","name":"nftDescriptor","type":"address"}],"name":"LogPoolAddition","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":true,"internalType":"address","name":"rewarder","type":"address"},{"indexed":false,"internalType":"address","name":"nftDescriptor","type":"address"}],"name":"LogPoolModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"emissionCurveAddress","type":"address"}],"name":"LogSetEmissionCurve","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accRewardPerShare","type":"uint256"}],"name":"LogUpdatePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"toId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Merge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"toId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Shift","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"toId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Split","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"relicId","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","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"}],"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":"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
60a06040523461042f57615c4c6040813803918261001c81610433565b93849283398101031261042f5761003e602061003783610458565b9201610458565b906100496040610433565b91600f83526e1b585091515514c811195c1bdcda5d608a1b60208401526100706040610433565b60078152666d61424545545360c81b602082015283519092906001600160401b038111610343575f54600181811c91168015610425575b602082101461032557601f81116103c3575b50602094601f8211600114610362579481929394955f92610357575b50508160011b915f199060031b1c1916175f555b82516001600160401b03811161034357600154600181811c91168015610339575b602082101461032557601f81116102c2575b506020601f821160011461025f57819293945f92610254575b50508160011b915f199060031b1c1916176001555b6001600c55608052600f80546001600160a01b0319166001600160a01b0392909216919091179055335f9081525f516020615c2c5f395f51905f52602052604090205460ff1615610204575b5f8052600b6020526101c8337fdf7de25b7f1fd6d0b5205f0e18f1f35bd7b8d84cce336588d184533ce43a6f7661046c565b5060405161574f90816104dd823960805181818161029b0152818161095d0152818161167e0152818161282d01528181612fd201526133350152f35b335f8181525f516020615c2c5f395f51905f5260205260408120805460ff1916600117905581907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4610196565b015190505f80610135565b601f1982169060015f52805f20915f5b8181106102aa57509583600195969710610292575b505050811b0160015561014a565b01515f1960f88460031b161c191690555f8080610284565b9192602060018192868b01518155019401920161026f565b60015f527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6601f830160051c8101916020841061031b575b601f0160051c01905b818110610310575061011c565b5f8155600101610303565b90915081906102fa565b634e487b7160e01b5f52602260045260245ffd5b90607f169061010a565b634e487b7160e01b5f52604160045260245ffd5b015190505f806100d5565b601f198216955f8052805f20915f5b8881106103ab57508360019596979810610393575b505050811b015f556100e9565b01515f1960f88460031b161c191690555f8080610386565b91926020600181928685015181550194019201610371565b5f80527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563601f830160051c8101916020841061041b575b601f0160051c01905b81811061041057506100b9565b5f8155600101610403565b90915081906103fa565b90607f16906100a7565b5f80fd5b6040519190601f01601f191682016001600160401b0381118382101761034357604052565b51906001600160a01b038216820361042f57565b6001810190825f528160205260405f2054155f146104d55780546801000000000000000081101561034357600181018083558110156104c1578390825f5260205f20015554915f5260205260405f2055600190565b634e487b7160e01b5f52603260045260245ffd5b5050505f9056fe6080806040526004361015610012575f80fd5b5f905f3560e01c90816301ffc9a7146137f057508063030101db1461372f57806306fdde0314613668578063081812fc1461364a578063081e3eda1461362d578063095ea7b3146134a757806309f1c80a146131cf57806312f7086c146131b057806317caf6f11461319257806318160ddd1461317457806318fccc7614612e56578063215e83eb14612e2b57806323b872dd14612e06578063248a9ca314612dda5780632f2ff15d14612cff5780632f380b3514612baf5780632f745c5914612b8757806336568abe14612af457806342842e0e14612abf57806342966c6814612a58578063430c208114612a26578063441a3e70146126575780634f6ccce7146125c457806351eb05a6146125965780635312ea8e1461247557806357a5b58c1461240c5780636352211e146123db5780636705fcf3146123365780636e7d40191461230b5780636ecbae3f1461219957806370a08231146121755780637747dd8114611ff05780638d74c2bf14611d7d5780639010d07c14611d5057806391d1485414611d0657806395d89b4114611c235780639a0e584a146115bc5780639a67759b14611593578063a217fddf14611577578063a22cb465146114a7578063a6443e1e14611480578063ac9650d8146112c3578063b88d4fde14611239578063b9be8cd514611019578063bd75fd6c14610ed9578063c346253d14610e95578063c87b56dd14610d67578063ca15c87314610d3d578063d14d0a1a14610b74578063d1abb9071461069f578063d1c2babb1461044b578063d547741f14610404578063e2bbb158146103d3578063e48dc13514610325578063e985e9c5146102cd5763f7c618c114610286575f80fd5b346102ca57806003193601126102ca576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b80fd5b50346102ca5760403660031901126102ca5760406102e961391a565b916102f2613930565b9260018060a01b031681526005602052209060018060a01b03165f52602052602060ff60405f2054166040519015158152f35b50346102ca5760203660031901126102ca57604060c091610344614123565b50600435815260146020522060056040519161035f83613ad9565b8054835260018101546020840152600281015460408401526003810154606084015260048101546080840152015460a08201526103d1604051809260a0809180518452602081015160208501526040810151604085015260608101516060850152608081015160808501520151910152565bf35b50346102ca576103fc6103e536613a1f565b906103ee614153565b6103f782614299565b614c8c565b6001600c5580f35b50346102ca5760403660031901126102ca57610448600435610424613930565b9061044361043e825f52600a602052600160405f20015490565b6146ac565b6146f0565b80f35b50346102ca5761045a36613a1f565b90610463614153565b8181146106905761047381614299565b61047c82614299565b80835260146020526040832080546004820154908486526014602052604086209160048301548103610681578254926104b58385613cae565b9081156106725760038601546104cb9085613c7d565b82600383019182546104dd9089613c7d565b6104e691613cae565b906104f091613c90565b9055818155610503828686868c8c61503c565b97919661050f866147d3565b9761051987613b66565b5060010190610527916139d0565b90546105379160031b1c88613c7d565b9161054187613b66565b506001019061054f916139d0565b90549060031b1c61055f91613c7d565b61056891613cae565b6105729087613c7d565b64e8d4a510009004600282015461058891613cae565b906001015461059691613c5c565b92600182019384546105a791613c5c565b918215159760016105fa6105f460209a64e8d4a510009861060e98610601977f285dbc28e663286c77e3cd79d1cf1525744b4dfe015f41295fe5ae2858880bdf9f61065a575b5050613c7d565b94613b66565b50016139d0565b90549060031b1c90613c7d565b04905561061a846148ed565b8386526014825261064b6040872060055f918281558260018201558260028201558260038201558260048201550155565b604051908152a36001600c5580f35b60026106699101918254613cae565b90555f806105ed565b636677a12d60e11b8952600489fd5b634f13191b60e01b8752600487fd5b634cce529560e11b8352600483fd5b50346102ca576106ae36613a65565b90916106b8614153565b8015610b65576106c783614299565b8284526014602052604084209160048301549182916106e5836147d3565b908580549289936106f68682613c5c565b908184556005840154906107098c615133565b918d818414610abd5750836106018460016105fa6107c28f64e8d4a510008f9e9d9c998a6107b182849f6107c89f9d8a6107b19f89610601946107aa6107976105fa946107b69c879f6107648a60026105fa61078a94613b66565b6107778294925492838360031b1c613c5c565b919060031b91821b915f19901b19161790565b905560026105fa86613b66565b6107778294925492838360031b1c613cae565b9055613b66565b613c7d565b049b019a8b5490613c5c565b9e613b66565b0490556001600160a01b0381169687158080610ab4575b15610927575060029150016107f5858254613cae565b90555b6109135750849086610809856139b8565b905460039190911b1c6001600160a01b0316806108a7575b5050916020918361086c7f614253edaf5943287293d855afffbb1f5f0403c51c84143aceaf27a50727b2fc9561085688613988565b9054339160031b1c6001600160a01b0316614793565b604051908152857f191a58d19a6a9b76e2e91bdc04ecbe7553dc094a5ad7af78175a0d9f884e264a853393a4604051908152a46001600c5580f35b809193503b1561090f578280916044604051809681936305f7936f60e51b83528c60048401528760248401525af1928315610902578793156108215781929350906108f191613af4565b6108fe578490865f610821565b8580fd5b50604051903d90823e3d90fd5b8280fd5b634e487b7160e01b81526021600452602490fd5b15610934575b50506107f8565b60029192500190610946825486613cae565b6040516370a0823160e01b815230600482015290927f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691602081602481865afa908115610aa957908695949392918691610a70575b5084811115610a6557506109b88480613c5c565b9055826109c6575b5061092d565b6109d1918391614793565b6109da866139b8565b905460039190911b1c6001600160a01b031690816109f9575b806109c0565b908092503b1561090f57829160648392604051948593849263014a362160e71b84528d600485015260248401528b60448401525af18015610a5a57908291610a42575b806109f3565b90610a4c91613af4565b8087126102ca57805f610a3c565b6040513d84823e3d90fd5b6109b8908095613c5c565b9550506020853d602011610aa1575b81610a8c60209383613af4565b81010312610a9d578594515f6109a4565b5f80fd5b3d9150610a7f565b6040513d88823e3d90fd5b508615156107df565b92989950939596509350610b5157928796959392818a938997955f9889988b84610ae684613b66565b5060020190610af4916139d0565b8192915491828260031b1c90610b0991613c5c565b90610b20929060031b91821b915f19901b19161790565b905560016105fa6107c28264e8d4a510006107b6819c6107b16107c89d6106016107b19d876105fa6106019e613b66565b634e487b7160e01b8b52602160045260248bfd5b631f2a200560e01b8452600484fd5b50346102ca5760203660031901126102ca57610b8e61391a565b610b9781613f39565b610ba08161401e565b90610baa81614007565b92610bb86040519485613af4565b818452601f19610bc783614007565b01855b818110610d26575050845b828110610c9b575050509060405192839260408401604085528151809152602060608601920190835b818110610c82575050508381036020850152602080845192838152019301915b818110610c2c575050500390f35b91935091602060c082610c74600194885160a0809180518452602081015160208501526040810151604085015260608101516060850152608081015160808501520151910152565b019401910191849392610c1e565b8251845287965060209384019390920191600101610bfe565b80610ca860019284613e31565b610cb2828761410f565b52610cbd818661410f565b518752601460205260408720600560405191610cd883613ad9565b80548352848101546020840152600281015460408401526003810154606084015260048101546080840152015460a0820152610d14828861410f565b52610d1f818761410f565b5001610bd5565b602090610d31614123565b82828901015201610bca565b50346102ca5760203660031901126102ca5760406020916004358152600b83522054604051908152f35b50346102ca5760203660031901126102ca576004355f818152600260205260409020546001600160a01b031615610e8657808252601460205281610db1600460408320015461395c565b90546040516344a5a61760e11b815260048101949094528391602491839160031b1c6001600160a01b03165afa908115610a5a578291610e06575b60405160208082528190610e02908201856138f6565b0390f35b90503d8083833e610e178183613af4565b81019060208183031261090f578051906001600160401b038211610e82570181601f8201121561090f57805190610e4d82613b15565b92610e5b6040519485613af4565b82845260208383010111610e825781610e02949260208093018386015e830101525f610dec565b8380fd5b631d1286b560e31b8252600482fd5b50346102ca5760203660031901126102ca57600435906013548210156102ca576020610ec0836139b8565b905460405160039290921b1c6001600160a01b03168152f35b50346102ca5760203660031901126102ca57610ef361391a565b610efc81613f39565b610f0581614007565b91610f136040519384613af4565b818352601f19610f2283614007565b01845b818110610ff0575050835b828110610f94578385604051918291602083016020845282518091526020604085019301915b818110610f64575050500390f35b91935091602060606001926040875180518352848101518584015201516040820152019401910191849392610f56565b80610fa160019284613e31565b80875260146020526004604088200154610fba82613cbb565b9060405192610fc884613a8f565b835260208301526040820152610fde828761410f565b52610fe9818661410f565b5001610f30565b602090604051610fff81613a8f565b878152878382015287604082015282828801015201610f25565b50346102ca5760603660031901126102ca5760243560043560443561103c614153565b8015610b655782821461122a5761105282614299565b61105b83614299565b818452601460205260408420805490600481015491858752601460205260408720926004840154810361121b5791839161111e95938895546110a1600385015484613c7d565b6110cd6110bd60038801926110b7845486613c7d565b90613cae565b6110c78487613cae565b90613c90565b90556110d98684613c5c565b908185556110f98a8289866110ee8284613cae565b9c8d94858d5561503c565b929064e8d4a5100061113261112b611110896147d3565b9e8f9660016105fa8c613b66565b90549060031b1c86613c7d565b8099613c7d565b049761114460018201998a5490613c5c565b9081611203575b505061115686613b66565b5060010190611164916139d0565b90549060031b1c61117491613c7d565b9061117e91613c7d565b64e8d4a510009004956001810196875461119791613c5c565b908115157fda2a03409498a5fe8db3da030754afa618bc2228c0517ec5fa8c9b052979e9ea9b60209b64e8d4a51000998a6111e96111f19b6106019a6001996105fa996105f49961065a575050613c7d565b049055613c7d565b049055604051908152a36001600c5580f35b60026112129101918254613cae565b90555f8061114b565b634f13191b60e01b8852600488fd5b634cce529560e11b8452600484fd5b50346102ca5760803660031901126102ca5761125361391a565b61125b613930565b90606435906044356001600160401b0383116112bf57366023840112156112bf57610448936112976112ba943690602481600401359101613b30565b926112aa6112a584336142b9565b613dcf565b6112b583838361432e565b61538a565b61501c565b8480fd5b50346102ca5760203660031901126102ca576004356001600160401b03811161147c576112f4903690600401613a35565b906112fe82614007565b9061130c6040519283613af4565b828252601f1961131b84614007565b01845b81811061146957505036819003601e190190845b84811015611402578060051b820135838112156113fe578201908135916001600160401b0383116113fa5760200182360381136113fa5761137a6113de916001943691613b30565b888060609261138c6040519485613af4565b602784527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c6020850152660819985a5b195960ca1b6040850152602081519101305af46113d761526b565b9030615680565b6113e8828761410f565b526113f3818661410f565b5001611332565b8780fd5b8680fd5b83866040519182916020830160208452825180915260408401602060408360051b870101940192905b82821061143a57505050500390f35b919360019193955060206114598192603f198a820301865288516138f6565b960192019201859493919261142b565b606060208286018101919091520161131e565b5080fd5b50346102ca5760203660031901126102ca57602061149f60043561409c565b604051908152f35b50346102ca5760403660031901126102ca576114c161391a565b6024359081151580920361090f576001600160a01b03169033821461153257338352600560205260408320825f5260205260405f2060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606490fd5b50346102ca57806003193601126102ca57602090604051908152f35b50346102ca57806003193601126102ca57600f546040516001600160a01b039091168152602090f35b50346102ca5760e03660031901126102ca576004356115d9613930565b6115e1613946565b6064356001600160401b0381116112bf57611600903690600401613a35565b906084356001600160401b0381116113fe57611620903690600401613a35565b929060a4356001600160401b038111611c1f5736602382011215611c1f57611652903690602481600401359101613b30565b60c43594906001600160a01b0386168603611c1b5761166f6145c9565b6001600160a01b0388811698907f0000000000000000000000000000000000000000000000000000000000000000168914611c0c578415611bfd57828503611bee578535611bdf5760018511611b96575b6010548b5b818110611b835750506116da8a601554613cae565b8015611b7457601555601254600160401b811015611b24579061170882600161172c940160125560126139d0565b81546001600160a01b0393841660039290921b91821b9390911b1916919091179055565b601354600160401b811015611b605787611708826001611751940160135560136139d0565b600e54600160401b811015611b6057866117088260016117769401600e55600e6139d0565b60405161178281613abe565b8a81526020810142815260408201908b825260608301938452601054600160401b811015611b4c578060016117ba9201601055613c40565b939093611b38579060039392915183555160018301555160028201550190518051906001600160401b038211611b24576117fe826117f88554613bcc565b85613fc4565b6020908c601f8411600114611abc576118619695949361183493909283611ab1575b50508160011b915f199060031b1c19161790565b90555b6118586118438261401e565b956040519561185187613a8f565b3691614050565b84523691614050565b6020820190815260408201928352601154600160401b811015611a9d5780600161188e9201601155613b66565b929092611a8957518051906001600160401b038211611a4657600160401b8211611a46576020908a855484875584818110611a6e575b50505001838a5260208a208a5b838110611a5a5750505050600182019051908151916001600160401b038311611a4657600160401b8311611a46576020908a835485855585818110611a2b575b5050500190895260208920895b838110611a1757505050506002019051908151916001600160401b038311611a0357600160401b8311611a035760209082548484558085106119e9575b500190875260208720875b8381106119d55750505050601254915f1983019283116119c157604080519586526001600160a01b0392831660208701529116937f916c1141fd0c2a70bb95c6e9f2376006b00f90a78c0db17abbf423c61db950df9190a480f35b634e487b7160e01b86526011600452602486fd5b600190602084519401938184015501611966565b838a52828a206119fd918101908601613fae565b5f61195b565b634e487b7160e01b88526041600452602488fd5b60019060208451940193818401550161191e565b848387611a3e9552209182019101613fae565b8a5f85611911565b634e487b7160e01b8a52604160045260248afd5b6001906020845194019381840155016118d1565b848389611a819552209182019101613fae565b8a5f846118c4565b634e487b7160e01b89526004899052602489fd5b634e487b7160e01b89526041600452602489fd5b015190505f80611820565b9190601f198416858452828420935b818110611b0c5750916001939185611861999897969410611af4575b505050811b019055611837565b01515f1960f88460031b161c191690555f8080611ae7565b92936020600181928786015181550195019301611acb565b634e487b7160e01b8c52604160045260248cfd5b634e487b7160e01b8e5260048e905260248efd5b634e487b7160e01b8e52604160045260248efd5b634e487b7160e01b8b52604160045260248bfd5b632ae6f6af60e11b8c5260048cfd5b80611b8f6001926147d3565b50016116c5565b60018b5b868210611ba85750506116c0565b611bb382888a613ebb565b351115611bd0576001611bc782888a613ebb565b35910190611b9a565b6367c462f760e01b8c5260048cfd5b6369afe63f60e11b8b5260048bfd5b63512509d360e11b8b5260048bfd5b63521299a960e01b8b5260048bfd5b63c982c8c360e01b8b5260048bfd5b8980fd5b8880fd5b50346102ca57806003193601126102ca57604051908060015490611c4682613bcc565b8085529160018116908115611cdf5750600114611c82575b610e0284611c6e81860382613af4565b6040519182916020835260208301906138f6565b600181527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6939250905b808210611cc557509091508101602001611c6e82611c5e565b919260018160209254838588010152019101909291611cac565b60ff191660208087019190915292151560051b85019092019250611c6e9150839050611c5e565b50346102ca5760403660031901126102ca576040611d22613930565b916004358152600a602052209060018060a01b03165f52602052602060ff60405f2054166040519015158152f35b50346102ca5760403660031901126102ca57610ec06020916004358152600b8352604060243591206139d0565b50346102ca5760c03660031901126102ca5760043590602435611d9e613946565b92606435936001600160401b038511610e825736602386011215610e82578460040135906001600160401b0382116112bf5736602483880101116112bf57608435916001600160a01b03831683036108fe5760a4359081151582036113fe57611e056145c9565b60105480861015611fe157875b818110611fce575050611e2485613c40565b50611e3187601554613cae565b611e416002830191825490613c5c565b8015611fbf5760155587905560039083611fad575b0190611e6c81611e668454613bcc565b84613fc4565b87601f8211600114611f20579080611ebd928a9b7ffa4328c2a1268b2b661914d91df191c5271c699ddc97ccedda086c6d25b099f9999a9b92611f125750508160011b915f199060031b1c19161790565b90555b611ecd836117088761395c565b15611ef1575b604080519586526001600160a01b039283166020870152911693a380f35b50611efb836139b8565b905460039190911b1c6001600160a01b0316611ed3565b602492500101355f80611820565b8289526020892090601f1983168a5b818110611f9257509a8392916001947ffa4328c2a1268b2b661914d91df191c5271c699ddc97ccedda086c6d25b099f99a9b9c9d10611f76575b505050811b019055611ec0565b01602401355f19600384901b60f8161c191690555f8080611f69565b8c830160240135845560019093019260209283019201611f2f565b611fba85611708896139b8565b611e56565b632ae6f6af60e11b8a5260048afd5b80611fda6001926147d3565b5001611e12565b63904e0f5960e01b8852600488fd5b50346102ca57611fff36613a65565b92909161200a614153565b82156121665761201981614299565b808252601460205260408220938454946120338587613c5c565b9182825561204081614ada565b958686818098526014602052604081208381556003860154600382015560058601549081600582015560048701549182600483015561207e836147d3565b9061208884613b66565b5060010190612096916139d0565b90549060031b1c6120a691613c7d565b6120b181809e613c7d565b64e8d4a5100090049860018901998a546120ca91613c5c565b8015159e60209f9b60209b6121176001967fcf0974dfd867840133a0d4b02f1672f24017796fb8892d1e0d587692e4da90ab9f966121209664e8d4a510009894899561065a575050613c7d565b04905588613c7d565b04910155604051946001600160a01b0316917fb1ef6f1c5fca9fc83b81f6c18e6269a7942f041cadd830c353bb90f8680a3d4d9080a48152a36001600c55604051908152f35b631f2a200560e01b8252600482fd5b50346102ca5760203660031901126102ca57602061149f61219461391a565b613f39565b50346102ca5760203660031901126102ca576121b361391a565b7ff0df1ecf66245243e1fe66eca783e2b1f173c34d37828b8788a74623e9a73e028252600a60209081526040808420335f908152925290205460ff161561223a57600f80546001600160a01b0319166001600160a01b039290921691821790557f097cb0b4d8d03c9f5f6d24fdb4d1c0764243aab030e9e385b0295badfe7a73e28280a280f35b61230760206122e760118561224e336153f3565b9060378561227b7ff0df1ecf66245243e1fe66eca783e2b1f173c34d37828b8788a74623e9a73e026154d9565b60405197889576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b828801528051918291018588015e8501907001034b99036b4b9b9b4b733903937b6329607d1b84830152805192839101604883015e010190838201520301601f198101835282613af4565b60405162461bcd60e51b81526020600482015291829160248301906138f6565b0390fd5b50346102ca5760203660031901126102ca57600435906012548210156102ca576020610ec083613988565b50346102ca5760603660031901126102ca5761235061391a565b60243561235b614153565b6010548110156123cc579160209261237283614ada565b9182918282526014865280600460408420015561239183604435614c8c565b604051946001600160a01b0316917fb1ef6f1c5fca9fc83b81f6c18e6269a7942f041cadd830c353bb90f8680a3d4d9080a46001600c558152f35b63904e0f5960e01b8352600483fd5b50346102ca5760203660031901126102ca5760206123fa600435613f17565b6040516001600160a01b039091168152f35b50346102ca5760203660031901126102ca576004356001600160401b03811161147c5761243d903690600401613a35565b612445614153565b825b81811061245757836001600c5580f35b8061246e6124686001938587613ebb565b356147d3565b5001612447565b50346102ca5760203660031901126102ca57600435612492614153565b61249b81613f17565b6001600160a01b038116903382036125875782845260146020527f6aaee64d11e8979fa392cd6388058c820f43709933f6a297e6e1005dddca62d6602060408620926125788454809261251c612508600489015498600260056124fd8c613b66565b5092015491016139d0565b819291549061077786838360031b1c613c5c565b9055612527896148ed565b888a526014855261255860408b2060055f918281558260018201558260028201558260038201558260048201550155565b61256187613988565b905460039190911b1c6001600160a01b0316614793565b604051908152a46001600c5580f35b6330cd747160e01b8452600484fd5b50346102ca5760203660031901126102ca576125b0614153565b6125bb6004356147d3565b506001600c5580f35b50346102ca5760203660031901126102ca576004356008548110156125fd576125ee6020916139a0565b90549060031b1c604051908152f35b60405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608490fd5b50346102ca5761266636613a1f565b9061266f614153565b8015612a175761267e82614299565b818352601460205260408320600481015490612699826147d3565b8282549287926126a98786613c5c565b908183556005830154916126bc8a615133565b928b81851461297d5750916107b18261060164e8d4a5100061270b856107b18e8e9f8b8f6105fa8f91899f9e6127279f6107976001956106019861078a6107646107aa9560026105fa8a613b66565b049660016105fa612721828c019a8b5490613c5c565b9b613b66565b0490558282156127f9575060026127419101918254613cae565b90555b610913575083612753826139b8565b905460039190911b1c6001600160a01b0316806127ae575b505061277a8261085683613988565b6040519182527f191a58d19a6a9b76e2e91bdc04ecbe7553dc094a5ad7af78175a0d9f884e264a60203393a46001600c5580f35b803b1561147c578180916044604051809481936305f7936f60e51b83528a60048401528960248401525af18015610a5a571561276b57816127ee91613af4565b610e8257835f61276b565b612805575b5050612744565b600201805490925061281691613cae565b6040516370a0823160e01b815230600482015290917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691602081602481865afa908115612972579085949392918591612939575b50849291908481111561292e575061288b8480613c5c565b905582612899575b506127fe565b6128a4918391614793565b6128ad846139b8565b905460039190911b1c6001600160a01b031690816128cd575b8290612893565b908092503b1561090f57829160648392604051948593849263014a362160e71b84528b600485015260248401528160448401525af18015610a5a57908291612916575b806128c6565b9061292091613af4565b8085126102ca57805f612910565b61288b908095613c5c565b92919450506020823d60201161296a575b8161295760209383613af4565b81010312610a9d57905184939084612873565b3d915061294a565b6040513d87823e3d90fd5b919650969192939450612a03579086939291815f978897878c836129a083613b66565b50600201906129ae916139d0565b8192915491828260031b1c906129c391613c5c565b906129da929060031b91821b915f19901b19161790565b905564e8d4a5100061270b81976107b1612727986106016107b19860016105fa61060199613b66565b634e487b7160e01b8a52602160045260248afd5b631f2a200560e01b8352600483fd5b50346102ca5760403660031901126102ca576020612a4e612a4561391a565b602435906142b9565b6040519015158152f35b50346102ca5760203660031901126102ca5760043580825260146020526040822054612ab057612a8781613cbb565b612aa15780612a9c6112a561044893336142b9565b6148ed565b63faaea8f160e01b8252600482fd5b63f25a119760e01b8252600482fd5b50346102ca576104486112ba612ad4366139e5565b9060405192612ae4602085613af4565b8684526112aa6112a584336142b9565b50346102ca5760403660031901126102ca57612b0e613930565b336001600160a01b03821603612b2a57610448906004356146f0565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b50346102ca5760403660031901126102ca57602061149f612ba661391a565b60243590613e31565b50346102ca5760203660031901126102ca57606080604051612bd081613abe565b8381528360208201528360408201520152612bec600435613c40565b509060405190612bfb82613abe565b825482526001830154926020830193845260036002820154916040850192835201916040519281815491612c2e83613bcc565b8087529260018116908115612cd35750600114612c8e575b50505090612c5a83610e0294930383613af4565b60608401918252604051948594602086525160208601525160408501525160608401525160808084015260a08301906138f6565b81526020812094939250905b808210612cb75750919250908201602001612c5a83610e02612c46565b9192936001816020925483858901015201910190939291612c9a565b60ff191660208089019190915293151560051b87019093019350612c5a9250859150610e029050612c46565b50346102ca5760403660031901126102ca57612d7d600435612d1f613930565b90612d3961043e825f52600a602052600160405f20015490565b808452600a6020526040842060018060a01b0383165f5260205260ff60405f20541615612d81575b8352600b602052604083206001600160a01b039091169061557b565b5080f35b808452600a602090815260408086206001600160a01b0385165f8181529190935220805460ff191660011790553390827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8780a4612d61565b50346102ca5760203660031901126102ca57602061149f6004355f52600a602052600160405f20015490565b50346102ca57610448612e18366139e5565b91612e266112a584336142b9565b61432e565b50346102ca5760203660031901126102ca5760043590600e548210156102ca576020610ec08361395c565b50346102ca5760403660031901126102ca57600435612e73613930565b612e7b614153565b612e8482614299565b818352601460205260408320908360048301548092612ea2826147d3565b908580549285936005830154612eb78b615133565b9080821461311857879850826106018360016105fa612f2e8264e8d4a510008e9f8c6107b1612f21849f9d9c612f349f6105fa6107b19f9689926107aa6107976107b69a61078a612f0d8960026105fa89613b66565b819291549061077788838360031b1c613c5c565b90549060031b1c8b613c7d565b9d613b66565b0490556001600160a01b038116958615808061310f575b15612f9c57506002915001612f61848254613cae565b90555b610913575060207f614253edaf5943287293d855afffbb1f5f0403c51c84143aceaf27a50727b2fc91604051908152a46001600c5580f35b15612fa9575b5050612f64565b60029192500190612fbb825485613cae565b6040516370a0823160e01b815230600482015290927f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691602081602481865afa908115610aa9579086959493929186916130da575b50848111156130cf575061302d8480613c5c565b90558261303b575b50612fa2565b613046918391614793565b61304f856139b8565b905460039190911b1c6001600160a01b0316908161306e575b80613035565b908092503b1561090f57829160648392604051948593849263014a362160e71b84528c600485015260248401528a60448401525af18015610a5a579082916130b7575b80613068565b906130c191613af4565b8086126102ca57805f6130b1565b61302d908095613c5c565b9550506020853d602011613107575b816130f660209383613af4565b81010312610a9d578594515f613019565b3d91506130e9565b50851515612f4b565b935095509590929350613160578594939291879181875f97610601899860016105fa612f2e8264e8d4a510006107b6819c6107b1612f21612f349e866105fa6107b19f613b66565b634e487b7160e01b89526021600452602489fd5b50346102ca57806003193601126102ca576020600854604051908152f35b50346102ca57806003193601126102ca576020601554604051908152f35b50346102ca5760203660031901126102ca57602061149f600435613cbb565b5034610a9d576020366003190112610a9d57600435906131ed614153565b5f828152600260205260409020546001600160a01b03161561349857815f52601460205260405f20600481015490613224826147d3565b938154925f9360058401549661323984615133565b978881811461347357916107b164e8d4a510006132ab836107b161329e878a613290610797889c8f6105fa816132cc9f61327c6107aa9160026105fa8197613b66565b81929154906107778b838360031b1c613c5c565b90555b60016105fa8d613b66565b90549060031b1c89613c7d565b04946106016132c060018b0197885490613c5c565b9c60016105fa8a613b66565b04905585156132f9575050926132e9600283949501918254613cae565b90555b61091357506001600c5580f35b90918361330d575b505050809192506132ec565b600261331d910195865490613cae565b6040516370a0823160e01b81523060048201529590917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691602088602481865afa8015610aa957869798879161343e575b5084811115613433575061338b8480613c5c565b9055848361339e575b5050859450613301565b836133ac916133b194614793565b6139b8565b905460039190911b1c6001600160a01b031691826133d1575b8084613394565b90918093503b15610e8257906064849283604051958694859363014a362160e71b8552600485015260248401528160448401525af18015610a5a5790829161341b575b80806133ca565b9061342591613af4565b8082126102ca57805f613414565b61338b908095613c5c565b9650506020863d60201161346b575b8161345a60209383613af4565b81010312610a9d578695515f613377565b3d915061344d565b509550955064e8d4a510006132cc5f976107b1836132ab836107b161329e5f9d613293565b631d1286b560e31b5f5260045ffd5b34610a9d576040366003190112610a9d576134c061391a565b602435906001600160a01b036134d583613f17565b6001600160a01b0390921691168181146135de578033149081156135ba575b501561354f575f82815260046020526040902080546001600160a01b031916821790556001600160a01b0361352883613f17565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f80a4005b60405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608490fd5b5f90815260056020908152604080832033845290915290205460ff169050836134f4565b60405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b34610a9d575f366003190112610a9d576020601054604051908152f35b34610a9d576020366003190112610a9d5760206123fa600435613c04565b34610a9d575f366003190112610a9d576040515f5f5461368781613bcc565b808452906001811690811561370b57506001146136af575b610e0283611c6e81850382613af4565b5f8080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563939250905b8082106136f157509091508101602001611c6e61369f565b9192600181602092548385880101520191019092916136d9565b60ff191660208086019190915291151560051b84019091019150611c6e905061369f565b34610a9d576020366003190112610a9d5760606040805161374f81613a8f565b82815282602082015201526137ca613768600435613b66565b50610e026040519161377983613a8f565b61378281613b82565b83526137dd6137a6600261379860018501613b82565b936020870194855201613b82565b916040850192835260405195869560208752516060602088015260808701906138c3565b9051858203601f190160408701526138c3565b9051838203601f190160608501526138c3565b34610a9d576020366003190112610a9d576004359063ffffffff60e01b8216809203610a9d5760209163dd614ea960e01b8114908115613832575b5015158152f35b635a05180f60e01b81149150811561384c575b508361382b565b637965db0b60e01b811491508115613866575b5083613845565b63780e9d6360e01b811491508115613880575b508361385f565b6380ac58cd60e01b8114915081156138b2575b81156138a1575b5083613879565b6301ffc9a760e01b1490508361389a565b635b5e139f60e01b81149150613893565b90602080835192838152019201905f5b8181106138e05750505090565b82518452602093840193909201916001016138d3565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b0382168203610a9d57565b602435906001600160a01b0382168203610a9d57565b604435906001600160a01b0382168203610a9d57565b600e5481101561397457600e5f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b6012548110156139745760125f5260205f2001905f90565b6008548110156139745760085f5260205f2001905f90565b6013548110156139745760135f5260205f2001905f90565b8054821015613974575f5260205f2001905f90565b6060906003190112610a9d576004356001600160a01b0381168103610a9d57906024356001600160a01b0381168103610a9d579060443590565b6040906003190112610a9d576004359060243590565b9181601f84011215610a9d578235916001600160401b038311610a9d576020808501948460051b010111610a9d57565b6060906003190112610a9d5760043590602435906044356001600160a01b0381168103610a9d5790565b606081019081106001600160401b03821117613aaa57604052565b634e487b7160e01b5f52604160045260245ffd5b608081019081106001600160401b03821117613aaa57604052565b60c081019081106001600160401b03821117613aaa57604052565b90601f801991011681019081106001600160401b03821117613aaa57604052565b6001600160401b038111613aaa57601f01601f191660200190565b929192613b3c82613b15565b91613b4a6040519384613af4565b829481845281830111610a9d578281602093845f960137010152565b6011548110156139745760115f52600360205f20910201905f90565b90604051918281549182825260208201905f5260205f20925f5b818110613bb3575050613bb192500383613af4565b565b8454835260019485019487945060209093019201613b9c565b90600182811c92168015613bfa575b6020831014613be657565b634e487b7160e01b5f52602260045260245ffd5b91607f1691613bdb565b5f81815260026020526040902054613c26906001600160a01b03161515613ecb565b5f908152600460205260409020546001600160a01b031690565b6010548110156139745760105f5260205f209060021b01905f90565b91908203918211613c6957565b634e487b7160e01b5f52601160045260245ffd5b81810292918115918404141715613c6957565b8115613c9a570490565b634e487b7160e01b5f52601260045260245ffd5b91908201809211613c6957565b5f52601460205260405f20600481015490613cd582613c40565b5091825492613ce3826141a9565b906001810154613cf38142613c5c565b9081151580613dc6575b613d50575b50505050613d4464e8d4a51000613d38613d4d956107b1600195610601613d2a895492613b66565b508860058b015491016139d0565b04600284015490613cae565b91015490613c5c565b90565b916002613d6c613d7593613d66613d7e96614202565b90613c7d565b91015490613c7d565b60155490613c90565b9064e8d4a5100082029180830464e8d4a510001490151715613c6957613d386001936107b1613dbd613d4d986110b764e8d4a5100096613d4498613c90565b97505093613d02565b50831515613cfd565b15613dd657565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b613e3a81613f39565b821015613e625760018060a01b03165f52600660205260405f20905f5260205260405f205490565b60405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608490fd5b91908110156139745760051b0190565b15613ed257565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b5f908152600260205260409020546001600160a01b0316613d4d811515613ecb565b6001600160a01b03168015613f57575f52600360205260405f205490565b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b818110613fb9575050565b5f8155600101613fae565b9190601f8111613fd357505050565b613bb1925f5260205f20906020601f840160051c83019310613ffd575b601f0160051c0190613fae565b9091508190613ff0565b6001600160401b038111613aaa5760051b60200190565b9061402882614007565b6140356040519182613af4565b8281528092614046601f1991614007565b0190602036910137565b92919061405c81614007565b9361406a6040519586613af4565b602085838152019160051b8101928311610a9d57905b82821061408c57505050565b8135815260209182019101614080565b5f52601460205260405f20906140b56004830154613b66565b5091825490600182146141085760036140d091015442613c5c565b905f198101908111613c695792905b90926140eb81856139d0565b90549060031b1c821015614103575f190192906140df565b925050565b505f925050565b80518210156139745760209160051b010190565b6040519061413082613ad9565b5f60a0838281528260208201528260408201528260608201528260808201520152565b6002600c5414614164576002600c55565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b906141b45f92613b66565b506002810180549060015f9301905b8284106141d05750505050565b909192946141f86001916110b76141e789866139d0565b90549060031b1c6106018a886139d0565b95019291906141c3565b90602060018060a01b03600f5416926024604051809581936315dd902560e21b835260048301525afa91821561428e575f9261425a575b506753444835ec580000821161424b57565b632dfc35e960e21b5f5260045ffd5b9091506020813d602011614286575b8161427660209383613af4565b81010312610a9d5751905f614239565b3d9150614269565b6040513d5f823e3d90fd5b6142a390336142b9565b156142aa57565b63390cdd9b60e21b5f5260045ffd5b906001600160a01b036142cb82613f17565b6001600160a01b039093169216828114929190831561430b575b5082156142f157505090565b9091506001600160a01b039061430690613c04565b161490565b9092505f52600560205260405f20815f5260205260ff60405f205416915f6142e5565b9061433883613f17565b6001600160a01b03838116929116829003614576576001600160a01b03811692831561452557826144805750600854845f5260096020528060405f2055600160401b811015613aaa576143ab6143958260018894016008556139a0565b819391549060031b91821b915f19901b19161790565b90555b81830361444c575b50825f52600460205260405f206001600160601b0360a01b8154169055805f52600360205260405f208054905f198201918211613c695755815f52600360205260405f2080549060018201809211613c6957555f83815260026020526040812080546001600160a01b031916841790557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080a4565b61445590613f39565b825f52600660205260405f20815f526020528360405f2055835f52600760205260405f20555f6143b6565b83830361448e575b506143ae565b61449790613f39565b5f198101908111613c6957845f52600760205260405f20548181036144e4575b50845f5260076020525f6040812055825f52600660205260405f20905f526020525f60408120555f614488565b835f52600660205260405f20825f5260205260405f2054845f52600660205260405f20825f526020528060405f20555f52600760205260405f20555f6144b7565b60405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b335f9081527fcc154f7b876a360d54d1dd91709acfea951faf52857cd1bb669415168b037aed602052604090205460ff161561460157565b61230760206122e76011614614336153f3565b6037846146407f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c6154d9565b60405196879476020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b828701528051918291018587015e8401907001034b99036b4b9b9b4b733903937b6329607d1b84830152805192839101604883015e01015f838201520301601f198101835282613af4565b5f818152600a6020908152604080832033845290915290205460ff16156146d05750565b60206122e76011612307936037846146406146ea336153f3565b936154d9565b9061473a91805f52600a60205260405f2060018060a01b0383165f5260205260ff60405f20541661473d575b5f908152600b602052604090206001600160a01b03909116906155cf565b50565b5f818152600a602090815260408083206001600160a01b03861680855292528220805460ff19169055339183907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a461471c565b60405163a9059cbb60e01b60208201526001600160a01b039092166024830152604480830193909352918152613bb1916147ce606483613af4565b615188565b906010548210156148de576147e782613c40565b5091600183018054906147fa8242613c5c565b948054958061480b575b5050505050565b614814856141a9565b9384614863575b5050507fcb7325664a4a3b7c7223eefc492a97ca4fdf94d46884621e5a8fae5a04b2b9d291606091429055604051904282526020820152856040820152a25f80808080614804565b61487b61488692613d66613d75939a9697959a614202565b600289015490613c7d565b9264e8d4a5100084029380850464e8d4a510001490151715613c69576148d36060936110b7847fcb7325664a4a3b7c7223eefc492a97ca4fdf94d46884621e5a8fae5a04b2b9d297613c90565b80975591819361481b565b63904e0f5960e01b5f5260045ffd5b6148f681613f17565b6001600160a01b0381169081614a445750600854825f5260096020528060405f2055600160401b811015613aaa576149386143958260018694016008556139a0565b90555b6008545f198101908111613c6957825f52600960205261495f60405f2054916139a0565b90549060031b1c80614973614395846139a0565b90555f52600960205260405f2055815f5260096020525f60408120556008548015614a30575f19016149a4816139a0565b8154905f199060031b1b19169055600855815f52600460205260405f206001600160601b0360a01b8154169055805f52600360205260405f209081545f198101908111613c69575f92558282526002602052604082206001600160601b0360a01b81541690557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4565b634e487b7160e01b5f52603160045260245ffd5b614a4d90613f39565b5f198101908111613c6957825f52600760205260405f2054818103614a99575b50825f5260076020525f6040812055815f52600660205260405f20905f526020525f604081205561493b565b825f52600660205260405f20825f5260205260405f2054835f52600660205260405f20825f526020528060405f20555f52600760205260405f20555f614a6d565b90600d545f198114613c69576001019182600d558260209060405190614b008383613af4565b5f82526001600160a01b038416938415801590614c49575f838152600260205260409020546001600160a01b0316614c0457600854835f52600986528060405f2055600160401b811015613aaa57614b626143958260018794016008556139a0565b9055614bd4575b845f526003845260405f209485549060018201809211613c695760026112ba968593613bb19955835f525260405f20816001600160601b0360a01b8254161790555f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a461529a565b614bdd81613f39565b855f526006855260405f20815f5285528260405f2055825f526007855260405f2055614b69565b60405162461bcd60e51b815260048101869052601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b6064856040519062461bcd60e51b825280600483015260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152fd5b5f8115614fba57825f52601460205260405f2090600482015491614caf836147d3565b90805491865f52601460205260405f20805480155f14614f125750614cfc6003670de0b6b3a7640000925b0191670de0b6b3a7640000614cf58454926107b18442613c5c565b0490613cae565b9055614d088684613cae565b90818355600583015493614d1b89615133565b9487818714614ea25764e8d4a51000614d62856107b1866106018760016105fa8f998e6107aa8b9f9d614d839f9d6107b19e61078a6107646107979460026105fa8a613b66565b0494610601614d776001890197885490613c5c565b9860016105fa8d613b66565b0490558115614e9b576002614d9b9101918254613cae565b90555b614da7826139b8565b905460039190911b1c6001600160a01b03169081614e4e575b5050614e0f614dce82613988565b90546040516323b872dd60e01b6020820152336024820152306044820152606480820187905281529160031b1c6001600160a01b03166147ce608483613af4565b7f9a2a1e97e6d641080089aafc36750cfdef4c79f8b3ace6fa4c384fa2f047695960206001600160a01b03614e4386613f17565b1693604051908152a4565b813b15610a9d575f80926044604051809581936303004b4760e01b83528a60048401528960248401525af1801561428e5715614dc057614e8f5f8093613af4565b12610a9d575f80614dc0565b5050614d9e565b509550815f968881614eb382613b66565b5060020190614ec1916139d0565b8154908d828260031b1c90614ed591613cae565b90614eec929060031b91821b915f19901b19161790565b9055614d6264e8d4a51000956107b1614d83966106016107b19660016105fa8c98613b66565b87811015614f6857670de0b6b3a76400008102818104670de0b6b3a764000003613c69576110c7614f43928a613cae565b670de0b6b3a764000003670de0b6b3a76400008111613c69576003614cfc9192614cda565b80881015614fa557670de0b6b3a76400008802888104670de0b6b3a764000003613c6957614f9f6003916110c7614cfc948c613cae565b92614cda565b50614cfc60036706f05b59d3b2000092614cda565b631f2a200560e01b5f5260045ffd5b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561502357565b60405162461bcd60e51b81528061230760048201614fc9565b959293909491955f526014602052600560405f20015495855f52601460205261506c600560405f20015496615133565b948592838914158061511a575b8489141590816150ed575b80806150e6575b156150aa57505050506150a69160026105fa61079793613b66565b9055565b9295509091156150c85750506150a69160026105fa61079793613b66565b9093506150d457505050565b6150a69160026105fa61079793613b66565b508161508b565b6151136150ff8b60026105fa89613b66565b819291549061077787838360031b1c613c5c565b9055615084565b61512c6150ff8b60026105fa88613b66565b9055615079565b9061513d8261409c565b91805f52601460205282600560405f20018181540361515b57505050565b557f8bdaee675270281b7bc2d5b9ced20517ecf5ce96158973ef78072a7bc1491b446020604051858152a2565b906151e89160018060a01b03165f80604051936151a6604086613af4565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564602086015260208151910182855af16151e261526b565b91615680565b8051806151f3575050565b8160209181010312610a9d5760200151801590811503610a9d5761521357565b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b3d15615295573d9061527c82613b15565b9161528a6040519384613af4565b82523d5f602084013e565b606090565b91823b15615382576152df926020925f604051809681958294630a85bd0160e11b845233600485015284602485015260448401526080606484015260848301906138f6565b03926001600160a01b03165af15f918161533d575b506153275761530161526b565b805190816153225760405162461bcd60e51b81528061230760048201614fc9565b602001fd5b6001600160e01b031916630a85bd0160e11b1490565b9091506020813d60201161537a575b8161535960209383613af4565b81010312610a9d57516001600160e01b031981168103610a9d57905f6152f4565b3d915061534c565b505050600190565b919290803b156153d9576152df935f60209460405196879586948593630a85bd0160e11b855233600486015260018060a01b0316602485015260448401526080606484015260848301906138f6565b50505050600190565b908151811015613974570160200190565b6153fd602a613b15565b9061540b6040519283613af4565b602a8252615419602a613b15565b6020830190601f19013682378251156139745760309053815160011015613974576078602183015360295b6001811161549857506154545790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b90600f81166010811015613974576f181899199a1a9b1b9c1cb0b131b232b360811b901a6154c683856153e2565b5360041c908015613c69575f1901615444565b6154e36042613b15565b906154f16040519283613af4565b604282526154ff6042613b15565b6020830190601f19013682378251156139745760309053815160011015613974576078602183015360415b6001811161553a57506154545790565b90600f81166010811015613974576f181899199a1a9b1b9c1cb0b131b232b360811b901a61556883856153e2565b5360041c908015613c69575f190161552a565b6001810190825f528160205260405f2054155f146155c8578054600160401b811015613aaa576155b56143958260018794018555846139d0565b905554915f5260205260405f2055600190565b5050505f90565b906001820191815f528260205260405f20548015155f14615678575f198101818111613c695782545f19810191908211613c6957808203615643575b50505080548015614a30575f19019061562482826139d0565b8154905f199060031b1b19169055555f526020525f6040812055600190565b61566361565361439593866139d0565b90549060031b1c928392866139d0565b90555f528360205260405f20555f808061560b565b505050505f90565b919290156156e25750815115615694575090565b3b1561569d5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156156f55750805190602001fd5b60405162461bcd60e51b8152602060048201529081906123079060248301906138f656fea2646970667358221220e88b44f277f57acdec001e69677ebb7f4aeb0fc7a1875bb9a882262f5ad3caf264736f6c634300081c003313da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e30000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f00000000000000000000000003a3b8a7a95b5e76c79aa85d25bde4ee5a445a130
Deployed Bytecode
0x6080806040526004361015610012575f80fd5b5f905f3560e01c90816301ffc9a7146137f057508063030101db1461372f57806306fdde0314613668578063081812fc1461364a578063081e3eda1461362d578063095ea7b3146134a757806309f1c80a146131cf57806312f7086c146131b057806317caf6f11461319257806318160ddd1461317457806318fccc7614612e56578063215e83eb14612e2b57806323b872dd14612e06578063248a9ca314612dda5780632f2ff15d14612cff5780632f380b3514612baf5780632f745c5914612b8757806336568abe14612af457806342842e0e14612abf57806342966c6814612a58578063430c208114612a26578063441a3e70146126575780634f6ccce7146125c457806351eb05a6146125965780635312ea8e1461247557806357a5b58c1461240c5780636352211e146123db5780636705fcf3146123365780636e7d40191461230b5780636ecbae3f1461219957806370a08231146121755780637747dd8114611ff05780638d74c2bf14611d7d5780639010d07c14611d5057806391d1485414611d0657806395d89b4114611c235780639a0e584a146115bc5780639a67759b14611593578063a217fddf14611577578063a22cb465146114a7578063a6443e1e14611480578063ac9650d8146112c3578063b88d4fde14611239578063b9be8cd514611019578063bd75fd6c14610ed9578063c346253d14610e95578063c87b56dd14610d67578063ca15c87314610d3d578063d14d0a1a14610b74578063d1abb9071461069f578063d1c2babb1461044b578063d547741f14610404578063e2bbb158146103d3578063e48dc13514610325578063e985e9c5146102cd5763f7c618c114610286575f80fd5b346102ca57806003193601126102ca576040517f0000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f06001600160a01b03168152602090f35b80fd5b50346102ca5760403660031901126102ca5760406102e961391a565b916102f2613930565b9260018060a01b031681526005602052209060018060a01b03165f52602052602060ff60405f2054166040519015158152f35b50346102ca5760203660031901126102ca57604060c091610344614123565b50600435815260146020522060056040519161035f83613ad9565b8054835260018101546020840152600281015460408401526003810154606084015260048101546080840152015460a08201526103d1604051809260a0809180518452602081015160208501526040810151604085015260608101516060850152608081015160808501520151910152565bf35b50346102ca576103fc6103e536613a1f565b906103ee614153565b6103f782614299565b614c8c565b6001600c5580f35b50346102ca5760403660031901126102ca57610448600435610424613930565b9061044361043e825f52600a602052600160405f20015490565b6146ac565b6146f0565b80f35b50346102ca5761045a36613a1f565b90610463614153565b8181146106905761047381614299565b61047c82614299565b80835260146020526040832080546004820154908486526014602052604086209160048301548103610681578254926104b58385613cae565b9081156106725760038601546104cb9085613c7d565b82600383019182546104dd9089613c7d565b6104e691613cae565b906104f091613c90565b9055818155610503828686868c8c61503c565b97919661050f866147d3565b9761051987613b66565b5060010190610527916139d0565b90546105379160031b1c88613c7d565b9161054187613b66565b506001019061054f916139d0565b90549060031b1c61055f91613c7d565b61056891613cae565b6105729087613c7d565b64e8d4a510009004600282015461058891613cae565b906001015461059691613c5c565b92600182019384546105a791613c5c565b918215159760016105fa6105f460209a64e8d4a510009861060e98610601977f285dbc28e663286c77e3cd79d1cf1525744b4dfe015f41295fe5ae2858880bdf9f61065a575b5050613c7d565b94613b66565b50016139d0565b90549060031b1c90613c7d565b04905561061a846148ed565b8386526014825261064b6040872060055f918281558260018201558260028201558260038201558260048201550155565b604051908152a36001600c5580f35b60026106699101918254613cae565b90555f806105ed565b636677a12d60e11b8952600489fd5b634f13191b60e01b8752600487fd5b634cce529560e11b8352600483fd5b50346102ca576106ae36613a65565b90916106b8614153565b8015610b65576106c783614299565b8284526014602052604084209160048301549182916106e5836147d3565b908580549289936106f68682613c5c565b908184556005840154906107098c615133565b918d818414610abd5750836106018460016105fa6107c28f64e8d4a510008f9e9d9c998a6107b182849f6107c89f9d8a6107b19f89610601946107aa6107976105fa946107b69c879f6107648a60026105fa61078a94613b66565b6107778294925492838360031b1c613c5c565b919060031b91821b915f19901b19161790565b905560026105fa86613b66565b6107778294925492838360031b1c613cae565b9055613b66565b613c7d565b049b019a8b5490613c5c565b9e613b66565b0490556001600160a01b0381169687158080610ab4575b15610927575060029150016107f5858254613cae565b90555b6109135750849086610809856139b8565b905460039190911b1c6001600160a01b0316806108a7575b5050916020918361086c7f614253edaf5943287293d855afffbb1f5f0403c51c84143aceaf27a50727b2fc9561085688613988565b9054339160031b1c6001600160a01b0316614793565b604051908152857f191a58d19a6a9b76e2e91bdc04ecbe7553dc094a5ad7af78175a0d9f884e264a853393a4604051908152a46001600c5580f35b809193503b1561090f578280916044604051809681936305f7936f60e51b83528c60048401528760248401525af1928315610902578793156108215781929350906108f191613af4565b6108fe578490865f610821565b8580fd5b50604051903d90823e3d90fd5b8280fd5b634e487b7160e01b81526021600452602490fd5b15610934575b50506107f8565b60029192500190610946825486613cae565b6040516370a0823160e01b815230600482015290927f0000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f06001600160a01b031691602081602481865afa908115610aa957908695949392918691610a70575b5084811115610a6557506109b88480613c5c565b9055826109c6575b5061092d565b6109d1918391614793565b6109da866139b8565b905460039190911b1c6001600160a01b031690816109f9575b806109c0565b908092503b1561090f57829160648392604051948593849263014a362160e71b84528d600485015260248401528b60448401525af18015610a5a57908291610a42575b806109f3565b90610a4c91613af4565b8087126102ca57805f610a3c565b6040513d84823e3d90fd5b6109b8908095613c5c565b9550506020853d602011610aa1575b81610a8c60209383613af4565b81010312610a9d578594515f6109a4565b5f80fd5b3d9150610a7f565b6040513d88823e3d90fd5b508615156107df565b92989950939596509350610b5157928796959392818a938997955f9889988b84610ae684613b66565b5060020190610af4916139d0565b8192915491828260031b1c90610b0991613c5c565b90610b20929060031b91821b915f19901b19161790565b905560016105fa6107c28264e8d4a510006107b6819c6107b16107c89d6106016107b19d876105fa6106019e613b66565b634e487b7160e01b8b52602160045260248bfd5b631f2a200560e01b8452600484fd5b50346102ca5760203660031901126102ca57610b8e61391a565b610b9781613f39565b610ba08161401e565b90610baa81614007565b92610bb86040519485613af4565b818452601f19610bc783614007565b01855b818110610d26575050845b828110610c9b575050509060405192839260408401604085528151809152602060608601920190835b818110610c82575050508381036020850152602080845192838152019301915b818110610c2c575050500390f35b91935091602060c082610c74600194885160a0809180518452602081015160208501526040810151604085015260608101516060850152608081015160808501520151910152565b019401910191849392610c1e565b8251845287965060209384019390920191600101610bfe565b80610ca860019284613e31565b610cb2828761410f565b52610cbd818661410f565b518752601460205260408720600560405191610cd883613ad9565b80548352848101546020840152600281015460408401526003810154606084015260048101546080840152015460a0820152610d14828861410f565b52610d1f818761410f565b5001610bd5565b602090610d31614123565b82828901015201610bca565b50346102ca5760203660031901126102ca5760406020916004358152600b83522054604051908152f35b50346102ca5760203660031901126102ca576004355f818152600260205260409020546001600160a01b031615610e8657808252601460205281610db1600460408320015461395c565b90546040516344a5a61760e11b815260048101949094528391602491839160031b1c6001600160a01b03165afa908115610a5a578291610e06575b60405160208082528190610e02908201856138f6565b0390f35b90503d8083833e610e178183613af4565b81019060208183031261090f578051906001600160401b038211610e82570181601f8201121561090f57805190610e4d82613b15565b92610e5b6040519485613af4565b82845260208383010111610e825781610e02949260208093018386015e830101525f610dec565b8380fd5b631d1286b560e31b8252600482fd5b50346102ca5760203660031901126102ca57600435906013548210156102ca576020610ec0836139b8565b905460405160039290921b1c6001600160a01b03168152f35b50346102ca5760203660031901126102ca57610ef361391a565b610efc81613f39565b610f0581614007565b91610f136040519384613af4565b818352601f19610f2283614007565b01845b818110610ff0575050835b828110610f94578385604051918291602083016020845282518091526020604085019301915b818110610f64575050500390f35b91935091602060606001926040875180518352848101518584015201516040820152019401910191849392610f56565b80610fa160019284613e31565b80875260146020526004604088200154610fba82613cbb565b9060405192610fc884613a8f565b835260208301526040820152610fde828761410f565b52610fe9818661410f565b5001610f30565b602090604051610fff81613a8f565b878152878382015287604082015282828801015201610f25565b50346102ca5760603660031901126102ca5760243560043560443561103c614153565b8015610b655782821461122a5761105282614299565b61105b83614299565b818452601460205260408420805490600481015491858752601460205260408720926004840154810361121b5791839161111e95938895546110a1600385015484613c7d565b6110cd6110bd60038801926110b7845486613c7d565b90613cae565b6110c78487613cae565b90613c90565b90556110d98684613c5c565b908185556110f98a8289866110ee8284613cae565b9c8d94858d5561503c565b929064e8d4a5100061113261112b611110896147d3565b9e8f9660016105fa8c613b66565b90549060031b1c86613c7d565b8099613c7d565b049761114460018201998a5490613c5c565b9081611203575b505061115686613b66565b5060010190611164916139d0565b90549060031b1c61117491613c7d565b9061117e91613c7d565b64e8d4a510009004956001810196875461119791613c5c565b908115157fda2a03409498a5fe8db3da030754afa618bc2228c0517ec5fa8c9b052979e9ea9b60209b64e8d4a51000998a6111e96111f19b6106019a6001996105fa996105f49961065a575050613c7d565b049055613c7d565b049055604051908152a36001600c5580f35b60026112129101918254613cae565b90555f8061114b565b634f13191b60e01b8852600488fd5b634cce529560e11b8452600484fd5b50346102ca5760803660031901126102ca5761125361391a565b61125b613930565b90606435906044356001600160401b0383116112bf57366023840112156112bf57610448936112976112ba943690602481600401359101613b30565b926112aa6112a584336142b9565b613dcf565b6112b583838361432e565b61538a565b61501c565b8480fd5b50346102ca5760203660031901126102ca576004356001600160401b03811161147c576112f4903690600401613a35565b906112fe82614007565b9061130c6040519283613af4565b828252601f1961131b84614007565b01845b81811061146957505036819003601e190190845b84811015611402578060051b820135838112156113fe578201908135916001600160401b0383116113fa5760200182360381136113fa5761137a6113de916001943691613b30565b888060609261138c6040519485613af4565b602784527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c6020850152660819985a5b195960ca1b6040850152602081519101305af46113d761526b565b9030615680565b6113e8828761410f565b526113f3818661410f565b5001611332565b8780fd5b8680fd5b83866040519182916020830160208452825180915260408401602060408360051b870101940192905b82821061143a57505050500390f35b919360019193955060206114598192603f198a820301865288516138f6565b960192019201859493919261142b565b606060208286018101919091520161131e565b5080fd5b50346102ca5760203660031901126102ca57602061149f60043561409c565b604051908152f35b50346102ca5760403660031901126102ca576114c161391a565b6024359081151580920361090f576001600160a01b03169033821461153257338352600560205260408320825f5260205260405f2060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606490fd5b50346102ca57806003193601126102ca57602090604051908152f35b50346102ca57806003193601126102ca57600f546040516001600160a01b039091168152602090f35b50346102ca5760e03660031901126102ca576004356115d9613930565b6115e1613946565b6064356001600160401b0381116112bf57611600903690600401613a35565b906084356001600160401b0381116113fe57611620903690600401613a35565b929060a4356001600160401b038111611c1f5736602382011215611c1f57611652903690602481600401359101613b30565b60c43594906001600160a01b0386168603611c1b5761166f6145c9565b6001600160a01b0388811698907f0000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f0168914611c0c578415611bfd57828503611bee578535611bdf5760018511611b96575b6010548b5b818110611b835750506116da8a601554613cae565b8015611b7457601555601254600160401b811015611b24579061170882600161172c940160125560126139d0565b81546001600160a01b0393841660039290921b91821b9390911b1916919091179055565b601354600160401b811015611b605787611708826001611751940160135560136139d0565b600e54600160401b811015611b6057866117088260016117769401600e55600e6139d0565b60405161178281613abe565b8a81526020810142815260408201908b825260608301938452601054600160401b811015611b4c578060016117ba9201601055613c40565b939093611b38579060039392915183555160018301555160028201550190518051906001600160401b038211611b24576117fe826117f88554613bcc565b85613fc4565b6020908c601f8411600114611abc576118619695949361183493909283611ab1575b50508160011b915f199060031b1c19161790565b90555b6118586118438261401e565b956040519561185187613a8f565b3691614050565b84523691614050565b6020820190815260408201928352601154600160401b811015611a9d5780600161188e9201601155613b66565b929092611a8957518051906001600160401b038211611a4657600160401b8211611a46576020908a855484875584818110611a6e575b50505001838a5260208a208a5b838110611a5a5750505050600182019051908151916001600160401b038311611a4657600160401b8311611a46576020908a835485855585818110611a2b575b5050500190895260208920895b838110611a1757505050506002019051908151916001600160401b038311611a0357600160401b8311611a035760209082548484558085106119e9575b500190875260208720875b8381106119d55750505050601254915f1983019283116119c157604080519586526001600160a01b0392831660208701529116937f916c1141fd0c2a70bb95c6e9f2376006b00f90a78c0db17abbf423c61db950df9190a480f35b634e487b7160e01b86526011600452602486fd5b600190602084519401938184015501611966565b838a52828a206119fd918101908601613fae565b5f61195b565b634e487b7160e01b88526041600452602488fd5b60019060208451940193818401550161191e565b848387611a3e9552209182019101613fae565b8a5f85611911565b634e487b7160e01b8a52604160045260248afd5b6001906020845194019381840155016118d1565b848389611a819552209182019101613fae565b8a5f846118c4565b634e487b7160e01b89526004899052602489fd5b634e487b7160e01b89526041600452602489fd5b015190505f80611820565b9190601f198416858452828420935b818110611b0c5750916001939185611861999897969410611af4575b505050811b019055611837565b01515f1960f88460031b161c191690555f8080611ae7565b92936020600181928786015181550195019301611acb565b634e487b7160e01b8c52604160045260248cfd5b634e487b7160e01b8e5260048e905260248efd5b634e487b7160e01b8e52604160045260248efd5b634e487b7160e01b8b52604160045260248bfd5b632ae6f6af60e11b8c5260048cfd5b80611b8f6001926147d3565b50016116c5565b60018b5b868210611ba85750506116c0565b611bb382888a613ebb565b351115611bd0576001611bc782888a613ebb565b35910190611b9a565b6367c462f760e01b8c5260048cfd5b6369afe63f60e11b8b5260048bfd5b63512509d360e11b8b5260048bfd5b63521299a960e01b8b5260048bfd5b63c982c8c360e01b8b5260048bfd5b8980fd5b8880fd5b50346102ca57806003193601126102ca57604051908060015490611c4682613bcc565b8085529160018116908115611cdf5750600114611c82575b610e0284611c6e81860382613af4565b6040519182916020835260208301906138f6565b600181527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6939250905b808210611cc557509091508101602001611c6e82611c5e565b919260018160209254838588010152019101909291611cac565b60ff191660208087019190915292151560051b85019092019250611c6e9150839050611c5e565b50346102ca5760403660031901126102ca576040611d22613930565b916004358152600a602052209060018060a01b03165f52602052602060ff60405f2054166040519015158152f35b50346102ca5760403660031901126102ca57610ec06020916004358152600b8352604060243591206139d0565b50346102ca5760c03660031901126102ca5760043590602435611d9e613946565b92606435936001600160401b038511610e825736602386011215610e82578460040135906001600160401b0382116112bf5736602483880101116112bf57608435916001600160a01b03831683036108fe5760a4359081151582036113fe57611e056145c9565b60105480861015611fe157875b818110611fce575050611e2485613c40565b50611e3187601554613cae565b611e416002830191825490613c5c565b8015611fbf5760155587905560039083611fad575b0190611e6c81611e668454613bcc565b84613fc4565b87601f8211600114611f20579080611ebd928a9b7ffa4328c2a1268b2b661914d91df191c5271c699ddc97ccedda086c6d25b099f9999a9b92611f125750508160011b915f199060031b1c19161790565b90555b611ecd836117088761395c565b15611ef1575b604080519586526001600160a01b039283166020870152911693a380f35b50611efb836139b8565b905460039190911b1c6001600160a01b0316611ed3565b602492500101355f80611820565b8289526020892090601f1983168a5b818110611f9257509a8392916001947ffa4328c2a1268b2b661914d91df191c5271c699ddc97ccedda086c6d25b099f99a9b9c9d10611f76575b505050811b019055611ec0565b01602401355f19600384901b60f8161c191690555f8080611f69565b8c830160240135845560019093019260209283019201611f2f565b611fba85611708896139b8565b611e56565b632ae6f6af60e11b8a5260048afd5b80611fda6001926147d3565b5001611e12565b63904e0f5960e01b8852600488fd5b50346102ca57611fff36613a65565b92909161200a614153565b82156121665761201981614299565b808252601460205260408220938454946120338587613c5c565b9182825561204081614ada565b958686818098526014602052604081208381556003860154600382015560058601549081600582015560048701549182600483015561207e836147d3565b9061208884613b66565b5060010190612096916139d0565b90549060031b1c6120a691613c7d565b6120b181809e613c7d565b64e8d4a5100090049860018901998a546120ca91613c5c565b8015159e60209f9b60209b6121176001967fcf0974dfd867840133a0d4b02f1672f24017796fb8892d1e0d587692e4da90ab9f966121209664e8d4a510009894899561065a575050613c7d565b04905588613c7d565b04910155604051946001600160a01b0316917fb1ef6f1c5fca9fc83b81f6c18e6269a7942f041cadd830c353bb90f8680a3d4d9080a48152a36001600c55604051908152f35b631f2a200560e01b8252600482fd5b50346102ca5760203660031901126102ca57602061149f61219461391a565b613f39565b50346102ca5760203660031901126102ca576121b361391a565b7ff0df1ecf66245243e1fe66eca783e2b1f173c34d37828b8788a74623e9a73e028252600a60209081526040808420335f908152925290205460ff161561223a57600f80546001600160a01b0319166001600160a01b039290921691821790557f097cb0b4d8d03c9f5f6d24fdb4d1c0764243aab030e9e385b0295badfe7a73e28280a280f35b61230760206122e760118561224e336153f3565b9060378561227b7ff0df1ecf66245243e1fe66eca783e2b1f173c34d37828b8788a74623e9a73e026154d9565b60405197889576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b828801528051918291018588015e8501907001034b99036b4b9b9b4b733903937b6329607d1b84830152805192839101604883015e010190838201520301601f198101835282613af4565b60405162461bcd60e51b81526020600482015291829160248301906138f6565b0390fd5b50346102ca5760203660031901126102ca57600435906012548210156102ca576020610ec083613988565b50346102ca5760603660031901126102ca5761235061391a565b60243561235b614153565b6010548110156123cc579160209261237283614ada565b9182918282526014865280600460408420015561239183604435614c8c565b604051946001600160a01b0316917fb1ef6f1c5fca9fc83b81f6c18e6269a7942f041cadd830c353bb90f8680a3d4d9080a46001600c558152f35b63904e0f5960e01b8352600483fd5b50346102ca5760203660031901126102ca5760206123fa600435613f17565b6040516001600160a01b039091168152f35b50346102ca5760203660031901126102ca576004356001600160401b03811161147c5761243d903690600401613a35565b612445614153565b825b81811061245757836001600c5580f35b8061246e6124686001938587613ebb565b356147d3565b5001612447565b50346102ca5760203660031901126102ca57600435612492614153565b61249b81613f17565b6001600160a01b038116903382036125875782845260146020527f6aaee64d11e8979fa392cd6388058c820f43709933f6a297e6e1005dddca62d6602060408620926125788454809261251c612508600489015498600260056124fd8c613b66565b5092015491016139d0565b819291549061077786838360031b1c613c5c565b9055612527896148ed565b888a526014855261255860408b2060055f918281558260018201558260028201558260038201558260048201550155565b61256187613988565b905460039190911b1c6001600160a01b0316614793565b604051908152a46001600c5580f35b6330cd747160e01b8452600484fd5b50346102ca5760203660031901126102ca576125b0614153565b6125bb6004356147d3565b506001600c5580f35b50346102ca5760203660031901126102ca576004356008548110156125fd576125ee6020916139a0565b90549060031b1c604051908152f35b60405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608490fd5b50346102ca5761266636613a1f565b9061266f614153565b8015612a175761267e82614299565b818352601460205260408320600481015490612699826147d3565b8282549287926126a98786613c5c565b908183556005830154916126bc8a615133565b928b81851461297d5750916107b18261060164e8d4a5100061270b856107b18e8e9f8b8f6105fa8f91899f9e6127279f6107976001956106019861078a6107646107aa9560026105fa8a613b66565b049660016105fa612721828c019a8b5490613c5c565b9b613b66565b0490558282156127f9575060026127419101918254613cae565b90555b610913575083612753826139b8565b905460039190911b1c6001600160a01b0316806127ae575b505061277a8261085683613988565b6040519182527f191a58d19a6a9b76e2e91bdc04ecbe7553dc094a5ad7af78175a0d9f884e264a60203393a46001600c5580f35b803b1561147c578180916044604051809481936305f7936f60e51b83528a60048401528960248401525af18015610a5a571561276b57816127ee91613af4565b610e8257835f61276b565b612805575b5050612744565b600201805490925061281691613cae565b6040516370a0823160e01b815230600482015290917f0000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f06001600160a01b031691602081602481865afa908115612972579085949392918591612939575b50849291908481111561292e575061288b8480613c5c565b905582612899575b506127fe565b6128a4918391614793565b6128ad846139b8565b905460039190911b1c6001600160a01b031690816128cd575b8290612893565b908092503b1561090f57829160648392604051948593849263014a362160e71b84528b600485015260248401528160448401525af18015610a5a57908291612916575b806128c6565b9061292091613af4565b8085126102ca57805f612910565b61288b908095613c5c565b92919450506020823d60201161296a575b8161295760209383613af4565b81010312610a9d57905184939084612873565b3d915061294a565b6040513d87823e3d90fd5b919650969192939450612a03579086939291815f978897878c836129a083613b66565b50600201906129ae916139d0565b8192915491828260031b1c906129c391613c5c565b906129da929060031b91821b915f19901b19161790565b905564e8d4a5100061270b81976107b1612727986106016107b19860016105fa61060199613b66565b634e487b7160e01b8a52602160045260248afd5b631f2a200560e01b8352600483fd5b50346102ca5760403660031901126102ca576020612a4e612a4561391a565b602435906142b9565b6040519015158152f35b50346102ca5760203660031901126102ca5760043580825260146020526040822054612ab057612a8781613cbb565b612aa15780612a9c6112a561044893336142b9565b6148ed565b63faaea8f160e01b8252600482fd5b63f25a119760e01b8252600482fd5b50346102ca576104486112ba612ad4366139e5565b9060405192612ae4602085613af4565b8684526112aa6112a584336142b9565b50346102ca5760403660031901126102ca57612b0e613930565b336001600160a01b03821603612b2a57610448906004356146f0565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b50346102ca5760403660031901126102ca57602061149f612ba661391a565b60243590613e31565b50346102ca5760203660031901126102ca57606080604051612bd081613abe565b8381528360208201528360408201520152612bec600435613c40565b509060405190612bfb82613abe565b825482526001830154926020830193845260036002820154916040850192835201916040519281815491612c2e83613bcc565b8087529260018116908115612cd35750600114612c8e575b50505090612c5a83610e0294930383613af4565b60608401918252604051948594602086525160208601525160408501525160608401525160808084015260a08301906138f6565b81526020812094939250905b808210612cb75750919250908201602001612c5a83610e02612c46565b9192936001816020925483858901015201910190939291612c9a565b60ff191660208089019190915293151560051b87019093019350612c5a9250859150610e029050612c46565b50346102ca5760403660031901126102ca57612d7d600435612d1f613930565b90612d3961043e825f52600a602052600160405f20015490565b808452600a6020526040842060018060a01b0383165f5260205260ff60405f20541615612d81575b8352600b602052604083206001600160a01b039091169061557b565b5080f35b808452600a602090815260408086206001600160a01b0385165f8181529190935220805460ff191660011790553390827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8780a4612d61565b50346102ca5760203660031901126102ca57602061149f6004355f52600a602052600160405f20015490565b50346102ca57610448612e18366139e5565b91612e266112a584336142b9565b61432e565b50346102ca5760203660031901126102ca5760043590600e548210156102ca576020610ec08361395c565b50346102ca5760403660031901126102ca57600435612e73613930565b612e7b614153565b612e8482614299565b818352601460205260408320908360048301548092612ea2826147d3565b908580549285936005830154612eb78b615133565b9080821461311857879850826106018360016105fa612f2e8264e8d4a510008e9f8c6107b1612f21849f9d9c612f349f6105fa6107b19f9689926107aa6107976107b69a61078a612f0d8960026105fa89613b66565b819291549061077788838360031b1c613c5c565b90549060031b1c8b613c7d565b9d613b66565b0490556001600160a01b038116958615808061310f575b15612f9c57506002915001612f61848254613cae565b90555b610913575060207f614253edaf5943287293d855afffbb1f5f0403c51c84143aceaf27a50727b2fc91604051908152a46001600c5580f35b15612fa9575b5050612f64565b60029192500190612fbb825485613cae565b6040516370a0823160e01b815230600482015290927f0000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f06001600160a01b031691602081602481865afa908115610aa9579086959493929186916130da575b50848111156130cf575061302d8480613c5c565b90558261303b575b50612fa2565b613046918391614793565b61304f856139b8565b905460039190911b1c6001600160a01b0316908161306e575b80613035565b908092503b1561090f57829160648392604051948593849263014a362160e71b84528c600485015260248401528a60448401525af18015610a5a579082916130b7575b80613068565b906130c191613af4565b8086126102ca57805f6130b1565b61302d908095613c5c565b9550506020853d602011613107575b816130f660209383613af4565b81010312610a9d578594515f613019565b3d91506130e9565b50851515612f4b565b935095509590929350613160578594939291879181875f97610601899860016105fa612f2e8264e8d4a510006107b6819c6107b1612f21612f349e866105fa6107b19f613b66565b634e487b7160e01b89526021600452602489fd5b50346102ca57806003193601126102ca576020600854604051908152f35b50346102ca57806003193601126102ca576020601554604051908152f35b50346102ca5760203660031901126102ca57602061149f600435613cbb565b5034610a9d576020366003190112610a9d57600435906131ed614153565b5f828152600260205260409020546001600160a01b03161561349857815f52601460205260405f20600481015490613224826147d3565b938154925f9360058401549661323984615133565b978881811461347357916107b164e8d4a510006132ab836107b161329e878a613290610797889c8f6105fa816132cc9f61327c6107aa9160026105fa8197613b66565b81929154906107778b838360031b1c613c5c565b90555b60016105fa8d613b66565b90549060031b1c89613c7d565b04946106016132c060018b0197885490613c5c565b9c60016105fa8a613b66565b04905585156132f9575050926132e9600283949501918254613cae565b90555b61091357506001600c5580f35b90918361330d575b505050809192506132ec565b600261331d910195865490613cae565b6040516370a0823160e01b81523060048201529590917f0000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f06001600160a01b031691602088602481865afa8015610aa957869798879161343e575b5084811115613433575061338b8480613c5c565b9055848361339e575b5050859450613301565b836133ac916133b194614793565b6139b8565b905460039190911b1c6001600160a01b031691826133d1575b8084613394565b90918093503b15610e8257906064849283604051958694859363014a362160e71b8552600485015260248401528160448401525af18015610a5a5790829161341b575b80806133ca565b9061342591613af4565b8082126102ca57805f613414565b61338b908095613c5c565b9650506020863d60201161346b575b8161345a60209383613af4565b81010312610a9d578695515f613377565b3d915061344d565b509550955064e8d4a510006132cc5f976107b1836132ab836107b161329e5f9d613293565b631d1286b560e31b5f5260045ffd5b34610a9d576040366003190112610a9d576134c061391a565b602435906001600160a01b036134d583613f17565b6001600160a01b0390921691168181146135de578033149081156135ba575b501561354f575f82815260046020526040902080546001600160a01b031916821790556001600160a01b0361352883613f17565b167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f80a4005b60405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608490fd5b5f90815260056020908152604080832033845290915290205460ff169050836134f4565b60405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608490fd5b34610a9d575f366003190112610a9d576020601054604051908152f35b34610a9d576020366003190112610a9d5760206123fa600435613c04565b34610a9d575f366003190112610a9d576040515f5f5461368781613bcc565b808452906001811690811561370b57506001146136af575b610e0283611c6e81850382613af4565b5f8080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563939250905b8082106136f157509091508101602001611c6e61369f565b9192600181602092548385880101520191019092916136d9565b60ff191660208086019190915291151560051b84019091019150611c6e905061369f565b34610a9d576020366003190112610a9d5760606040805161374f81613a8f565b82815282602082015201526137ca613768600435613b66565b50610e026040519161377983613a8f565b61378281613b82565b83526137dd6137a6600261379860018501613b82565b936020870194855201613b82565b916040850192835260405195869560208752516060602088015260808701906138c3565b9051858203601f190160408701526138c3565b9051838203601f190160608501526138c3565b34610a9d576020366003190112610a9d576004359063ffffffff60e01b8216809203610a9d5760209163dd614ea960e01b8114908115613832575b5015158152f35b635a05180f60e01b81149150811561384c575b508361382b565b637965db0b60e01b811491508115613866575b5083613845565b63780e9d6360e01b811491508115613880575b508361385f565b6380ac58cd60e01b8114915081156138b2575b81156138a1575b5083613879565b6301ffc9a760e01b1490508361389a565b635b5e139f60e01b81149150613893565b90602080835192838152019201905f5b8181106138e05750505090565b82518452602093840193909201916001016138d3565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b600435906001600160a01b0382168203610a9d57565b602435906001600160a01b0382168203610a9d57565b604435906001600160a01b0382168203610a9d57565b600e5481101561397457600e5f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b6012548110156139745760125f5260205f2001905f90565b6008548110156139745760085f5260205f2001905f90565b6013548110156139745760135f5260205f2001905f90565b8054821015613974575f5260205f2001905f90565b6060906003190112610a9d576004356001600160a01b0381168103610a9d57906024356001600160a01b0381168103610a9d579060443590565b6040906003190112610a9d576004359060243590565b9181601f84011215610a9d578235916001600160401b038311610a9d576020808501948460051b010111610a9d57565b6060906003190112610a9d5760043590602435906044356001600160a01b0381168103610a9d5790565b606081019081106001600160401b03821117613aaa57604052565b634e487b7160e01b5f52604160045260245ffd5b608081019081106001600160401b03821117613aaa57604052565b60c081019081106001600160401b03821117613aaa57604052565b90601f801991011681019081106001600160401b03821117613aaa57604052565b6001600160401b038111613aaa57601f01601f191660200190565b929192613b3c82613b15565b91613b4a6040519384613af4565b829481845281830111610a9d578281602093845f960137010152565b6011548110156139745760115f52600360205f20910201905f90565b90604051918281549182825260208201905f5260205f20925f5b818110613bb3575050613bb192500383613af4565b565b8454835260019485019487945060209093019201613b9c565b90600182811c92168015613bfa575b6020831014613be657565b634e487b7160e01b5f52602260045260245ffd5b91607f1691613bdb565b5f81815260026020526040902054613c26906001600160a01b03161515613ecb565b5f908152600460205260409020546001600160a01b031690565b6010548110156139745760105f5260205f209060021b01905f90565b91908203918211613c6957565b634e487b7160e01b5f52601160045260245ffd5b81810292918115918404141715613c6957565b8115613c9a570490565b634e487b7160e01b5f52601260045260245ffd5b91908201809211613c6957565b5f52601460205260405f20600481015490613cd582613c40565b5091825492613ce3826141a9565b906001810154613cf38142613c5c565b9081151580613dc6575b613d50575b50505050613d4464e8d4a51000613d38613d4d956107b1600195610601613d2a895492613b66565b508860058b015491016139d0565b04600284015490613cae565b91015490613c5c565b90565b916002613d6c613d7593613d66613d7e96614202565b90613c7d565b91015490613c7d565b60155490613c90565b9064e8d4a5100082029180830464e8d4a510001490151715613c6957613d386001936107b1613dbd613d4d986110b764e8d4a5100096613d4498613c90565b97505093613d02565b50831515613cfd565b15613dd657565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b613e3a81613f39565b821015613e625760018060a01b03165f52600660205260405f20905f5260205260405f205490565b60405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608490fd5b91908110156139745760051b0190565b15613ed257565b60405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606490fd5b5f908152600260205260409020546001600160a01b0316613d4d811515613ecb565b6001600160a01b03168015613f57575f52600360205260405f205490565b60405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b818110613fb9575050565b5f8155600101613fae565b9190601f8111613fd357505050565b613bb1925f5260205f20906020601f840160051c83019310613ffd575b601f0160051c0190613fae565b9091508190613ff0565b6001600160401b038111613aaa5760051b60200190565b9061402882614007565b6140356040519182613af4565b8281528092614046601f1991614007565b0190602036910137565b92919061405c81614007565b9361406a6040519586613af4565b602085838152019160051b8101928311610a9d57905b82821061408c57505050565b8135815260209182019101614080565b5f52601460205260405f20906140b56004830154613b66565b5091825490600182146141085760036140d091015442613c5c565b905f198101908111613c695792905b90926140eb81856139d0565b90549060031b1c821015614103575f190192906140df565b925050565b505f925050565b80518210156139745760209160051b010190565b6040519061413082613ad9565b5f60a0838281528260208201528260408201528260608201528260808201520152565b6002600c5414614164576002600c55565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b906141b45f92613b66565b506002810180549060015f9301905b8284106141d05750505050565b909192946141f86001916110b76141e789866139d0565b90549060031b1c6106018a886139d0565b95019291906141c3565b90602060018060a01b03600f5416926024604051809581936315dd902560e21b835260048301525afa91821561428e575f9261425a575b506753444835ec580000821161424b57565b632dfc35e960e21b5f5260045ffd5b9091506020813d602011614286575b8161427660209383613af4565b81010312610a9d5751905f614239565b3d9150614269565b6040513d5f823e3d90fd5b6142a390336142b9565b156142aa57565b63390cdd9b60e21b5f5260045ffd5b906001600160a01b036142cb82613f17565b6001600160a01b039093169216828114929190831561430b575b5082156142f157505090565b9091506001600160a01b039061430690613c04565b161490565b9092505f52600560205260405f20815f5260205260ff60405f205416915f6142e5565b9061433883613f17565b6001600160a01b03838116929116829003614576576001600160a01b03811692831561452557826144805750600854845f5260096020528060405f2055600160401b811015613aaa576143ab6143958260018894016008556139a0565b819391549060031b91821b915f19901b19161790565b90555b81830361444c575b50825f52600460205260405f206001600160601b0360a01b8154169055805f52600360205260405f208054905f198201918211613c695755815f52600360205260405f2080549060018201809211613c6957555f83815260026020526040812080546001600160a01b031916841790557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9080a4565b61445590613f39565b825f52600660205260405f20815f526020528360405f2055835f52600760205260405f20555f6143b6565b83830361448e575b506143ae565b61449790613f39565b5f198101908111613c6957845f52600760205260405f20548181036144e4575b50845f5260076020525f6040812055825f52600660205260405f20905f526020525f60408120555f614488565b835f52600660205260405f20825f5260205260405f2054845f52600660205260405f20825f526020528060405f20555f52600760205260405f20555f6144b7565b60405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b335f9081527fcc154f7b876a360d54d1dd91709acfea951faf52857cd1bb669415168b037aed602052604090205460ff161561460157565b61230760206122e76011614614336153f3565b6037846146407f523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c6154d9565b60405196879476020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b828701528051918291018587015e8401907001034b99036b4b9b9b4b733903937b6329607d1b84830152805192839101604883015e01015f838201520301601f198101835282613af4565b5f818152600a6020908152604080832033845290915290205460ff16156146d05750565b60206122e76011612307936037846146406146ea336153f3565b936154d9565b9061473a91805f52600a60205260405f2060018060a01b0383165f5260205260ff60405f20541661473d575b5f908152600b602052604090206001600160a01b03909116906155cf565b50565b5f818152600a602090815260408083206001600160a01b03861680855292528220805460ff19169055339183907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a461471c565b60405163a9059cbb60e01b60208201526001600160a01b039092166024830152604480830193909352918152613bb1916147ce606483613af4565b615188565b906010548210156148de576147e782613c40565b5091600183018054906147fa8242613c5c565b948054958061480b575b5050505050565b614814856141a9565b9384614863575b5050507fcb7325664a4a3b7c7223eefc492a97ca4fdf94d46884621e5a8fae5a04b2b9d291606091429055604051904282526020820152856040820152a25f80808080614804565b61487b61488692613d66613d75939a9697959a614202565b600289015490613c7d565b9264e8d4a5100084029380850464e8d4a510001490151715613c69576148d36060936110b7847fcb7325664a4a3b7c7223eefc492a97ca4fdf94d46884621e5a8fae5a04b2b9d297613c90565b80975591819361481b565b63904e0f5960e01b5f5260045ffd5b6148f681613f17565b6001600160a01b0381169081614a445750600854825f5260096020528060405f2055600160401b811015613aaa576149386143958260018694016008556139a0565b90555b6008545f198101908111613c6957825f52600960205261495f60405f2054916139a0565b90549060031b1c80614973614395846139a0565b90555f52600960205260405f2055815f5260096020525f60408120556008548015614a30575f19016149a4816139a0565b8154905f199060031b1b19169055600855815f52600460205260405f206001600160601b0360a01b8154169055805f52600360205260405f209081545f198101908111613c69575f92558282526002602052604082206001600160601b0360a01b81541690557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4565b634e487b7160e01b5f52603160045260245ffd5b614a4d90613f39565b5f198101908111613c6957825f52600760205260405f2054818103614a99575b50825f5260076020525f6040812055815f52600660205260405f20905f526020525f604081205561493b565b825f52600660205260405f20825f5260205260405f2054835f52600660205260405f20825f526020528060405f20555f52600760205260405f20555f614a6d565b90600d545f198114613c69576001019182600d558260209060405190614b008383613af4565b5f82526001600160a01b038416938415801590614c49575f838152600260205260409020546001600160a01b0316614c0457600854835f52600986528060405f2055600160401b811015613aaa57614b626143958260018794016008556139a0565b9055614bd4575b845f526003845260405f209485549060018201809211613c695760026112ba968593613bb19955835f525260405f20816001600160601b0360a01b8254161790555f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a461529a565b614bdd81613f39565b855f526006855260405f20815f5285528260405f2055825f526007855260405f2055614b69565b60405162461bcd60e51b815260048101869052601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606490fd5b6064856040519062461bcd60e51b825280600483015260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152fd5b5f8115614fba57825f52601460205260405f2090600482015491614caf836147d3565b90805491865f52601460205260405f20805480155f14614f125750614cfc6003670de0b6b3a7640000925b0191670de0b6b3a7640000614cf58454926107b18442613c5c565b0490613cae565b9055614d088684613cae565b90818355600583015493614d1b89615133565b9487818714614ea25764e8d4a51000614d62856107b1866106018760016105fa8f998e6107aa8b9f9d614d839f9d6107b19e61078a6107646107979460026105fa8a613b66565b0494610601614d776001890197885490613c5c565b9860016105fa8d613b66565b0490558115614e9b576002614d9b9101918254613cae565b90555b614da7826139b8565b905460039190911b1c6001600160a01b03169081614e4e575b5050614e0f614dce82613988565b90546040516323b872dd60e01b6020820152336024820152306044820152606480820187905281529160031b1c6001600160a01b03166147ce608483613af4565b7f9a2a1e97e6d641080089aafc36750cfdef4c79f8b3ace6fa4c384fa2f047695960206001600160a01b03614e4386613f17565b1693604051908152a4565b813b15610a9d575f80926044604051809581936303004b4760e01b83528a60048401528960248401525af1801561428e5715614dc057614e8f5f8093613af4565b12610a9d575f80614dc0565b5050614d9e565b509550815f968881614eb382613b66565b5060020190614ec1916139d0565b8154908d828260031b1c90614ed591613cae565b90614eec929060031b91821b915f19901b19161790565b9055614d6264e8d4a51000956107b1614d83966106016107b19660016105fa8c98613b66565b87811015614f6857670de0b6b3a76400008102818104670de0b6b3a764000003613c69576110c7614f43928a613cae565b670de0b6b3a764000003670de0b6b3a76400008111613c69576003614cfc9192614cda565b80881015614fa557670de0b6b3a76400008802888104670de0b6b3a764000003613c6957614f9f6003916110c7614cfc948c613cae565b92614cda565b50614cfc60036706f05b59d3b2000092614cda565b631f2a200560e01b5f5260045ffd5b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561502357565b60405162461bcd60e51b81528061230760048201614fc9565b959293909491955f526014602052600560405f20015495855f52601460205261506c600560405f20015496615133565b948592838914158061511a575b8489141590816150ed575b80806150e6575b156150aa57505050506150a69160026105fa61079793613b66565b9055565b9295509091156150c85750506150a69160026105fa61079793613b66565b9093506150d457505050565b6150a69160026105fa61079793613b66565b508161508b565b6151136150ff8b60026105fa89613b66565b819291549061077787838360031b1c613c5c565b9055615084565b61512c6150ff8b60026105fa88613b66565b9055615079565b9061513d8261409c565b91805f52601460205282600560405f20018181540361515b57505050565b557f8bdaee675270281b7bc2d5b9ced20517ecf5ce96158973ef78072a7bc1491b446020604051858152a2565b906151e89160018060a01b03165f80604051936151a6604086613af4565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564602086015260208151910182855af16151e261526b565b91615680565b8051806151f3575050565b8160209181010312610a9d5760200151801590811503610a9d5761521357565b60405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b3d15615295573d9061527c82613b15565b9161528a6040519384613af4565b82523d5f602084013e565b606090565b91823b15615382576152df926020925f604051809681958294630a85bd0160e11b845233600485015284602485015260448401526080606484015260848301906138f6565b03926001600160a01b03165af15f918161533d575b506153275761530161526b565b805190816153225760405162461bcd60e51b81528061230760048201614fc9565b602001fd5b6001600160e01b031916630a85bd0160e11b1490565b9091506020813d60201161537a575b8161535960209383613af4565b81010312610a9d57516001600160e01b031981168103610a9d57905f6152f4565b3d915061534c565b505050600190565b919290803b156153d9576152df935f60209460405196879586948593630a85bd0160e11b855233600486015260018060a01b0316602485015260448401526080606484015260848301906138f6565b50505050600190565b908151811015613974570160200190565b6153fd602a613b15565b9061540b6040519283613af4565b602a8252615419602a613b15565b6020830190601f19013682378251156139745760309053815160011015613974576078602183015360295b6001811161549857506154545790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b90600f81166010811015613974576f181899199a1a9b1b9c1cb0b131b232b360811b901a6154c683856153e2565b5360041c908015613c69575f1901615444565b6154e36042613b15565b906154f16040519283613af4565b604282526154ff6042613b15565b6020830190601f19013682378251156139745760309053815160011015613974576078602183015360415b6001811161553a57506154545790565b90600f81166010811015613974576f181899199a1a9b1b9c1cb0b131b232b360811b901a61556883856153e2565b5360041c908015613c69575f190161552a565b6001810190825f528160205260405f2054155f146155c8578054600160401b811015613aaa576155b56143958260018794018555846139d0565b905554915f5260205260405f2055600190565b5050505f90565b906001820191815f528260205260405f20548015155f14615678575f198101818111613c695782545f19810191908211613c6957808203615643575b50505080548015614a30575f19019061562482826139d0565b8154905f199060031b1b19169055555f526020525f6040812055600190565b61566361565361439593866139d0565b90549060031b1c928392866139d0565b90555f528360205260405f20555f808061560b565b505050505f90565b919290156156e25750815115615694575090565b3b1561569d5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156156f55750805190602001fd5b60405162461bcd60e51b8152602060048201529081906123079060248301906138f656fea2646970667358221220e88b44f277f57acdec001e69677ebb7f4aeb0fc7a1875bb9a882262f5ad3caf264736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f00000000000000000000000003a3b8a7a95b5e76c79aa85d25bde4ee5a445a130
-----Decoded View---------------
Arg [0] : _rewardToken (address): 0x2D0E0814E62D80056181F5cd932274405966e4f0
Arg [1] : _emissionCurve (address): 0x3A3b8a7a95b5e76C79aa85D25BDe4Ee5a445A130
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000002d0e0814e62d80056181f5cd932274405966e4f0
Arg [1] : 0000000000000000000000003a3b8a7a95b5e76c79aa85d25bde4ee5a445a130
[ 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.