More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 871 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Unstake Batch Of... | 21610130 | 14 days ago | IN | 0 ETH | 0.00075642 | ||||
Harvest Rewards | 21610127 | 14 days ago | IN | 0 ETH | 0.00069415 | ||||
Unstake Batch Of... | 21601640 | 16 days ago | IN | 0 ETH | 0.00140628 | ||||
Unstake Batch Of... | 21590366 | 17 days ago | IN | 0 ETH | 0.00113597 | ||||
Harvest Rewards | 21590359 | 17 days ago | IN | 0 ETH | 0.00093218 | ||||
Unstake Batch Of... | 21588975 | 17 days ago | IN | 0 ETH | 0.00179098 | ||||
Harvest Rewards | 21588973 | 17 days ago | IN | 0 ETH | 0.00229229 | ||||
Unstake Batch Of... | 21581176 | 18 days ago | IN | 0 ETH | 0.00829665 | ||||
Unstake Batch Of... | 21570994 | 20 days ago | IN | 0 ETH | 0.00099667 | ||||
Harvest Rewards | 21570980 | 20 days ago | IN | 0 ETH | 0.00115661 | ||||
Unstake Batch Of... | 21567343 | 20 days ago | IN | 0 ETH | 0.00303834 | ||||
Harvest Rewards | 21567339 | 20 days ago | IN | 0 ETH | 0.00366676 | ||||
Unstake Batch Of... | 21526816 | 26 days ago | IN | 0 ETH | 0.00073648 | ||||
Harvest Rewards | 21526800 | 26 days ago | IN | 0 ETH | 0.0004564 | ||||
Unstake Batch Of... | 21525226 | 26 days ago | IN | 0 ETH | 0.00101408 | ||||
Harvest Rewards | 21525224 | 26 days ago | IN | 0 ETH | 0.00129699 | ||||
Unstake Batch Of... | 21524999 | 26 days ago | IN | 0 ETH | 0.01754161 | ||||
Unstake Batch Of... | 21524892 | 26 days ago | IN | 0 ETH | 0.00498962 | ||||
Harvest Rewards | 21524790 | 26 days ago | IN | 0 ETH | 0.00029882 | ||||
Unstake Batch Of... | 21524785 | 26 days ago | IN | 0 ETH | 0.00170141 | ||||
Unstake Batch Of... | 21524779 | 26 days ago | IN | 0 ETH | 0.00169056 | ||||
Harvest Rewards | 21522663 | 27 days ago | IN | 0 ETH | 0.00038632 | ||||
Unstake Batch Of... | 21522658 | 27 days ago | IN | 0 ETH | 0.0030077 | ||||
Unstake Batch Of... | 21522415 | 27 days ago | IN | 0 ETH | 0.02402259 | ||||
Harvest Rewards | 21522412 | 27 days ago | IN | 0 ETH | 0.00127559 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
LockNFT
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "./LockPeriodContract.sol"; import "./interfaces/ILockNFT.sol"; import "./interfaces/IUSAStakeReceiptNFT.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; /** @title LockNFT @notice Contract for locking NFTs in the lock pool with USA tokens and DEDPRZ NFTS. Passive and gas efficient rewards farming. @author github @bullishpaisa */ contract LockNFT is LockPeriodContract, ILockNFT, IERC1155Receiver { using Address for address; mapping(uint256 => uint256) public amountUsaLocked; uint256 public usaLockAmount; IUSAStakeReceiptNFT public immutable receiptNFTContract; // DEPPRZ nft IERC1155 public immutable lockTokenERC1155; // DEPPRZ nft constructor( address _rewardsToken_usa_1, address _rewardsToken_WETH_2, address _rewardsToken_Stable_3, address _lockERC20, address _owner, address _multisig, address _receiptNFT, address _lockNFTAddress, uint256 _lockDurationNextPeriod, uint256 _defaultWindowDuration ) LockPeriodContract( _rewardsToken_usa_1, _rewardsToken_WETH_2, _rewardsToken_Stable_3, _lockERC20, _owner, _multisig ) { lockDurationNextPeriod__ = _lockDurationNextPeriod; defaultWindowDuration__ = _defaultWindowDuration; lockTokenERC1155 = IERC1155(_lockNFTAddress); receiptNFTContract = IUSAStakeReceiptNFT(_receiptNFT); STAKE_TOKEN_DECIMALS_SCALE = 1; usaLockAmount = 2500 * 1e18; } /// @inheritdoc ILockNFT function lockSingleNFTInAnyPeriod( uint256 _tokenId ) external nonReentrant updateReward(msg.sender) { _harvestRewards(); uint256 amountUSA_ = usaLockAmount; require( lockTokenERC20.balanceOf(msg.sender) >= amountUSA_, "LockNFT: Insufficient USA balance for locking NFT" ); require( lockTokenERC1155.balanceOf(msg.sender, _tokenId) > 0, "LockNFT: user does not own NFT it is trying to lock" ); // if state is unlocked redeemable, then let the user lock tokens 'in the regular fashion if (contractState__ == ContractState.UNLOCKED_REDEEMABLE) { _stakeAssets(1); } else if (contractState__ == ContractState.ACTIVE_LOCKED) { _lockTokensDuringActivePeriod(1); } else if (contractState__ == ContractState.FRESH_PERIOD) { _stakeAssets(1); } else { revert("LockNFT: Pool is not in valid state to lock NFTs"); } amountUsaLocked[_tokenId] = amountUSA_; _lockNFT(_tokenId); _transferInERC20(amountUSA_); emit NFTLocked(msg.sender, _tokenId, amountUSA_, activePeriodIndex__); } /// @inheritdoc ILockNFT function lockBatchNFTInAnyPeriod( uint256[] memory _tokenIds ) external nonReentrant updateReward(msg.sender) { _harvestRewards(); uint256 amountUSA_ = usaLockAmount * _tokenIds.length; require( lockTokenERC20.balanceOf(msg.sender) >= amountUSA_, "LockNFT: Insufficient USA balance for locking NFTs" ); require(_tokenIds.length > 0, "LockNFT: empty tokenIds array"); // if state is unlocked redeemable, then let the user lock tokens 'in the regular fashion if (contractState__ == ContractState.UNLOCKED_REDEEMABLE) { _stakeAssets(_tokenIds.length); } else if (contractState__ == ContractState.ACTIVE_LOCKED) { _lockTokensDuringActivePeriod(_tokenIds.length); } else if (contractState__ == ContractState.FRESH_PERIOD) { _stakeAssets(_tokenIds.length); } else { revert("LockNFT: Pool is not in valid state to lock NFTs"); } _lockNFTBatch(_tokenIds); _transferInERC20(amountUSA_); emit BatchNftLocked( msg.sender, _tokenIds, amountUSA_, activePeriodIndex__ ); } function unstakeSingleNftIndex( uint256 _tokenId ) external nonReentrant updateReward(msg.sender) { _harvestRewards(); require( receiptNFTContract.isOwnerOf(msg.sender, _tokenId), "LockNFT: staker not staker of receipt NFT" ); if (contractState__ == ContractState.UNLOCKED_REDEEMABLE) { _unstakeAssets(1); } else if (contractState__ == ContractState.ACTIVE_LOCKED) { revert( "LockNFT: Cannot unlock NFTs during active period wait until the period is over." ); } else if (contractState__ == ContractState.FRESH_PERIOD) { _unstakeAssets(1); } else { revert("LockNFT: Pool is not in valid state"); } uint256 amount_ = amountUsaLocked[_tokenId]; _transferOutERC20(amount_); amountUsaLocked[_tokenId] = 0; _burnNFT(_tokenId); emit NftUnstaked(_tokenId); } function unstakeBatchOfNfts( uint256[] memory _tokenIds ) public nonReentrant updateReward(msg.sender) { _harvestRewards(); if (contractState__ == ContractState.UNLOCKED_REDEEMABLE) { _unstakeAssets(_tokenIds.length); } else if (contractState__ == ContractState.ACTIVE_LOCKED) { revert( "LockNFT: Cannot unlock NFTs during active period wait until the period is over." ); } else if (contractState__ == ContractState.FRESH_PERIOD) { _unstakeAssets(_tokenIds.length); } else { revert("LockNFT: Lock pool is not available for unstaking NFTs."); } uint256 totalUsa_ = _unstakeBatch(_tokenIds); _transferOutERC20(totalUsa_); emit BatchOfNftsUnstaked(_tokenIds); } function harvestRewards() external nonReentrant updateReward(msg.sender) returns ( uint256 claimableReward_USA_1, uint256 claimableReward_WETH_2, uint256 claimableReward_Stable_3 ) { ( claimableReward_USA_1, claimableReward_WETH_2, claimableReward_Stable_3 ) = _harvestRewards(); } function setUsaLockAmount(uint256 _amount) external onlyOwner { usaLockAmount = _amount; emit SetUsaLockAmount(_amount); } // Internal functions function _unstakeBatch( uint256[] memory _tokenIds ) internal returns (uint256) { uint256 totalToReturn_; for (uint256 i = 0; i < _tokenIds.length; i++) { require( receiptNFTContract.isOwnerOf(msg.sender, _tokenIds[i]), "LockNFT: user doesn't own the NFT it is trying to unlock" ); _burnNFT(_tokenIds[i]); totalToReturn_ += amountUsaLocked[_tokenIds[i]]; amountUsaLocked[_tokenIds[i]] = 0; } return totalToReturn_; } function _lockNFTBatch(uint256[] memory _tokenIds) internal { for (uint256 i = 0; i < _tokenIds.length; i++) { require( lockTokenERC1155.balanceOf(msg.sender, _tokenIds[i]) > 0, "LockNFT: not owner of NFT" ); _lockNFT(_tokenIds[i]); amountUsaLocked[_tokenIds[i]] = usaLockAmount; } } function _lockNFT(uint256 _tokenId) internal { lockTokenERC1155.safeTransferFrom( msg.sender, address(this), _tokenId, 1, "" ); receiptNFTContract.mintNft(msg.sender, _tokenId); } function _burnNFT(uint256 _tokenId) internal { lockTokenERC1155.safeTransferFrom( address(this), msg.sender, _tokenId, 1, "" ); receiptNFTContract.burnNft(_tokenId); } function executeAnyCall(address _target, bytes memory _data) external { require( msg.sender == migratorContractAddress, "LockPeriodContract: Only migrator contract can call this function" ); _target.functionCall(_data); } function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external override returns (bytes4) { return bytes4( keccak256( "onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)" ) ); } function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4) { return bytes4( keccak256( "onERC1155Received(address,address,uint256,uint256,bytes)" ) ); } function supportsInterface( bytes4 interfaceId ) public view virtual returns (bool) { return interfaceId == type(IERC1155).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; // contracts import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; // interfaces import "./interfaces/ILockPeriodContract.sol"; /** @title LockPeriodContract @notice Contract for locking NFTs in the lock pool with USA tokens and DEDPRZ NFTS. Passive and gas efficient rewards farming. @author github @bullishpaisa */ contract LockPeriodContract is ILockPeriodContract, Ownable, ReentrancyGuard, Pausable { uint256 internal immutable STAKE_TOKEN_DECIMALS_SCALE; address internal immutable MULTISIG_ADDRESS; IERC20 internal immutable lockTokenERC20; IERC20 internal immutable rewardToken_USA_1; IERC20 internal immutable rewardToken_WETH_2; IERC20 internal immutable rewardToken_Stable_3; mapping(uint256 => PeriodInfo) internal periodInfo__; mapping(address => StakeInfo) internal stakes__; // the reward per staked/locked token for each period_ mapping(uint256 => uint256) internal periodRewardPerStakedToken_USA_1__; // the reward per staked/locked token for each period_ for WETH mapping(uint256 => uint256) internal periodRewardPerStakedToken_WETH_2__; // the reward per staked/locked token for each period_ for Stable mapping(uint256 => uint256) internal periodRewardPerStakedToken_Stable_3__; ContractState internal contractState__; // the index counters uint256 internal periodIndexCounter__; // the index of the current lock period uint256 internal activePeriodIndex__; // the index of the next lock period uint256 internal nextPeriodIndex__; // total amount of rewards distributed by the rewardsDistribution contract uint256 internal totalRewardsDistributed_USA_1__; uint256 internal totalRewardsDistributed_WETH_2__; uint256 internal totalRewardsDistributed_Stable_3__; uint256 internal lockDurationNextPeriod__; uint256 internal defaultWindowDuration__; uint256 internal totalAmountStakedAssets__; address public rewardsDistribution; address public migratorContractAddress; constructor( address _rewardsToken_usa_1, address _rewardsToken_WETH_2, address _rewardsToken_Stable_3, address _lockERC20, address _owner, address _multisig ) Ownable(_owner) { rewardToken_USA_1 = IERC20(_rewardsToken_usa_1); rewardToken_WETH_2 = IERC20(_rewardsToken_WETH_2); rewardToken_Stable_3 = IERC20(_rewardsToken_Stable_3); lockTokenERC20 = IERC20(_lockERC20); MULTISIG_ADDRESS = _multisig; } /* ========== MODIFIERS ========== */ modifier updateReward(address _account) { _updateContractState(); _calculateAndUpdateRewards(_account); _; } modifier onlyRewardsDistribution() { require( msg.sender == rewardsDistribution, "LockPeriodContract: Caller is not RewardsDistribution contract" ); _; } /* ========== MUTATIVE FUNCTIONS ========== */ // function purpose is to check if the contractState__ is updated and if so, updates it function _updateContractState() internal { _checkIfNotPaused(); if (contractState__ == ContractState.ACTIVE_LOCKED) { _processActivePeriod(); } else if (contractState__ == ContractState.UNLOCKED_REDEEMABLE) { _processUnlockRedeemable(); } else if (contractState__ == ContractState.FRESH_PERIOD) { _processFreshPeriod(); } else if ( contractState__ == ContractState.CONTRACT_UNLOCKED_INACTIVE ) { return; } else { revert( "LockPeriodContract: Lock contract is awaiting configuration" ); } } function _calculateAndUpdateRewards(address _account) internal { unchecked { uint256 newReward_USA_1_ = 0; uint256 newReward_WETH_2_ = 0; uint256 newReward_Stable_3_ = 0; bool hasReward_ = false; StakeInfo memory stakeInfo_ = stakes__[_account]; // Calculate new rewards since the last update for ( uint256 i = stakeInfo_.lastUpdatePeriodIndex; i < activePeriodIndex__; ++i ) { if (periodInfo__[i].isFinalized == 0) { continue; } // if user has nothing staked, we exit the loop, but update the last updated period_ index if (stakeInfo_.amountStaked == 0) { stakes__[_account].lastUpdatePeriodIndex = uint8( activePeriodIndex__ ); return; } newReward_USA_1_ += (periodRewardPerStakedToken_USA_1__[i] * stakeInfo_.amountStaked) / STAKE_TOKEN_DECIMALS_SCALE; newReward_WETH_2_ += (periodRewardPerStakedToken_WETH_2__[i] * stakeInfo_.amountStaked) / STAKE_TOKEN_DECIMALS_SCALE; newReward_Stable_3_ += (periodRewardPerStakedToken_Stable_3__[i] * stakeInfo_.amountStaked) / STAKE_TOKEN_DECIMALS_SCALE; hasReward_ = true; } if (hasReward_) { // Update the reward debt to include new rewards stakeInfo_.rewardDebt_USA_1 += uint88(newReward_USA_1_); stakeInfo_.rewardDebt_WETH_2 += uint88(newReward_WETH_2_); stakeInfo_.rewardDebt_Stable_3 += uint88(newReward_Stable_3_); if (stakeInfo_.lastUpdatePeriodIndex < activePeriodIndex__) { // Update the last updated period_ index stakeInfo_.lastUpdatePeriodIndex = uint8( activePeriodIndex__ ); } stakes__[_account] = stakeInfo_; return; } } } function _processActivePeriod() internal { // the current contract state is active PeriodInfo memory period_ = periodInfo__[activePeriodIndex__]; uint256 _activePeriodIndex = activePeriodIndex__; if (block.timestamp <= period_.timestampPeriodEnd) { // scenario 1 - the period is still active, no update is required return; } else { // scenario 2 - the active period has expired, we need to process this if (period_.isFinalized == 0) { // if the period has not been finalized, we need to finalize it periodInfo__[_activePeriodIndex].isFinalized = 1; activePeriodIndex__ = _createNextPeriod( period_.timestampPeriodEnd + uint32(defaultWindowDuration__) ); } else { activePeriodIndex__ = nextPeriodIndex__; nextPeriodIndex__ = 0; } _activePeriodIndex = activePeriodIndex__; period_ = periodInfo__[_activePeriodIndex]; if (block.timestamp < period_.timestampPeriodStart) { // the next period has not started yet, so the contract state is now UNLOCKED_REDEEMABLE contractState__ = ContractState.UNLOCKED_REDEEMABLE; emit ContractStateChanged( ContractState.UNLOCKED_REDEEMABLE, _activePeriodIndex ); } else if (block.timestamp <= period_.timestampPeriodEnd) { // register the total amount staked in the period periodInfo__[_activePeriodIndex].totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); emit ContractStateChanged( ContractState.ACTIVE_LOCKED, _activePeriodIndex ); } else { // the next period has ended, so a whole active period has gone by without the contract being updated periodInfo__[_activePeriodIndex].isFinalized = 1; // since the active state was skipped we need to store the total amount staked in the period periodInfo__[_activePeriodIndex].totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); activePeriodIndex__ = _createNextPeriod( period_.timestampPeriodEnd + uint32(defaultWindowDuration__) ); if ( block.timestamp < (period_.timestampPeriodEnd + uint32(defaultWindowDuration__)) ) { // the next period has not started yet, so the contract state is now UNLOCKED_REDEEMABLE contractState__ = ContractState.UNLOCKED_REDEEMABLE; emit ContractStateChanged( ContractState.UNLOCKED_REDEEMABLE, activePeriodIndex__ ); } else { if ( block.timestamp <= (period_.timestampPeriodEnd + uint32( defaultWindowDuration__ + lockDurationNextPeriod__ )) ) { // the next period has started, so the contract state is now ACTIVE_LOCKED contractState__ = ContractState.ACTIVE_LOCKED; periodInfo__[activePeriodIndex__] .totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); emit ContractStateChanged( ContractState.ACTIVE_LOCKED, activePeriodIndex__ ); } else { // the contract has gone without admin updates for more than 2.5 periods, it kicks into the inactive state contractState__ = ContractState .CONTRACT_UNLOCKED_INACTIVE; periodInfo__[activePeriodIndex__] .totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); // finalize the period periodInfo__[activePeriodIndex__].isFinalized = 1; emit ContractStateChanged( ContractState.CONTRACT_UNLOCKED_INACTIVE, activePeriodIndex__ ); } } } } } function _processUnlockRedeemable() internal { PeriodInfo memory period_ = periodInfo__[activePeriodIndex__]; uint256 _activePeriodIndex = activePeriodIndex__; if (block.timestamp < period_.timestampPeriodStart) { // the contract is in the correct state as the active period till has to start return; } else if ( block.timestamp >= period_.timestampPeriodStart && block.timestamp <= period_.timestampPeriodEnd ) { // the new lock period has started, the period is active we need to process this contractState__ = ContractState.ACTIVE_LOCKED; periodInfo__[_activePeriodIndex].totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); } else { periodInfo__[_activePeriodIndex].isFinalized = 1; // since the active state was skipped we need to store the total amount staked in the period periodInfo__[_activePeriodIndex].totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); activePeriodIndex__ = _createNextPeriod( period_.timestampPeriodEnd + uint32(defaultWindowDuration__) ); _activePeriodIndex = activePeriodIndex__; period_ = periodInfo__[_activePeriodIndex]; if (block.timestamp < period_.timestampPeriodStart) { emit ContractStateChanged( ContractState.UNLOCKED_REDEEMABLE, _activePeriodIndex ); } else if (block.timestamp <= period_.timestampPeriodEnd) { // the next period has started, so the contract state is now ACTIVE_LOCKED, but the previous period has not been finalized (so skipped effectively) contractState__ = ContractState.ACTIVE_LOCKED; periodInfo__[_activePeriodIndex].totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); emit ContractStateChanged( ContractState.ACTIVE_LOCKED, _activePeriodIndex ); } else { contractState__ = ContractState.CONTRACT_UNLOCKED_INACTIVE; periodInfo__[_activePeriodIndex].isFinalized = 1; periodInfo__[_activePeriodIndex].totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); emit ContractStateChanged( ContractState.CONTRACT_UNLOCKED_INACTIVE, _activePeriodIndex ); } } } function _processFreshPeriod() internal { unchecked { PeriodInfo memory period_ = periodInfo__[activePeriodIndex__]; uint256 _activePeriodIndex = activePeriodIndex__; if (block.timestamp < period_.timestampPeriodStart) { // the period has not started yet, since it is a fresh period the state remains the same (so FRESH_PERIOD) } else if ( block.timestamp >= period_.timestampPeriodStart && block.timestamp <= period_.timestampPeriodEnd ) { // the fresh period has ended, so the contract state is now ACTIVE_LOCKED contractState__ = ContractState.ACTIVE_LOCKED; // set the total amount staked in the period periodInfo__[_activePeriodIndex].totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); emit ContractStateChanged( ContractState.ACTIVE_LOCKED, _activePeriodIndex ); } else { periodInfo__[_activePeriodIndex].isFinalized = 1; periodInfo__[_activePeriodIndex].totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); activePeriodIndex__ = _createNextPeriod( period_.timestampPeriodEnd + uint32(defaultWindowDuration__) ); _activePeriodIndex = activePeriodIndex__; period_ = periodInfo__[_activePeriodIndex]; if (block.timestamp < period_.timestampPeriodStart) { contractState__ = ContractState.UNLOCKED_REDEEMABLE; emit ContractStateChanged( ContractState.UNLOCKED_REDEEMABLE, _activePeriodIndex ); } else if (block.timestamp <= period_.timestampPeriodEnd) { contractState__ = ContractState.ACTIVE_LOCKED; periodInfo__[_activePeriodIndex] .totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); emit ContractStateChanged( ContractState.ACTIVE_LOCKED, _activePeriodIndex ); } else { contractState__ = ContractState.CONTRACT_UNLOCKED_INACTIVE; periodInfo__[_activePeriodIndex].isFinalized = 1; periodInfo__[_activePeriodIndex] .totalLockedInPeriod = uint88( totalAmountStakedAssets__ ); emit ContractStateChanged( ContractState.CONTRACT_UNLOCKED_INACTIVE, _activePeriodIndex ); } } } } /* ========== INTERNAL FUNCTIONS ========== */ function _totalClaimable( address _account, uint256 _activePeriodIndex ) internal view returns ( uint256 totalClaimableUSA_, uint256 totalClaimableWETH_, uint256 totalClaimableStable_ ) { unchecked { StakeInfo memory stakeInfo_ = stakes__[_account]; // check how much the user can claim as per the updated state totalClaimableUSA_ = stakeInfo_.rewardDebt_USA_1 - stakeInfo_.rewardPaid_USA_1; totalClaimableWETH_ = stakeInfo_.rewardDebt_WETH_2 - stakeInfo_.rewardPaid_WETH_2; totalClaimableStable_ = stakeInfo_.rewardDebt_Stable_3 - stakeInfo_.rewardPaid_Stable_3; if ( block.timestamp > periodInfo__[_activePeriodIndex].timestampPeriodEnd ) { _activePeriodIndex += 1; } for ( uint256 i = stakeInfo_.lastUpdatePeriodIndex; i < _activePeriodIndex; ++i ) { if (periodInfo__[i].isFinalized == 0) { continue; } if (stakeInfo_.amountStaked == 0) { return (0, 0, 0); } totalClaimableUSA_ += (periodRewardPerStakedToken_USA_1__[i] * stakeInfo_.amountStaked) / STAKE_TOKEN_DECIMALS_SCALE; totalClaimableWETH_ += (periodRewardPerStakedToken_WETH_2__[i] * stakeInfo_.amountStaked) / STAKE_TOKEN_DECIMALS_SCALE; totalClaimableStable_ += (periodRewardPerStakedToken_Stable_3__[i] * stakeInfo_.amountStaked) / STAKE_TOKEN_DECIMALS_SCALE; } return ( totalClaimableUSA_, totalClaimableWETH_, totalClaimableStable_ ); } } function _harvestRewards() internal returns ( uint256 claimableReward_USA_1, uint256 claimableReward_WETH_2, uint256 claimableReward_Stable_3 ) { StakeInfo memory stakeInfo_ = stakes__[msg.sender]; claimableReward_USA_1 = stakeInfo_.rewardDebt_USA_1 - stakeInfo_.rewardPaid_USA_1; claimableReward_WETH_2 = stakeInfo_.rewardDebt_WETH_2 - stakeInfo_.rewardPaid_WETH_2; claimableReward_Stable_3 = stakeInfo_.rewardDebt_Stable_3 - stakeInfo_.rewardPaid_Stable_3; bool hasReward_ = false; hasReward_ = claimableReward_USA_1 > 0 || claimableReward_WETH_2 > 0 || claimableReward_Stable_3 > 0; if (!hasReward_) { return (0, 0, 0); } if (claimableReward_USA_1 > 0) { stakeInfo_.rewardPaid_USA_1 += uint88(claimableReward_USA_1); rewardToken_USA_1.transfer(msg.sender, claimableReward_USA_1); } if (claimableReward_WETH_2 > 0) { stakeInfo_.rewardPaid_WETH_2 += uint88(claimableReward_WETH_2); rewardToken_WETH_2.transfer(msg.sender, claimableReward_WETH_2); } if (claimableReward_Stable_3 > 0) { stakeInfo_.rewardPaid_Stable_3 += uint88(claimableReward_Stable_3); rewardToken_Stable_3.transfer(msg.sender, claimableReward_Stable_3); } stakes__[msg.sender] = stakeInfo_; emit RewardsClaimed( msg.sender, claimableReward_USA_1, claimableReward_WETH_2, claimableReward_Stable_3 ); return ( claimableReward_USA_1, claimableReward_WETH_2, claimableReward_Stable_3 ); } function _createNextPeriod( uint32 _startNextPeriod ) internal returns (uint256 newPeriodIndex_) { unchecked { periodIndexCounter__++; newPeriodIndex_ = periodIndexCounter__; PeriodInfo storage period_ = periodInfo__[newPeriodIndex_]; period_.timestampPeriodStart = _startNextPeriod; period_.timestampPeriodEnd = uint32( _startNextPeriod + lockDurationNextPeriod__ ); // log the start and end of the new period emit NewPeriodCreated( newPeriodIndex_, _startNextPeriod, period_.timestampPeriodEnd ); // totalLockedInPeriod and totalRewardedInPeriod_USA_1 are not set yet (so are 0) return newPeriodIndex_; } } function _lockTokensDuringActivePeriod(uint256 _amount) internal { StakeInfo memory stakeInfo_ = stakes__[msg.sender]; // user cannot have already staked tokens locked in the current active period require( stakeInfo_.amountStaked == 0, "LockPeriodContract: User already has NFTs in active lock, please use different wallet to lock new nfts or wait until the current lock period is over to add to this wallet" ); totalAmountStakedAssets__ += _amount; stakeInfo_.amountStaked = uint88(_amount); stakeInfo_.lastUpdatePeriodIndex = uint8(activePeriodIndex__ + 1); stakes__[msg.sender] = stakeInfo_; } function _transferInERC20(uint256 _amount) internal { require(_amount > 0, "LockPeriodContract: Cannot lock 0"); // transfer tokens from user to contract lockTokenERC20.transferFrom(msg.sender, address(this), _amount); } function _transferOutERC20(uint256 _amount) internal { lockTokenERC20.transfer(msg.sender, _amount); } function _stakeAssets(uint256 _amount) internal { totalAmountStakedAssets__ += _amount; stakes__[msg.sender].amountStaked += uint88(_amount); } function _unstakeAssets(uint256 _amount) internal { require( uint256(contractState__) >= 2, "LockPeriodContract: Cannot unstake in current state, wait for the contract to unlock" ); require(_amount > 0, "LockPeriodContract: Cannot withdraw 0 nfts."); require( _amount <= stakes__[msg.sender].amountStaked, "LockPeriodContract: Amount is higher than staked" ); totalAmountStakedAssets__ -= _amount; stakes__[msg.sender].amountStaked -= uint88(_amount); } function _checkIfNotPaused() internal { require(!paused(), "LockPeriodContract: Contract is paused"); } /* ========== RESTRICTED FUNCTIONS ========== */ function restartLockContract( uint32 _startFirstPeriod, uint256 _lockDurationNextPeriod ) external onlyOwner { _updateContractState(); _restartLockContract(_startFirstPeriod, _lockDurationNextPeriod); } function _restartLockContract( uint32 _startFirstPeriod, uint256 _lockDurationNextPeriod ) internal { // set period for period 0 to finalized periodInfo__[periodIndexCounter__].isFinalized = 1; periodIndexCounter__++; activePeriodIndex__ = periodIndexCounter__; nextPeriodIndex__ = 0; lockDurationNextPeriod__ = _lockDurationNextPeriod; // set contractState__ to FRESH_PERIOD contractState__ = ContractState.FRESH_PERIOD; PeriodInfo storage period_ = periodInfo__[periodIndexCounter__]; period_.timestampPeriodStart = _startFirstPeriod; period_.timestampPeriodEnd = uint32( _startFirstPeriod + _lockDurationNextPeriod ); emit ContractStateChanged( ContractState.FRESH_PERIOD, activePeriodIndex__ ); emit NewLockPeriodConfigured( activePeriodIndex__, _startFirstPeriod, _lockDurationNextPeriod ); } /// @inheritdoc ILockPeriodContract function configureFirstPeriod( uint32 _startFirstPeriod, uint256 _lockDurationNextPeriod ) external onlyOwner { require( contractState__ == ContractState.NONE, "LockPeriodContract: Contract state is not NONE" ); lockDurationNextPeriod__ = _lockDurationNextPeriod; // set period for period 0 to finalized periodInfo__[0].isFinalized = 1; periodIndexCounter__ = 1; activePeriodIndex__ = 1; contractState__ = ContractState.FRESH_PERIOD; PeriodInfo storage period_ = periodInfo__[1]; period_.timestampPeriodStart = _startFirstPeriod; period_.timestampPeriodEnd = uint32( _startFirstPeriod + lockDurationNextPeriod__ ); emit NewLockPeriodConfigured( activePeriodIndex__, _startFirstPeriod, _lockDurationNextPeriod ); } /// @inheritdoc ILockPeriodContract function updateManual() external { _updateContractState(); } /// @inheritdoc ILockPeriodContract function distributeRewardsForLatestPeriod( uint256 _amountReward_usa_1, uint256 _amountReward_weth_2, uint256 _amountReward_stable_3 ) external onlyRewardsDistribution { _updateContractState(); uint256 _periodIndex = activePeriodIndex__; // require that the contract is in the active state require( contractState__ == ContractState.ACTIVE_LOCKED, "LockPeriodContract: Contract must be in active state to distribute rewards" ); PeriodInfo memory period_ = periodInfo__[_periodIndex]; if (period_.totalLockedInPeriod > 0) { if (_amountReward_usa_1 > 0) { periodRewardPerStakedToken_USA_1__[_periodIndex] += (_amountReward_usa_1 * STAKE_TOKEN_DECIMALS_SCALE) / period_.totalLockedInPeriod; period_.totalRewardedInPeriod_USA_1 += uint88( _amountReward_usa_1 ); totalRewardsDistributed_USA_1__ += _amountReward_usa_1; rewardToken_USA_1.transferFrom( msg.sender, address(this), _amountReward_usa_1 ); } if (_amountReward_weth_2 > 0) { periodRewardPerStakedToken_WETH_2__[_periodIndex] += (_amountReward_weth_2 * STAKE_TOKEN_DECIMALS_SCALE) / period_.totalLockedInPeriod; period_.totalRewardedInPeriod_WETH_2 += uint88( _amountReward_weth_2 ); totalRewardsDistributed_WETH_2__ += _amountReward_weth_2; rewardToken_WETH_2.transferFrom( msg.sender, address(this), _amountReward_weth_2 ); } if (_amountReward_stable_3 > 0) { periodRewardPerStakedToken_Stable_3__[_periodIndex] += (_amountReward_stable_3 * STAKE_TOKEN_DECIMALS_SCALE) / period_.totalLockedInPeriod; period_.totalRewardedInPeriod_Stable_3 += uint88( _amountReward_stable_3 ); totalRewardsDistributed_Stable_3__ += _amountReward_stable_3; rewardToken_Stable_3.transferFrom( msg.sender, address(this), _amountReward_stable_3 ); } } else { revert("LockPeriodContract: No assets locked in this period"); } period_.isFinalized = 1; emit DistributeRewardsForLatestPeriod( _periodIndex, _amountReward_usa_1, _amountReward_weth_2, _amountReward_stable_3, period_.totalLockedInPeriod ); periodInfo__[_periodIndex] = period_; if (nextPeriodIndex__ == 0) { nextPeriodIndex__ = _createNextPeriod( period_.timestampPeriodEnd + uint32(defaultWindowDuration__) ); } } /// @inheritdoc ILockPeriodContract function setPoolState(ContractState _poolState) external onlyOwner { contractState__ = _poolState; emit PoolStateManualSet(_poolState); emit ContractStateChanged(_poolState, activePeriodIndex__); } function unfinalizePeriod(uint256 _periodIndex) external onlyOwner { require( _periodIndex <= periodIndexCounter__, "LockPeriodContract: Period index is higher than period index counter" ); periodInfo__[_periodIndex].isFinalized = 0; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } /// @inheritdoc ILockPeriodContract function setStandardWindowDuration( uint32 _standardWindowDuration ) external onlyOwner { defaultWindowDuration__ = _standardWindowDuration; emit StandardWindowDurationUpdated(_standardWindowDuration); } /// @inheritdoc ILockPeriodContract function setLockPeriodNextPeriod( uint256 _lockPeriodNextPeriod ) external onlyOwner { lockDurationNextPeriod__ = _lockPeriodNextPeriod; emit LockPeriodNextPeriodUpdated(_lockPeriodNextPeriod); } /// @inheritdoc ILockPeriodContract function setRewardsDistribution( address _rewardsDistribution ) external onlyOwner { rewardsDistribution = _rewardsDistribution; emit RewardsDistributionUpdated(_rewardsDistribution); } /// @inheritdoc ILockPeriodContract function setPeriodFinalized(uint256 _periodIndex) external onlyOwner { require( _periodIndex <= periodIndexCounter__, "LockPeriodContract: Period index is higher than period index counter" ); periodInfo__[_periodIndex].isFinalized = 1; } /// @inheritdoc ILockPeriodContract function setTotalLockedInPeriod( uint256 _periodIndex, uint88 _totalLockedInPeriod ) external onlyOwner { require( _periodIndex <= periodIndexCounter__, "LockPeriodContract: Period index is higher than period index counter" ); periodInfo__[_periodIndex].totalLockedInPeriod = _totalLockedInPeriod; } /// @inheritdoc ILockPeriodContract function setPeriodAllInfo( uint256 _periodIndex, uint8 _isFinalized, uint32 _timestampPeriodStart, uint32 _timestampPeriodEnd, uint88 _totalLockedInPeriod, uint88 _totalRewardedInPeriod_USA_1, uint88 _totalRewardedInPeriod_WETH_2, uint88 _totalRewardedInPeriod_Stable_3 ) external onlyOwner { // make sure _periodIndex is not higher than periodIndexCounter__ require( _periodIndex <= periodIndexCounter__, "LockPeriodContract: Period index is higher than period index counter" ); periodInfo__[_periodIndex].isFinalized = _isFinalized; periodInfo__[_periodIndex].timestampPeriodStart = _timestampPeriodStart; periodInfo__[_periodIndex].timestampPeriodEnd = _timestampPeriodEnd; periodInfo__[_periodIndex].totalLockedInPeriod = _totalLockedInPeriod; periodInfo__[_periodIndex] .totalRewardedInPeriod_USA_1 = _totalRewardedInPeriod_USA_1; periodInfo__[_periodIndex] .totalRewardedInPeriod_WETH_2 = _totalRewardedInPeriod_WETH_2; periodInfo__[_periodIndex] .totalRewardedInPeriod_Stable_3 = _totalRewardedInPeriod_Stable_3; } /// @inheritdoc ILockPeriodContract function emergencyWithdrawToken( address _token, address _to, uint256 _amount ) external onlyOwner { // check that the token is not the stake token require( _token != address(lockTokenERC20), "LockPeriodContract: Cannot withdraw staking token" ); IERC20(_token).transfer(_to, _amount); } /// @inheritdoc ILockPeriodContract function transferStakedTokensToMultisig( address _to, uint256 _amount ) external { require( msg.sender == MULTISIG_ADDRESS, "LockPeriodContract: Only multisig can call this function" ); lockTokenERC20.transfer(_to, _amount); } // /// @inheritdoc ILockPeriodContract function setMigratorContract(address _migratorContract) external { require( msg.sender == MULTISIG_ADDRESS, "LockPeriodContract: Only multisig can call this function" ); migratorContractAddress = _migratorContract; } /* ========== VIEWS ========== */ function _checkActivePeriod() internal view returns (ContractState state_, uint256 activePeriodIndex_) { PeriodInfo memory period_ = periodInfo__[activePeriodIndex__]; if (block.timestamp <= period_.timestampPeriodEnd) { // the contract is up to date, the active period is ongoing, the contract is in the correct state return (ContractState.ACTIVE_LOCKED, activePeriodIndex__); } else { // the period has ended, the contract is in the correct state as the active period has ended uint32 nextPeriodStart_ = period_.timestampPeriodEnd + uint32(defaultWindowDuration__); if (block.timestamp < nextPeriodStart_) { return ( ContractState.UNLOCKED_REDEEMABLE, activePeriodIndex__ + 1 ); } else if ( block.timestamp <= nextPeriodStart_ + uint32(lockDurationNextPeriod__) ) { return (ContractState.ACTIVE_LOCKED, activePeriodIndex__ + 1); } else if ( block.timestamp < nextPeriodStart_ + uint32(lockDurationNextPeriod__) + uint32(defaultWindowDuration__) ) { return ( ContractState.UNLOCKED_REDEEMABLE, activePeriodIndex__ + 2 ); } else { return (ContractState.ACTIVE_LOCKED, activePeriodIndex__ + 2); } } } function _checkUnlockRedeemable() internal view returns (ContractState state_, uint256 activePeriodIndex_) { PeriodInfo memory period_ = periodInfo__[activePeriodIndex__]; if (block.timestamp < period_.timestampPeriodStart) { // the contract is in the correct state as the active period till has to start return (ContractState.UNLOCKED_REDEEMABLE, activePeriodIndex__); } else if ( block.timestamp >= period_.timestampPeriodStart && block.timestamp <= period_.timestampPeriodEnd ) { return (ContractState.ACTIVE_LOCKED, activePeriodIndex__); } else { uint32 nextPeriodStart_ = period_.timestampPeriodEnd + uint32(defaultWindowDuration__); if (block.timestamp < nextPeriodStart_) { return ( ContractState.UNLOCKED_REDEEMABLE, activePeriodIndex__ + 1 ); } else if ( block.timestamp <= nextPeriodStart_ + uint32(lockDurationNextPeriod__) ) { return (ContractState.ACTIVE_LOCKED, activePeriodIndex__ + 1); } else { return ( ContractState.UNLOCKED_REDEEMABLE, activePeriodIndex__ + 2 ); } } } function _checkFreshPeriod() internal view returns (ContractState state_, uint256 activePeriodIndex_) { PeriodInfo memory period_ = periodInfo__[activePeriodIndex__]; if (block.timestamp < period_.timestampPeriodStart) { // the contract is in the correct state as the active period till has to start return (ContractState.FRESH_PERIOD, activePeriodIndex__); } else if ( block.timestamp >= period_.timestampPeriodStart && block.timestamp <= period_.timestampPeriodEnd ) { return (ContractState.ACTIVE_LOCKED, activePeriodIndex__); } else { uint32 nextPeriodStart_ = period_.timestampPeriodEnd + uint32(defaultWindowDuration__); if (block.timestamp < nextPeriodStart_) { return ( ContractState.UNLOCKED_REDEEMABLE, activePeriodIndex__ + 1 ); } else { return ( ContractState.CONTRACT_UNLOCKED_INACTIVE, activePeriodIndex__ + 1 ); } } } function returnContractPeriodState() public view returns (ContractState state_, uint256 activePeriodIndex_) { if (contractState__ == ContractState.ACTIVE_LOCKED) { (state_, activePeriodIndex_) = _checkActivePeriod(); } else if (contractState__ == ContractState.UNLOCKED_REDEEMABLE) { (state_, activePeriodIndex_) = _checkUnlockRedeemable(); } else if (contractState__ == ContractState.FRESH_PERIOD) { (state_, activePeriodIndex_) = _checkFreshPeriod(); } else if ( contractState__ == ContractState.CONTRACT_UNLOCKED_INACTIVE ) { return ( ContractState.CONTRACT_UNLOCKED_INACTIVE, activePeriodIndex__ ); } else { revert( "LockPeriodContract: Lock contract is awaiting configuration" ); } } function returnPendingRewards( address _user ) external view returns (uint256, uint256, uint256) { return _totalClaimable(_user, activePeriodIndex__ + 1); } function returnPeriodInfoTime() external view returns ( uint256 currentPeriodStart_, uint256 currentPeriodEnd_, uint256 nextPeriodStart_, uint256 nextPeriodEnd_ ) { (, uint256 activePeriodIndex_) = returnContractPeriodState(); PeriodInfo memory period_ = periodInfo__[activePeriodIndex__]; if (activePeriodIndex_ == activePeriodIndex__) { currentPeriodStart_ = period_.timestampPeriodStart; currentPeriodEnd_ = period_.timestampPeriodEnd; nextPeriodStart_ = period_.timestampPeriodEnd + uint32(defaultWindowDuration__); nextPeriodEnd_ = nextPeriodStart_ + uint32(lockDurationNextPeriod__); return ( currentPeriodStart_, currentPeriodEnd_, nextPeriodStart_, nextPeriodEnd_ ); } else if (activePeriodIndex_ == activePeriodIndex__ + 1) { currentPeriodStart_ = period_.timestampPeriodEnd + uint32(defaultWindowDuration__); currentPeriodEnd_ = currentPeriodStart_ + uint32(lockDurationNextPeriod__); nextPeriodStart_ = currentPeriodEnd_ + uint32(defaultWindowDuration__); nextPeriodEnd_ = nextPeriodStart_ + uint32(lockDurationNextPeriod__); } else { currentPeriodStart_ = period_.timestampPeriodEnd + uint32(defaultWindowDuration__) + uint32(lockDurationNextPeriod__) + uint32(defaultWindowDuration__); currentPeriodEnd_ = currentPeriodStart_ + uint32(lockDurationNextPeriod__); nextPeriodStart_ = currentPeriodEnd_ + uint32(defaultWindowDuration__); nextPeriodEnd_ = nextPeriodStart_ + uint32(lockDurationNextPeriod__); } } /// @inheritdoc ILockPeriodContract function returnPeriodInfoStruct( uint256 _periodIndex ) external view returns (PeriodInfo memory) { return periodInfo__[_periodIndex]; } /// @inheritdoc ILockPeriodContract function returnPeriodIndexCounter() external view returns (uint256) { return periodIndexCounter__; } /// @inheritdoc ILockPeriodContract function isActivePeriodFinalized() external view returns (bool) { return periodInfo__[activePeriodIndex__].isFinalized == 1; } /// @inheritdoc ILockPeriodContract function isPreviousPeriodFinalized() external view returns (bool) { return periodInfo__[activePeriodIndex__ - 1].isFinalized == 1; } /// @inheritdoc ILockPeriodContract function returnActivePeriodInContract() external view returns (uint256) { return activePeriodIndex__; } /// @inheritdoc ILockPeriodContract function returnNextPeriod() external view returns (uint256) { return nextPeriodIndex__; } /// @inheritdoc ILockPeriodContract function returnContractStateInContract() external view returns (ContractState) { return contractState__; } /// @inheritdoc ILockPeriodContract function returnPeriodRewardPerStakedToken( uint256 _periodIndex ) external view returns (uint256, uint256, uint256) { return ( periodRewardPerStakedToken_USA_1__[_periodIndex], periodRewardPerStakedToken_WETH_2__[_periodIndex], periodRewardPerStakedToken_Stable_3__[_periodIndex] ); } /// @inheritdoc ILockPeriodContract function returnTotalRewardsDistributed() external view returns ( uint256 totalRewardsDistributed_USA_1, uint256 totalRewardsDistributed_WETH_2, uint256 totalRewardsDistributed_Stable_3 ) { return ( totalRewardsDistributed_USA_1__, totalRewardsDistributed_WETH_2__, totalRewardsDistributed_Stable_3__ ); } /// @inheritdoc ILockPeriodContract function returnPeriodInfo( uint256 _periodIndex ) external view returns ( uint8 isFinalized, uint88 totalLockedInPeriod, uint88 totalRewardedInPeriod_USA_1, uint32 timestampPeriodStart, uint88 totalRewardedInPeriod_WETH_2, uint88 totalRewardedInPeriod_Stable_3, uint32 timestampPeriodEnd ) { PeriodInfo memory period_ = periodInfo__[_periodIndex]; return ( period_.isFinalized, period_.totalLockedInPeriod, period_.totalRewardedInPeriod_USA_1, period_.timestampPeriodStart, period_.totalRewardedInPeriod_WETH_2, period_.totalRewardedInPeriod_Stable_3, period_.timestampPeriodEnd ); } /// @inheritdoc ILockPeriodContract function returnUserStakeInfo( address _account ) external view returns ( uint8 lastUpdatePeriodIndex, uint88 amountStaked, uint88 rewardDebt_USA_1, uint88 rewardPaid_USA_1, uint88 rewardDebt_WETH_2, uint88 rewardPaid_WETH_2, uint88 rewardDebt_Stable_3, uint88 rewardPaid_Stable_3 ) { StakeInfo memory stakeInfo_ = stakes__[_account]; return ( stakeInfo_.lastUpdatePeriodIndex, stakeInfo_.amountStaked, stakeInfo_.rewardDebt_USA_1, stakeInfo_.rewardPaid_USA_1, stakeInfo_.rewardDebt_WETH_2, stakeInfo_.rewardPaid_WETH_2, stakeInfo_.rewardDebt_Stable_3, stakeInfo_.rewardPaid_Stable_3 ); } /// @inheritdoc ILockPeriodContract function totalTokensLocked() external view returns (uint256) { return totalAmountStakedAssets__; } function returnLockPeriod() external view returns (uint256) { return lockDurationNextPeriod__; } function returnStandardWindowDuration() external view returns (uint256) { return defaultWindowDuration__; } /// @inheritdoc ILockPeriodContract function amountLocked(address _account) external view returns (uint256) { return stakes__[_account].amountStaked; } /// @inheritdoc ILockPeriodContract function returnRewardClaimableUser( address _account ) external view returns (uint256, uint256, uint256) { return _totalClaimable(_account, activePeriodIndex__); } /// @inheritdoc ILockPeriodContract function rewardPerToken_USA_1( uint256 _periodIndex ) external view returns (uint256) { return periodRewardPerStakedToken_USA_1__[_periodIndex]; } /// @inheritdoc ILockPeriodContract function rewardPerToken_WETH_2( uint256 _periodIndex ) external view returns (uint256) { return periodRewardPerStakedToken_WETH_2__[_periodIndex]; } /// @inheritdoc ILockPeriodContract function rewardPerToken_Stable_3( uint256 _periodIndex ) external view returns (uint256) { return periodRewardPerStakedToken_Stable_3__[_periodIndex]; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; interface ILockNFT { function lockBatchNFTInAnyPeriod(uint256[] calldata _tokenIds) external; function lockSingleNFTInAnyPeriod(uint256 _tokenId) external; event NFTLocked( address staker, uint256 nftIndex, uint256 amountUSA, uint256 activerPeriodIndex ); event BatchNftLocked( address stakerAddress, uint256[] tokenIds, uint256 totalUSAStaked, uint256 activePeriodIndex ); event SetUsaLockAmount(uint256 _amount); event BatchOfNftsUnstaked(uint256[] _tokenIds); event NftUnstaked(uint256 tokenId); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; interface IUSAStakeReceiptNFT is IERC721Enumerable { function mintNft(address _to, uint256 _tokenId) external; function burnNft(uint256 _tokenId) external; function mintBatch(address _to, uint256[] memory _tokenIds) external; function setStakeContract(address _stakeContract) external; function returnArrayWithNfts( address _user ) external view returns (uint256[] memory indexArray_); function isOwnerOf( address _user, uint256 _tokenId ) external view returns (bool); function burnBatch(uint256[] memory _tokenIds) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC-1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[ERC]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the zero address. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; import {Errors} from "./Errors.sol"; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert Errors.InsufficientBalance(address(this).balance, amount); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert Errors.FailedCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {Errors.FailedCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert Errors.InsufficientBalance(address(this).balance, value); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case * of an unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {Errors.FailedCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}. */ function _revert(bytes memory returndata) 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 Errors.FailedCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC-1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC-1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ 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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @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; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // 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; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { bool private _paused; /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; interface ILockPeriodContract { /** * @param isFinalized 0 = not finalized, 1 = finalized * @param periodDuration the duration of the period_ in seconds * @param timestampPeriodEnd the timestamp of the end of the period_ * @param totalLockedInPeriod the total amount of tokens locked in the period_ * @param totalRewardedInPeriod_USA_1 the total amount of WETH rewarded in the period_ * @param totalRewardedInPeriod_WETH_2 the total amount of WETH rewarded in the period_ * @param totalRewardedInPeriod_Stable_3 the total amount of WETH rewarded in the period_ * @param timestampPeriodStart the timestamp of the start of the period_ */ struct PeriodInfo { uint8 isFinalized; // 0 = not finalized, 1 = finalized uint88 totalLockedInPeriod; uint88 totalRewardedInPeriod_USA_1; uint32 timestampPeriodStart; uint88 totalRewardedInPeriod_WETH_2; uint88 totalRewardedInPeriod_Stable_3; uint32 timestampPeriodEnd; } /** * @param amountStaked the amount of tokens staked * @param rewardDebt_USA_1 the amount of rewards(WETH) that have been distributed but not yet claimed * @param rewardPaid the amount of rewards(WETH) that have been claimed * @param lastUpdatePeriodIndex the index of the last period_ that the user has updated their rewards for */ struct StakeInfo { uint8 lastUpdatePeriodIndex; uint88 amountStaked; uint88 rewardDebt_USA_1; uint88 rewardPaid_USA_1; uint88 rewardDebt_WETH_2; uint88 rewardPaid_WETH_2; uint88 rewardDebt_Stable_3; uint88 rewardPaid_Stable_3; } enum ContractState { NONE, // 0 ACTIVE_LOCKED, // 1 UNLOCKED_REDEEMABLE, // 2 FRESH_PERIOD, // 3 CONTRACT_UNLOCKED_INACTIVE // 4 } /* ========== VIEW FUNCTIONS ========== */ function returnPeriodIndexCounter() external view returns (uint256); function isActivePeriodFinalized() external view returns (bool); function isPreviousPeriodFinalized() external view returns (bool); function returnContractStateInContract() external view returns (ContractState); function returnActivePeriodInContract() external view returns (uint256); function returnLockPeriod() external view returns (uint256); function returnStandardWindowDuration() external view returns (uint256); function returnNextPeriod() external view returns (uint256); function returnPeriodRewardPerStakedToken( uint256 _periodIndex ) external view returns (uint256, uint256, uint256); function totalTokensLocked() external view returns (uint256); function returnTotalRewardsDistributed() external view returns ( uint256 totalRewardsDistributed_USA_1, uint256 totalRewardsDistributed_WETH_2, uint256 totalRewardsDistributed_Stable_3 ); /** * @notice Calculates the amount of reward USA token each locked token is entitled to for a given period * @param _periodIndex The index of the period for which to calculate the reward per token * @return The calculated reward amount per token as a fixed point number with 18 decimals */ function rewardPerToken_USA_1( uint256 _periodIndex ) external view returns (uint256); /** * @notice Calculates the amount of reward WETH token each locked token is entitled to for a given period * @param _periodIndex The index of the period for which to calculate the reward per token * @return The calculated reward amount per token as a fixed point number with 18 decimals */ function rewardPerToken_WETH_2( uint256 _periodIndex ) external view returns (uint256); /** * @notice Calculates the amount of reward Stable token each locked token is entitled to for a given period * @param _periodIndex The index of the period for which to calculate the reward per token * @return The calculated reward amount per token as a fixed point number with 18 decimals */ function rewardPerToken_Stable_3( uint256 _periodIndex ) external view returns (uint256); /** * @notice Returns the amount of tokens staked by a specific user and how much historically user has been issued and claimed * @param _user The address of the user for whom to return the stake information * @return lastUpdatePeriodIndex The index of the last period that the user has updated their rewards for * @return amountStaked The amount of tokens staked by the user * @return rewardDebt_USA_1 The amount of USA the user has earned historically (up only value, accumulated) * @return rewardPaid_USA_1 The amount of USA the user has claimed historically (up only value, accumulated) * @return rewardDebt_WETH_2 The amount of WETH the user has earned historically (up only value, accumulated) * @return rewardPaid_WETH_2 The amount of WETH the user has claimed historically (up only value, accumulated) * @return rewardDebt_Stable_3 The amount of Stable the user has earned historically (up only value, accumulated) * @return rewardPaid_Stable_3 The amount of Stable the user has claimed historically (up only value, accumulated) */ function returnUserStakeInfo( address _user ) external view returns ( uint8 lastUpdatePeriodIndex, uint88 amountStaked, uint88 rewardDebt_USA_1, uint88 rewardPaid_USA_1, uint88 rewardDebt_WETH_2, uint88 rewardPaid_WETH_2, uint88 rewardDebt_Stable_3, uint88 rewardPaid_Stable_3 ); /** * @notice Returns the claimable reward amount of a specific user * @param _user The address of the user for whom to return the claimable reward * @return The total amount of rewards that the user can claim */ function returnRewardClaimableUser( address _user ) external view returns (uint256, uint256, uint256); /** * @notice Returns detailed information about a specific period by index. * @dev This function provides granular details about a period, including its finalization status, total tokens locked, rewards distributed across different tokens, and its start and end timestamps. This information is crucial for understanding the state and history of rewards and staking for a given period. * @param _periodIndex The index of the period for which to retrieve information. * @return isFinalized Indicates whether the period has been finalized (1) or not (0). * @return totalLockedInPeriod The total amount of tokens locked during the specified period. * @return totalRewardedInPeriod_USA_1 The total amount of USA_1 token rewards distributed during the specified period. * @return timestampPeriodStart The start timestamp of the period. * @return totalRewardedInPeriod_WETH_2 The total amount of WETH_2 token rewards distributed during the specified period. * @return totalRewardedInPeriod_Stable_3 The total amount of Stable_3 token rewards distributed during the specified period. * @return timestampPeriodEnd The end timestamp of the period. */ function returnPeriodInfo( uint256 _periodIndex ) external view returns ( uint8 isFinalized, uint88 totalLockedInPeriod, uint88 totalRewardedInPeriod_USA_1, uint32 timestampPeriodStart, uint88 totalRewardedInPeriod_WETH_2, uint88 totalRewardedInPeriod_Stable_3, uint32 timestampPeriodEnd ); function returnPeriodInfoTime() external view returns ( uint256 currentPeriodStart_, uint256 currentPeriodEnd_, uint256 nextPeriodStart_, uint256 nextPeriodEnd_ ); /** * @notice Returns a struct containing detailed information about a specific period by index. * @dev This function is an alternative to `returnPeriodInfo` that returns a struct, making it easier to interact with in some scenarios. It provides the same information in a structured format, which can be particularly useful when the caller needs to process multiple pieces of period data at once. * @param _periodIndex The index of the period for which to retrieve information. * @return A `PeriodInfo` struct containing all relevant details about the period, including its finalization status, total tokens locked, rewards distributed across different tokens, and its start and end timestamps. */ function returnPeriodInfoStruct( uint256 _periodIndex ) external view returns (PeriodInfo memory); /** * @notice Returns the balance of staked tokens for a specific account * @param _account The address of the account for which to return the staked token balance * @return The total amount of tokens staked by the specified account */ function amountLocked(address _account) external view returns (uint256); /* ========== WRITE FUNCTIONS ========== */ function distributeRewardsForLatestPeriod( uint256 _amountReward_1, uint256 _amountReward_2, uint256 _amountReward_3 ) external; function pause() external; function unpause() external; /** * @notice Sets the duration of the standard window for the staking period * @param _standardWindowDuration The duration in seconds for the standard window */ function setStandardWindowDuration(uint32 _standardWindowDuration) external; /** * @notice set the rewards distribution contract address that can call notifyRewardAmount() * @param _rewardsDistribution The address of the rewardsDistribution contract */ function setRewardsDistribution(address _rewardsDistribution) external; /** * @notice Sets the lock period for the next period * This function can be used to set the lock period for the next period * @param _lockPeriodNextPeriod The lock period for the next period */ function setLockPeriodNextPeriod(uint256 _lockPeriodNextPeriod) external; /** * @notice Updates all information for a specific period * @dev This function allows updating the period information including its start and end timestamps, * the total amount locked during the period, and the total rewards distributed in the period for each token type. * This function can only be called by the contract owner or another authorized entity. * @param _periodIndex The index of the period to update * @param _isFinalized The finalization status of the period (0 = not finalized, 1 = finalized) * @param _timestampPeriodStart The start timestamp of the period * @param _timestampPeriodEnd The end timestamp of the period * @param _totalLockedInPeriod The total amount of tokens locked during the period * @param _totalRewardedInPeriod_USA_1 The total amount of USA token rewards distributed during the period * @param _totalRewardedInPeriod_WETH_2 The total amount of WETH token rewards distributed during the period * @param _totalRewardedInPeriod_Stable_3 The total amount of Stable token rewards distributed during the period */ function setPeriodAllInfo( uint256 _periodIndex, uint8 _isFinalized, uint32 _timestampPeriodStart, uint32 _timestampPeriodEnd, uint88 _totalLockedInPeriod, uint88 _totalRewardedInPeriod_USA_1, uint88 _totalRewardedInPeriod_WETH_2, uint88 _totalRewardedInPeriod_Stable_3 ) external; /** * @notice Updates the total amount of tokens locked for a specific period * @dev This function allows updating the total amount of tokens that have been locked during a specified period. * It can only be called by the contract owner or another authorized entity. This is crucial for accurately tracking * the total locked tokens which can affect reward calculations and period finalizations. * @param _periodIndex The index of the period for which to update the total locked amount * @param _totalLockedInPeriod The new total amount of tokens locked in the specified period */ function setTotalLockedInPeriod( uint256 _periodIndex, uint88 _totalLockedInPeriod ) external; /** * @notice Marks a specific period as finalized * @dev This function sets the finalization status of a specified period to finalized (1). * It can only be called by the contract owner or another authorized entity. Finalizing a period * is an important step in the rewards distribution process as it prevents any further changes * to the period's data, ensuring the integrity of the rewards calculation. * @param _periodIndex The index of the period to be finalized */ function setPeriodFinalized(uint256 _periodIndex) external; function unfinalizePeriod(uint256 _periodIndex) external; /** * @notice Manually triggers the update of the contract state * @dev This function is designed to manually trigger the internal mechanism that updates the contract's state based on the current time and the state of periods. It is intended to be used in scenarios where the automatic state transition needs to be enforced immediately. This function can only be called by the contract owner or another authorized entity. */ function updateManual() external; /** * @notice Sets the current state of the pool * @dev This function allows updating the current state of the pool to reflect its operational status accurately. * The state can be one of several predefined states, such as ACTIVE_LOCKED, UNLOCKED_REDEEMABLE, or FRESH_PERIOD, * each representing a different phase in the pool's lifecycle. Changing the pool state is a critical action that * can affect the pool's behavior and how users interact with it. Therefore, this function can only be called by * the contract owner or another authorized entity to ensure that state transitions are controlled and intentional. * @param _poolState The new state to set for the pool */ function setPoolState(ContractState _poolState) external; /** * @notice Configures the first period of the lock pool * @dev This function sets the start time and lock duration for the first period of the lock pool. * It can only be called by the contract owner or another authorized entity. This is a critical setup step * that initializes the first period, enabling users to start locking tokens. The lock duration determines * how long the tokens will be locked before they can be unlocked or before rewards can be claimed. * @param _startFirstPeriod The start time of the first period * @param _lockDurationNextPeriod The lock duration for the first period */ function configureFirstPeriod( uint32 _startFirstPeriod, uint256 _lockDurationNextPeriod ) external; /** * @notice Transfers staked tokens to a multisig address * @dev This function is designed for emergency scenarios or contract migrations. It allows the transfer of staked tokens to a multisig address. This function can only be called by the multisig address set in the contract, ensuring that only authorized parties can execute it. * @param _to The address to which the tokens will be transferred. * @param _amount The amount of tokens to be transferred. */ function transferStakedTokensToMultisig( address _to, uint256 _amount ) external; /** * @notice Allows the emergency withdrawal of tokens * @dev This function is an emergency mechanism to withdraw tokens from the contract. It can be used in scenarios such as contract migration or if there's a need to recover tokens mistakenly sent to the contract. This function can only be called by the contract owner. * @param _token The address of the token to be withdrawn. * @param _to The address to which the tokens will be sent. * @param _amount The amount of tokens to be withdrawn. */ function emergencyWithdrawToken( address _token, address _to, uint256 _amount ) external; /** * @notice Sets the migrator contract address * @dev This function allows setting the address of the migrator contract, which is authorized to call `migrateLockERC20TokensToNewLockContract`. This is a security measure to ensure that only a trusted migrator can perform migrations. This function can only be called by the multisig address. * @param _migratorContract The address of the migrator contract. */ function setMigratorContract(address _migratorContract) external; /* ========== EVENTS ========== */ event TokensStaked( address indexed user, uint256 amount, uint256 periodIndexCounter_ ); event StopNextPeriod(bool stopNextPeriod); event RewardDistributed(uint256 indexed periodIndex, uint256 amount); event NewPeriodStarted( uint256 indexed periodIndex, uint256 startTime, uint256 endTime ); event RewardsClaimed( address indexed user, uint256 amountClaimedUSA, uint256 amountClaimedWETH, uint256 amountClaimedStable ); event RewardsDurationUpdated(uint256 newDuration); event LockPeriodNextPeriodUpdated(uint256 lockPeriodNextPeriod); event RewardsDistributionUpdated(address newRewardsDistribution); event StandardWindowDurationUpdated(uint32 standardWindowDuration); event UnstakeTokens(address indexed user, uint256 amount); event DistributeRewardsForLatestPeriod( uint256 periodIndex, uint256 amountReward_usa_1, uint256 amountReward_weth_2, uint256 amountReward_stable_3, uint88 totalLockedInPeriod ); event NewLockPeriodConfigured( uint256 indexed periodIndex, uint32 timestampPeriodStart, uint256 lockDurationNextPeriod ); event PoolStateManualSet(ContractState _poolState); event LockActiveUpdated(bool _isLockActive); event ContractStateChanged( ContractState _contractState, uint256 periodIndex ); event NewPeriodCreated( uint256 indexed periodIndex, uint32 timestampPeriodStart, uint32 timestampPeriodEnd ); event TimeoutByUnfinalizedPeriods(uint256 activePeriodIndex); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.20; import {IERC721} from "../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 v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * 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[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * @dev Collection of common custom errors used in multiple contracts * * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library. * It is recommended to avoid relying on the error API for critical functionality. */ library Errors { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error InsufficientBalance(uint256 balance, uint256 needed); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedCall(); /** * @dev The deployment failed. */ error FailedDeployment(); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC-721 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 ERC-721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or * {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the address zero. * * 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); }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "forge-std/=lib/forge-std/src/", "@delta/=lib/ERC1155Delta/contracts/", "solady/=lib/solady/", "@chainlink/=lib/ERC1155Delta/node_modules/@chainlink/", "@ensdomains/=lib/ERC1155Delta/node_modules/@ensdomains/", "@eth-optimism/=lib/ERC1155Delta/node_modules/@eth-optimism/contracts/", "ERC1155Delta/=lib/ERC1155Delta/contracts/", "closedsea/=lib/ERC1155Delta/node_modules/closedsea/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "erc721a/=lib/ERC1155Delta/node_modules/erc721a/contracts/", "erc721psi/=lib/ERC1155Delta/node_modules/erc721psi/contracts/", "eth-gas-reporter/=lib/ERC1155Delta/node_modules/eth-gas-reporter/", "hardhat/=lib/ERC1155Delta/node_modules/hardhat/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solidity-bits/=lib/ERC1155Delta/node_modules/solidity-bits/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_rewardsToken_usa_1","type":"address"},{"internalType":"address","name":"_rewardsToken_WETH_2","type":"address"},{"internalType":"address","name":"_rewardsToken_Stable_3","type":"address"},{"internalType":"address","name":"_lockERC20","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_multisig","type":"address"},{"internalType":"address","name":"_receiptNFT","type":"address"},{"internalType":"address","name":"_lockNFTAddress","type":"address"},{"internalType":"uint256","name":"_lockDurationNextPeriod","type":"uint256"},{"internalType":"uint256","name":"_defaultWindowDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"stakerAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"totalUSAStaked","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"activePeriodIndex","type":"uint256"}],"name":"BatchNftLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"BatchOfNftsUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum ILockPeriodContract.ContractState","name":"_contractState","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"periodIndex","type":"uint256"}],"name":"ContractStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"periodIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReward_usa_1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReward_weth_2","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReward_stable_3","type":"uint256"},{"indexed":false,"internalType":"uint88","name":"totalLockedInPeriod","type":"uint88"}],"name":"DistributeRewardsForLatestPeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_isLockActive","type":"bool"}],"name":"LockActiveUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockPeriodNextPeriod","type":"uint256"}],"name":"LockPeriodNextPeriodUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountUSA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"activerPeriodIndex","type":"uint256"}],"name":"NFTLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"periodIndex","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"timestampPeriodStart","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"lockDurationNextPeriod","type":"uint256"}],"name":"NewLockPeriodConfigured","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"periodIndex","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"timestampPeriodStart","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"timestampPeriodEnd","type":"uint32"}],"name":"NewPeriodCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"periodIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"NewPeriodStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NftUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum ILockPeriodContract.ContractState","name":"_poolState","type":"uint8"}],"name":"PoolStateManualSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"periodIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountClaimedUSA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountClaimedWETH","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountClaimedStable","type":"uint256"}],"name":"RewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newRewardsDistribution","type":"address"}],"name":"RewardsDistributionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"RewardsDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"SetUsaLockAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"standardWindowDuration","type":"uint32"}],"name":"StandardWindowDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"stopNextPeriod","type":"bool"}],"name":"StopNextPeriod","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"activePeriodIndex","type":"uint256"}],"name":"TimeoutByUnfinalizedPeriods","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodIndexCounter_","type":"uint256"}],"name":"TokensStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnstakeTokens","type":"event"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"amountLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"amountUsaLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_startFirstPeriod","type":"uint32"},{"internalType":"uint256","name":"_lockDurationNextPeriod","type":"uint256"}],"name":"configureFirstPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountReward_usa_1","type":"uint256"},{"internalType":"uint256","name":"_amountReward_weth_2","type":"uint256"},{"internalType":"uint256","name":"_amountReward_stable_3","type":"uint256"}],"name":"distributeRewardsForLatestPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"emergencyWithdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"executeAnyCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvestRewards","outputs":[{"internalType":"uint256","name":"claimableReward_USA_1","type":"uint256"},{"internalType":"uint256","name":"claimableReward_WETH_2","type":"uint256"},{"internalType":"uint256","name":"claimableReward_Stable_3","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isActivePeriodFinalized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPreviousPeriodFinalized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"lockBatchNFTInAnyPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"lockSingleNFTInAnyPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockTokenERC1155","outputs":[{"internalType":"contract IERC1155","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"migratorContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"receiptNFTContract","outputs":[{"internalType":"contract IUSAStakeReceiptNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_startFirstPeriod","type":"uint32"},{"internalType":"uint256","name":"_lockDurationNextPeriod","type":"uint256"}],"name":"restartLockContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"returnActivePeriodInContract","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnContractPeriodState","outputs":[{"internalType":"enum ILockPeriodContract.ContractState","name":"state_","type":"uint8"},{"internalType":"uint256","name":"activePeriodIndex_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnContractStateInContract","outputs":[{"internalType":"enum ILockPeriodContract.ContractState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnLockPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnNextPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"returnPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnPeriodIndexCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"returnPeriodInfo","outputs":[{"internalType":"uint8","name":"isFinalized","type":"uint8"},{"internalType":"uint88","name":"totalLockedInPeriod","type":"uint88"},{"internalType":"uint88","name":"totalRewardedInPeriod_USA_1","type":"uint88"},{"internalType":"uint32","name":"timestampPeriodStart","type":"uint32"},{"internalType":"uint88","name":"totalRewardedInPeriod_WETH_2","type":"uint88"},{"internalType":"uint88","name":"totalRewardedInPeriod_Stable_3","type":"uint88"},{"internalType":"uint32","name":"timestampPeriodEnd","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"returnPeriodInfoStruct","outputs":[{"components":[{"internalType":"uint8","name":"isFinalized","type":"uint8"},{"internalType":"uint88","name":"totalLockedInPeriod","type":"uint88"},{"internalType":"uint88","name":"totalRewardedInPeriod_USA_1","type":"uint88"},{"internalType":"uint32","name":"timestampPeriodStart","type":"uint32"},{"internalType":"uint88","name":"totalRewardedInPeriod_WETH_2","type":"uint88"},{"internalType":"uint88","name":"totalRewardedInPeriod_Stable_3","type":"uint88"},{"internalType":"uint32","name":"timestampPeriodEnd","type":"uint32"}],"internalType":"struct ILockPeriodContract.PeriodInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnPeriodInfoTime","outputs":[{"internalType":"uint256","name":"currentPeriodStart_","type":"uint256"},{"internalType":"uint256","name":"currentPeriodEnd_","type":"uint256"},{"internalType":"uint256","name":"nextPeriodStart_","type":"uint256"},{"internalType":"uint256","name":"nextPeriodEnd_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"returnPeriodRewardPerStakedToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"returnRewardClaimableUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnStandardWindowDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"returnTotalRewardsDistributed","outputs":[{"internalType":"uint256","name":"totalRewardsDistributed_USA_1","type":"uint256"},{"internalType":"uint256","name":"totalRewardsDistributed_WETH_2","type":"uint256"},{"internalType":"uint256","name":"totalRewardsDistributed_Stable_3","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"returnUserStakeInfo","outputs":[{"internalType":"uint8","name":"lastUpdatePeriodIndex","type":"uint8"},{"internalType":"uint88","name":"amountStaked","type":"uint88"},{"internalType":"uint88","name":"rewardDebt_USA_1","type":"uint88"},{"internalType":"uint88","name":"rewardPaid_USA_1","type":"uint88"},{"internalType":"uint88","name":"rewardDebt_WETH_2","type":"uint88"},{"internalType":"uint88","name":"rewardPaid_WETH_2","type":"uint88"},{"internalType":"uint88","name":"rewardDebt_Stable_3","type":"uint88"},{"internalType":"uint88","name":"rewardPaid_Stable_3","type":"uint88"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"rewardPerToken_Stable_3","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"rewardPerToken_USA_1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"rewardPerToken_WETH_2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDistribution","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockPeriodNextPeriod","type":"uint256"}],"name":"setLockPeriodNextPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_migratorContract","type":"address"}],"name":"setMigratorContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"},{"internalType":"uint8","name":"_isFinalized","type":"uint8"},{"internalType":"uint32","name":"_timestampPeriodStart","type":"uint32"},{"internalType":"uint32","name":"_timestampPeriodEnd","type":"uint32"},{"internalType":"uint88","name":"_totalLockedInPeriod","type":"uint88"},{"internalType":"uint88","name":"_totalRewardedInPeriod_USA_1","type":"uint88"},{"internalType":"uint88","name":"_totalRewardedInPeriod_WETH_2","type":"uint88"},{"internalType":"uint88","name":"_totalRewardedInPeriod_Stable_3","type":"uint88"}],"name":"setPeriodAllInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"setPeriodFinalized","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ILockPeriodContract.ContractState","name":"_poolState","type":"uint8"}],"name":"setPoolState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsDistribution","type":"address"}],"name":"setRewardsDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_standardWindowDuration","type":"uint32"}],"name":"setStandardWindowDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"},{"internalType":"uint88","name":"_totalLockedInPeriod","type":"uint88"}],"name":"setTotalLockedInPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setUsaLockAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTokensLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferStakedTokensToMultisig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodIndex","type":"uint256"}],"name":"unfinalizePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"unstakeBatchOfNfts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"unstakeSingleNftIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateManual","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usaLockAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101806040523480156200001257600080fd5b5060405162005d2b38038062005d2b833981016040819052620000359162000150565b898989898989816001600160a01b0381166200006b57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200007681620000e3565b5060018080556002805460ff191690556001600160a01b0396871660e052948616610100529285166101205250831660c052821660a052600f9390935560109190915591821661016052911661014052608052505068878678326eac900000601555506200020d92505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200014b57600080fd5b919050565b6000806000806000806000806000806101408b8d0312156200017157600080fd5b6200017c8b62000133565b99506200018c60208c0162000133565b98506200019c60408c0162000133565b9750620001ac60608c0162000133565b9650620001bc60808c0162000133565b9550620001cc60a08c0162000133565b9450620001dc60c08c0162000133565b9350620001ec60e08c0162000133565b92506101008b015191506101208b015190509295989b9194979a5092959850565b60805160a05160c05160e05161010051610120516101405161016051615a09620003226000396000818161050a0152818161218b01528181613c2d015281816140b5015261438201526000818161053101528181611c9901528181614137015281816141ab01526144050152600081816114c5015261300301526000818161138b0152612f4c0152600081816112510152612e95015260008181610ce4015281816119fc015281816120970152818161259901528181613df8015261406701526000818161181001526125450152600081816111ae015281816112e80152818161142201528181612af501528181612b4b01528181612ba1015281816133150152818161336b01526133c10152615a096000f3fe608060405234801561001057600080fd5b50600436106103995760003560e01c80637e66bd5b116101e9578063c154fea01161010f578063ede9f270116100ad578063fb61717f1161007c578063fb61717f14610bd9578063fdc5029514610bec578063fe1de0ac14610bf4578063fe2047e614610c0757600080fd5b8063ede9f27014610b36578063f23a6e6114610b56578063f2fde38b14610b8f578063f6c788b214610ba257600080fd5b8063cec686bf116100e9578063cec686bf14610afa578063d5328dbe14610b08578063dc5bf96114610b1b578063df3ebe8f14610b2357600080fd5b8063c154fea014610aac578063c48ec1e614610abf578063c8cd077314610ad257600080fd5b80639464599b11610187578063adfd801e11610156578063adfd801e146108d8578063b076408b146108eb578063b19466601461090b578063bc197c8114610a5857600080fd5b80639464599b14610889578063a67856461461089c578063a86ed8e1146108bc578063a8789cba146108c557600080fd5b80638c365f9a116101c35780638c365f9a1461083c5780638da5cb5b1461084f5780638ed4e1581461086057806391588f9d1461087657600080fd5b80637e66bd5b146107275780638456cb591461073a5780638759d2011461074257600080fd5b806346372098116102ce57806356b7469a1161026c5780635ed2ab701161023b5780635ed2ab70146106e65780636d7a270c146106f9578063715018a61461070c57806377dd84691461071457600080fd5b806356b7469a1461069557806359d1face146106a85780635bde3b27146106bb5780635c975abb146106db57600080fd5b80634da48d53116102a85780634da48d531461065f5780635091936a14610672578063545b0be11461067a57806356773a091461068257600080fd5b80634637209814610505578063479796441461052c5780634c9b14981461055357600080fd5b806327bbf0081161033b5780633331cfec116103155780633331cfec146104ac5780633f4ba83a146104ca5780633fc6df6e146104d2578063434af4f2146104fd57600080fd5b806327bbf0081461047e5780632be11ae214610491578063314616731461049957600080fd5b806317627e671161037757806317627e67146103f15780631976214314610406578063263a7c3f14610419578063277327a51461046b57600080fd5b806301ffc9a71461039e57806309c44666146103d7578063133f50a3146103e9575b600080fd5b6103c26103ac366004614ff4565b6001600160e01b031916636cdb3d1360e11b1490565b60405190151581526020015b60405180910390f35b600b545b6040519081526020016103ce565b6103c2610c0f565b6104046103ff36600461501e565b610c40565b005b610404610414366004615053565b610c84565b61045061042736600461501e565b600081815260056020908152604080832054600683528184205460079093529220549193909250565b604080519384526020840192909252908201526060016103ce565b61040461047936600461506e565b610cda565b61040461048c3660046150f1565b610df9565b610450610e9b565b6104046104a73660046151ab565b610ed9565b6103c2600a5460009081526003602052604090205460ff1660011490565b610404610f1d565b6012546104e5906001600160a01b031681565b6040516001600160a01b0390911681526020016103ce565b6010546103db565b6104e57f000000000000000000000000000000000000000000000000000000000000000081565b6104e57f000000000000000000000000000000000000000000000000000000000000000081565b61060d610561366004615053565b6001600160a01b031660009081526004602090815260409182902082516101008082018552825460ff81168084529181046001600160581b03908116958401869052600160601b9091048116958301869052600184015480821660608501819052600160581b91829004831660808601819052600287015480851660a08801819052939004841660c0870181905260039097015490931660e09095018590529297959695929491939092565b6040805160ff90991689526001600160581b0397881660208a01529587169588019590955292851660608701529084166080860152831660a0850152821660c08401521660e0820152610100016103ce565b61040461066d36600461501e565b610f2f565b6009546103db565b600f546103db565b610450610690366004615053565b610f71565b60085460ff166040516103ce91906151fe565b6104046106b636600461501e565b610f9b565b6103db6106c936600461501e565b60009081526007602052604090205490565b60025460ff166103c2565b6104046106f436600461520c565b610fe0565b61040461070736600461524f565b611710565b61040461176f565b61040461072236600461527b565b611781565b610404610735366004615053565b611805565b61040461186f565b6107eb61075036600461501e565b600090815260036020908152604091829020825160e081018452815460ff81168083526001600160581b0361010083048116958401869052600160601b8304811696840187905263ffffffff600160b81b90930483166060850181905260019095015480821660808601819052600160581b820490921660a08601819052600160b01b90910490931660c09094018490529096949594909290565b6040805160ff90981688526001600160581b0396871660208901529486169487019490945263ffffffff928316606087015290841660808601529290921660a08401521660c082015260e0016103ce565b6013546104e5906001600160a01b031681565b6000546001600160a01b03166104e5565b61086861187f565b6040516103ce92919061529c565b610450610884366004615053565b611993565b6104046108973660046152b7565b6119a4565b6103db6108aa36600461501e565b60009081526006602052604090205490565b6103db60155481565b6104046108d336600461501e565b611c5e565b6104046108e63660046152b7565b611eaf565b6103db6108f936600461501e565b60009081526005602052604090205490565b6109df61091936600461501e565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915250600090815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b909404841660608201526001909101548083166080830152600160581b810490921660a0820152600160b01b90910490911660c082015290565b6040516103ce9190600060e08201905060ff835116825260208301516001600160581b0380821660208501528060408601511660408501526060850151915063ffffffff80831660608601528160808701511660808601528160a08701511660a08601528060c08701511660c086015250505092915050565b610a93610a663660046153eb565b7fbc197c819b3e337a6f9652dd10becd7eef83032af3b9d958d3d42f669414662198975050505050505050565b6040516001600160e01b031990911681526020016103ce565b610404610aba36600461501e565b612019565b610404610acd36600461501e565b612056565b610ada612354565b6040805194855260208501939093529183015260608201526080016103ce565b600c54600d54600e54610450565b610404610b163660046154a6565b61253a565b6011546103db565b610404610b313660046154d0565b612613565b6103db610b4436600461501e565b60146020526000908152604090205481565b610a93610b643660046154ec565b7ff23a6e612e1ff4830e658fe43f4e3cb4a5f8170bd5d9e69fb5d7a7fa9e4fdf979695505050505050565b610404610b9d366004615053565b6127a2565b6103db610bb0366004615053565b6001600160a01b031660009081526004602052604090205461010090046001600160581b031690565b610404610be7366004615564565b6127dd565b600a546103db565b610404610c023660046154d0565b6128bf565b6104046128dd565b6000600360006001600a54610c249190615612565b815260208101919091526040016000205460ff16600114919050565b610c486128e5565b600f8190556040518181527f600238da9717e7a12500ffe1c4a936a272d9b4aa0daf3971902c7746bb797f18906020015b60405180910390a150565b610c8c6128e5565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527f1c794a043683a294127c95bc365bae91b63b651eb9884a2c9120afee2bb690b490602001610c79565b610ce26128e5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603610d825760405162461bcd60e51b815260206004820152603160248201527f4c6f636b506572696f64436f6e74726163743a2043616e6e6f742077697468646044820152703930bb9039ba30b5b4b733903a37b5b2b760791b60648201526084015b60405180910390fd5b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb90610db09085908590600401615625565b6020604051808303816000875af1158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df3919061563e565b50505050565b6013546001600160a01b03163314610e835760405162461bcd60e51b815260206004820152604160248201527f4c6f636b506572696f64436f6e74726163743a204f6e6c79206d69677261746f60448201527f7220636f6e74726163742063616e2063616c6c20746869732066756e6374696f6064820152603760f91b608482015260a401610d79565b610e966001600160a01b03831682612912565b505050565b6000806000610ea8612929565b33610eb1612953565b610eba816129ed565b610ec2612d44565b91955093509150610ed4905060018055565b909192565b610ee16128e5565b63ffffffff811660108190556040519081527f4b4ab4d31395b5d90df847f00d1fdc1e6e8e5432637e239b6a84ddc738e420c290602001610c79565b610f256128e5565b610f2d61319d565b565b610f376128e5565b600954811115610f595760405162461bcd60e51b8152600401610d7990615660565b6000908152600360205260409020805460ff19169055565b6000806000610f8e84600a546001610f8991906156ca565b6131ef565b9250925092509193909250565b610fa36128e5565b600954811115610fc55760405162461bcd60e51b8152600401610d7990615660565b6000908152600360205260409020805460ff19166001179055565b6012546001600160a01b031633146110605760405162461bcd60e51b815260206004820152603e60248201527f4c6f636b506572696f64436f6e74726163743a2043616c6c6572206973206e6f60448201527f742052657761726473446973747269627574696f6e20636f6e747261637400006064820152608401610d79565b611068612953565b600a54600160085460ff166004811115611084576110846151c6565b1461110a5760405162461bcd60e51b815260206004820152604a60248201527f4c6f636b506572696f64436f6e74726163743a20436f6e7472616374206d757360448201527f7420626520696e2061637469766520737461746520746f2064697374726962756064820152697465207265776172647360b01b608482015260a401610d79565b600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b0361010082048116948301859052600160601b820481169583019590955263ffffffff600160b81b909104811660608301526001909201548085166080830152600160581b810490941660a0820152600160b01b9093041660c0830152156115485784156112cf5760208101516001600160581b03166111d37f0000000000000000000000000000000000000000000000000000000000000000876156dd565b6111dd919061570a565b600083815260056020526040812080549091906111fb9084906156ca565b925050819055508481604001818151611214919061572c565b6001600160581b0316905250600c80548691906000906112359084906156ca565b90915550506040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd9061128a90339030908a9060040161574c565b6020604051808303816000875af11580156112a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112cd919061563e565b505b83156114095760208101516001600160581b031661130d7f0000000000000000000000000000000000000000000000000000000000000000866156dd565b611317919061570a565b600083815260066020526040812080549091906113359084906156ca565b92505081905550838160800181815161134e919061572c565b6001600160581b0316905250600d805485919060009061136f9084906156ca565b90915550506040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906113c49033903090899060040161574c565b6020604051808303816000875af11580156113e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611407919061563e565b505b82156115435760208101516001600160581b03166114477f0000000000000000000000000000000000000000000000000000000000000000856156dd565b611451919061570a565b6000838152600760205260408120805490919061146f9084906156ca565b92505081905550828160a001818151611488919061572c565b6001600160581b0316905250600e80548491906000906114a99084906156ca565b90915550506040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906114fe9033903090889060040161574c565b6020604051808303816000875af115801561151d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611541919061563e565b505b6115ac565b60405162461bcd60e51b815260206004820152603360248201527f4c6f636b506572696f64436f6e74726163743a204e6f20617373657473206c6f60448201527218dad959081a5b881d1a1a5cc81c195c9a5bd9606a1b6064820152608401610d79565b60018152602080820151604080518581529283018890528201869052606082018590526001600160581b031660808201527f37e67855d43539d9a5c8da51025d5f1f1f2b098378cbd9119ec6da68d76dd6659060a00160405180910390a16000828152600360209081526040808320845181549386015192860151606087015160ff9092166001600160601b0319909516949094176101006001600160581b0394851602176effffffffffffffffffffffffffffff60601b1916600160601b9484169490940263ffffffff60b81b191693909317600160b81b63ffffffff9485160217815560808501516001909101805460a087015160c08801519385166001600160b01b031990921691909117600160581b91909416029290921763ffffffff60b01b1916600160b01b9190931602919091179055600b549003611709576117056010548260c001516117009190615770565b613428565b600b555b5050505050565b6117186128e5565b60095482111561173a5760405162461bcd60e51b8152600401610d7990615660565b60009182526003602052604090912080546001600160581b0390921661010002610100600160601b0319909216919091179055565b6117776128e5565b610f2d60006134d1565b6117896128e5565b6008805482919060ff191660018360048111156117a8576117a86151c6565b02179055507fedc027ba0ec107497f782531e7477ac47d3f255451ff6b76a17f6c87ad51d0c7816040516117dc91906151fe565b60405180910390a16000805160206159b483398151915281600a54604051610c7992919061529c565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461184d5760405162461bcd60e51b8152600401610d799061578d565b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6118776128e5565b610f2d613521565b600080600160085460ff16600481111561189b5761189b6151c6565b036118b1576118a861355e565b90925090509091565b600260085460ff1660048111156118ca576118ca6151c6565b036118d7576118a86136b1565b600360085460ff1660048111156118f0576118f06151c6565b036118fd576118a86137fb565b600460085460ff166004811115611916576119166151c6565b03611925575050600a54600491565b60405162461bcd60e51b815260206004820152603b60248201527f4c6f636b506572696f64436f6e74726163743a204c6f636b20636f6e7472616360448201527f74206973206177616974696e6720636f6e66696775726174696f6e00000000006064820152608401610d79565b6000806000610f8e84600a546131ef565b6119ac612929565b336119b5612953565b6119be816129ed565b6119c6612d44565b505050600082516015546119da91906156dd565b6040516370a0823160e01b815233600482015290915081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906157ea565b1015611ad05760405162461bcd60e51b815260206004820152603260248201527f4c6f636b4e46543a20496e73756666696369656e74205553412062616c616e636044820152716520666f72206c6f636b696e67204e46547360701b6064820152608401610d79565b6000835111611b215760405162461bcd60e51b815260206004820152601d60248201527f4c6f636b4e46543a20656d70747920746f6b656e4964732061727261790000006044820152606401610d79565b600260085460ff166004811115611b3a57611b3a6151c6565b03611b4e57611b49835161391b565b611bff565b600160085460ff166004811115611b6757611b676151c6565b03611b7657611b498351613989565b600360085460ff166004811115611b8f57611b8f6151c6565b03611b9e57611b49835161391b565b60405162461bcd60e51b815260206004820152603060248201527f4c6f636b4e46543a20506f6f6c206973206e6f7420696e2076616c696420737460448201526f61746520746f206c6f636b204e46547360801b6064820152608401610d79565b611c0883613c1d565b611c1181613d87565b7f3fc9b100f5f199551238c574c72086b03731f18cad1265e6007c5b56314f54b2338483600a54604051611c48949392919061583e565b60405180910390a15050611c5b60018055565b50565b611c66612929565b33611c6f612953565b611c78816129ed565b611c80612d44565b50506040516362dc7bb960e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016915063c5b8f77290611cd19033908690600401615625565b602060405180830381865afa158015611cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d12919061563e565b611d705760405162461bcd60e51b815260206004820152602960248201527f4c6f636b4e46543a207374616b6572206e6f74207374616b6572206f6620726560448201526818d95a5c1d0813919560ba1b6064820152608401610d79565b600260085460ff166004811115611d8957611d896151c6565b03611d9d57611d986001613e74565b611e4f565b600160085460ff166004811115611db657611db66151c6565b03611dd35760405162461bcd60e51b8152600401610d7990615875565b600360085460ff166004811115611dec57611dec6151c6565b03611dfb57611d986001613e74565b60405162461bcd60e51b815260206004820152602360248201527f4c6f636b4e46543a20506f6f6c206973206e6f7420696e2076616c696420737460448201526261746560e81b6064820152608401610d79565b600082815260146020526040902054611e6781614050565b600083815260146020526040812055611e7f8361409e565b6040518381527fd0daa302149605824eac6528c76de0fc06b0fa0578393ba6b7fe51f1b8e957c690602001611c48565b611eb7612929565b33611ec0612953565b611ec9816129ed565b611ed1612d44565b5060029150611edd9050565b60085460ff166004811115611ef457611ef46151c6565b03611f0857611f038251613e74565b611fd4565b600160085460ff166004811115611f2157611f216151c6565b03611f3e5760405162461bcd60e51b8152600401610d7990615875565b600360085460ff166004811115611f5757611f576151c6565b03611f6657611f038251613e74565b60405162461bcd60e51b815260206004820152603760248201527f4c6f636b4e46543a204c6f636b20706f6f6c206973206e6f7420617661696c6160448201527f626c6520666f7220756e7374616b696e67204e4654732e0000000000000000006064820152608401610d79565b6000611fdf8361419a565b9050611fea81614050565b7f223a5a50ded9737ff0aef6dd7ddd63825f8030e6950f1aef9892a8cdc6e7ec4d83604051611c4891906158ea565b6120216128e5565b60158190556040518181527fd66f04a11379e0e8a493105463391c665d44a203b38337c175b9b82e3789248790602001610c79565b61205e612929565b33612067612953565b612070816129ed565b612078612d44565b50506015546040516370a0823160e01b815233600482015290915081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156120e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061210a91906157ea565b10156121725760405162461bcd60e51b815260206004820152603160248201527f4c6f636b4e46543a20496e73756666696369656e74205553412062616c616e636044820152701948199bdc881b1bd8dada5b99c8139195607a1b6064820152608401610d79565b604051627eeac760e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169062fdd58e906121c19033908890600401615625565b602060405180830381865afa1580156121de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220291906157ea565b1161226b5760405162461bcd60e51b815260206004820152603360248201527f4c6f636b4e46543a207573657220646f6573206e6f74206f776e204e465420696044820152727420697320747279696e6720746f206c6f636b60681b6064820152608401610d79565b600260085460ff166004811115612284576122846151c6565b0361229857612293600161391b565b6122e8565b600160085460ff1660048111156122b1576122b16151c6565b036122c0576122936001613989565b600360085460ff1660048111156122d9576122d96151c6565b03611b9e57612293600161391b565b60008381526014602052604090208190556123028361436b565b61230b81613d87565b600a54604080513381526020810186905290810183905260608101919091527f4fa3323643eefbf7c850a1b2eeee7bbe3b0917e586d48d5585abfb3484f18f6f90608001611c48565b600080600080600061236461187f565b600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b909404841660608201526001909101548083166080830152600160581b810490921660a0820152600160b01b90910490911660c0820152919350909150820361244757606081015160c082015160105463ffffffff928316985091811696506124229190615770565b63ffffffff169350600f5463ffffffff168461243e91906156ca565b92505050612534565b600a546124559060016156ca565b82036124bc576010548160c0015161246d9190615770565b63ffffffff169550600f5463ffffffff168661248991906156ca565b945060105463ffffffff168561249f91906156ca565b9350600f5463ffffffff16846124b591906156ca565b9250612531565b601054600f5460c08301516124d2908390615770565b6124dc9190615770565b6124e69190615770565b63ffffffff169550600f5463ffffffff168661250291906156ca565b945060105463ffffffff168561251891906156ca565b9350600f5463ffffffff168461252e91906156ca565b92505b50505b90919293565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146125825760405162461bcd60e51b8152600401610d799061578d565b60405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906125d09085908590600401615625565b6020604051808303816000875af11580156125ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e96919061563e565b61261b6128e5565b600060085460ff166004811115612634576126346151c6565b146126985760405162461bcd60e51b815260206004820152602e60248201527f4c6f636b506572696f64436f6e74726163743a20436f6e74726163742073746160448201526d7465206973206e6f74204e4f4e4560901b6064820152608401610d79565b600f819055600360208190527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff8054600160ff1991821681179092556009829055600a829055600880549091169092179091556000527fa15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054c805463ffffffff60b81b1916600160b81b63ffffffff851690810291909117825561273b9083906156ca565b60018201805463ffffffff60b01b1916600160b01b63ffffffff93841602179055600a546040805192861683526020830185905290917f665c5600507c31828997e6438a0fbf96bae27b433167b5946a331c04b0ed8c8691015b60405180910390a2505050565b6127aa6128e5565b6001600160a01b0381166127d457604051631e4fbdf760e01b815260006004820152602401610d79565b611c5b816134d1565b6127e56128e5565b6009548811156128075760405162461bcd60e51b8152600401610d7990615660565b600097885260036020526040909720805460018201805460ff9990991660ff63ffffffff60b81b011990921691909117600160b81b63ffffffff9889160217610100600160b81b0319166101006001600160581b0396871602600160601b600160b81b03191617600160601b9486169490940293909317905582166001600160d01b0319909516600160b01b93909416929092026001600160b01b0319169290921792909217600160581b9190931602919091179055565b6128c76128e5565b6128cf612953565b6128d9828261443e565b5050565b610f2d612953565b6000546001600160a01b03163314610f2d5760405163118cdaa760e01b8152336004820152602401610d79565b606061292083836000614559565b90505b92915050565b60026001540361294c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b61295b6145ff565b600160085460ff166004811115612974576129746151c6565b0361298157610f2d614661565b600260085460ff16600481111561299a5761299a6151c6565b036129a757610f2d614a4a565b600360085460ff1660048111156129c0576129c06151c6565b036129cd57610f2d614d55565b600460085460ff1660048111156129e6576129e66151c6565b0361192557565b6001600160a01b038116600090815260046020908152604080832081516101008082018452825460ff81168084526001600160581b03928204831696840196909652600160601b900481169382019390935260018201548084166060830152600160581b9081900484166080830152600283015480851660a084015204831660c082015260039091015490911660e08201528291829182915b600a54811015612c025760008181526003602052604090205460ff1615612bfa5781602001516001600160581b0316600003612af3575050600a546001600160a01b03959095166000908152600460205260409020805460ff191660ff9096169590951790945550505050565b7f000000000000000000000000000000000000000000000000000000000000000082602001516001600160581b031660056000848152602001908152602001600020540281612b4457612b446156f4565b04860195507f000000000000000000000000000000000000000000000000000000000000000082602001516001600160581b031660066000848152602001908152602001600020540281612b9a57612b9a6156f4565b04850194507f000000000000000000000000000000000000000000000000000000000000000082602001516001600160581b031660076000848152602001908152602001600020540281612bf057612bf06156f4565b0484019350600192505b600101612a86565b508115612d3c576040810180516001600160581b03908701811690915260808201805186018216905260c08201805185019091169052600a54815160ff161015612c4f57600a5460ff1681525b6001600160a01b039590951660009081526004602090815260409182902087518154928901519389015160ff9091166001600160601b0319909316929092176101006001600160581b039485160217600160601b600160b81b031916600160601b92841692909202919091178155606087015160018201805460808a01519285166001600160b01b031991821617600160581b93861684021790915560a089015160028401805460c08c015192871693169290921790851690920291909117905560e090960151600390960180546affffffffffffffffffffff1916969091169590951790945550505050565b505050505050565b33600090815260046020908152604080832081516101008082018452825460ff811683526001600160581b03918104821695830195909552600160601b9094048416928101839052600182015480851660608301819052600160581b9182900486166080840152600284015480871660a085015291909104851660c083015260039092015490931660e0840152839283929091612de0916158fd565b6001600160581b031693508060a001518160800151612dff91906158fd565b6001600160581b031692508060e001518160c00151612e1e91906158fd565b6001600160581b03169150600080851180612e395750600084115b80612e445750600083115b905080612e5a5750600094859450849350915050565b8415612f11578482606001818151612e72919061572c565b6001600160581b031690525060405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90612ecc9033908990600401615625565b6020604051808303816000875af1158015612eeb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f0f919061563e565b505b8315612fc857838260a001818151612f29919061572c565b6001600160581b031690525060405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90612f839033908890600401615625565b6020604051808303816000875af1158015612fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc6919061563e565b505b821561307f57828260e001818151612fe0919061572c565b6001600160581b031690525060405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb9061303a9033908790600401615625565b6020604051808303816000875af1158015613059573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061307d919061563e565b505b3360008181526004602090815260409182902085518154878401518886015160ff9093166001600160601b0319909216919091176101006001600160581b039283160217600160601b600160b81b031916600160601b9282169290920291909117825560608088015160018401805460808b01519285166001600160b01b031991821617600160581b93861684021790915560a08a015160028601805460c08d015192871693169290921790851690920291909117905560e0880151600390930180546affffffffffffffffffffff19169390921692909217905582518981529182018890529181018690527f56253d287efacdb2c4cd76dd03624a4821c1ce721d1152e8f5f5718f6087c9bf910160405180910390a25050909192565b6131a5614f28565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216600090815260046020908152604080832081516101008082018452825460ff811683526001600160581b03918104821683870152600160601b9004811682850181905260018085015480841660608601819052600160581b91829004851660808701819052600288015480871660a08901819052939004861660c08801819052600398890154871660e089018190528d8d5298909a529790992090910154979091038216969403811694929092039091169163ffffffff600160b01b909104164211156132c7576001850194505b805160ff165b8581101561341e5760008181526003602052604090205460ff16156134165781602001516001600160581b03166000036133135760008060009450945094505050613421565b7f000000000000000000000000000000000000000000000000000000000000000082602001516001600160581b031660056000848152602001908152602001600020540281613364576133646156f4565b04850194507f000000000000000000000000000000000000000000000000000000000000000082602001516001600160581b0316600660008481526020019081526020016000205402816133ba576133ba6156f4565b04840193507f000000000000000000000000000000000000000000000000000000000000000082602001516001600160581b031660076000848152602001908152602001600020540281613410576134106156f4565b04830192505b6001016132cd565b50505b9250925092565b60098054600190810191829055600082815260036020908152604091829020805463ffffffff60b81b1916600160b81b63ffffffff888116918202929092178355600f54958301805463ffffffff60b01b1916600160b01b97830184168802179081905585519182529590950416918401919091529183917f337c60b404decee955464323e09d23581f70eaafc8fe18089552e09bd3a06e03910160405180910390a250919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b613529614f4b565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586131d23390565b600a546000908152600360209081526040808320815160e081018352815460ff811682526001600160581b036101008204811695830195909552600160601b810485169382019390935263ffffffff600160b81b909304831660608201526001909101548084166080830152600160581b810490931660a0820152600160b01b9092041660c0820181905282919042116135ff575050600a54600192909150565b60006010548260c001516136139190615770565b90508063ffffffff1642101561363e576002600a54600161363491906156ca565b9350935050509091565b600f5461364b9082615770565b63ffffffff164211613668576001600a54600161363491906156ca565b601054600f546136789083615770565b6136829190615770565b63ffffffff164210156136a0576002600a54600261363491906156ca565b6001600a54600261363491906156ca565b600a546000908152600360209081526040808320815160e081018352815460ff811682526001600160581b036101008204811695830195909552600160601b810485169382019390935263ffffffff600160b81b9093048316606082018190526001909201548085166080830152600160581b810490941660a0820152600160b01b90930490911660c0830152829190421015613755575050600a54600292909150565b806060015163ffffffff16421015801561377957508060c0015163ffffffff164211155b1561378b575050600a54600192909150565b60006010548260c0015161379f9190615770565b90508063ffffffff164210156137c0576002600a54600161363491906156ca565b600f546137cd9082615770565b63ffffffff1642116137ea576001600a54600161363491906156ca565b6002600a54600261363491906156ca565b600a546000908152600360209081526040808320815160e081018352815460ff811682526001600160581b036101008204811695830195909552600160601b810485169382019390935263ffffffff600160b81b9093048316606082018190526001909201548085166080830152600160581b810490941660a0820152600160b01b90930490911660c083015282919042101561389f575050600a54600392909150565b806060015163ffffffff1642101580156138c357508060c0015163ffffffff164211155b156138d5575050600a54600192909150565b60006010548260c001516138e99190615770565b90508063ffffffff1642101561390a576002600a54600161363491906156ca565b6004600a54600161363491906156ca565b806011600082825461392d91906156ca565b9091555050336000908152600460205260409020805482919060019061396290849061010090046001600160581b031661572c565b92506101000a8154816001600160581b0302191690836001600160581b0316021790555050565b3360009081526004602090815260409182902082516101008082018552825460ff811683526001600160581b039181048216948301859052600160601b900481169482019490945260018201548085166060830152600160581b9081900485166080830152600283015480861660a084015204841660c082015260039091015490921660e083015215613b0a5760405162461bcd60e51b81526020600482015260aa60248201527f4c6f636b506572696f64436f6e74726163743a205573657220616c726561647960448201527f20686173204e46547320696e20616374697665206c6f636b2c20706c6561736560648201527f2075736520646966666572656e742077616c6c657420746f206c6f636b206e6560848201527f77206e667473206f72207761697420756e74696c207468652063757272656e7460a48201527f206c6f636b20706572696f64206973206f76657220746f2061646420746f207460c4820152691a1a5cc81dd85b1b195d60b21b60e482015261010401610d79565b8160116000828254613b1c91906156ca565b90915550506001600160581b0382166020820152600a54613b3e9060016156ca565b60ff90811682523360009081526004602090815260409182902084518154928601519386015194166001600160601b0319909216919091176101006001600160581b039384160217600160601b600160b81b031916600160601b93831693909302929092178255606083015160018301805460808601519284166001600160b01b031991821617600160581b93851684021790915560a085015160028501805460c088015192861693169290921790841690920291909117905560e090920151600390910180546affffffffffffffffffffff19169190921617905550565b60005b81518110156128d95760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031662fdd58e33858581518110613c6c57613c6c61591d565b60200260200101516040518363ffffffff1660e01b8152600401613c91929190615625565b602060405180830381865afa158015613cae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cd291906157ea565b11613d1f5760405162461bcd60e51b815260206004820152601960248201527f4c6f636b4e46543a206e6f74206f776e6572206f66204e4654000000000000006044820152606401610d79565b613d41828281518110613d3457613d3461591d565b602002602001015161436b565b60155460146000848481518110613d5a57613d5a61591d565b60200260200101518152602001908152602001600020819055508080613d7f90615933565b915050613c20565b60008111613de15760405162461bcd60e51b815260206004820152602160248201527f4c6f636b506572696f64436f6e74726163743a2043616e6e6f74206c6f636b206044820152600360fc1b6064820152608401610d79565b6040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90613e319033903090869060040161574c565b6020604051808303816000875af1158015613e50573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d9919061563e565b60085460029060ff166004811115613e8e57613e8e6151c6565b1015613f1f5760405162461bcd60e51b815260206004820152605460248201527f4c6f636b506572696f64436f6e74726163743a2043616e6e6f7420756e73746160448201527f6b6520696e2063757272656e742073746174652c207761697420666f722074686064820152736520636f6e747261637420746f20756e6c6f636b60601b608482015260a401610d79565b60008111613f835760405162461bcd60e51b815260206004820152602b60248201527f4c6f636b506572696f64436f6e74726163743a2043616e6e6f7420776974686460448201526a3930bb90181037333a399760a91b6064820152608401610d79565b3360009081526004602052604090205461010090046001600160581b03168111156140095760405162461bcd60e51b815260206004820152603060248201527f4c6f636b506572696f64436f6e74726163743a20416d6f756e7420697320686960448201526f19da195c881d1a185b881cdd185ad95960821b6064820152608401610d79565b806011600082825461401b9190615612565b9091555050336000908152600460205260409020805482919060019061396290849061010090046001600160581b03166158fd565b60405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90613e319033908590600401615625565b604051637921219560e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f242432a906140f19030903390869060019060040161594c565b600060405180830381600087803b15801561410b57600080fd5b505af115801561411f573d6000803e3d6000fd5b5050604051631eaf7f7f60e11b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169250633d5efefe91506024015b600060405180830381600087803b15801561418657600080fd5b505af1158015611709573d6000803e3d6000fd5b60008060005b8351811015614364577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c5b8f772338684815181106141eb576141eb61591d565b60200260200101516040518363ffffffff1660e01b8152600401614210929190615625565b602060405180830381865afa15801561422d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614251919061563e565b6142c35760405162461bcd60e51b815260206004820152603860248201527f4c6f636b4e46543a207573657220646f65736e2774206f776e20746865204e4660448201527f5420697420697320747279696e6720746f20756e6c6f636b00000000000000006064820152608401610d79565b6142e58482815181106142d8576142d861591d565b602002602001015161409e565b601460008583815181106142fb576142fb61591d565b60200260200101518152602001908152602001600020548261431d91906156ca565b91506000601460008684815181106143375761433761591d565b6020026020010151815260200190815260200160002081905550808061435c90615933565b9150506141a0565b5092915050565b604051637921219560e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f242432a906143be9033903090869060019060040161594c565b600060405180830381600087803b1580156143d857600080fd5b505af11580156143ec573d6000803e3d6000fd5b505060405163d1194e2b60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925063d1194e2b915061416c9033908590600401615625565b600980546000908152600360205260408120805460ff191660011790558154919061446883615933565b9091555050600954600a556000600b55600f819055600880546003919060ff191660018302179055506009546000908152600360205260409020805463ffffffff60b81b1916600160b81b63ffffffff85169081029190911782556144ce9083906156ca565b8160010160166101000a81548163ffffffff021916908363ffffffff1602179055506000805160206159b48339815191526003600a5460405161451292919061529c565b60405180910390a1600a546040805163ffffffff86168152602081018590527f665c5600507c31828997e6438a0fbf96bae27b433167b5946a331c04b0ed8c869101612795565b6060814710156145855760405163cf47918160e01b815247600482015260248101839052604401610d79565b600080856001600160a01b031684866040516145a19190615984565b60006040518083038185875af1925050503d80600081146145de576040519150601f19603f3d011682016040523d82523d6000602084013e6145e3565b606091505b50915091506145f3868383614f6f565b925050505b9392505050565b60025460ff1615610f2d5760405162461bcd60e51b815260206004820152602660248201527f4c6f636b506572696f64436f6e74726163743a20436f6e7472616374206973206044820152651c185d5cd95960d21b6064820152608401610d79565b600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b909404841660608201526001909101548083166080830152600160581b810490921660a0820152600160b01b90910490911660c0820181905290919042116146fc575050565b815160ff1660000361473e576000818152600360205260409020805460ff1916600117905560105460c08301516147369161170091615770565b600a5561474a565b600b8054600a55600090555b5050600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c0820152919042101561482457600880546002919060ff19166001835b02179055506000805160206159b483398151915260028260405161481892919061529c565b60405180910390a15050565b8160c0015163ffffffff16421161488c576011546000828152600360205260409081902080546001600160581b0390931661010002610100600160601b031990931692909217909155516000805160206159b48339815191529061481890600190849061529c565b6000818152600360205260409020805460ff198116600190811783556011546001600160581b0316610100026001600160601b03199092169190911717905560105460c08301516148e09161170091615770565b600a5560105460c08301516148f59190615770565b63ffffffff16421015614933576008805460ff19166002908117909155600a546040516000805160206159b48339815191529261481892909161529c565b600f5460105461494391906156ca565b8260c001516149529190615770565b63ffffffff1642116149c9576008805460ff19166001908117909155601154600a8054600090815260036020526040908190208054610100600160601b0319166101006001600160581b0390951694909402939093179092555490516000805160206159b48339815191529261481892909161529c565b600880546004919060ff19166001830217905550601154600a805460009081526003602052604080822080546001600160581b0390951661010002610100600160601b03199095169490941790935581548152829020805460ff191660011790555490516000805160206159b483398151915291614818916004919061529c565b600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c08201529190421015614ae5575050565b816060015163ffffffff164210158015614b0957508160c0015163ffffffff164211155b15614b55576008805460ff191660011790556011546000918252600360205260409091208054610100600160601b0319166101006001600160581b039093169290920291909117905550565b6000818152600360205260409020805460ff198116600190811783556011546001600160581b0316610100026001600160601b03199092169190911717905560105460c0830151614ba99161170091615770565b600a819055600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c08201529350909150421015614c65576000805160206159b483398151915260028260405161481892919061529c565b8160c0015163ffffffff164211614ce157600880546001919060ff191682805b02179055506011546000828152600360205260409081902080546001600160581b0390931661010002610100600160601b031990931692909217909155516000805160206159b48339815191529061481890600190849061529c565b600880546004919060ff1916600183021790555060008181526003602052604090819020805460ff198116600190811783556011546001600160581b0316610100026001600160601b031990921691909117179055516000805160206159b48339815191529061481890600490849061529c565b600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c0820152919042106128d957816060015163ffffffff164210158015614e0f57508160c0015163ffffffff164211155b15614e2757600880546001919060ff19168280614c85565b6000818152600360205260409020805460ff198116600190811783556011546001600160581b0316610100026001600160601b03199092169190911717905560105460c0830151614e789101613428565b600a819055600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c08201529350909150421015614c6557600880546002919060ff19166001836147f3565b60025460ff16610f2d57604051638dfc202b60e01b815260040160405180910390fd5b60025460ff1615610f2d5760405163d93c066560e01b815260040160405180910390fd5b606082614f8457614f7f82614fcb565b6145f8565b8151158015614f9b57506001600160a01b0384163b155b15614fc457604051639996b31560e01b81526001600160a01b0385166004820152602401610d79565b50806145f8565b805115614fdb5780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b60006020828403121561500657600080fd5b81356001600160e01b0319811681146145f857600080fd5b60006020828403121561503057600080fd5b5035919050565b80356001600160a01b038116811461504e57600080fd5b919050565b60006020828403121561506557600080fd5b61292082615037565b60008060006060848603121561508357600080fd5b61508c84615037565b925061509a60208501615037565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156150e9576150e96150aa565b604052919050565b6000806040838503121561510457600080fd5b61510d83615037565b915060208084013567ffffffffffffffff8082111561512b57600080fd5b818601915086601f83011261513f57600080fd5b813581811115615151576151516150aa565b615163601f8201601f191685016150c0565b9150808252878482850101111561517957600080fd5b80848401858401376000848284010152508093505050509250929050565b803563ffffffff8116811461504e57600080fd5b6000602082840312156151bd57600080fd5b61292082615197565b634e487b7160e01b600052602160045260246000fd5b600581106151fa57634e487b7160e01b600052602160045260246000fd5b9052565b6020810161292382846151dc565b60008060006060848603121561522157600080fd5b505081359360208301359350604090920135919050565b80356001600160581b038116811461504e57600080fd5b6000806040838503121561526257600080fd5b8235915061527260208401615238565b90509250929050565b60006020828403121561528d57600080fd5b8135600581106145f857600080fd5b604081016152aa82856151dc565b8260208301529392505050565b600060208083850312156152ca57600080fd5b823567ffffffffffffffff808211156152e257600080fd5b818501915085601f8301126152f657600080fd5b813581811115615308576153086150aa565b8060051b91506153198483016150c0565b818152918301840191848101908884111561533357600080fd5b938501935b8385101561535157843582529385019390850190615338565b98975050505050505050565b60008083601f84011261536f57600080fd5b50813567ffffffffffffffff81111561538757600080fd5b6020830191508360208260051b85010111156153a257600080fd5b9250929050565b60008083601f8401126153bb57600080fd5b50813567ffffffffffffffff8111156153d357600080fd5b6020830191508360208285010111156153a257600080fd5b60008060008060008060008060a0898b03121561540757600080fd5b61541089615037565b975061541e60208a01615037565b9650604089013567ffffffffffffffff8082111561543b57600080fd5b6154478c838d0161535d565b909850965060608b013591508082111561546057600080fd5b61546c8c838d0161535d565b909650945060808b013591508082111561548557600080fd5b506154928b828c016153a9565b999c989b5096995094979396929594505050565b600080604083850312156154b957600080fd5b6154c283615037565b946020939093013593505050565b600080604083850312156154e357600080fd5b6154c283615197565b60008060008060008060a0878903121561550557600080fd5b61550e87615037565b955061551c60208801615037565b94506040870135935060608701359250608087013567ffffffffffffffff81111561554657600080fd5b61555289828a016153a9565b979a9699509497509295939492505050565b600080600080600080600080610100898b03121561558157600080fd5b88359750602089013560ff8116811461559957600080fd5b96506155a760408a01615197565b95506155b560608a01615197565b94506155c360808a01615238565b93506155d160a08a01615238565b92506155df60c08a01615238565b91506155ed60e08a01615238565b90509295985092959890939650565b634e487b7160e01b600052601160045260246000fd5b81810381811115612923576129236155fc565b6001600160a01b03929092168252602082015260400190565b60006020828403121561565057600080fd5b815180151581146145f857600080fd5b60208082526044908201527f4c6f636b506572696f64436f6e74726163743a20506572696f6420696e64657860408201527f20697320686967686572207468616e20706572696f6420696e64657820636f75606082015263373a32b960e11b608082015260a00190565b80820180821115612923576129236155fc565b8082028115828204841417612923576129236155fc565b634e487b7160e01b600052601260045260246000fd5b60008261572757634e487b7160e01b600052601260045260246000fd5b500490565b6001600160581b03818116838216019080821115614364576143646155fc565b6001600160a01b039384168152919092166020820152604081019190915260600190565b63ffffffff818116838216019080821115614364576143646155fc565b60208082526038908201527f4c6f636b506572696f64436f6e74726163743a204f6e6c79206d756c7469736960408201527f672063616e2063616c6c20746869732066756e6374696f6e0000000000000000606082015260800190565b6000602082840312156157fc57600080fd5b5051919050565b600081518084526020808501945080840160005b8381101561583357815187529582019590820190600101615817565b509495945050505050565b6001600160a01b038516815260806020820181905260009061586290830186615803565b6040830194909452506060015292915050565b6020808252604f908201527f4c6f636b4e46543a2043616e6e6f7420756e6c6f636b204e465473206475726960408201527f6e672061637469766520706572696f64207761697420756e74696c207468652060608201526e3832b934b7b21034b99037bb32b91760891b608082015260a00190565b6020815260006129206020830184615803565b6001600160581b03828116828216039080821115614364576143646155fc565b634e487b7160e01b600052603260045260246000fd5b600060018201615945576159456155fc565b5060010190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b6000825160005b818110156159a5576020818601810151858301520161598b565b50600092019182525091905056febef423ced52545594b81c8679c0d9566b5129c4120568a000c6ff1c9e89e71f4a2646970667358221220acbd4e1e49aabbcb13472590bbd3afd909be686041794a7a1945783ca55d3cad64736f6c634300081500330000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da000000000000000000000000095cb2dd19ad95dba033889c2b0965e6fe357309000000000000000000000000ab3044d92f7d82bf332898653453a2d9744b4a36000000000000000000000000d51a6af83c7ab056f0f4e89cc295e3a10982914e0000000000000000000000000bde4ba965f8f21c6b359c0e0488deb0e921ada20000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000e10
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103995760003560e01c80637e66bd5b116101e9578063c154fea01161010f578063ede9f270116100ad578063fb61717f1161007c578063fb61717f14610bd9578063fdc5029514610bec578063fe1de0ac14610bf4578063fe2047e614610c0757600080fd5b8063ede9f27014610b36578063f23a6e6114610b56578063f2fde38b14610b8f578063f6c788b214610ba257600080fd5b8063cec686bf116100e9578063cec686bf14610afa578063d5328dbe14610b08578063dc5bf96114610b1b578063df3ebe8f14610b2357600080fd5b8063c154fea014610aac578063c48ec1e614610abf578063c8cd077314610ad257600080fd5b80639464599b11610187578063adfd801e11610156578063adfd801e146108d8578063b076408b146108eb578063b19466601461090b578063bc197c8114610a5857600080fd5b80639464599b14610889578063a67856461461089c578063a86ed8e1146108bc578063a8789cba146108c557600080fd5b80638c365f9a116101c35780638c365f9a1461083c5780638da5cb5b1461084f5780638ed4e1581461086057806391588f9d1461087657600080fd5b80637e66bd5b146107275780638456cb591461073a5780638759d2011461074257600080fd5b806346372098116102ce57806356b7469a1161026c5780635ed2ab701161023b5780635ed2ab70146106e65780636d7a270c146106f9578063715018a61461070c57806377dd84691461071457600080fd5b806356b7469a1461069557806359d1face146106a85780635bde3b27146106bb5780635c975abb146106db57600080fd5b80634da48d53116102a85780634da48d531461065f5780635091936a14610672578063545b0be11461067a57806356773a091461068257600080fd5b80634637209814610505578063479796441461052c5780634c9b14981461055357600080fd5b806327bbf0081161033b5780633331cfec116103155780633331cfec146104ac5780633f4ba83a146104ca5780633fc6df6e146104d2578063434af4f2146104fd57600080fd5b806327bbf0081461047e5780632be11ae214610491578063314616731461049957600080fd5b806317627e671161037757806317627e67146103f15780631976214314610406578063263a7c3f14610419578063277327a51461046b57600080fd5b806301ffc9a71461039e57806309c44666146103d7578063133f50a3146103e9575b600080fd5b6103c26103ac366004614ff4565b6001600160e01b031916636cdb3d1360e11b1490565b60405190151581526020015b60405180910390f35b600b545b6040519081526020016103ce565b6103c2610c0f565b6104046103ff36600461501e565b610c40565b005b610404610414366004615053565b610c84565b61045061042736600461501e565b600081815260056020908152604080832054600683528184205460079093529220549193909250565b604080519384526020840192909252908201526060016103ce565b61040461047936600461506e565b610cda565b61040461048c3660046150f1565b610df9565b610450610e9b565b6104046104a73660046151ab565b610ed9565b6103c2600a5460009081526003602052604090205460ff1660011490565b610404610f1d565b6012546104e5906001600160a01b031681565b6040516001600160a01b0390911681526020016103ce565b6010546103db565b6104e57f0000000000000000000000000bde4ba965f8f21c6b359c0e0488deb0e921ada281565b6104e57f000000000000000000000000d51a6af83c7ab056f0f4e89cc295e3a10982914e81565b61060d610561366004615053565b6001600160a01b031660009081526004602090815260409182902082516101008082018552825460ff81168084529181046001600160581b03908116958401869052600160601b9091048116958301869052600184015480821660608501819052600160581b91829004831660808601819052600287015480851660a08801819052939004841660c0870181905260039097015490931660e09095018590529297959695929491939092565b6040805160ff90991689526001600160581b0397881660208a01529587169588019590955292851660608701529084166080860152831660a0850152821660c08401521660e0820152610100016103ce565b61040461066d36600461501e565b610f2f565b6009546103db565b600f546103db565b610450610690366004615053565b610f71565b60085460ff166040516103ce91906151fe565b6104046106b636600461501e565b610f9b565b6103db6106c936600461501e565b60009081526007602052604090205490565b60025460ff166103c2565b6104046106f436600461520c565b610fe0565b61040461070736600461524f565b611710565b61040461176f565b61040461072236600461527b565b611781565b610404610735366004615053565b611805565b61040461186f565b6107eb61075036600461501e565b600090815260036020908152604091829020825160e081018452815460ff81168083526001600160581b0361010083048116958401869052600160601b8304811696840187905263ffffffff600160b81b90930483166060850181905260019095015480821660808601819052600160581b820490921660a08601819052600160b01b90910490931660c09094018490529096949594909290565b6040805160ff90981688526001600160581b0396871660208901529486169487019490945263ffffffff928316606087015290841660808601529290921660a08401521660c082015260e0016103ce565b6013546104e5906001600160a01b031681565b6000546001600160a01b03166104e5565b61086861187f565b6040516103ce92919061529c565b610450610884366004615053565b611993565b6104046108973660046152b7565b6119a4565b6103db6108aa36600461501e565b60009081526006602052604090205490565b6103db60155481565b6104046108d336600461501e565b611c5e565b6104046108e63660046152b7565b611eaf565b6103db6108f936600461501e565b60009081526005602052604090205490565b6109df61091936600461501e565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915250600090815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b909404841660608201526001909101548083166080830152600160581b810490921660a0820152600160b01b90910490911660c082015290565b6040516103ce9190600060e08201905060ff835116825260208301516001600160581b0380821660208501528060408601511660408501526060850151915063ffffffff80831660608601528160808701511660808601528160a08701511660a08601528060c08701511660c086015250505092915050565b610a93610a663660046153eb565b7fbc197c819b3e337a6f9652dd10becd7eef83032af3b9d958d3d42f669414662198975050505050505050565b6040516001600160e01b031990911681526020016103ce565b610404610aba36600461501e565b612019565b610404610acd36600461501e565b612056565b610ada612354565b6040805194855260208501939093529183015260608201526080016103ce565b600c54600d54600e54610450565b610404610b163660046154a6565b61253a565b6011546103db565b610404610b313660046154d0565b612613565b6103db610b4436600461501e565b60146020526000908152604090205481565b610a93610b643660046154ec565b7ff23a6e612e1ff4830e658fe43f4e3cb4a5f8170bd5d9e69fb5d7a7fa9e4fdf979695505050505050565b610404610b9d366004615053565b6127a2565b6103db610bb0366004615053565b6001600160a01b031660009081526004602052604090205461010090046001600160581b031690565b610404610be7366004615564565b6127dd565b600a546103db565b610404610c023660046154d0565b6128bf565b6104046128dd565b6000600360006001600a54610c249190615612565b815260208101919091526040016000205460ff16600114919050565b610c486128e5565b600f8190556040518181527f600238da9717e7a12500ffe1c4a936a272d9b4aa0daf3971902c7746bb797f18906020015b60405180910390a150565b610c8c6128e5565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527f1c794a043683a294127c95bc365bae91b63b651eb9884a2c9120afee2bb690b490602001610c79565b610ce26128e5565b7f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da6001600160a01b0316836001600160a01b031603610d825760405162461bcd60e51b815260206004820152603160248201527f4c6f636b506572696f64436f6e74726163743a2043616e6e6f742077697468646044820152703930bb9039ba30b5b4b733903a37b5b2b760791b60648201526084015b60405180910390fd5b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb90610db09085908590600401615625565b6020604051808303816000875af1158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df3919061563e565b50505050565b6013546001600160a01b03163314610e835760405162461bcd60e51b815260206004820152604160248201527f4c6f636b506572696f64436f6e74726163743a204f6e6c79206d69677261746f60448201527f7220636f6e74726163742063616e2063616c6c20746869732066756e6374696f6064820152603760f91b608482015260a401610d79565b610e966001600160a01b03831682612912565b505050565b6000806000610ea8612929565b33610eb1612953565b610eba816129ed565b610ec2612d44565b91955093509150610ed4905060018055565b909192565b610ee16128e5565b63ffffffff811660108190556040519081527f4b4ab4d31395b5d90df847f00d1fdc1e6e8e5432637e239b6a84ddc738e420c290602001610c79565b610f256128e5565b610f2d61319d565b565b610f376128e5565b600954811115610f595760405162461bcd60e51b8152600401610d7990615660565b6000908152600360205260409020805460ff19169055565b6000806000610f8e84600a546001610f8991906156ca565b6131ef565b9250925092509193909250565b610fa36128e5565b600954811115610fc55760405162461bcd60e51b8152600401610d7990615660565b6000908152600360205260409020805460ff19166001179055565b6012546001600160a01b031633146110605760405162461bcd60e51b815260206004820152603e60248201527f4c6f636b506572696f64436f6e74726163743a2043616c6c6572206973206e6f60448201527f742052657761726473446973747269627574696f6e20636f6e747261637400006064820152608401610d79565b611068612953565b600a54600160085460ff166004811115611084576110846151c6565b1461110a5760405162461bcd60e51b815260206004820152604a60248201527f4c6f636b506572696f64436f6e74726163743a20436f6e7472616374206d757360448201527f7420626520696e2061637469766520737461746520746f2064697374726962756064820152697465207265776172647360b01b608482015260a401610d79565b600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b0361010082048116948301859052600160601b820481169583019590955263ffffffff600160b81b909104811660608301526001909201548085166080830152600160581b810490941660a0820152600160b01b9093041660c0830152156115485784156112cf5760208101516001600160581b03166111d37f0000000000000000000000000000000000000000000000000000000000000001876156dd565b6111dd919061570a565b600083815260056020526040812080549091906111fb9084906156ca565b925050819055508481604001818151611214919061572c565b6001600160581b0316905250600c80548691906000906112359084906156ca565b90915550506040516323b872dd60e01b81526001600160a01b037f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da16906323b872dd9061128a90339030908a9060040161574c565b6020604051808303816000875af11580156112a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112cd919061563e565b505b83156114095760208101516001600160581b031661130d7f0000000000000000000000000000000000000000000000000000000000000001866156dd565b611317919061570a565b600083815260066020526040812080549091906113359084906156ca565b92505081905550838160800181815161134e919061572c565b6001600160581b0316905250600d805485919060009061136f9084906156ca565b90915550506040516323b872dd60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906323b872dd906113c49033903090899060040161574c565b6020604051808303816000875af11580156113e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611407919061563e565b505b82156115435760208101516001600160581b03166114477f0000000000000000000000000000000000000000000000000000000000000001856156dd565b611451919061570a565b6000838152600760205260408120805490919061146f9084906156ca565b92505081905550828160a001818151611488919061572c565b6001600160581b0316905250600e80548491906000906114a99084906156ca565b90915550506040516323b872dd60e01b81526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16906323b872dd906114fe9033903090889060040161574c565b6020604051808303816000875af115801561151d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611541919061563e565b505b6115ac565b60405162461bcd60e51b815260206004820152603360248201527f4c6f636b506572696f64436f6e74726163743a204e6f20617373657473206c6f60448201527218dad959081a5b881d1a1a5cc81c195c9a5bd9606a1b6064820152608401610d79565b60018152602080820151604080518581529283018890528201869052606082018590526001600160581b031660808201527f37e67855d43539d9a5c8da51025d5f1f1f2b098378cbd9119ec6da68d76dd6659060a00160405180910390a16000828152600360209081526040808320845181549386015192860151606087015160ff9092166001600160601b0319909516949094176101006001600160581b0394851602176effffffffffffffffffffffffffffff60601b1916600160601b9484169490940263ffffffff60b81b191693909317600160b81b63ffffffff9485160217815560808501516001909101805460a087015160c08801519385166001600160b01b031990921691909117600160581b91909416029290921763ffffffff60b01b1916600160b01b9190931602919091179055600b549003611709576117056010548260c001516117009190615770565b613428565b600b555b5050505050565b6117186128e5565b60095482111561173a5760405162461bcd60e51b8152600401610d7990615660565b60009182526003602052604090912080546001600160581b0390921661010002610100600160601b0319909216919091179055565b6117776128e5565b610f2d60006134d1565b6117896128e5565b6008805482919060ff191660018360048111156117a8576117a86151c6565b02179055507fedc027ba0ec107497f782531e7477ac47d3f255451ff6b76a17f6c87ad51d0c7816040516117dc91906151fe565b60405180910390a16000805160206159b483398151915281600a54604051610c7992919061529c565b336001600160a01b037f000000000000000000000000ab3044d92f7d82bf332898653453a2d9744b4a36161461184d5760405162461bcd60e51b8152600401610d799061578d565b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6118776128e5565b610f2d613521565b600080600160085460ff16600481111561189b5761189b6151c6565b036118b1576118a861355e565b90925090509091565b600260085460ff1660048111156118ca576118ca6151c6565b036118d7576118a86136b1565b600360085460ff1660048111156118f0576118f06151c6565b036118fd576118a86137fb565b600460085460ff166004811115611916576119166151c6565b03611925575050600a54600491565b60405162461bcd60e51b815260206004820152603b60248201527f4c6f636b506572696f64436f6e74726163743a204c6f636b20636f6e7472616360448201527f74206973206177616974696e6720636f6e66696775726174696f6e00000000006064820152608401610d79565b6000806000610f8e84600a546131ef565b6119ac612929565b336119b5612953565b6119be816129ed565b6119c6612d44565b505050600082516015546119da91906156dd565b6040516370a0823160e01b815233600482015290915081906001600160a01b037f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da16906370a0823190602401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906157ea565b1015611ad05760405162461bcd60e51b815260206004820152603260248201527f4c6f636b4e46543a20496e73756666696369656e74205553412062616c616e636044820152716520666f72206c6f636b696e67204e46547360701b6064820152608401610d79565b6000835111611b215760405162461bcd60e51b815260206004820152601d60248201527f4c6f636b4e46543a20656d70747920746f6b656e4964732061727261790000006044820152606401610d79565b600260085460ff166004811115611b3a57611b3a6151c6565b03611b4e57611b49835161391b565b611bff565b600160085460ff166004811115611b6757611b676151c6565b03611b7657611b498351613989565b600360085460ff166004811115611b8f57611b8f6151c6565b03611b9e57611b49835161391b565b60405162461bcd60e51b815260206004820152603060248201527f4c6f636b4e46543a20506f6f6c206973206e6f7420696e2076616c696420737460448201526f61746520746f206c6f636b204e46547360801b6064820152608401610d79565b611c0883613c1d565b611c1181613d87565b7f3fc9b100f5f199551238c574c72086b03731f18cad1265e6007c5b56314f54b2338483600a54604051611c48949392919061583e565b60405180910390a15050611c5b60018055565b50565b611c66612929565b33611c6f612953565b611c78816129ed565b611c80612d44565b50506040516362dc7bb960e11b81526001600160a01b037f000000000000000000000000d51a6af83c7ab056f0f4e89cc295e3a10982914e16915063c5b8f77290611cd19033908690600401615625565b602060405180830381865afa158015611cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d12919061563e565b611d705760405162461bcd60e51b815260206004820152602960248201527f4c6f636b4e46543a207374616b6572206e6f74207374616b6572206f6620726560448201526818d95a5c1d0813919560ba1b6064820152608401610d79565b600260085460ff166004811115611d8957611d896151c6565b03611d9d57611d986001613e74565b611e4f565b600160085460ff166004811115611db657611db66151c6565b03611dd35760405162461bcd60e51b8152600401610d7990615875565b600360085460ff166004811115611dec57611dec6151c6565b03611dfb57611d986001613e74565b60405162461bcd60e51b815260206004820152602360248201527f4c6f636b4e46543a20506f6f6c206973206e6f7420696e2076616c696420737460448201526261746560e81b6064820152608401610d79565b600082815260146020526040902054611e6781614050565b600083815260146020526040812055611e7f8361409e565b6040518381527fd0daa302149605824eac6528c76de0fc06b0fa0578393ba6b7fe51f1b8e957c690602001611c48565b611eb7612929565b33611ec0612953565b611ec9816129ed565b611ed1612d44565b5060029150611edd9050565b60085460ff166004811115611ef457611ef46151c6565b03611f0857611f038251613e74565b611fd4565b600160085460ff166004811115611f2157611f216151c6565b03611f3e5760405162461bcd60e51b8152600401610d7990615875565b600360085460ff166004811115611f5757611f576151c6565b03611f6657611f038251613e74565b60405162461bcd60e51b815260206004820152603760248201527f4c6f636b4e46543a204c6f636b20706f6f6c206973206e6f7420617661696c6160448201527f626c6520666f7220756e7374616b696e67204e4654732e0000000000000000006064820152608401610d79565b6000611fdf8361419a565b9050611fea81614050565b7f223a5a50ded9737ff0aef6dd7ddd63825f8030e6950f1aef9892a8cdc6e7ec4d83604051611c4891906158ea565b6120216128e5565b60158190556040518181527fd66f04a11379e0e8a493105463391c665d44a203b38337c175b9b82e3789248790602001610c79565b61205e612929565b33612067612953565b612070816129ed565b612078612d44565b50506015546040516370a0823160e01b815233600482015290915081907f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da6001600160a01b0316906370a0823190602401602060405180830381865afa1580156120e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061210a91906157ea565b10156121725760405162461bcd60e51b815260206004820152603160248201527f4c6f636b4e46543a20496e73756666696369656e74205553412062616c616e636044820152701948199bdc881b1bd8dada5b99c8139195607a1b6064820152608401610d79565b604051627eeac760e11b81526000906001600160a01b037f0000000000000000000000000bde4ba965f8f21c6b359c0e0488deb0e921ada2169062fdd58e906121c19033908890600401615625565b602060405180830381865afa1580156121de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061220291906157ea565b1161226b5760405162461bcd60e51b815260206004820152603360248201527f4c6f636b4e46543a207573657220646f6573206e6f74206f776e204e465420696044820152727420697320747279696e6720746f206c6f636b60681b6064820152608401610d79565b600260085460ff166004811115612284576122846151c6565b0361229857612293600161391b565b6122e8565b600160085460ff1660048111156122b1576122b16151c6565b036122c0576122936001613989565b600360085460ff1660048111156122d9576122d96151c6565b03611b9e57612293600161391b565b60008381526014602052604090208190556123028361436b565b61230b81613d87565b600a54604080513381526020810186905290810183905260608101919091527f4fa3323643eefbf7c850a1b2eeee7bbe3b0917e586d48d5585abfb3484f18f6f90608001611c48565b600080600080600061236461187f565b600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b909404841660608201526001909101548083166080830152600160581b810490921660a0820152600160b01b90910490911660c0820152919350909150820361244757606081015160c082015160105463ffffffff928316985091811696506124229190615770565b63ffffffff169350600f5463ffffffff168461243e91906156ca565b92505050612534565b600a546124559060016156ca565b82036124bc576010548160c0015161246d9190615770565b63ffffffff169550600f5463ffffffff168661248991906156ca565b945060105463ffffffff168561249f91906156ca565b9350600f5463ffffffff16846124b591906156ca565b9250612531565b601054600f5460c08301516124d2908390615770565b6124dc9190615770565b6124e69190615770565b63ffffffff169550600f5463ffffffff168661250291906156ca565b945060105463ffffffff168561251891906156ca565b9350600f5463ffffffff168461252e91906156ca565b92505b50505b90919293565b336001600160a01b037f000000000000000000000000ab3044d92f7d82bf332898653453a2d9744b4a3616146125825760405162461bcd60e51b8152600401610d799061578d565b60405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da169063a9059cbb906125d09085908590600401615625565b6020604051808303816000875af11580156125ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e96919061563e565b61261b6128e5565b600060085460ff166004811115612634576126346151c6565b146126985760405162461bcd60e51b815260206004820152602e60248201527f4c6f636b506572696f64436f6e74726163743a20436f6e74726163742073746160448201526d7465206973206e6f74204e4f4e4560901b6064820152608401610d79565b600f819055600360208190527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff8054600160ff1991821681179092556009829055600a829055600880549091169092179091556000527fa15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054c805463ffffffff60b81b1916600160b81b63ffffffff851690810291909117825561273b9083906156ca565b60018201805463ffffffff60b01b1916600160b01b63ffffffff93841602179055600a546040805192861683526020830185905290917f665c5600507c31828997e6438a0fbf96bae27b433167b5946a331c04b0ed8c8691015b60405180910390a2505050565b6127aa6128e5565b6001600160a01b0381166127d457604051631e4fbdf760e01b815260006004820152602401610d79565b611c5b816134d1565b6127e56128e5565b6009548811156128075760405162461bcd60e51b8152600401610d7990615660565b600097885260036020526040909720805460018201805460ff9990991660ff63ffffffff60b81b011990921691909117600160b81b63ffffffff9889160217610100600160b81b0319166101006001600160581b0396871602600160601b600160b81b03191617600160601b9486169490940293909317905582166001600160d01b0319909516600160b01b93909416929092026001600160b01b0319169290921792909217600160581b9190931602919091179055565b6128c76128e5565b6128cf612953565b6128d9828261443e565b5050565b610f2d612953565b6000546001600160a01b03163314610f2d5760405163118cdaa760e01b8152336004820152602401610d79565b606061292083836000614559565b90505b92915050565b60026001540361294c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b61295b6145ff565b600160085460ff166004811115612974576129746151c6565b0361298157610f2d614661565b600260085460ff16600481111561299a5761299a6151c6565b036129a757610f2d614a4a565b600360085460ff1660048111156129c0576129c06151c6565b036129cd57610f2d614d55565b600460085460ff1660048111156129e6576129e66151c6565b0361192557565b6001600160a01b038116600090815260046020908152604080832081516101008082018452825460ff81168084526001600160581b03928204831696840196909652600160601b900481169382019390935260018201548084166060830152600160581b9081900484166080830152600283015480851660a084015204831660c082015260039091015490911660e08201528291829182915b600a54811015612c025760008181526003602052604090205460ff1615612bfa5781602001516001600160581b0316600003612af3575050600a546001600160a01b03959095166000908152600460205260409020805460ff191660ff9096169590951790945550505050565b7f000000000000000000000000000000000000000000000000000000000000000182602001516001600160581b031660056000848152602001908152602001600020540281612b4457612b446156f4565b04860195507f000000000000000000000000000000000000000000000000000000000000000182602001516001600160581b031660066000848152602001908152602001600020540281612b9a57612b9a6156f4565b04850194507f000000000000000000000000000000000000000000000000000000000000000182602001516001600160581b031660076000848152602001908152602001600020540281612bf057612bf06156f4565b0484019350600192505b600101612a86565b508115612d3c576040810180516001600160581b03908701811690915260808201805186018216905260c08201805185019091169052600a54815160ff161015612c4f57600a5460ff1681525b6001600160a01b039590951660009081526004602090815260409182902087518154928901519389015160ff9091166001600160601b0319909316929092176101006001600160581b039485160217600160601b600160b81b031916600160601b92841692909202919091178155606087015160018201805460808a01519285166001600160b01b031991821617600160581b93861684021790915560a089015160028401805460c08c015192871693169290921790851690920291909117905560e090960151600390960180546affffffffffffffffffffff1916969091169590951790945550505050565b505050505050565b33600090815260046020908152604080832081516101008082018452825460ff811683526001600160581b03918104821695830195909552600160601b9094048416928101839052600182015480851660608301819052600160581b9182900486166080840152600284015480871660a085015291909104851660c083015260039092015490931660e0840152839283929091612de0916158fd565b6001600160581b031693508060a001518160800151612dff91906158fd565b6001600160581b031692508060e001518160c00151612e1e91906158fd565b6001600160581b03169150600080851180612e395750600084115b80612e445750600083115b905080612e5a5750600094859450849350915050565b8415612f11578482606001818151612e72919061572c565b6001600160581b031690525060405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da169063a9059cbb90612ecc9033908990600401615625565b6020604051808303816000875af1158015612eeb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f0f919061563e565b505b8315612fc857838260a001818151612f29919061572c565b6001600160581b031690525060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2169063a9059cbb90612f839033908890600401615625565b6020604051808303816000875af1158015612fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc6919061563e565b505b821561307f57828260e001818151612fe0919061572c565b6001600160581b031690525060405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f169063a9059cbb9061303a9033908790600401615625565b6020604051808303816000875af1158015613059573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061307d919061563e565b505b3360008181526004602090815260409182902085518154878401518886015160ff9093166001600160601b0319909216919091176101006001600160581b039283160217600160601b600160b81b031916600160601b9282169290920291909117825560608088015160018401805460808b01519285166001600160b01b031991821617600160581b93861684021790915560a08a015160028601805460c08d015192871693169290921790851690920291909117905560e0880151600390930180546affffffffffffffffffffff19169390921692909217905582518981529182018890529181018690527f56253d287efacdb2c4cd76dd03624a4821c1ce721d1152e8f5f5718f6087c9bf910160405180910390a25050909192565b6131a5614f28565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216600090815260046020908152604080832081516101008082018452825460ff811683526001600160581b03918104821683870152600160601b9004811682850181905260018085015480841660608601819052600160581b91829004851660808701819052600288015480871660a08901819052939004861660c08801819052600398890154871660e089018190528d8d5298909a529790992090910154979091038216969403811694929092039091169163ffffffff600160b01b909104164211156132c7576001850194505b805160ff165b8581101561341e5760008181526003602052604090205460ff16156134165781602001516001600160581b03166000036133135760008060009450945094505050613421565b7f000000000000000000000000000000000000000000000000000000000000000182602001516001600160581b031660056000848152602001908152602001600020540281613364576133646156f4565b04850194507f000000000000000000000000000000000000000000000000000000000000000182602001516001600160581b0316600660008481526020019081526020016000205402816133ba576133ba6156f4565b04840193507f000000000000000000000000000000000000000000000000000000000000000182602001516001600160581b031660076000848152602001908152602001600020540281613410576134106156f4565b04830192505b6001016132cd565b50505b9250925092565b60098054600190810191829055600082815260036020908152604091829020805463ffffffff60b81b1916600160b81b63ffffffff888116918202929092178355600f54958301805463ffffffff60b01b1916600160b01b97830184168802179081905585519182529590950416918401919091529183917f337c60b404decee955464323e09d23581f70eaafc8fe18089552e09bd3a06e03910160405180910390a250919050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b613529614f4b565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586131d23390565b600a546000908152600360209081526040808320815160e081018352815460ff811682526001600160581b036101008204811695830195909552600160601b810485169382019390935263ffffffff600160b81b909304831660608201526001909101548084166080830152600160581b810490931660a0820152600160b01b9092041660c0820181905282919042116135ff575050600a54600192909150565b60006010548260c001516136139190615770565b90508063ffffffff1642101561363e576002600a54600161363491906156ca565b9350935050509091565b600f5461364b9082615770565b63ffffffff164211613668576001600a54600161363491906156ca565b601054600f546136789083615770565b6136829190615770565b63ffffffff164210156136a0576002600a54600261363491906156ca565b6001600a54600261363491906156ca565b600a546000908152600360209081526040808320815160e081018352815460ff811682526001600160581b036101008204811695830195909552600160601b810485169382019390935263ffffffff600160b81b9093048316606082018190526001909201548085166080830152600160581b810490941660a0820152600160b01b90930490911660c0830152829190421015613755575050600a54600292909150565b806060015163ffffffff16421015801561377957508060c0015163ffffffff164211155b1561378b575050600a54600192909150565b60006010548260c0015161379f9190615770565b90508063ffffffff164210156137c0576002600a54600161363491906156ca565b600f546137cd9082615770565b63ffffffff1642116137ea576001600a54600161363491906156ca565b6002600a54600261363491906156ca565b600a546000908152600360209081526040808320815160e081018352815460ff811682526001600160581b036101008204811695830195909552600160601b810485169382019390935263ffffffff600160b81b9093048316606082018190526001909201548085166080830152600160581b810490941660a0820152600160b01b90930490911660c083015282919042101561389f575050600a54600392909150565b806060015163ffffffff1642101580156138c357508060c0015163ffffffff164211155b156138d5575050600a54600192909150565b60006010548260c001516138e99190615770565b90508063ffffffff1642101561390a576002600a54600161363491906156ca565b6004600a54600161363491906156ca565b806011600082825461392d91906156ca565b9091555050336000908152600460205260409020805482919060019061396290849061010090046001600160581b031661572c565b92506101000a8154816001600160581b0302191690836001600160581b0316021790555050565b3360009081526004602090815260409182902082516101008082018552825460ff811683526001600160581b039181048216948301859052600160601b900481169482019490945260018201548085166060830152600160581b9081900485166080830152600283015480861660a084015204841660c082015260039091015490921660e083015215613b0a5760405162461bcd60e51b81526020600482015260aa60248201527f4c6f636b506572696f64436f6e74726163743a205573657220616c726561647960448201527f20686173204e46547320696e20616374697665206c6f636b2c20706c6561736560648201527f2075736520646966666572656e742077616c6c657420746f206c6f636b206e6560848201527f77206e667473206f72207761697420756e74696c207468652063757272656e7460a48201527f206c6f636b20706572696f64206973206f76657220746f2061646420746f207460c4820152691a1a5cc81dd85b1b195d60b21b60e482015261010401610d79565b8160116000828254613b1c91906156ca565b90915550506001600160581b0382166020820152600a54613b3e9060016156ca565b60ff90811682523360009081526004602090815260409182902084518154928601519386015194166001600160601b0319909216919091176101006001600160581b039384160217600160601b600160b81b031916600160601b93831693909302929092178255606083015160018301805460808601519284166001600160b01b031991821617600160581b93851684021790915560a085015160028501805460c088015192861693169290921790841690920291909117905560e090920151600390910180546affffffffffffffffffffff19169190921617905550565b60005b81518110156128d95760007f0000000000000000000000000bde4ba965f8f21c6b359c0e0488deb0e921ada26001600160a01b031662fdd58e33858581518110613c6c57613c6c61591d565b60200260200101516040518363ffffffff1660e01b8152600401613c91929190615625565b602060405180830381865afa158015613cae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cd291906157ea565b11613d1f5760405162461bcd60e51b815260206004820152601960248201527f4c6f636b4e46543a206e6f74206f776e6572206f66204e4654000000000000006044820152606401610d79565b613d41828281518110613d3457613d3461591d565b602002602001015161436b565b60155460146000848481518110613d5a57613d5a61591d565b60200260200101518152602001908152602001600020819055508080613d7f90615933565b915050613c20565b60008111613de15760405162461bcd60e51b815260206004820152602160248201527f4c6f636b506572696f64436f6e74726163743a2043616e6e6f74206c6f636b206044820152600360fc1b6064820152608401610d79565b6040516323b872dd60e01b81526001600160a01b037f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da16906323b872dd90613e319033903090869060040161574c565b6020604051808303816000875af1158015613e50573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d9919061563e565b60085460029060ff166004811115613e8e57613e8e6151c6565b1015613f1f5760405162461bcd60e51b815260206004820152605460248201527f4c6f636b506572696f64436f6e74726163743a2043616e6e6f7420756e73746160448201527f6b6520696e2063757272656e742073746174652c207761697420666f722074686064820152736520636f6e747261637420746f20756e6c6f636b60601b608482015260a401610d79565b60008111613f835760405162461bcd60e51b815260206004820152602b60248201527f4c6f636b506572696f64436f6e74726163743a2043616e6e6f7420776974686460448201526a3930bb90181037333a399760a91b6064820152608401610d79565b3360009081526004602052604090205461010090046001600160581b03168111156140095760405162461bcd60e51b815260206004820152603060248201527f4c6f636b506572696f64436f6e74726163743a20416d6f756e7420697320686960448201526f19da195c881d1a185b881cdd185ad95960821b6064820152608401610d79565b806011600082825461401b9190615612565b9091555050336000908152600460205260409020805482919060019061396290849061010090046001600160581b03166158fd565b60405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da169063a9059cbb90613e319033908590600401615625565b604051637921219560e11b81526001600160a01b037f0000000000000000000000000bde4ba965f8f21c6b359c0e0488deb0e921ada2169063f242432a906140f19030903390869060019060040161594c565b600060405180830381600087803b15801561410b57600080fd5b505af115801561411f573d6000803e3d6000fd5b5050604051631eaf7f7f60e11b8152600481018490527f000000000000000000000000d51a6af83c7ab056f0f4e89cc295e3a10982914e6001600160a01b03169250633d5efefe91506024015b600060405180830381600087803b15801561418657600080fd5b505af1158015611709573d6000803e3d6000fd5b60008060005b8351811015614364577f000000000000000000000000d51a6af83c7ab056f0f4e89cc295e3a10982914e6001600160a01b031663c5b8f772338684815181106141eb576141eb61591d565b60200260200101516040518363ffffffff1660e01b8152600401614210929190615625565b602060405180830381865afa15801561422d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614251919061563e565b6142c35760405162461bcd60e51b815260206004820152603860248201527f4c6f636b4e46543a207573657220646f65736e2774206f776e20746865204e4660448201527f5420697420697320747279696e6720746f20756e6c6f636b00000000000000006064820152608401610d79565b6142e58482815181106142d8576142d861591d565b602002602001015161409e565b601460008583815181106142fb576142fb61591d565b60200260200101518152602001908152602001600020548261431d91906156ca565b91506000601460008684815181106143375761433761591d565b6020026020010151815260200190815260200160002081905550808061435c90615933565b9150506141a0565b5092915050565b604051637921219560e11b81526001600160a01b037f0000000000000000000000000bde4ba965f8f21c6b359c0e0488deb0e921ada2169063f242432a906143be9033903090869060019060040161594c565b600060405180830381600087803b1580156143d857600080fd5b505af11580156143ec573d6000803e3d6000fd5b505060405163d1194e2b60e01b81526001600160a01b037f000000000000000000000000d51a6af83c7ab056f0f4e89cc295e3a10982914e16925063d1194e2b915061416c9033908590600401615625565b600980546000908152600360205260408120805460ff191660011790558154919061446883615933565b9091555050600954600a556000600b55600f819055600880546003919060ff191660018302179055506009546000908152600360205260409020805463ffffffff60b81b1916600160b81b63ffffffff85169081029190911782556144ce9083906156ca565b8160010160166101000a81548163ffffffff021916908363ffffffff1602179055506000805160206159b48339815191526003600a5460405161451292919061529c565b60405180910390a1600a546040805163ffffffff86168152602081018590527f665c5600507c31828997e6438a0fbf96bae27b433167b5946a331c04b0ed8c869101612795565b6060814710156145855760405163cf47918160e01b815247600482015260248101839052604401610d79565b600080856001600160a01b031684866040516145a19190615984565b60006040518083038185875af1925050503d80600081146145de576040519150601f19603f3d011682016040523d82523d6000602084013e6145e3565b606091505b50915091506145f3868383614f6f565b925050505b9392505050565b60025460ff1615610f2d5760405162461bcd60e51b815260206004820152602660248201527f4c6f636b506572696f64436f6e74726163743a20436f6e7472616374206973206044820152651c185d5cd95960d21b6064820152608401610d79565b600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b909404841660608201526001909101548083166080830152600160581b810490921660a0820152600160b01b90910490911660c0820181905290919042116146fc575050565b815160ff1660000361473e576000818152600360205260409020805460ff1916600117905560105460c08301516147369161170091615770565b600a5561474a565b600b8054600a55600090555b5050600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c0820152919042101561482457600880546002919060ff19166001835b02179055506000805160206159b483398151915260028260405161481892919061529c565b60405180910390a15050565b8160c0015163ffffffff16421161488c576011546000828152600360205260409081902080546001600160581b0390931661010002610100600160601b031990931692909217909155516000805160206159b48339815191529061481890600190849061529c565b6000818152600360205260409020805460ff198116600190811783556011546001600160581b0316610100026001600160601b03199092169190911717905560105460c08301516148e09161170091615770565b600a5560105460c08301516148f59190615770565b63ffffffff16421015614933576008805460ff19166002908117909155600a546040516000805160206159b48339815191529261481892909161529c565b600f5460105461494391906156ca565b8260c001516149529190615770565b63ffffffff1642116149c9576008805460ff19166001908117909155601154600a8054600090815260036020526040908190208054610100600160601b0319166101006001600160581b0390951694909402939093179092555490516000805160206159b48339815191529261481892909161529c565b600880546004919060ff19166001830217905550601154600a805460009081526003602052604080822080546001600160581b0390951661010002610100600160601b03199095169490941790935581548152829020805460ff191660011790555490516000805160206159b483398151915291614818916004919061529c565b600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c08201529190421015614ae5575050565b816060015163ffffffff164210158015614b0957508160c0015163ffffffff164211155b15614b55576008805460ff191660011790556011546000918252600360205260409091208054610100600160601b0319166101006001600160581b039093169290920291909117905550565b6000818152600360205260409020805460ff198116600190811783556011546001600160581b0316610100026001600160601b03199092169190911717905560105460c0830151614ba99161170091615770565b600a819055600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c08201529350909150421015614c65576000805160206159b483398151915260028260405161481892919061529c565b8160c0015163ffffffff164211614ce157600880546001919060ff191682805b02179055506011546000828152600360205260409081902080546001600160581b0390931661010002610100600160601b031990931692909217909155516000805160206159b48339815191529061481890600190849061529c565b600880546004919060ff1916600183021790555060008181526003602052604090819020805460ff198116600190811783556011546001600160581b0316610100026001600160601b031990921691909117179055516000805160206159b48339815191529061481890600490849061529c565b600a54600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c0820152919042106128d957816060015163ffffffff164210158015614e0f57508160c0015163ffffffff164211155b15614e2757600880546001919060ff19168280614c85565b6000818152600360205260409020805460ff198116600190811783556011546001600160581b0316610100026001600160601b03199092169190911717905560105460c0830151614e789101613428565b600a819055600081815260036020908152604091829020825160e081018452815460ff811682526001600160581b036101008204811694830194909452600160601b810484169482019490945263ffffffff600160b81b9094048416606082018190526001909201548084166080830152600160581b810490931660a0820152600160b01b90920490921660c08201529350909150421015614c6557600880546002919060ff19166001836147f3565b60025460ff16610f2d57604051638dfc202b60e01b815260040160405180910390fd5b60025460ff1615610f2d5760405163d93c066560e01b815260040160405180910390fd5b606082614f8457614f7f82614fcb565b6145f8565b8151158015614f9b57506001600160a01b0384163b155b15614fc457604051639996b31560e01b81526001600160a01b0385166004820152602401610d79565b50806145f8565b805115614fdb5780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b60006020828403121561500657600080fd5b81356001600160e01b0319811681146145f857600080fd5b60006020828403121561503057600080fd5b5035919050565b80356001600160a01b038116811461504e57600080fd5b919050565b60006020828403121561506557600080fd5b61292082615037565b60008060006060848603121561508357600080fd5b61508c84615037565b925061509a60208501615037565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156150e9576150e96150aa565b604052919050565b6000806040838503121561510457600080fd5b61510d83615037565b915060208084013567ffffffffffffffff8082111561512b57600080fd5b818601915086601f83011261513f57600080fd5b813581811115615151576151516150aa565b615163601f8201601f191685016150c0565b9150808252878482850101111561517957600080fd5b80848401858401376000848284010152508093505050509250929050565b803563ffffffff8116811461504e57600080fd5b6000602082840312156151bd57600080fd5b61292082615197565b634e487b7160e01b600052602160045260246000fd5b600581106151fa57634e487b7160e01b600052602160045260246000fd5b9052565b6020810161292382846151dc565b60008060006060848603121561522157600080fd5b505081359360208301359350604090920135919050565b80356001600160581b038116811461504e57600080fd5b6000806040838503121561526257600080fd5b8235915061527260208401615238565b90509250929050565b60006020828403121561528d57600080fd5b8135600581106145f857600080fd5b604081016152aa82856151dc565b8260208301529392505050565b600060208083850312156152ca57600080fd5b823567ffffffffffffffff808211156152e257600080fd5b818501915085601f8301126152f657600080fd5b813581811115615308576153086150aa565b8060051b91506153198483016150c0565b818152918301840191848101908884111561533357600080fd5b938501935b8385101561535157843582529385019390850190615338565b98975050505050505050565b60008083601f84011261536f57600080fd5b50813567ffffffffffffffff81111561538757600080fd5b6020830191508360208260051b85010111156153a257600080fd5b9250929050565b60008083601f8401126153bb57600080fd5b50813567ffffffffffffffff8111156153d357600080fd5b6020830191508360208285010111156153a257600080fd5b60008060008060008060008060a0898b03121561540757600080fd5b61541089615037565b975061541e60208a01615037565b9650604089013567ffffffffffffffff8082111561543b57600080fd5b6154478c838d0161535d565b909850965060608b013591508082111561546057600080fd5b61546c8c838d0161535d565b909650945060808b013591508082111561548557600080fd5b506154928b828c016153a9565b999c989b5096995094979396929594505050565b600080604083850312156154b957600080fd5b6154c283615037565b946020939093013593505050565b600080604083850312156154e357600080fd5b6154c283615197565b60008060008060008060a0878903121561550557600080fd5b61550e87615037565b955061551c60208801615037565b94506040870135935060608701359250608087013567ffffffffffffffff81111561554657600080fd5b61555289828a016153a9565b979a9699509497509295939492505050565b600080600080600080600080610100898b03121561558157600080fd5b88359750602089013560ff8116811461559957600080fd5b96506155a760408a01615197565b95506155b560608a01615197565b94506155c360808a01615238565b93506155d160a08a01615238565b92506155df60c08a01615238565b91506155ed60e08a01615238565b90509295985092959890939650565b634e487b7160e01b600052601160045260246000fd5b81810381811115612923576129236155fc565b6001600160a01b03929092168252602082015260400190565b60006020828403121561565057600080fd5b815180151581146145f857600080fd5b60208082526044908201527f4c6f636b506572696f64436f6e74726163743a20506572696f6420696e64657860408201527f20697320686967686572207468616e20706572696f6420696e64657820636f75606082015263373a32b960e11b608082015260a00190565b80820180821115612923576129236155fc565b8082028115828204841417612923576129236155fc565b634e487b7160e01b600052601260045260246000fd5b60008261572757634e487b7160e01b600052601260045260246000fd5b500490565b6001600160581b03818116838216019080821115614364576143646155fc565b6001600160a01b039384168152919092166020820152604081019190915260600190565b63ffffffff818116838216019080821115614364576143646155fc565b60208082526038908201527f4c6f636b506572696f64436f6e74726163743a204f6e6c79206d756c7469736960408201527f672063616e2063616c6c20746869732066756e6374696f6e0000000000000000606082015260800190565b6000602082840312156157fc57600080fd5b5051919050565b600081518084526020808501945080840160005b8381101561583357815187529582019590820190600101615817565b509495945050505050565b6001600160a01b038516815260806020820181905260009061586290830186615803565b6040830194909452506060015292915050565b6020808252604f908201527f4c6f636b4e46543a2043616e6e6f7420756e6c6f636b204e465473206475726960408201527f6e672061637469766520706572696f64207761697420756e74696c207468652060608201526e3832b934b7b21034b99037bb32b91760891b608082015260a00190565b6020815260006129206020830184615803565b6001600160581b03828116828216039080821115614364576143646155fc565b634e487b7160e01b600052603260045260246000fd5b600060018201615945576159456155fc565b5060010190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b6000825160005b818110156159a5576020818601810151858301520161598b565b50600092019182525091905056febef423ced52545594b81c8679c0d9566b5129c4120568a000c6ff1c9e89e71f4a2646970667358221220acbd4e1e49aabbcb13472590bbd3afd909be686041794a7a1945783ca55d3cad64736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da000000000000000000000000095cb2dd19ad95dba033889c2b0965e6fe357309000000000000000000000000ab3044d92f7d82bf332898653453a2d9744b4a36000000000000000000000000d51a6af83c7ab056f0f4e89cc295e3a10982914e0000000000000000000000000bde4ba965f8f21c6b359c0e0488deb0e921ada20000000000000000000000000000000000000000000000000000000000000e100000000000000000000000000000000000000000000000000000000000000e10
-----Decoded View---------------
Arg [0] : _rewardsToken_usa_1 (address): 0x4FFe9CC172527DF1E40D0b2EfE1e9F05884A13dA
Arg [1] : _rewardsToken_WETH_2 (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : _rewardsToken_Stable_3 (address): 0x6B175474E89094C44Da98b954EedeAC495271d0F
Arg [3] : _lockERC20 (address): 0x4FFe9CC172527DF1E40D0b2EfE1e9F05884A13dA
Arg [4] : _owner (address): 0x095Cb2dd19aD95dbA033889c2B0965e6fE357309
Arg [5] : _multisig (address): 0xAb3044d92F7D82BF332898653453a2D9744b4a36
Arg [6] : _receiptNFT (address): 0xd51A6Af83C7ab056F0f4e89cC295e3a10982914E
Arg [7] : _lockNFTAddress (address): 0x0bde4ba965f8f21c6b359c0e0488dEB0e921AdA2
Arg [8] : _lockDurationNextPeriod (uint256): 3600
Arg [9] : _defaultWindowDuration (uint256): 3600
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f
Arg [3] : 0000000000000000000000004ffe9cc172527df1e40d0b2efe1e9f05884a13da
Arg [4] : 000000000000000000000000095cb2dd19ad95dba033889c2b0965e6fe357309
Arg [5] : 000000000000000000000000ab3044d92f7d82bf332898653453a2d9744b4a36
Arg [6] : 000000000000000000000000d51a6af83c7ab056f0f4e89cc295e3a10982914e
Arg [7] : 0000000000000000000000000bde4ba965f8f21c6b359c0e0488deb0e921ada2
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000e10
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000e10
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.051984 | 85,327.5264 | $4,435.67 |
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.