Overview
CRO Balance
CRO Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 6 from a total of 6 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 18947133 | 9 days ago | IN | 0 CRO | 0.99421875 | ||||
Approve | 18875169 | 14 days ago | IN | 0 CRO | 0.26592476 | ||||
Withdraw Trapped... | 16092097 | 196 days ago | IN | 0 CRO | 0.88375 | ||||
Withdraw Trapped... | 14594035 | 295 days ago | IN | 0 CRO | 0.88375 | ||||
Withdraw | 14594035 | 295 days ago | IN | 0 CRO | 0.88375 | ||||
Transfer | 12852385 | 409 days ago | IN | 0 CRO | 1.7675 |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
CorgiBoost
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity =0.8.18; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @notice a staking vault contract to stake CORGIAI and earn CORGIAI */ contract CorgiBoost is Initializable, UUPSUpgradeable, OwnableUpgradeable, ERC20Upgradeable, ReentrancyGuardUpgradeable { using SafeERC20 for IERC20; struct Stake { uint256 amount; uint256 poolId; uint256 weightedAmount; uint256 stakeTimestamp; uint256 unlockTimestamp; bool active; } struct PoolInfo { uint256 multiplier; uint256 lockPeriod; uint256 totalStaked; } struct UserInfo { uint256 weightedAmount; uint256 rewardDebt; uint256 claimTotal; Stake[] stakes; } struct StakingPeriod { uint256 rewardsPerSecond; uint256 periodInSeconds; } uint256 public constant PRECISION = 10 ** 18; // total corgiAiToken amount deposited by users (except rewards) uint256 public totalStaked; // total corgiAiToken rewards claimed by users uint256 public totalRewardsClaimed; uint256 public totalRewardPhases; uint256 public currentPhase; uint256 public startTime; uint256 public endTime; uint256 public lastRewardTime; uint256 public rewardsPerSecond; uint256 public accTokenPerShare; uint256 public totalRewards; IERC20 public corgiAiToken; PoolInfo[] public poolInfo; mapping(uint256 => StakingPeriod) public stakingPeriod; mapping(address => UserInfo) public userInfo; // multiplier -> lockPeriod -> poolID (in +1 format) mapping(uint256 => mapping(uint256 => uint256)) public activePoolMap; event Deposit( address indexed user, uint256 indexed pid, uint256 indexed stakeId, uint256 amount, uint256 weightedAmount, uint256 unlockTimestamp ); event Withdraw( address indexed user, uint256 indexed stakeId, uint256 indexed pid, uint256 amount, uint256 weightedAmount ); event Upgrade( address indexed user, uint256 indexed stakeId, uint256 indexed newPid, uint256 newWeightedAmount, uint256 newUnlockTimestamp ); event AddPool( uint256 indexed poolId, uint256 multiplier, uint256 lockPeriod ); event SetPool( uint256 indexed poolId, uint256 multiplier, uint256 lockPeriod ); event ClaimReward( address indexed user, uint256 amount ); event NewRewardsPhase( uint256 indexed currentPhase, uint256 rewardsPerSecond ); event WithdrawTrappedTokens(address indexed receiver, uint256 amount); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @notice initalizes the contract /// @dev owner will need to transfer totalRewards to the contract after deploying /// @dev caution: totalRewards must match with _rewardsPerSecondList and _periodInSecondsList /// @param _corgiAiToken address of CORGIAI token (reward1 token) function initialize( IERC20 _corgiAiToken, uint256 _startTime, uint256 _totalRewards, uint256[] calldata _rewardsPerSecondList, uint256[] calldata _periodInSecondsList ) public initializer { require( address(_corgiAiToken) != address(0), "CorgiBoost: corgiAiToken must not be address(0)" ); totalRewardPhases = _rewardsPerSecondList.length; require( totalRewardPhases == _periodInSecondsList.length, "CorgiBoost: lengths must match numberPeriods" ); corgiAiToken = _corgiAiToken; for (uint256 i; i < totalRewardPhases; ++i) { stakingPeriod[i] = StakingPeriod({ rewardsPerSecond: _rewardsPerSecondList[i], periodInSeconds: _periodInSecondsList[i] }); } // owner need to send totalRewards manually to the contract after deployment totalRewards = _totalRewards; rewardsPerSecond = _rewardsPerSecondList[0]; startTime = _startTime; endTime = _startTime + _periodInSecondsList[0]; // Set the lastRewardTime as the startTime lastRewardTime = _startTime; __Ownable_init(); __UUPSUpgradeable_init(); __ERC20_init("CORGIAI Boost Bearing Token", "CBOOST"); } /** * @notice Update pool rewards * @dev this function doesn't work when totalSupply=0 and reward cycles run empty. * @dev caution: totalRewards must match with _rewardsPerSecondList and _periodInSecondsList * @dev sender must approve CorgiAiToken to spend on CorgiBoost contract */ function updateRewards( uint256 _totalRewards, uint256[] calldata _rewardsPerSecondList, uint256[] calldata _periodInSecondsList ) external onlyOwner nonReentrant { _harvest(); // can not update reward structure after reward cycle ends require(block.timestamp < endTime, "invalid operation"); uint256 _totalRewardPhases = _rewardsPerSecondList.length; require( _totalRewardPhases == _periodInSecondsList.length, "updateRewarder: length mismatch" ); require( _totalRewardPhases > currentPhase + 1, "updateRewarder expired" ); uint256 nextPhase = currentPhase + 1; if (currentPhase == 0 && block.timestamp < startTime) { nextPhase = 0; } else { for (uint256 i = currentPhase; i >= 0; --i) { StakingPeriod memory s = stakingPeriod[i]; require( s.rewardsPerSecond == _rewardsPerSecondList[i] && s.periodInSeconds == _periodInSecondsList[i], "invalid rewardsPerSecond or periodInSeconds" ); if (i == 0) { break; } } } for (uint256 i = nextPhase; i < _totalRewardPhases; ++i) { stakingPeriod[i] = StakingPeriod({ rewardsPerSecond: _rewardsPerSecondList[i], periodInSeconds: _periodInSecondsList[i] }); } if (totalRewardPhases > _totalRewardPhases) { for (uint256 i = _totalRewardPhases; i < totalRewardPhases; ++i) { delete(stakingPeriod[i]); } } totalRewardPhases = _totalRewardPhases; if (_totalRewards > totalRewards) { corgiAiToken.safeTransferFrom(msg.sender, address(this), _totalRewards - totalRewards); } else if (_totalRewards < totalRewards){ corgiAiToken.safeTransfer(msg.sender, totalRewards - _totalRewards); } totalRewards = _totalRewards; } /// @notice deposit CORGIAI /// @param _pid unique identfier to staking vault /// @param _amount amount of CORGIAI to stake function deposit(uint256 _pid, uint256 _amount) external { depositFor(_pid, _amount, msg.sender); } /// @notice deposit CORGIAI on behalf of user /// @param _pid unique identfier to staking vault /// @param _amount amount of CORGIAI to stake /// @param _user address to deposit on behalf on. CORGIAI will come from msg.sender instead of user function depositFor( uint256 _pid, uint256 _amount, address _user ) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; require(pool.multiplier > 0, "CorgiBoost: Invalid Pool ID"); _harvest(); Stake memory stake; UserInfo storage user = userInfo[_user]; if (user.weightedAmount > 0) { _harvestPendingRewards(_user); } if (_amount > 0) { uint256 weightedAmount = pool.multiplier * _amount; stake.amount = _amount; stake.poolId = _pid; stake.weightedAmount = weightedAmount; stake.stakeTimestamp = block.timestamp; stake.unlockTimestamp = block.timestamp + pool.lockPeriod; stake.active = true; pool.totalStaked += _amount; totalStaked += _amount; corgiAiToken.safeTransferFrom(msg.sender, address(this), _amount); _mint(_user, weightedAmount); user.stakes.push(stake); user.weightedAmount += weightedAmount; } user.rewardDebt = (user.weightedAmount * accTokenPerShare) / PRECISION; emit Deposit( _user, _pid, user.stakes.length - 1, _amount, stake.weightedAmount, stake.unlockTimestamp ); } /// @notice withdraw user deposit /// @param _stakeId unique identifier for each user deposit function withdraw(uint256 _stakeId) public nonReentrant { UserInfo storage user = userInfo[msg.sender]; Stake storage stake = user.stakes[_stakeId]; PoolInfo storage pool = poolInfo[stake.poolId]; require( block.timestamp >= stake.unlockTimestamp, "CorgiBoost: Stake not Ready for Withdrawal" ); require(stake.active, "CorgiBoost: Stake not Active"); _harvest(); if (user.weightedAmount > 0) { _harvestPendingRewards(msg.sender); } corgiAiToken.safeTransfer(msg.sender, stake.amount); user.weightedAmount -= stake.weightedAmount; _burn(msg.sender, stake.weightedAmount); pool.totalStaked -= stake.amount; totalStaked -= stake.amount; stake.active = false; user.rewardDebt = (user.weightedAmount * accTokenPerShare) / PRECISION; emit Withdraw(msg.sender, _stakeId, stake.poolId, stake.amount, stake.weightedAmount); } /// @notice upgrade the users deposit to new vault /// @param _stakeId users deposit id /// @param _newPid new vault Id to upgrade the deposit /// @dev only upgrade of the vault is possible, no downgrade. usually staking vault are represented by multiplier and lockPeriod /// @dev upgrade means move from low multiplier to high multiplier function upgrade(uint256 _stakeId, uint256 _newPid) public nonReentrant { UserInfo storage user = userInfo[msg.sender]; Stake storage stake = user.stakes[_stakeId]; PoolInfo storage oldPool = poolInfo[stake.poolId]; PoolInfo storage newPool = poolInfo[_newPid]; require(stake.active, "CorgiBoost: Stake not Active"); require( stake.stakeTimestamp + newPool.lockPeriod >= stake.unlockTimestamp, "CorgiBoost: New Stake must be longer" ); require( newPool.multiplier > stake.weightedAmount / stake.amount, "CorgiBoost: Why downgrade" ); _harvest(); if (user.weightedAmount > 0) { _harvestPendingRewards(msg.sender); } stake.poolId = _newPid; stake.unlockTimestamp = stake.stakeTimestamp + newPool.lockPeriod; uint256 upgradeAmount = newPool.multiplier * stake.amount - stake.weightedAmount; user.weightedAmount += upgradeAmount; stake.weightedAmount += upgradeAmount; _mint(msg.sender, upgradeAmount); oldPool.totalStaked -= stake.amount; newPool.totalStaked += stake.amount; user.rewardDebt = (user.weightedAmount * accTokenPerShare) / PRECISION; emit Upgrade( msg.sender, _stakeId, _newPid, stake.weightedAmount, stake.unlockTimestamp ); } function batchWithdraw(uint256[] calldata _stakeIds) external { for (uint256 i; i < _stakeIds.length; ++i) { withdraw(_stakeIds[i]); } } function batchUpgrade( uint256[] calldata _stakeIds, uint256[] calldata _newPids ) external { require( _stakeIds.length == _newPids.length, "CorgiBoost: Array length mismatch" ); for (uint256 i; i < _stakeIds.length; ++i) { upgrade(_stakeIds[i], _newPids[i]); } } /// @notice add new staking vault /// @param _multiplier vault multiplier /// @param _lockPeriod time in seconds to unlock/withdraw from the vault function add(uint256 _multiplier, uint256 _lockPeriod) public onlyOwner { require( activePoolMap[_multiplier][_lockPeriod] == 0, "CorgiBoost: Duplicate Pool" ); require(_multiplier > 0, "CorgiBoost: Multiplier must be > 0"); poolInfo.push( PoolInfo({ multiplier: _multiplier, lockPeriod: _lockPeriod, totalStaked: 0 }) ); activePoolMap[_multiplier][_lockPeriod] = poolInfo.length; emit AddPool(poolInfo.length - 1, _multiplier, _lockPeriod); } /// @notice updates the existing vault configurations /// @dev only owner can call this. function set( uint256 _pid, uint256 _multiplier, uint256 _lockPeriod ) public onlyOwner { require( activePoolMap[_multiplier][_lockPeriod] == 0, "CorgiBoost: Duplicate Pool" ); require(_multiplier > 0, "CorgiBoost: Multiplier must be > 0"); _harvest(); PoolInfo storage pool = poolInfo[_pid]; activePoolMap[pool.multiplier][pool.lockPeriod] = 0; pool.multiplier = _multiplier; pool.lockPeriod = _lockPeriod; activePoolMap[_multiplier][_lockPeriod] = _pid + 1; emit SetPool(_pid, _multiplier, _lockPeriod); } /// @notice returns the user info function getUserInfo( address _user ) external view returns (uint256, uint256, uint256) { UserInfo memory user = userInfo[_user]; return (user.weightedAmount, user.rewardDebt, user.claimTotal); } /// @notice get user stakes by stakeId range /// @dev Just in case there are too many Stakes and jams `getUserInfo` function getUserStakes(address _user, uint256 _startStakeId, uint256 _endStakeId) external view returns (Stake[] memory) { UserInfo memory user = userInfo[_user]; uint256 stakeLength = 1 + (_endStakeId - _startStakeId); Stake[] memory stakes = new Stake[](stakeLength); for (uint256 i = _startStakeId; i <= _endStakeId; ++i) { stakes[i] = user.stakes[i]; } return stakes; } /// @notice get user stakes for input stakeIds /// @dev sometimes FE wants to refresh specific stake info function getUserStakesByIds(address _user, uint256[] calldata stakeIds) external view returns (Stake[] memory) { UserInfo memory user = userInfo[_user]; uint256 stakeLength = stakeIds.length; Stake[] memory stakes = new Stake[](stakeLength); for (uint256 i; i < stakeLength; ++i) { stakes[i] = user.stakes[stakeIds[i]]; } return stakes; } function getUserStakeLength(address _user) external view returns (uint256) { return userInfo[_user].stakes.length; } /// @notice returns the users pending CORGIAI rewards function pendingCorgi(address _user) external view returns (uint256) { if (totalSupply() == 0) { return 0; } UserInfo memory user = userInfo[_user]; uint256 rewardsToHarvest = _pendingRewards(); return (user.weightedAmount * (accTokenPerShare + (PRECISION * rewardsToHarvest) / totalSupply())) / PRECISION - user.rewardDebt; } function poolLength() external view returns (uint256) { return poolInfo.length; } /** * @dev BOOST Token is currently non-transferable */ function _beforeTokenTransfer( address _from, address _to, uint256 ) internal pure override { require( _from == address(0) || _to == address(0), "CorgiBoost: Transfer not permitted" ); } /// @notice transfers pending rewards to user /// @dev wrapped in an internal function, to be reused and called from child contract /// @dev this function should be used right before any update to users boosted token balance and right after _harvest() function function _harvestPendingRewards(address _user) internal { UserInfo storage user = userInfo[_user]; uint256 pending = (user.weightedAmount * accTokenPerShare) / PRECISION - user.rewardDebt; if (pending > 0) { totalRewardsClaimed += pending; user.claimTotal += pending; corgiAiToken.safeTransfer(_user, pending); } emit ClaimReward(_user, pending); } /** * @notice Update reward variables of the pool */ function _harvest() internal { if (block.timestamp <= lastRewardTime || totalSupply() == 0) { return; } uint256 pendingRewards = _calculatePendingRewards(); // Update last reward time only if it wasn't updated after or at the end time if (lastRewardTime <= endTime) { lastRewardTime = block.timestamp; } accTokenPerShare += (PRECISION * pendingRewards) / totalSupply(); } function _calculatePendingRewards() internal returns (uint256) { if (block.timestamp <= lastRewardTime) { return 0; } // Calculate multiplier uint256 multiplier = _getMultiplier( lastRewardTime, block.timestamp, endTime ); // Calculate rewards for staking and others uint256 pendingRewards = multiplier * rewardsPerSecond; // Check whether to adjust multipliers and reward per second while ( (block.timestamp > endTime) && (currentPhase < (totalRewardPhases - 1)) ) { // Update rewards per second _switchToNextPhase(); uint256 previousEndTime = endTime; // Adjust the end time endTime += stakingPeriod[currentPhase].periodInSeconds; // Adjust multiplier to cover the missing periods with other lower inflation schedule uint256 newMultiplier = _getMultiplier( previousEndTime, block.timestamp, endTime ); // Adjust token rewards pendingRewards += (newMultiplier * rewardsPerSecond); } return pendingRewards; } function _pendingRewards() internal view returns (uint256) { if (block.timestamp <= lastRewardTime) { return 0; } // shadow state vars to avoid updates uint256 tEndTime = endTime; uint256 tCurrentPhase = currentPhase; uint256 trewardsPerSecond = rewardsPerSecond; // Calculate multiplier uint256 multiplier = _getMultiplier( lastRewardTime, block.timestamp, tEndTime ); // Calculate rewards for staking and others uint256 pendingRewards = multiplier * trewardsPerSecond; // Check whether to adjust multipliers and reward per second while ( (block.timestamp > tEndTime) && (tCurrentPhase < (totalRewardPhases - 1)) ) { // Update rewards per second tCurrentPhase++; trewardsPerSecond = stakingPeriod[tCurrentPhase].rewardsPerSecond; uint256 previousEndTime = tEndTime; // Adjust the end time tEndTime += stakingPeriod[tCurrentPhase].periodInSeconds; // Adjust multiplier to cover the missing periods with other lower inflation schedule uint256 newMultiplier = _getMultiplier( previousEndTime, block.timestamp, tEndTime ); // Adjust token rewards pendingRewards += (newMultiplier * trewardsPerSecond); } return pendingRewards; } /** * @notice Update rewards per second * @dev Rewards are halved by 2 (for staking + others) */ function _switchToNextPhase() internal { // Update current phase currentPhase++; // Update rewards per second rewardsPerSecond = stakingPeriod[currentPhase].rewardsPerSecond; emit NewRewardsPhase(currentPhase, rewardsPerSecond); } /** * @notice Return reward multiplier over the given "from" to "to" timestamp. * @param from timestamp to start calculating reward * @param to timestamp to finish calculating reward * @return the multiplier for the period */ function _getMultiplier( uint256 from, uint256 to, uint256 tEndTime ) internal pure returns (uint256) { if (to <= tEndTime) { return to - from; } else if (from >= tEndTime) { return 0; } else { return tEndTime - from; } } function withdrawTrappedTokens() external onlyOwner { uint256 expectedBalance = totalStaked + (totalRewards - totalRewardsClaimed); uint256 contractBalance = corgiAiToken.balanceOf(address(this)); require(contractBalance >= expectedBalance, "insufficient reward balance"); uint256 trappedAmt; if (contractBalance > expectedBalance) { trappedAmt = contractBalance - expectedBalance; corgiAiToken.safeTransfer(msg.sender, trappedAmt); } emit WithdrawTrappedTokens(msg.sender, trappedAmt); } /** * @dev Required by EIP-1822 UUPS */ function _authorizeUpgrade(address) internal override onlyOwner {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol) pragma solidity ^0.8.0; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. * * _Available since v4.9._ */ interface IERC1967Upgradeable { /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/IERC1967Upgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockPeriod","type":"uint256"}],"name":"AddPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weightedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockTimestamp","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"currentPhase","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardsPerSecond","type":"uint256"}],"name":"NewRewardsPhase","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":true,"internalType":"uint256","name":"poolId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockPeriod","type":"uint256"}],"name":"SetPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"newPid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newWeightedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newUnlockTimestamp","type":"uint256"}],"name":"Upgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"stakeId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weightedAmount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawTrappedTokens","type":"event"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accTokenPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"activePoolMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_multiplier","type":"uint256"},{"internalType":"uint256","name":"_lockPeriod","type":"uint256"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_stakeIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_newPids","type":"uint256[]"}],"name":"batchUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_stakeIds","type":"uint256[]"}],"name":"batchWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"corgiAiToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentPhase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"depositFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserStakeLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_startStakeId","type":"uint256"},{"internalType":"uint256","name":"_endStakeId","type":"uint256"}],"name":"getUserStakes","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"weightedAmount","type":"uint256"},{"internalType":"uint256","name":"stakeTimestamp","type":"uint256"},{"internalType":"uint256","name":"unlockTimestamp","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct CorgiBoost.Stake[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256[]","name":"stakeIds","type":"uint256[]"}],"name":"getUserStakesByIds","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"weightedAmount","type":"uint256"},{"internalType":"uint256","name":"stakeTimestamp","type":"uint256"},{"internalType":"uint256","name":"unlockTimestamp","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct CorgiBoost.Stake[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_corgiAiToken","type":"address"},{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_totalRewards","type":"uint256"},{"internalType":"uint256[]","name":"_rewardsPerSecondList","type":"uint256[]"},{"internalType":"uint256[]","name":"_periodInSecondsList","type":"uint256[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastRewardTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingCorgi","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"uint256","name":"multiplier","type":"uint256"},{"internalType":"uint256","name":"lockPeriod","type":"uint256"},{"internalType":"uint256","name":"totalStaked","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_multiplier","type":"uint256"},{"internalType":"uint256","name":"_lockPeriod","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakingPeriod","outputs":[{"internalType":"uint256","name":"rewardsPerSecond","type":"uint256"},{"internalType":"uint256","name":"periodInSeconds","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewardPhases","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewardsClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalRewards","type":"uint256"},{"internalType":"uint256[]","name":"_rewardsPerSecondList","type":"uint256[]"},{"internalType":"uint256[]","name":"_periodInSecondsList","type":"uint256[]"}],"name":"updateRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeId","type":"uint256"},{"internalType":"uint256","name":"_newPid","type":"uint256"}],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"weightedAmount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"claimTotal","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawTrappedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60805161437e6200012060003960008181610e1801528181610e580152818161177f015281816117bf015261184e015261437e6000f3fe6080604052600436106102c95760003560e01c80637264599811610175578063a9059cbb116100dc578063e2bbb15811610095578063f2fde38b1161006f578063f2fde38b146108a8578063f7ea7bca146108c8578063f9586e3f14610902578063fe05d02a1461093b57600080fd5b8063e2bbb15814610850578063eacdaabc14610870578063f29350b71461088757600080fd5b8063a9059cbb1461076a578063aaf5eb681461078a578063bc13711c146107a6578063c1027c98146107c6578063c257c4a814610810578063dd62ed3e1461083057600080fd5b80638f6629151161012e5780638f662915146106d057806390210d7e146106e75780639231cf741461070757806395d89b411461071e578063a34b0f7614610733578063a457c2d71461074a57600080fd5b8063726459981461061957806372e5539914610630578063771602f71461065057806378e9792514610670578063817b1cd2146106875780638da5cb5b1461069e57600080fd5b80633197cbb611610234578063451450ec116101ed5780636386c1c7116101c75780636386c1c7146105815780636a6c8d8b146105a157806370a08231146105ce578063715018a61461060457600080fd5b8063451450ec146105395780634f1ef2861461055957806352d1902d1461056c57600080fd5b80633197cbb6146104825780633659cfe61461049957806337870f6d146104b957806339509351146104d95780633c011b5f146104f957806343b0e8df1461051957600080fd5b80631526fe27116102865780631526fe271461039757806318160ddd146103d25780631959a002146103e757806323b872dd146104245780632e1a7d4d14610444578063313ce5671461046657600080fd5b8063055ad42e146102ce57806306fdde03146102f8578063081e3eda1461031a578063095ea7b3146103305780630e15561a146103605780630fabb5a414610377575b600080fd5b3480156102da57600080fd5b506102e56101305481565b6040519081526020015b60405180910390f35b34801561030457600080fd5b5061030d610950565b6040516102ef91906139ef565b34801561032657600080fd5b50610138546102e5565b34801561033c57600080fd5b5061035061034b366004613a37565b6109e2565b60405190151581526020016102ef565b34801561036c57600080fd5b506102e56101365481565b34801561038357600080fd5b506102e5610392366004613a63565b6109fc565b3480156103a357600080fd5b506103b76103b2366004613a80565b610b62565b604080519384526020840192909252908201526060016102ef565b3480156103de57600080fd5b5060cb546102e5565b3480156103f357600080fd5b506103b7610402366004613a63565b61013a6020526000908152604090208054600182015460029092015490919083565b34801561043057600080fd5b5061035061043f366004613a99565b610b96565b34801561045057600080fd5b5061046461045f366004613a80565b610bbc565b005b34801561047257600080fd5b50604051601281526020016102ef565b34801561048e57600080fd5b506102e56101325481565b3480156104a557600080fd5b506104646104b4366004613a63565b610e0e565b3480156104c557600080fd5b506104646104d4366004613b26565b610eea565b3480156104e557600080fd5b506103506104f4366004613a37565b611238565b34801561050557600080fd5b50610464610514366004613bbc565b61125a565b34801561052557600080fd5b50610464610534366004613c28565b61130f565b34801561054557600080fd5b50610464610554366004613c54565b611463565b610464610567366004613c8c565b611775565b34801561057857600080fd5b506102e5611841565b34801561058d57600080fd5b506103b761059c366004613a63565b6118f4565b3480156105ad57600080fd5b506105c16105bc366004613d50565b6119fc565b6040516102ef9190613d85565b3480156105da57600080fd5b506102e56105e9366004613a63565b6001600160a01b0316600090815260c9602052604090205490565b34801561061057600080fd5b50610464611ba6565b34801561062557600080fd5b506102e561012f5481565b34801561063c57600080fd5b5061046461064b366004613dff565b611bba565b34801561065c57600080fd5b5061046461066b366004613c54565b611bfb565b34801561067c57600080fd5b506102e56101315481565b34801561069357600080fd5b506102e561012d5481565b3480156106aa57600080fd5b506097546001600160a01b03165b6040516001600160a01b0390911681526020016102ef565b3480156106dc57600080fd5b506102e56101355481565b3480156106f357600080fd5b50610464610702366004613e41565b611d93565b34801561071357600080fd5b506102e56101335481565b34801561072a57600080fd5b5061030d612017565b34801561073f57600080fd5b506102e561012e5481565b34801561075657600080fd5b50610350610765366004613a37565b612026565b34801561077657600080fd5b50610350610785366004613a37565b6120ac565b34801561079657600080fd5b506102e5670de0b6b3a764000081565b3480156107b257600080fd5b506105c16107c1366004613e7a565b6120ba565b3480156107d257600080fd5b506107fb6107e1366004613a80565b610139602052600090815260409020805460019091015482565b604080519283526020830191909152016102ef565b34801561081c57600080fd5b5061046461082b366004613ecf565b61225b565b34801561083c57600080fd5b506102e561084b366004613f49565b6125cd565b34801561085c57600080fd5b5061046461086b366004613c54565b6125f8565b34801561087c57600080fd5b506102e56101345481565b34801561089357600080fd5b50610137546106b8906001600160a01b031681565b3480156108b457600080fd5b506104646108c3366004613a63565b612603565b3480156108d457600080fd5b506102e56108e3366004613a63565b6001600160a01b0316600090815261013a602052604090206003015490565b34801561090e57600080fd5b506102e561091d366004613c54565b61013b60209081526000928352604080842090915290825290205481565b34801561094757600080fd5b50610464612679565b606060cc805461095f90613f82565b80601f016020809104026020016040519081016040528092919081815260200182805461098b90613f82565b80156109d85780601f106109ad576101008083540402835291602001916109d8565b820191906000526020600020905b8154815290600101906020018083116109bb57829003601f168201915b5050505050905090565b6000336109f08185856127d2565b60019150505b92915050565b6000610a0760cb5490565b600003610a1657506000919050565b6001600160a01b038216600090815261013a60209081526040808320815160808101835281548152600182015481850152600282015481840152600382018054845181870281018701909552808552919492936060860193909290879084015b82821015610ae35760008481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a08301529083529092019101610a76565b505050508152505090506000610af76128f6565b90508160200151670de0b6b3a7640000610b1060cb5490565b610b2284670de0b6b3a7640000613fd2565b610b2c9190613fe9565b61013554610b3a919061400b565b8451610b469190613fd2565b610b509190613fe9565b610b5a919061401e565b949350505050565b6101388181548110610b7357600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600033610ba48582856129c3565b610baf858585612a3d565b60019150505b9392505050565b610bc4612bf3565b33600090815261013a6020526040812060038101805491929184908110610bed57610bed614031565b906000526020600020906006020190506000610138826001015481548110610c1757610c17614031565b906000526020600020906003020190508160040154421015610c935760405162461bcd60e51b815260206004820152602a60248201527f436f726769426f6f73743a205374616b65206e6f7420526561647920666f722060448201526915da5d1a191c985dd85b60b21b60648201526084015b60405180910390fd5b600582015460ff16610ce75760405162461bcd60e51b815260206004820152601c60248201527f436f726769426f6f73743a205374616b65206e6f7420416374697665000000006044820152606401610c8a565b610cef612c4c565b825415610cff57610cff33612cbd565b815461013754610d1c916001600160a01b03909116903390612d99565b8160020154836000016000828254610d34919061401e565b92505081905550610d49338360020154612dfc565b8154600282018054600090610d5f90849061401e565b9091555050815461012d8054600090610d7990849061401e565b909155505060058201805460ff19169055610135548354670de0b6b3a764000091610da391613fd2565b610dad9190613fe9565b60018481019190915582015482546002840154604080519283526020830191909152869133917fe08737ac48a1dab4b1a46c7dc9398bd5bfc6d7ad6fabb7cd8caa254de14def35910160405180910390a4505050610e0b600160fb55565b50565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610e565760405162461bcd60e51b8152600401610c8a90614047565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610e9f600080516020614302833981519152546001600160a01b031690565b6001600160a01b031614610ec55760405162461bcd60e51b8152600401610c8a90614093565b610ece81612f3c565b60408051600080825260208201909252610e0b91839190612f44565b600054610100900460ff1615808015610f0a5750600054600160ff909116105b80610f245750303b158015610f24575060005460ff166001145b610f875760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c8a565b6000805460ff191660011790558015610faa576000805461ff0019166101001790555b6001600160a01b0388166110185760405162461bcd60e51b815260206004820152602f60248201527f436f726769426f6f73743a20636f7267694169546f6b656e206d757374206e6f60448201526e74206265206164647265737328302960881b6064820152608401610c8a565b61012f8490558184146110825760405162461bcd60e51b815260206004820152602c60248201527f436f726769426f6f73743a206c656e67746873206d757374206d61746368206e60448201526b756d626572506572696f647360a01b6064820152608401610c8a565b61013780546001600160a01b0319166001600160a01b038a1617905560005b61012f548110156111235760405180604001604052808787848181106110c9576110c9614031565b9050602002013581526020018585848181106110e7576110e7614031565b602090810292909201359092526000848152610139825260409020835181559201516001909201919091555061111c816140df565b90506110a1565b50610136869055848460008161113b5761113b614031565b60200291909101356101345550610131879055828260008161115f5761115f614031565b9050602002013587611171919061400b565b610132556101338790556111836130af565b61118b6130de565b6111e86040518060400160405280601b81526020017f434f524749414920426f6f73742042656172696e6720546f6b656e00000000008152506040518060400160405280600681526020016510d093d3d4d560d21b815250613105565b801561122e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6000336109f081858561124b83836125cd565b611255919061400b565b6127d2565b8281146112b35760405162461bcd60e51b815260206004820152602160248201527f436f726769426f6f73743a204172726179206c656e677468206d69736d6174636044820152600d60fb1b6064820152608401610c8a565b60005b83811015611308576112f88585838181106112d3576112d3614031565b905060200201358484848181106112ec576112ec614031565b90506020020135611463565b611301816140df565b90506112b6565b5050505050565b611317613136565b600082815261013b602090815260408083208484529091529020541561137f5760405162461bcd60e51b815260206004820152601a60248201527f436f726769426f6f73743a204475706c696361746520506f6f6c0000000000006044820152606401610c8a565b6000821161139f5760405162461bcd60e51b8152600401610c8a906140f8565b6113a7612c4c565b600061013884815481106113bd576113bd614031565b6000918252602080832060039092029091018054835261013b8252604080842060018084018054875291909452908420939093558581559184905590915061140690859061400b565b600084815261013b6020908152604080832086845282529182902092909255805185815291820184905285917f17cb2943c2b75826e10c84d8d48b9953b663936eb40867b23dfe8f4930b98686910160405180910390a250505050565b61146b612bf3565b33600090815261013a602052604081206003810180549192918590811061149457611494614031565b9060005260206000209060060201905060006101388260010154815481106114be576114be614031565b90600052602060002090600302019050600061013885815481106114e4576114e4614031565b600091825260209091206005850154600390920201915060ff1661154a5760405162461bcd60e51b815260206004820152601c60248201527f436f726769426f6f73743a205374616b65206e6f7420416374697665000000006044820152606401610c8a565b826004015481600101548460030154611563919061400b565b10156115bd5760405162461bcd60e51b8152602060048201526024808201527f436f726769426f6f73743a204e6577205374616b65206d757374206265206c6f6044820152633733b2b960e11b6064820152608401610c8a565b825460028401546115ce9190613fe9565b81541161161d5760405162461bcd60e51b815260206004820152601960248201527f436f726769426f6f73743a2057687920646f776e6772616465000000000000006044820152606401610c8a565b611625612c4c565b8354156116355761163533612cbd565b6001808401869055810154600384015461164f919061400b565b60048401556002830154835482546000929161166a91613fd2565b611674919061401e565b90508085600001600082825461168a919061400b565b92505081905550808460020160008282546116a5919061400b565b909155506116b590503382613190565b83546002840180546000906116cb90849061401e565b909155505083546002830180546000906116e690849061400b565b9091555050610135548554670de0b6b3a76400009161170491613fd2565b61170e9190613fe9565b60018601556002840154600485015460405188928a9233927fa0ad55fd11cc19ae2402e185f0103dc5a70da0930212e8db8d1b5020fa15728c9261175a92908252602082015260400190565b60405180910390a45050505050611771600160fb55565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036117bd5760405162461bcd60e51b8152600401610c8a90614047565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611806600080516020614302833981519152546001600160a01b031690565b6001600160a01b03161461182c5760405162461bcd60e51b8152600401610c8a90614093565b61183582612f3c565b61177182826001612f44565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118e15760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610c8a565b5060008051602061430283398151915290565b60008060008061013a6000866001600160a01b03166001600160a01b0316815260200190815260200160002060405180608001604052908160008201548152602001600182015481526020016002820154815260200160038201805480602002602001604051908101604052809291908181526020016000905b828210156119db5760008481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a0830152908352909201910161196e565b50505091525050805160208201516040909201519097919650945092505050565b6001600160a01b038316600090815261013a602090815260408083208151608081018352815481526001820154818501526002820154818401526003820180548451818702810187019095528085526060969592948588019390929190879084015b82821015611acb5760008481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a08301529083529092019101611a5e565b50505091525090915060009050611ae2858561401e565b611aed90600161400b565b905060008167ffffffffffffffff811115611b0a57611b0a613c76565b604051908082528060200260200182016040528015611b4357816020015b611b30613993565b815260200190600190039081611b285790505b509050855b858111611b9b5783606001518181518110611b6557611b65614031565b6020026020010151828281518110611b7f57611b7f614031565b602002602001018190525080611b94906140df565b9050611b48565b509695505050505050565b611bae613136565b611bb8600061325d565b565b60005b81811015611bf657611be6838383818110611bda57611bda614031565b90506020020135610bbc565b611bef816140df565b9050611bbd565b505050565b611c03613136565b600082815261013b6020908152604080832084845290915290205415611c6b5760405162461bcd60e51b815260206004820152601a60248201527f436f726769426f6f73743a204475706c696361746520506f6f6c0000000000006044820152606401610c8a565b60008211611c8b5760405162461bcd60e51b8152600401610c8a906140f8565b604080516060810182528381526020808201848152600083850181815261013880546001808201835582855296517ff79a63dcec80ed75c82f36161f17b9c2f407860160383a7be0a0ee7962c527ae60039092029182015593517ff79a63dcec80ed75c82f36161f17b9c2f407860160383a7be0a0ee7962c527af85015590517ff79a63dcec80ed75c82f36161f17b9c2f407860160383a7be0a0ee7962c527b090930192909255905486825261013b835284822086835290925292909220829055611d569161401e565b60408051848152602081018490527f4d93067d0d628fe42c457623322c0f22ad92f71762a2eebe06e2a0e7d2aa61c7910160405180910390a25050565b611d9b612bf3565b60006101388481548110611db157611db1614031565b906000526020600020906003020190506000816000015411611e155760405162461bcd60e51b815260206004820152601b60248201527f436f726769426f6f73743a20496e76616c696420506f6f6c20494400000000006044820152606401610c8a565b611e1d612c4c565b611e25613993565b6001600160a01b038316600090815261013a60205260409020805415611e4e57611e4e84612cbd565b8415611f70578254600090611e64908790613fd2565b868452602084018890526040840181905242606085018190526001860154919250611e8f919061400b565b6080840152600160a0840152600284018054879190600090611eb290849061400b565b925050819055508561012d6000828254611ecc919061400b565b909155505061013754611eea906001600160a01b03163330896132af565b611ef48582613190565b600382810180546001808201835560009283526020808420885160069094020192835587015190820155604086015160028201556060860151928101929092556080850151600483015560a08501516005909201805460ff191692151592909217909155825482918491611f6990849061400b565b9091555050505b610135548154670de0b6b3a764000091611f8991613fd2565b611f939190613fe9565b6001808301919091556003820154611fab919061401e565b86856001600160a01b03167ff943cf10ef4d1e3239f4716ddecdf546e8ba8ab0e41deafd9a71a99936827e458886604001518760800151604051612002939291909283526020830191909152604082015260600190565b60405180910390a4505050611bf6600160fb55565b606060cd805461095f90613f82565b6000338161203482866125cd565b9050838110156120945760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610c8a565b6120a182868684036127d2565b506001949350505050565b6000336109f0818585612a3d565b6001600160a01b038316600090815261013a602090815260408083208151608081018352815481526001820154818501526002820154818401526003820180548451818702810187019095528085526060969592948588019390929190879084015b828210156121895760008481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a0830152908352909201910161211c565b50505091525090915083905060008167ffffffffffffffff8111156121b0576121b0613c76565b6040519080825280602002602001820160405280156121e957816020015b6121d6613993565b8152602001906001900390816121ce5790505b50905060005b82811015611b9b57836060015187878381811061220e5761220e614031565b905060200201358151811061222557612225614031565b602002602001015182828151811061223f5761223f614031565b602002602001018190525080612254906140df565b90506121ef565b612263613136565b61226b612bf3565b612273612c4c565b6101325442106122b95760405162461bcd60e51b815260206004820152601160248201527034b73b30b634b21037b832b930ba34b7b760791b6044820152606401610c8a565b828181146123095760405162461bcd60e51b815260206004820152601f60248201527f75706461746552657761726465723a206c656e677468206d69736d61746368006044820152606401610c8a565b6101305461231890600161400b565b811161235f5760405162461bcd60e51b81526020600482015260166024820152751d5c19185d1954995dd85c99195c88195e1c1a5c995960521b6044820152606401610c8a565b6000610130546001612371919061400b565b905061013054600014801561238857506101315442105b1561239557506000612488565b610130545b6000818152610139602090815260409182902082518084019093528054835260010154908201528787838181106123d3576123d3614031565b90506020020135816000015114801561240757508585838181106123f9576123f9614031565b905060200201358160200151145b6124675760405162461bcd60e51b815260206004820152602b60248201527f696e76616c696420726577617264735065725365636f6e64206f72207065726960448201526a6f64496e5365636f6e647360a81b6064820152608401610c8a565b816000036124755750612486565b5061247f8161413a565b905061239a565b505b805b828110156125095760405180604001604052808888848181106124af576124af614031565b9050602002013581526020018686848181106124cd576124cd614031565b6020908102929092013590925260008481526101398252604090208351815592015160019092019190915550612502816140df565b905061248a565b508161012f54111561254a57815b61012f548110156125485760008181526101396020526040812081815560010155612541816140df565b9050612517565b505b61012f82905561013654871115612589576125843330610136548a61256f919061401e565b610137546001600160a01b03169291906132af565b6125bb565b610136548710156125bb576125bb3388610136546125a7919061401e565b610137546001600160a01b03169190612d99565b5050610136859055611308600160fb55565b6001600160a01b03918216600090815260ca6020908152604080832093909416825291909152205490565b611771828233611d93565b61260b613136565b6001600160a01b0381166126705760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c8a565b610e0b8161325d565b612681613136565b600061012e5461013654612695919061401e565b61012d546126a3919061400b565b610137546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156126f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127169190614151565b9050818110156127685760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e74207265776172642062616c616e636500000000006044820152606401610c8a565b6000828211156127975761277c838361401e565b61013754909150612797906001600160a01b03163383612d99565b60405181815233907f1b1a78ab6b774fe3205ef7b6230247d37cd25ac16c5db42d8bc5d259695c1da2906020015b60405180910390a2505050565b6001600160a01b0383166128345760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c8a565b6001600160a01b0382166128955760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c8a565b6001600160a01b03838116600081815260ca602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006101335442116129085750600090565b610132546101305461013454610133546000906129269042866132e7565b905060006129348383613fd2565b90505b84421180156129545750600161012f54612951919061401e565b84105b156129ba5783612963816140df565b6000818152610139602052604090208054600190910154919650945086915061298c908261400b565b9550600061299b8242896132e7565b90506129a78582613fd2565b6129b1908461400b565b92505050612937565b95945050505050565b60006129cf84846125cd565b90506000198114612a375781811015612a2a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610c8a565b612a3784848484036127d2565b50505050565b6001600160a01b038316612aa15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c8a565b6001600160a01b038216612b035760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c8a565b612b0e83838361331a565b6001600160a01b038316600090815260c9602052604090205481811015612b865760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610c8a565b6001600160a01b03808516600081815260c9602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612be69086815260200190565b60405180910390a3612a37565b600260fb5403612c455760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c8a565b600260fb55565b6101335442111580612c5e575060cb54155b15612c6557565b6000612c6f61338e565b9050610132546101335411612c845742610133555b60cb54612c9982670de0b6b3a7640000613fd2565b612ca39190613fe9565b6101356000828254612cb5919061400b565b909155505050565b6001600160a01b038116600090815261013a602052604081206001810154610135548254929392670de0b6b3a764000091612cf791613fd2565b612d019190613fe9565b612d0b919061401e565b90508015612d5e578061012e6000828254612d26919061400b565b9250508190555080826002016000828254612d41919061400b565b909155505061013754612d5e906001600160a01b03168483612d99565b826001600160a01b03167fba8de60c3403ec381d1d484652ea1980e3c3e56359195c92525bff4ce47ad98e826040516127c591815260200190565b6040516001600160a01b038316602482015260448101829052611bf690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261345d565b6001600160a01b038216612e5c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610c8a565b612e688260008361331a565b6001600160a01b038216600090815260c9602052604090205481811015612edc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610c8a565b6001600160a01b038316600081815260c960209081526040808320868603905560cb80548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b610e0b613136565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612f7757611bf68361352f565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612fd1575060408051601f3d908101601f19168201909252612fce91810190614151565b60015b6130345760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610c8a565b60008051602061430283398151915281146130a35760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610c8a565b50611bf68383836135cb565b600054610100900460ff166130d65760405162461bcd60e51b8152600401610c8a9061416a565b611bb86135f0565b600054610100900460ff16611bb85760405162461bcd60e51b8152600401610c8a9061416a565b600054610100900460ff1661312c5760405162461bcd60e51b8152600401610c8a9061416a565b6117718282613620565b6097546001600160a01b03163314611bb85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c8a565b6001600160a01b0382166131e65760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610c8a565b6131f26000838361331a565b8060cb6000828254613204919061400b565b90915550506001600160a01b038216600081815260c960209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052612a379085906323b872dd60e01b90608401612dc5565b6000818311613301576132fa848461401e565b9050610bb5565b81841061331057506000610bb5565b6132fa848361401e565b6001600160a01b038316158061333757506001600160a01b038216155b611bf65760405162461bcd60e51b815260206004820152602260248201527f436f726769426f6f73743a205472616e73666572206e6f74207065726d697474604482015261195960f21b6064820152608401610c8a565b60006101335442116133a05750600090565b60006133b36101335442610132546132e7565b9050600061013454826133c69190613fd2565b90505b61013254421180156133ec5750600161012f546133e6919061401e565b61013054105b156109f6576133f9613660565b61013280546101305460009081526101396020526040812060010154919290613422838561400b565b9250508190555060006134398242610132546132e7565b9050610134548161344a9190613fd2565b613454908461400b565b925050506133c9565b60006134b2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136c69092919063ffffffff16565b805190915015611bf657808060200190518101906134d091906141b5565b611bf65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c8a565b6001600160a01b0381163b61359c5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610c8a565b60008051602061430283398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6135d4836136d5565b6000825111806135e15750805b15611bf657612a378383613715565b600054610100900460ff166136175760405162461bcd60e51b8152600401610c8a9061416a565b611bb83361325d565b600054610100900460ff166136475760405162461bcd60e51b8152600401610c8a9061416a565b60cc6136538382614225565b5060cd611bf68282614225565b6101308054906000613671836140df565b909155505061013054600081815261013960209081526040918290205461013481905591519182527fd3e074f816f4b09b1a1aefc557d5cdd102cc9402b4d5cb73dd8cb3fc880863a3910160405180910390a2565b6060610b5a8484600085613800565b6136de8161352f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61377d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610c8a565b600080846001600160a01b03168460405161379891906142e5565b600060405180830381855af49150503d80600081146137d3576040519150601f19603f3d011682016040523d82523d6000602084013e6137d8565b606091505b50915091506129ba8282604051806060016040528060278152602001614322602791396138db565b6060824710156138615760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c8a565b600080866001600160a01b0316858760405161387d91906142e5565b60006040518083038185875af1925050503d80600081146138ba576040519150601f19603f3d011682016040523d82523d6000602084013e6138bf565b606091505b50915091506138d0878383876138f4565b979650505050505050565b606083156138ea575081610bb5565b610bb58383613969565b6060831561396357825160000361395c576001600160a01b0385163b61395c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c8a565b5081610b5a565b610b5a83835b8151156139795781518083602001fd5b8060405162461bcd60e51b8152600401610c8a91906139ef565b6040518060c0016040528060008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b60005b838110156139e65781810151838201526020016139ce565b50506000910152565b6020815260008251806020840152613a0e8160408501602087016139cb565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610e0b57600080fd5b60008060408385031215613a4a57600080fd5b8235613a5581613a22565b946020939093013593505050565b600060208284031215613a7557600080fd5b8135610bb581613a22565b600060208284031215613a9257600080fd5b5035919050565b600080600060608486031215613aae57600080fd5b8335613ab981613a22565b92506020840135613ac981613a22565b929592945050506040919091013590565b60008083601f840112613aec57600080fd5b50813567ffffffffffffffff811115613b0457600080fd5b6020830191508360208260051b8501011115613b1f57600080fd5b9250929050565b600080600080600080600060a0888a031215613b4157600080fd5b8735613b4c81613a22565b96506020880135955060408801359450606088013567ffffffffffffffff80821115613b7757600080fd5b613b838b838c01613ada565b909650945060808a0135915080821115613b9c57600080fd5b50613ba98a828b01613ada565b989b979a50959850939692959293505050565b60008060008060408587031215613bd257600080fd5b843567ffffffffffffffff80821115613bea57600080fd5b613bf688838901613ada565b90965094506020870135915080821115613c0f57600080fd5b50613c1c87828801613ada565b95989497509550505050565b600080600060608486031215613c3d57600080fd5b505081359360208301359350604090920135919050565b60008060408385031215613c6757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215613c9f57600080fd5b8235613caa81613a22565b9150602083013567ffffffffffffffff80821115613cc757600080fd5b818501915085601f830112613cdb57600080fd5b813581811115613ced57613ced613c76565b604051601f8201601f19908116603f01168101908382118183101715613d1557613d15613c76565b81604052828152886020848701011115613d2e57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080600060608486031215613d6557600080fd5b8335613d7081613a22565b95602085013595506040909401359392505050565b602080825282518282018190526000919060409081850190868401855b82811015613df25781518051855286810151878601528581015186860152606080820151908601526080808201519086015260a09081015115159085015260c09093019290850190600101613da2565b5091979650505050505050565b60008060208385031215613e1257600080fd5b823567ffffffffffffffff811115613e2957600080fd5b613e3585828601613ada565b90969095509350505050565b600080600060608486031215613e5657600080fd5b83359250602084013591506040840135613e6f81613a22565b809150509250925092565b600080600060408486031215613e8f57600080fd5b8335613e9a81613a22565b9250602084013567ffffffffffffffff811115613eb657600080fd5b613ec286828701613ada565b9497909650939450505050565b600080600080600060608688031215613ee757600080fd5b85359450602086013567ffffffffffffffff80821115613f0657600080fd5b613f1289838a01613ada565b90965094506040880135915080821115613f2b57600080fd5b50613f3888828901613ada565b969995985093965092949392505050565b60008060408385031215613f5c57600080fd5b8235613f6781613a22565b91506020830135613f7781613a22565b809150509250929050565b600181811c90821680613f9657607f821691505b602082108103613fb657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109f6576109f6613fbc565b60008261400657634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156109f6576109f6613fbc565b818103818111156109f6576109f6613fbc565b634e487b7160e01b600052603260045260246000fd5b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000600182016140f1576140f1613fbc565b5060010190565b60208082526022908201527f436f726769426f6f73743a204d756c7469706c696572206d757374206265203e604082015261020360f41b606082015260800190565b60008161414957614149613fbc565b506000190190565b60006020828403121561416357600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156141c757600080fd5b81518015158114610bb557600080fd5b601f821115611bf657600081815260208120601f850160051c810160208610156141fe5750805b601f850160051c820191505b8181101561421d5782815560010161420a565b505050505050565b815167ffffffffffffffff81111561423f5761423f613c76565b6142538161424d8454613f82565b846141d7565b602080601f83116001811461428857600084156142705750858301515b600019600386901b1c1916600185901b17855561421d565b600085815260208120601f198616915b828110156142b757888601518255948401946001909101908401614298565b50858210156142d55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082516142f78184602087016139cb565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122059c6558efc63db82192ab788ea439ee79207da2de4d96300f202eeb98eaa39b064736f6c63430008120033
Deployed Bytecode
0x6080604052600436106102c95760003560e01c80637264599811610175578063a9059cbb116100dc578063e2bbb15811610095578063f2fde38b1161006f578063f2fde38b146108a8578063f7ea7bca146108c8578063f9586e3f14610902578063fe05d02a1461093b57600080fd5b8063e2bbb15814610850578063eacdaabc14610870578063f29350b71461088757600080fd5b8063a9059cbb1461076a578063aaf5eb681461078a578063bc13711c146107a6578063c1027c98146107c6578063c257c4a814610810578063dd62ed3e1461083057600080fd5b80638f6629151161012e5780638f662915146106d057806390210d7e146106e75780639231cf741461070757806395d89b411461071e578063a34b0f7614610733578063a457c2d71461074a57600080fd5b8063726459981461061957806372e5539914610630578063771602f71461065057806378e9792514610670578063817b1cd2146106875780638da5cb5b1461069e57600080fd5b80633197cbb611610234578063451450ec116101ed5780636386c1c7116101c75780636386c1c7146105815780636a6c8d8b146105a157806370a08231146105ce578063715018a61461060457600080fd5b8063451450ec146105395780634f1ef2861461055957806352d1902d1461056c57600080fd5b80633197cbb6146104825780633659cfe61461049957806337870f6d146104b957806339509351146104d95780633c011b5f146104f957806343b0e8df1461051957600080fd5b80631526fe27116102865780631526fe271461039757806318160ddd146103d25780631959a002146103e757806323b872dd146104245780632e1a7d4d14610444578063313ce5671461046657600080fd5b8063055ad42e146102ce57806306fdde03146102f8578063081e3eda1461031a578063095ea7b3146103305780630e15561a146103605780630fabb5a414610377575b600080fd5b3480156102da57600080fd5b506102e56101305481565b6040519081526020015b60405180910390f35b34801561030457600080fd5b5061030d610950565b6040516102ef91906139ef565b34801561032657600080fd5b50610138546102e5565b34801561033c57600080fd5b5061035061034b366004613a37565b6109e2565b60405190151581526020016102ef565b34801561036c57600080fd5b506102e56101365481565b34801561038357600080fd5b506102e5610392366004613a63565b6109fc565b3480156103a357600080fd5b506103b76103b2366004613a80565b610b62565b604080519384526020840192909252908201526060016102ef565b3480156103de57600080fd5b5060cb546102e5565b3480156103f357600080fd5b506103b7610402366004613a63565b61013a6020526000908152604090208054600182015460029092015490919083565b34801561043057600080fd5b5061035061043f366004613a99565b610b96565b34801561045057600080fd5b5061046461045f366004613a80565b610bbc565b005b34801561047257600080fd5b50604051601281526020016102ef565b34801561048e57600080fd5b506102e56101325481565b3480156104a557600080fd5b506104646104b4366004613a63565b610e0e565b3480156104c557600080fd5b506104646104d4366004613b26565b610eea565b3480156104e557600080fd5b506103506104f4366004613a37565b611238565b34801561050557600080fd5b50610464610514366004613bbc565b61125a565b34801561052557600080fd5b50610464610534366004613c28565b61130f565b34801561054557600080fd5b50610464610554366004613c54565b611463565b610464610567366004613c8c565b611775565b34801561057857600080fd5b506102e5611841565b34801561058d57600080fd5b506103b761059c366004613a63565b6118f4565b3480156105ad57600080fd5b506105c16105bc366004613d50565b6119fc565b6040516102ef9190613d85565b3480156105da57600080fd5b506102e56105e9366004613a63565b6001600160a01b0316600090815260c9602052604090205490565b34801561061057600080fd5b50610464611ba6565b34801561062557600080fd5b506102e561012f5481565b34801561063c57600080fd5b5061046461064b366004613dff565b611bba565b34801561065c57600080fd5b5061046461066b366004613c54565b611bfb565b34801561067c57600080fd5b506102e56101315481565b34801561069357600080fd5b506102e561012d5481565b3480156106aa57600080fd5b506097546001600160a01b03165b6040516001600160a01b0390911681526020016102ef565b3480156106dc57600080fd5b506102e56101355481565b3480156106f357600080fd5b50610464610702366004613e41565b611d93565b34801561071357600080fd5b506102e56101335481565b34801561072a57600080fd5b5061030d612017565b34801561073f57600080fd5b506102e561012e5481565b34801561075657600080fd5b50610350610765366004613a37565b612026565b34801561077657600080fd5b50610350610785366004613a37565b6120ac565b34801561079657600080fd5b506102e5670de0b6b3a764000081565b3480156107b257600080fd5b506105c16107c1366004613e7a565b6120ba565b3480156107d257600080fd5b506107fb6107e1366004613a80565b610139602052600090815260409020805460019091015482565b604080519283526020830191909152016102ef565b34801561081c57600080fd5b5061046461082b366004613ecf565b61225b565b34801561083c57600080fd5b506102e561084b366004613f49565b6125cd565b34801561085c57600080fd5b5061046461086b366004613c54565b6125f8565b34801561087c57600080fd5b506102e56101345481565b34801561089357600080fd5b50610137546106b8906001600160a01b031681565b3480156108b457600080fd5b506104646108c3366004613a63565b612603565b3480156108d457600080fd5b506102e56108e3366004613a63565b6001600160a01b0316600090815261013a602052604090206003015490565b34801561090e57600080fd5b506102e561091d366004613c54565b61013b60209081526000928352604080842090915290825290205481565b34801561094757600080fd5b50610464612679565b606060cc805461095f90613f82565b80601f016020809104026020016040519081016040528092919081815260200182805461098b90613f82565b80156109d85780601f106109ad576101008083540402835291602001916109d8565b820191906000526020600020905b8154815290600101906020018083116109bb57829003601f168201915b5050505050905090565b6000336109f08185856127d2565b60019150505b92915050565b6000610a0760cb5490565b600003610a1657506000919050565b6001600160a01b038216600090815261013a60209081526040808320815160808101835281548152600182015481850152600282015481840152600382018054845181870281018701909552808552919492936060860193909290879084015b82821015610ae35760008481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a08301529083529092019101610a76565b505050508152505090506000610af76128f6565b90508160200151670de0b6b3a7640000610b1060cb5490565b610b2284670de0b6b3a7640000613fd2565b610b2c9190613fe9565b61013554610b3a919061400b565b8451610b469190613fd2565b610b509190613fe9565b610b5a919061401e565b949350505050565b6101388181548110610b7357600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600033610ba48582856129c3565b610baf858585612a3d565b60019150505b9392505050565b610bc4612bf3565b33600090815261013a6020526040812060038101805491929184908110610bed57610bed614031565b906000526020600020906006020190506000610138826001015481548110610c1757610c17614031565b906000526020600020906003020190508160040154421015610c935760405162461bcd60e51b815260206004820152602a60248201527f436f726769426f6f73743a205374616b65206e6f7420526561647920666f722060448201526915da5d1a191c985dd85b60b21b60648201526084015b60405180910390fd5b600582015460ff16610ce75760405162461bcd60e51b815260206004820152601c60248201527f436f726769426f6f73743a205374616b65206e6f7420416374697665000000006044820152606401610c8a565b610cef612c4c565b825415610cff57610cff33612cbd565b815461013754610d1c916001600160a01b03909116903390612d99565b8160020154836000016000828254610d34919061401e565b92505081905550610d49338360020154612dfc565b8154600282018054600090610d5f90849061401e565b9091555050815461012d8054600090610d7990849061401e565b909155505060058201805460ff19169055610135548354670de0b6b3a764000091610da391613fd2565b610dad9190613fe9565b60018481019190915582015482546002840154604080519283526020830191909152869133917fe08737ac48a1dab4b1a46c7dc9398bd5bfc6d7ad6fabb7cd8caa254de14def35910160405180910390a4505050610e0b600160fb55565b50565b6001600160a01b037f000000000000000000000000c8702948140573d839929bfaf6b70549ab9d8c62163003610e565760405162461bcd60e51b8152600401610c8a90614047565b7f000000000000000000000000c8702948140573d839929bfaf6b70549ab9d8c626001600160a01b0316610e9f600080516020614302833981519152546001600160a01b031690565b6001600160a01b031614610ec55760405162461bcd60e51b8152600401610c8a90614093565b610ece81612f3c565b60408051600080825260208201909252610e0b91839190612f44565b600054610100900460ff1615808015610f0a5750600054600160ff909116105b80610f245750303b158015610f24575060005460ff166001145b610f875760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c8a565b6000805460ff191660011790558015610faa576000805461ff0019166101001790555b6001600160a01b0388166110185760405162461bcd60e51b815260206004820152602f60248201527f436f726769426f6f73743a20636f7267694169546f6b656e206d757374206e6f60448201526e74206265206164647265737328302960881b6064820152608401610c8a565b61012f8490558184146110825760405162461bcd60e51b815260206004820152602c60248201527f436f726769426f6f73743a206c656e67746873206d757374206d61746368206e60448201526b756d626572506572696f647360a01b6064820152608401610c8a565b61013780546001600160a01b0319166001600160a01b038a1617905560005b61012f548110156111235760405180604001604052808787848181106110c9576110c9614031565b9050602002013581526020018585848181106110e7576110e7614031565b602090810292909201359092526000848152610139825260409020835181559201516001909201919091555061111c816140df565b90506110a1565b50610136869055848460008161113b5761113b614031565b60200291909101356101345550610131879055828260008161115f5761115f614031565b9050602002013587611171919061400b565b610132556101338790556111836130af565b61118b6130de565b6111e86040518060400160405280601b81526020017f434f524749414920426f6f73742042656172696e6720546f6b656e00000000008152506040518060400160405280600681526020016510d093d3d4d560d21b815250613105565b801561122e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b6000336109f081858561124b83836125cd565b611255919061400b565b6127d2565b8281146112b35760405162461bcd60e51b815260206004820152602160248201527f436f726769426f6f73743a204172726179206c656e677468206d69736d6174636044820152600d60fb1b6064820152608401610c8a565b60005b83811015611308576112f88585838181106112d3576112d3614031565b905060200201358484848181106112ec576112ec614031565b90506020020135611463565b611301816140df565b90506112b6565b5050505050565b611317613136565b600082815261013b602090815260408083208484529091529020541561137f5760405162461bcd60e51b815260206004820152601a60248201527f436f726769426f6f73743a204475706c696361746520506f6f6c0000000000006044820152606401610c8a565b6000821161139f5760405162461bcd60e51b8152600401610c8a906140f8565b6113a7612c4c565b600061013884815481106113bd576113bd614031565b6000918252602080832060039092029091018054835261013b8252604080842060018084018054875291909452908420939093558581559184905590915061140690859061400b565b600084815261013b6020908152604080832086845282529182902092909255805185815291820184905285917f17cb2943c2b75826e10c84d8d48b9953b663936eb40867b23dfe8f4930b98686910160405180910390a250505050565b61146b612bf3565b33600090815261013a602052604081206003810180549192918590811061149457611494614031565b9060005260206000209060060201905060006101388260010154815481106114be576114be614031565b90600052602060002090600302019050600061013885815481106114e4576114e4614031565b600091825260209091206005850154600390920201915060ff1661154a5760405162461bcd60e51b815260206004820152601c60248201527f436f726769426f6f73743a205374616b65206e6f7420416374697665000000006044820152606401610c8a565b826004015481600101548460030154611563919061400b565b10156115bd5760405162461bcd60e51b8152602060048201526024808201527f436f726769426f6f73743a204e6577205374616b65206d757374206265206c6f6044820152633733b2b960e11b6064820152608401610c8a565b825460028401546115ce9190613fe9565b81541161161d5760405162461bcd60e51b815260206004820152601960248201527f436f726769426f6f73743a2057687920646f776e6772616465000000000000006044820152606401610c8a565b611625612c4c565b8354156116355761163533612cbd565b6001808401869055810154600384015461164f919061400b565b60048401556002830154835482546000929161166a91613fd2565b611674919061401e565b90508085600001600082825461168a919061400b565b92505081905550808460020160008282546116a5919061400b565b909155506116b590503382613190565b83546002840180546000906116cb90849061401e565b909155505083546002830180546000906116e690849061400b565b9091555050610135548554670de0b6b3a76400009161170491613fd2565b61170e9190613fe9565b60018601556002840154600485015460405188928a9233927fa0ad55fd11cc19ae2402e185f0103dc5a70da0930212e8db8d1b5020fa15728c9261175a92908252602082015260400190565b60405180910390a45050505050611771600160fb55565b5050565b6001600160a01b037f000000000000000000000000c8702948140573d839929bfaf6b70549ab9d8c621630036117bd5760405162461bcd60e51b8152600401610c8a90614047565b7f000000000000000000000000c8702948140573d839929bfaf6b70549ab9d8c626001600160a01b0316611806600080516020614302833981519152546001600160a01b031690565b6001600160a01b03161461182c5760405162461bcd60e51b8152600401610c8a90614093565b61183582612f3c565b61177182826001612f44565b6000306001600160a01b037f000000000000000000000000c8702948140573d839929bfaf6b70549ab9d8c6216146118e15760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610c8a565b5060008051602061430283398151915290565b60008060008061013a6000866001600160a01b03166001600160a01b0316815260200190815260200160002060405180608001604052908160008201548152602001600182015481526020016002820154815260200160038201805480602002602001604051908101604052809291908181526020016000905b828210156119db5760008481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a0830152908352909201910161196e565b50505091525050805160208201516040909201519097919650945092505050565b6001600160a01b038316600090815261013a602090815260408083208151608081018352815481526001820154818501526002820154818401526003820180548451818702810187019095528085526060969592948588019390929190879084015b82821015611acb5760008481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a08301529083529092019101611a5e565b50505091525090915060009050611ae2858561401e565b611aed90600161400b565b905060008167ffffffffffffffff811115611b0a57611b0a613c76565b604051908082528060200260200182016040528015611b4357816020015b611b30613993565b815260200190600190039081611b285790505b509050855b858111611b9b5783606001518181518110611b6557611b65614031565b6020026020010151828281518110611b7f57611b7f614031565b602002602001018190525080611b94906140df565b9050611b48565b509695505050505050565b611bae613136565b611bb8600061325d565b565b60005b81811015611bf657611be6838383818110611bda57611bda614031565b90506020020135610bbc565b611bef816140df565b9050611bbd565b505050565b611c03613136565b600082815261013b6020908152604080832084845290915290205415611c6b5760405162461bcd60e51b815260206004820152601a60248201527f436f726769426f6f73743a204475706c696361746520506f6f6c0000000000006044820152606401610c8a565b60008211611c8b5760405162461bcd60e51b8152600401610c8a906140f8565b604080516060810182528381526020808201848152600083850181815261013880546001808201835582855296517ff79a63dcec80ed75c82f36161f17b9c2f407860160383a7be0a0ee7962c527ae60039092029182015593517ff79a63dcec80ed75c82f36161f17b9c2f407860160383a7be0a0ee7962c527af85015590517ff79a63dcec80ed75c82f36161f17b9c2f407860160383a7be0a0ee7962c527b090930192909255905486825261013b835284822086835290925292909220829055611d569161401e565b60408051848152602081018490527f4d93067d0d628fe42c457623322c0f22ad92f71762a2eebe06e2a0e7d2aa61c7910160405180910390a25050565b611d9b612bf3565b60006101388481548110611db157611db1614031565b906000526020600020906003020190506000816000015411611e155760405162461bcd60e51b815260206004820152601b60248201527f436f726769426f6f73743a20496e76616c696420506f6f6c20494400000000006044820152606401610c8a565b611e1d612c4c565b611e25613993565b6001600160a01b038316600090815261013a60205260409020805415611e4e57611e4e84612cbd565b8415611f70578254600090611e64908790613fd2565b868452602084018890526040840181905242606085018190526001860154919250611e8f919061400b565b6080840152600160a0840152600284018054879190600090611eb290849061400b565b925050819055508561012d6000828254611ecc919061400b565b909155505061013754611eea906001600160a01b03163330896132af565b611ef48582613190565b600382810180546001808201835560009283526020808420885160069094020192835587015190820155604086015160028201556060860151928101929092556080850151600483015560a08501516005909201805460ff191692151592909217909155825482918491611f6990849061400b565b9091555050505b610135548154670de0b6b3a764000091611f8991613fd2565b611f939190613fe9565b6001808301919091556003820154611fab919061401e565b86856001600160a01b03167ff943cf10ef4d1e3239f4716ddecdf546e8ba8ab0e41deafd9a71a99936827e458886604001518760800151604051612002939291909283526020830191909152604082015260600190565b60405180910390a4505050611bf6600160fb55565b606060cd805461095f90613f82565b6000338161203482866125cd565b9050838110156120945760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610c8a565b6120a182868684036127d2565b506001949350505050565b6000336109f0818585612a3d565b6001600160a01b038316600090815261013a602090815260408083208151608081018352815481526001820154818501526002820154818401526003820180548451818702810187019095528085526060969592948588019390929190879084015b828210156121895760008481526020908190206040805160c08101825260068602909201805483526001808201548486015260028201549284019290925260038101546060840152600481015460808401526005015460ff16151560a0830152908352909201910161211c565b50505091525090915083905060008167ffffffffffffffff8111156121b0576121b0613c76565b6040519080825280602002602001820160405280156121e957816020015b6121d6613993565b8152602001906001900390816121ce5790505b50905060005b82811015611b9b57836060015187878381811061220e5761220e614031565b905060200201358151811061222557612225614031565b602002602001015182828151811061223f5761223f614031565b602002602001018190525080612254906140df565b90506121ef565b612263613136565b61226b612bf3565b612273612c4c565b6101325442106122b95760405162461bcd60e51b815260206004820152601160248201527034b73b30b634b21037b832b930ba34b7b760791b6044820152606401610c8a565b828181146123095760405162461bcd60e51b815260206004820152601f60248201527f75706461746552657761726465723a206c656e677468206d69736d61746368006044820152606401610c8a565b6101305461231890600161400b565b811161235f5760405162461bcd60e51b81526020600482015260166024820152751d5c19185d1954995dd85c99195c88195e1c1a5c995960521b6044820152606401610c8a565b6000610130546001612371919061400b565b905061013054600014801561238857506101315442105b1561239557506000612488565b610130545b6000818152610139602090815260409182902082518084019093528054835260010154908201528787838181106123d3576123d3614031565b90506020020135816000015114801561240757508585838181106123f9576123f9614031565b905060200201358160200151145b6124675760405162461bcd60e51b815260206004820152602b60248201527f696e76616c696420726577617264735065725365636f6e64206f72207065726960448201526a6f64496e5365636f6e647360a81b6064820152608401610c8a565b816000036124755750612486565b5061247f8161413a565b905061239a565b505b805b828110156125095760405180604001604052808888848181106124af576124af614031565b9050602002013581526020018686848181106124cd576124cd614031565b6020908102929092013590925260008481526101398252604090208351815592015160019092019190915550612502816140df565b905061248a565b508161012f54111561254a57815b61012f548110156125485760008181526101396020526040812081815560010155612541816140df565b9050612517565b505b61012f82905561013654871115612589576125843330610136548a61256f919061401e565b610137546001600160a01b03169291906132af565b6125bb565b610136548710156125bb576125bb3388610136546125a7919061401e565b610137546001600160a01b03169190612d99565b5050610136859055611308600160fb55565b6001600160a01b03918216600090815260ca6020908152604080832093909416825291909152205490565b611771828233611d93565b61260b613136565b6001600160a01b0381166126705760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c8a565b610e0b8161325d565b612681613136565b600061012e5461013654612695919061401e565b61012d546126a3919061400b565b610137546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156126f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127169190614151565b9050818110156127685760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e74207265776172642062616c616e636500000000006044820152606401610c8a565b6000828211156127975761277c838361401e565b61013754909150612797906001600160a01b03163383612d99565b60405181815233907f1b1a78ab6b774fe3205ef7b6230247d37cd25ac16c5db42d8bc5d259695c1da2906020015b60405180910390a2505050565b6001600160a01b0383166128345760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c8a565b6001600160a01b0382166128955760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c8a565b6001600160a01b03838116600081815260ca602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006101335442116129085750600090565b610132546101305461013454610133546000906129269042866132e7565b905060006129348383613fd2565b90505b84421180156129545750600161012f54612951919061401e565b84105b156129ba5783612963816140df565b6000818152610139602052604090208054600190910154919650945086915061298c908261400b565b9550600061299b8242896132e7565b90506129a78582613fd2565b6129b1908461400b565b92505050612937565b95945050505050565b60006129cf84846125cd565b90506000198114612a375781811015612a2a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610c8a565b612a3784848484036127d2565b50505050565b6001600160a01b038316612aa15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c8a565b6001600160a01b038216612b035760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c8a565b612b0e83838361331a565b6001600160a01b038316600090815260c9602052604090205481811015612b865760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610c8a565b6001600160a01b03808516600081815260c9602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612be69086815260200190565b60405180910390a3612a37565b600260fb5403612c455760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c8a565b600260fb55565b6101335442111580612c5e575060cb54155b15612c6557565b6000612c6f61338e565b9050610132546101335411612c845742610133555b60cb54612c9982670de0b6b3a7640000613fd2565b612ca39190613fe9565b6101356000828254612cb5919061400b565b909155505050565b6001600160a01b038116600090815261013a602052604081206001810154610135548254929392670de0b6b3a764000091612cf791613fd2565b612d019190613fe9565b612d0b919061401e565b90508015612d5e578061012e6000828254612d26919061400b565b9250508190555080826002016000828254612d41919061400b565b909155505061013754612d5e906001600160a01b03168483612d99565b826001600160a01b03167fba8de60c3403ec381d1d484652ea1980e3c3e56359195c92525bff4ce47ad98e826040516127c591815260200190565b6040516001600160a01b038316602482015260448101829052611bf690849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261345d565b6001600160a01b038216612e5c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610c8a565b612e688260008361331a565b6001600160a01b038216600090815260c9602052604090205481811015612edc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610c8a565b6001600160a01b038316600081815260c960209081526040808320868603905560cb80548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b610e0b613136565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612f7757611bf68361352f565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612fd1575060408051601f3d908101601f19168201909252612fce91810190614151565b60015b6130345760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610c8a565b60008051602061430283398151915281146130a35760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610c8a565b50611bf68383836135cb565b600054610100900460ff166130d65760405162461bcd60e51b8152600401610c8a9061416a565b611bb86135f0565b600054610100900460ff16611bb85760405162461bcd60e51b8152600401610c8a9061416a565b600054610100900460ff1661312c5760405162461bcd60e51b8152600401610c8a9061416a565b6117718282613620565b6097546001600160a01b03163314611bb85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c8a565b6001600160a01b0382166131e65760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610c8a565b6131f26000838361331a565b8060cb6000828254613204919061400b565b90915550506001600160a01b038216600081815260c960209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052612a379085906323b872dd60e01b90608401612dc5565b6000818311613301576132fa848461401e565b9050610bb5565b81841061331057506000610bb5565b6132fa848361401e565b6001600160a01b038316158061333757506001600160a01b038216155b611bf65760405162461bcd60e51b815260206004820152602260248201527f436f726769426f6f73743a205472616e73666572206e6f74207065726d697474604482015261195960f21b6064820152608401610c8a565b60006101335442116133a05750600090565b60006133b36101335442610132546132e7565b9050600061013454826133c69190613fd2565b90505b61013254421180156133ec5750600161012f546133e6919061401e565b61013054105b156109f6576133f9613660565b61013280546101305460009081526101396020526040812060010154919290613422838561400b565b9250508190555060006134398242610132546132e7565b9050610134548161344a9190613fd2565b613454908461400b565b925050506133c9565b60006134b2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136c69092919063ffffffff16565b805190915015611bf657808060200190518101906134d091906141b5565b611bf65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c8a565b6001600160a01b0381163b61359c5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610c8a565b60008051602061430283398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6135d4836136d5565b6000825111806135e15750805b15611bf657612a378383613715565b600054610100900460ff166136175760405162461bcd60e51b8152600401610c8a9061416a565b611bb83361325d565b600054610100900460ff166136475760405162461bcd60e51b8152600401610c8a9061416a565b60cc6136538382614225565b5060cd611bf68282614225565b6101308054906000613671836140df565b909155505061013054600081815261013960209081526040918290205461013481905591519182527fd3e074f816f4b09b1a1aefc557d5cdd102cc9402b4d5cb73dd8cb3fc880863a3910160405180910390a2565b6060610b5a8484600085613800565b6136de8161352f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61377d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610c8a565b600080846001600160a01b03168460405161379891906142e5565b600060405180830381855af49150503d80600081146137d3576040519150601f19603f3d011682016040523d82523d6000602084013e6137d8565b606091505b50915091506129ba8282604051806060016040528060278152602001614322602791396138db565b6060824710156138615760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c8a565b600080866001600160a01b0316858760405161387d91906142e5565b60006040518083038185875af1925050503d80600081146138ba576040519150601f19603f3d011682016040523d82523d6000602084013e6138bf565b606091505b50915091506138d0878383876138f4565b979650505050505050565b606083156138ea575081610bb5565b610bb58383613969565b6060831561396357825160000361395c576001600160a01b0385163b61395c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c8a565b5081610b5a565b610b5a83835b8151156139795781518083602001fd5b8060405162461bcd60e51b8152600401610c8a91906139ef565b6040518060c0016040528060008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b60005b838110156139e65781810151838201526020016139ce565b50506000910152565b6020815260008251806020840152613a0e8160408501602087016139cb565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610e0b57600080fd5b60008060408385031215613a4a57600080fd5b8235613a5581613a22565b946020939093013593505050565b600060208284031215613a7557600080fd5b8135610bb581613a22565b600060208284031215613a9257600080fd5b5035919050565b600080600060608486031215613aae57600080fd5b8335613ab981613a22565b92506020840135613ac981613a22565b929592945050506040919091013590565b60008083601f840112613aec57600080fd5b50813567ffffffffffffffff811115613b0457600080fd5b6020830191508360208260051b8501011115613b1f57600080fd5b9250929050565b600080600080600080600060a0888a031215613b4157600080fd5b8735613b4c81613a22565b96506020880135955060408801359450606088013567ffffffffffffffff80821115613b7757600080fd5b613b838b838c01613ada565b909650945060808a0135915080821115613b9c57600080fd5b50613ba98a828b01613ada565b989b979a50959850939692959293505050565b60008060008060408587031215613bd257600080fd5b843567ffffffffffffffff80821115613bea57600080fd5b613bf688838901613ada565b90965094506020870135915080821115613c0f57600080fd5b50613c1c87828801613ada565b95989497509550505050565b600080600060608486031215613c3d57600080fd5b505081359360208301359350604090920135919050565b60008060408385031215613c6757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215613c9f57600080fd5b8235613caa81613a22565b9150602083013567ffffffffffffffff80821115613cc757600080fd5b818501915085601f830112613cdb57600080fd5b813581811115613ced57613ced613c76565b604051601f8201601f19908116603f01168101908382118183101715613d1557613d15613c76565b81604052828152886020848701011115613d2e57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600080600060608486031215613d6557600080fd5b8335613d7081613a22565b95602085013595506040909401359392505050565b602080825282518282018190526000919060409081850190868401855b82811015613df25781518051855286810151878601528581015186860152606080820151908601526080808201519086015260a09081015115159085015260c09093019290850190600101613da2565b5091979650505050505050565b60008060208385031215613e1257600080fd5b823567ffffffffffffffff811115613e2957600080fd5b613e3585828601613ada565b90969095509350505050565b600080600060608486031215613e5657600080fd5b83359250602084013591506040840135613e6f81613a22565b809150509250925092565b600080600060408486031215613e8f57600080fd5b8335613e9a81613a22565b9250602084013567ffffffffffffffff811115613eb657600080fd5b613ec286828701613ada565b9497909650939450505050565b600080600080600060608688031215613ee757600080fd5b85359450602086013567ffffffffffffffff80821115613f0657600080fd5b613f1289838a01613ada565b90965094506040880135915080821115613f2b57600080fd5b50613f3888828901613ada565b969995985093965092949392505050565b60008060408385031215613f5c57600080fd5b8235613f6781613a22565b91506020830135613f7781613a22565b809150509250929050565b600181811c90821680613f9657607f821691505b602082108103613fb657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109f6576109f6613fbc565b60008261400657634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156109f6576109f6613fbc565b818103818111156109f6576109f6613fbc565b634e487b7160e01b600052603260045260246000fd5b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000600182016140f1576140f1613fbc565b5060010190565b60208082526022908201527f436f726769426f6f73743a204d756c7469706c696572206d757374206265203e604082015261020360f41b606082015260800190565b60008161414957614149613fbc565b506000190190565b60006020828403121561416357600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156141c757600080fd5b81518015158114610bb557600080fd5b601f821115611bf657600081815260208120601f850160051c810160208610156141fe5750805b601f850160051c820191505b8181101561421d5782815560010161420a565b505050505050565b815167ffffffffffffffff81111561423f5761423f613c76565b6142538161424d8454613f82565b846141d7565b602080601f83116001811461428857600084156142705750858301515b600019600386901b1c1916600185901b17855561421d565b600085815260208120601f198616915b828110156142b757888601518255948401946001909101908401614298565b50858210156142d55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082516142f78184602087016139cb565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122059c6558efc63db82192ab788ea439ee79207da2de4d96300f202eeb98eaa39b064736f6c63430008120033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.