Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PirateStake
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.25; import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import {ReentrancyGuardTransient} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol"; interface IClaim { function claim( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external; } /** * @title ITokenShop * @dev Interface for the Purchase contract. * This contract is used to purchase items from the Shop using staked tokens. */ interface ITokenShop { function purchaseFromStake( address purchaser, uint256[] calldata skuEntities, uint256[] calldata quantities ) external returns (uint256 purchaseId, uint256 total); } /// @notice Error emitted when a user tries to withdraw more tokens than they have staked error InsufficientBalance(); /// @notice Error emitted when a user tries to deposit 0 tokens or withdraw 0 tokens error IncorrectAmount(); /// @notice Error emitted when an owner is trying to set an invalid multiplier error InvalidMultiplier(); /// @notice Error emitted when the purchase contract is not set error InvalidPurchaseContract(); /// @notice Error emitted when the purchase contract returns an invalid purchase error InvalidPurchase(); /// @notice When trying to claim or set an invalid season. error InvalidSeason(); /// @notice Invalid maximum growth multiplier error InvalidMaxGrowthMultiplier(); /// @notice Invalid Week Multiplier Increment error InvalidWeeklyMultiplierIncrement(); /** * @title A contract for staking ERC20 tokens * @notice This contract allows users to stake ERC20 tokens and earn points based on the amount of tokens staked and the time they have been staked */ contract PirateStake is Initializable, ContextUpgradeable, Ownable2StepUpgradeable, PausableUpgradeable, ReentrancyGuardTransient { using SafeERC20 for IERC20; /** * @notice UserStakeInfo struct to store user's staking information * @param erc20balance The amount of ERC20 tokens staked by the user * @param erc20initial The initial amount of ERC20 tokens staked by the user * @param accumulatedPoints The total points earned by the user over time * @param lastUpdatedTime The timestamp of the last update * @param multiplier The multiplier applied to the user's points */ struct UserStakeInfo { uint256 erc20balance; uint256 erc20initial; uint256 accumulatedPoints; uint64 lastUpdatedTime; uint16 multiplier; } /// @notice Season 1 Added variables /// @notice the user's staking information. Deprecated (Used only for S1) mapping(address => UserStakeInfo) public users; /// @notice The ERC20 token that can be staked IERC20 public token; /// @notice The claim contract that allows users to claim tokens. Deprecated (used only for S1) IClaim public claim; /// @notice The packed value of the start date and the maximum multiplier. Deprecated (used only for S1) uint256 public packedStartDateAndMaxMultiplier; /// @notice The bonus multiplier to apply to the user's points. Deprecated (used only for S1) uint256 public bonusMultiplier; /// @notice The address of the approved purchase contract ITokenShop public shopContract; /// @notice Season 2 Added variables /// @notice The current season set by admin uint256 public currentSeason; /// @notice The season info for each season struct Season { // The start date of the season uint256 startDate; // The end date of a season uint256 endDate; // The multiplier given at the start of a season (decays 10% per day down to 100%) uint256 startingMultiplier; // Season Absolute Max, the maximum multiplier they can get through any means uint256 seasonAbsoluteMax; // The maximum multiplier a user can reach by holding uint256 maximumGrowthMultiplier; // The multiplier bonus given to a user when claiming uint256 claimMultiplier; // The % increase in multiplier each week for holding uint256 weeklyMultiplierIncrement; // The contract address for claiming. IClaim claimContract; } /// @notice The end date of the season - points will no longer accrue after this date. mapping(uint256 seasonId => Season seasonInfo) public seasonInfo; /// @notice Mapping of season IDs to users to their stake information mapping(uint256 seasonId => mapping(address userWallet => UserStakeInfo stakeInfo)) public seasonIdToUserToStakeInfo; /// @notice Event emitted when a user deposits tokens event Deposit(address indexed user, uint256 amount, uint256 multiplier); /// @notice Event emitted when a user withdraws tokens event Withdraw(address indexed user, uint256 amount, uint256 multiplier); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /** * @notice Initialize the contract with the ERC20 token and the claim contract * @param _token The address of the ERC20 token * @param _claim The address of the claim contract */ function initialize(address _token, address _claim) public initializer { __Ownable_init(_msgSender()); __Ownable2Step_init(); __Pausable_init(); __Context_init(); token = IERC20(_token); claim = IClaim(_claim); packedStartDateAndMaxMultiplier = (block.timestamp << 192) | 500; // two decimals in max multiplier bonusMultiplier = 50; currentSeason = 1; _pause(); } /** * @dev Pause the contract */ function pause() external onlyOwner { _pause(); } /** * @dev Unpause the contract */ function unpause() external onlyOwner { _unpause(); } /** * @notice Set the start date and maximum multiplier * @param _startDate The start date of the staking program * @param _maxMultiplier The maximum multiplier that can be applied to the points */ function setStartDateAndMaxMultiplier( uint64 _startDate, uint192 _maxMultiplier ) external onlyOwner { //todo: revert deprecated; // no reason to have a multiplier more than 100x if (_maxMultiplier > 10_000) { revert InvalidMultiplier(); } packedStartDateAndMaxMultiplier = (uint256(_startDate) << 192) | _maxMultiplier; } /** * @notice Set the Shop Contract * @param _shopContract The address of the Shop Contract */ function setShopContract(address _shopContract) external onlyOwner { if (address(shopContract) != address(0)) { // Revoke the approval of the old contract token.approve(address(shopContract), 0); } shopContract = ITokenShop(_shopContract); //ensure we don't need to approve every tx token.approve(address(shopContract), type(uint256).max); } /** * @notice setBonusMultiplier * @param _bonusMultiplier The bonus multiplier to apply to the user's points (Cannot be more than 1000) */ function setBonusMultiplier(uint256 _bonusMultiplier) external onlyOwner { if (_bonusMultiplier > 1000) { revert InvalidMultiplier(); } bonusMultiplier = _bonusMultiplier; } /** * @notice Set the current season * @param season The season ID */ function setCurrentSeason(uint256 season) external onlyOwner { if (season == 0) { revert InvalidSeason(); } currentSeason = season; } /** * @notice Set the season information * @param season The season ID * @param startDate The start date of the season * @param endDate The end date of the season * @param startingMultiplier The starting multiplier for the season * @param maximumGrowthMultiplier The maximum multiplier for the season one can earn by waiting * @param claimMultiplier The bonus multiplier for claiming * @param weeklyMultiplierIncrement The amount the multiplier increases by each week up until the maximum limit * @param claimContract The address of the claim contract */ function setSeasonInfo( uint256 season, uint256 startDate, uint256 endDate, uint256 startingMultiplier, uint256 seasonAbsoluteMax, uint256 maximumGrowthMultiplier, uint256 claimMultiplier, uint256 weeklyMultiplierIncrement, address claimContract ) external onlyOwner { if (endDate < startDate && startDate != 0 && endDate != 0) { revert InvalidSeason(); } if (seasonAbsoluteMax < maximumGrowthMultiplier) { revert InvalidSeason(); } if (weeklyMultiplierIncrement > maximumGrowthMultiplier) { revert InvalidSeason(); } seasonInfo[season] = Season({ startDate: startDate, endDate: endDate, startingMultiplier: startingMultiplier, seasonAbsoluteMax: seasonAbsoluteMax, maximumGrowthMultiplier: maximumGrowthMultiplier, claimMultiplier: claimMultiplier, weeklyMultiplierIncrement: weeklyMultiplierIncrement, claimContract: IClaim(claimContract) }); } /** * @notice Update the maximum growth multiplier for a season * @param season The season ID * @param newMax The new maximum growth multiplier */ function updateMaxGrowthMultiplier( uint256 season, uint256 newMax ) external onlyOwner { if (newMax == 0) { revert InvalidMaxGrowthMultiplier(); } seasonInfo[season].maximumGrowthMultiplier = newMax; } /** * @notice Fix the user point calculation for a season * @param seasons The season IDs * @param usersSet The addresses of the user * @param newPoints The new points to set for the users */ function fixUserPointCalculation( uint256[] calldata seasons, address[] calldata usersSet, uint256[] calldata newPoints ) external onlyOwner { if ( seasons.length != usersSet.length || seasons.length != newPoints.length ) { revert InvalidSeason(); } for (uint256 i = 0; i < seasons.length; i++) { seasonIdToUserToStakeInfo[seasons[i]][usersSet[i]] .accumulatedPoints = newPoints[i]; } } /** * @notice Update the Weekly Multiplier Increment for a season * @param season The season ID * @param newIncrement The new weekly multiplier increment */ function updateWeeklyMultiplierIncrement( uint256 season, uint256 newIncrement ) external onlyOwner { if (newIncrement == 0) { revert InvalidWeeklyMultiplierIncrement(); } seasonInfo[season].weeklyMultiplierIncrement = newIncrement; } /** * @notice Claim from Claim Contract and deposit for an increased multiplier * @param season The season ID * @param index The index of the claim * @param amount The amount of tokens to deposit * @param permitAmount The amount of tokens to deposit * @param merkleProof The Merkle proof for the claim * @param deadline The timestamp until which the permit is valid * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function claimAndDepositSeasonPermit( uint256 season, uint256 index, uint256 amount, uint256 permitAmount, bytes32[] calldata merkleProof, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external nonReentrant whenNotPaused { IERC20Permit(address(token)).permit( _msgSender(), address(this), permitAmount, deadline, v, r, s ); _claimAndDeposit(season, index, amount, merkleProof); } /** * @notice Claim from Claim Contract and deposit for an increased multiplier * @param season The season ID * @param index The index of the claim * @param amount The amount of tokens to deposit * @param merkleProof The Merkle proof for the claim */ function claimAndDeposit( uint256 season, uint256 index, uint256 amount, bytes32[] calldata merkleProof ) external nonReentrant whenNotPaused { _claimAndDeposit(season, index, amount, merkleProof); } /** * @notice Claim from Claim Contract and deposit for an increased multiplier * @param index The index of the claim * @param amount The amount of tokens to deposit * @param permitAmount The amount of tokens to deposit * @param merkleProof The Merkle proof for the claim * @param deadline The timestamp until which the permit is valid * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function claimAndDepositPermit( uint256 index, uint256 amount, uint256 permitAmount, bytes32[] calldata merkleProof, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external nonReentrant whenNotPaused { IERC20Permit(address(token)).permit( _msgSender(), address(this), permitAmount, deadline, v, r, s ); _claimAndDeposit(currentSeason, index, amount, merkleProof); } /** * @notice Claim from Claim Contract and deposit for an increased multiplier * @param index The index of the claim * @param amount The amount of tokens to deposit * @param merkleProof The Merkle proof for the claim */ function claimAndDeposit( uint256 index, uint256 amount, bytes32[] calldata merkleProof ) external nonReentrant whenNotPaused { _claimAndDeposit(currentSeason, index, amount, merkleProof); } /** * @notice Deposit ERC20 tokens into the contract * @param amount The amount of tokens to deposit * @param permitAmount The amount of tokens to deposit * @param deadline The timestamp until which the permit is valid * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function depositPermit( uint256 amount, uint256 permitAmount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external nonReentrant whenNotPaused { IERC20Permit(address(token)).permit( _msgSender(), address(this), permitAmount, deadline, v, r, s ); _deposit(amount, 0); } /** * @notice Deposit ERC20 tokens into the contract * @dev The user must approve the contract to spend the tokens before calling this function * @param amount The amount of tokens to deposit */ function deposit(uint256 amount) external nonReentrant whenNotPaused { _deposit(amount, 0); } /** * @notice Withdraw ERC20 tokens from the contract * @dev The user must have enough tokens staked to withdraw the specified amount * @param amount The amount of tokens to withdraw */ function withdraw(uint256 amount) external nonReentrant whenNotPaused { if (amount == 0) { revert IncorrectAmount(); } UserStakeInfo storage userStakeInfo = _seasonStakeInfo( currentSeason, _msgSender() ); userStakeInfo.accumulatedPoints = _accumulatedPoints(_msgSender()); if (userStakeInfo.erc20balance < amount) { if (userStakeInfo.erc20initial == 0 && currentSeason > 1) { UserStakeInfo memory lastSeasonStakeInfo = _lastSeasonStakeInfo( _msgSender() ); userStakeInfo.erc20balance = lastSeasonStakeInfo.erc20balance; userStakeInfo.erc20initial = lastSeasonStakeInfo.erc20initial; } if (userStakeInfo.erc20balance < amount) { revert InsufficientBalance(); } } userStakeInfo.erc20balance = userStakeInfo.erc20balance - amount; userStakeInfo.lastUpdatedTime = uint64(block.timestamp); userStakeInfo.multiplier = uint16(currentMultiplier()); token.safeTransfer(_msgSender(), amount); emit Withdraw(_msgSender(), amount, userStakeInfo.multiplier); } /** * @notice Purchase items from Shop using Staked tokens without losing multiplier * @param skuEntities listingId * @param quantities amount per listing id */ function purchase( uint256[] calldata skuEntities, uint256[] calldata quantities ) external nonReentrant whenNotPaused { if (skuEntities.length != quantities.length) { revert InvalidPurchase(); } if (shopContract == ITokenShop(address(0))) { revert InvalidPurchaseContract(); } UserStakeInfo storage userStakeInfo = _seasonStakeInfo( currentSeason, _msgSender() ); userStakeInfo.accumulatedPoints = _accumulatedPoints(_msgSender()); // Season 1 staker-only, fallback to last season if (userStakeInfo.erc20initial == 0 && currentSeason > 1) { UserStakeInfo memory lastSeasonStakeInfo = _lastSeasonStakeInfo( _msgSender() ); // Port over their S1 ERC20 balance, ERC20 initial, and multiplier userStakeInfo.erc20balance = lastSeasonStakeInfo.erc20balance; userStakeInfo.erc20initial = lastSeasonStakeInfo.erc20initial; userStakeInfo.multiplier = lastSeasonStakeInfo.multiplier; } if (userStakeInfo.lastUpdatedTime != 0) { userStakeInfo.multiplier = uint16( _getMultiplier(currentSeason, userStakeInfo) ); } userStakeInfo.lastUpdatedTime = uint64(block.timestamp); (uint256 purchaseId, uint256 total) = shopContract.purchaseFromStake( _msgSender(), skuEntities, quantities ); if (userStakeInfo.erc20balance < total) { revert InsufficientBalance(); } if (purchaseId == 0) { revert InvalidPurchase(); } userStakeInfo.erc20balance = userStakeInfo.erc20balance - total; emit Withdraw(_msgSender(), total, userStakeInfo.multiplier); } /** * @notice Returns the current global multiplier value * @dev The multiplier decays linearly over time from the start date to 100 */ function currentMultiplier() public view returns (uint256 multiplier) { uint256 startDate; uint cachedCurrentSeason = currentSeason; if (cachedCurrentSeason <= 1) { uint256 packedValue = packedStartDateAndMaxMultiplier; startDate = packedValue >> 192; multiplier = packedValue & 0xFFFFFFFFFFFFFFFFFFFFFFFF; } else { startDate = seasonInfo[cachedCurrentSeason].startDate; multiplier = seasonInfo[cachedCurrentSeason].startingMultiplier; } uint256 daysPassed = (block.timestamp - startDate) / 1 days; // Number of days passed since the start date unchecked { uint256 decay = daysPassed * 10; // Calculate the total decay if (decay < multiplier) { multiplier -= decay; if (multiplier < 100) { multiplier = 100; } } else { multiplier = 100; } } return multiplier; } /** * Getters */ function getMultiplier(address user) external view returns (uint256) { return getMultiplier(currentSeason, user); } /** * @notice Returns the multiplier for a specific user * @param season The season ID * @param user The address of the user * @return The multiplier for the user */ function getMultiplier( uint256 season, address user ) public view returns (uint256) { return _getMultiplier(season, _seasonStakeInfo(season, user)); } /** * @notice Returns the ERC20 balance of a user * @param user The address of the user * @return The ERC20 balance of the user */ function getErc20Balance(address user) external view returns (uint256) { // TODO: Upgrade logic for S3, and iterate recursively if ( _seasonStakeInfo(currentSeason, user).erc20initial == 0 && currentSeason > 1 ) { return _lastSeasonStakeInfo(user).erc20balance; } return _seasonStakeInfo(currentSeason, user).erc20balance; } /** * @notice Returns the ERC20 balance of a user * @param season The season ID * @param user The address of the user * @return The ERC20 balance of the user */ function getErc20Balance( uint256 season, address user ) public view returns (uint256) { return _seasonStakeInfo(season, user).erc20balance; } /** * @notice Returns the total points earned by a user * @param user The address of the user * @return The total points earned by the user */ function getPointsBalance(address user) external view returns (uint256) { return getPointsBalance(currentSeason, user); } /** * @notice Returns the total points earned by a user * @param season The season ID * @param user The address of the user * @return The total points earned by the user */ function getPointsBalance( uint256 season, address user ) public view returns (uint256) { if (season <= 1) { return _totalPoints(season, users[user]); } if ( seasonIdToUserToStakeInfo[season][user].erc20initial > 0 || currentSeason != season ) { return _totalPoints(season, seasonIdToUserToStakeInfo[season][user]); } UserStakeInfo memory intermittentStakeInfo = UserStakeInfo({ erc20balance: _lastSeasonStakeInfo(user).erc20balance, erc20initial: 0, accumulatedPoints: 0, multiplier: _lastSeasonStakeInfo(user).multiplier, lastUpdatedTime: uint64(seasonInfo[currentSeason].startDate) }); return _totalPoints(season, intermittentStakeInfo); } /** * @notice Returns the base points earned by a user * @param user The address of the user * @return The base points earned by the user */ function getBasePoints( uint256 season, address user ) public view returns (uint256) { if (season <= 1) { return _basePoints(season, _seasonStakeInfo(season, user)); } UserStakeInfo memory userStakeInfo = _seasonStakeInfo(season, user); //If user has deposited this season OR we are not returning current season. if (userStakeInfo.erc20initial > 0 || currentSeason != season) { return _basePoints(season, userStakeInfo); } //calculate delta between last seasons stake and current season UserStakeInfo memory intermittentStakeInfo = UserStakeInfo({ erc20balance: _lastSeasonStakeInfo(user).erc20balance, erc20initial: 0, accumulatedPoints: 0, multiplier: _lastSeasonStakeInfo(user).multiplier, lastUpdatedTime: uint64(seasonInfo[currentSeason].startDate) }); return _basePoints(season, intermittentStakeInfo); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual override onlyOwner { revert("Cannot renounce ownership"); } /** * Private */ /** * @notice Get the multiplier for a user * @param season The season ID * @param userStakeInfo The user's staking information */ function _getMultiplier( uint256 season, UserStakeInfo memory userStakeInfo ) private view returns (uint256) { if (season <= 1) { return userStakeInfo.multiplier; } if ( userStakeInfo.multiplier >= seasonInfo[season].maximumGrowthMultiplier || userStakeInfo.erc20balance == 0 ) { return userStakeInfo.multiplier; } uint256 multiplierCapLeft = seasonInfo[season].maximumGrowthMultiplier - userStakeInfo.multiplier; uint256 endDate = seasonInfo[season].endDate; if (endDate == 0) { endDate = block.timestamp; } uint256 additionalMultiplier = ((endDate - userStakeInfo.lastUpdatedTime) / 1 weeks) * seasonInfo[season].weeklyMultiplierIncrement; if (additionalMultiplier >= multiplierCapLeft) { return userStakeInfo.multiplier + multiplierCapLeft; } return userStakeInfo.multiplier + additionalMultiplier; } /** * @notice Claim from Claim Contract and deposit for an increased multiplier * @param season The season ID * @param index The index of the claim * @param amount The amount of tokens to deposit * @param merkleProof The Merkle proof for the claim */ function _claimAndDeposit( uint256 season, uint256 index, uint256 amount, bytes32[] calldata merkleProof ) private { if (season > currentSeason) { revert InvalidSeason(); } seasonInfo[season].claimContract.claim( index, _msgSender(), amount, merkleProof ); if (currentSeason == season) { _deposit(amount, seasonInfo[season].claimMultiplier); } else { _deposit(amount, 0); } } /** * @notice Deposit ERC20 tokens into the contract * @param amount The amount of tokens to deposit * @param bonus The bonus multiplier to apply to the user's points * @dev The user must approve the contract to spend the tokens before calling this function */ function _deposit(uint256 amount, uint256 bonus) private { if (amount == 0) { revert IncorrectAmount(); } token.safeTransferFrom(_msgSender(), address(this), amount); uint cachedCurrentSeason = currentSeason; UserStakeInfo storage userStakeInfo = _seasonStakeInfo( cachedCurrentSeason, _msgSender() ); userStakeInfo.accumulatedPoints = _accumulatedPoints(_msgSender()); userStakeInfo.erc20balance = userStakeInfo.erc20balance + amount; if (userStakeInfo.lastUpdatedTime != 0) { userStakeInfo.multiplier = uint16( _getMultiplier(cachedCurrentSeason, userStakeInfo) ); } userStakeInfo.lastUpdatedTime = uint64(block.timestamp); // If they have deposited then set bonus to zero. if (userStakeInfo.erc20initial != 0) { bonus = 0; } if (userStakeInfo.erc20initial == 0) { if (cachedCurrentSeason > 1) { // Note: This loop will be an issue if we have a large amount of seasons, // However, since the contract is upgradeable we will refactor this before we get to this issue. for (uint256 i = cachedCurrentSeason - 1; i > 0; i--) { //read their previous season value from storage. UserStakeInfo storage previousSeasonStakeInfo = _seasonStakeInfo( i, _msgSender() ); // if the user ever was involved that season we take their initial (even if 0). if (previousSeasonStakeInfo.erc20initial > 0) { userStakeInfo.erc20initial = previousSeasonStakeInfo.erc20balance + amount; userStakeInfo.erc20balance = previousSeasonStakeInfo.erc20balance + amount; break; } } } // If User still has no balance, we set to amount if (userStakeInfo.erc20initial == 0) { userStakeInfo.erc20initial = amount; } } if (userStakeInfo.multiplier == 0) { // get the higher of their previous season multiplier or current season multiplier uint256 userMultiplier = 0; if (cachedCurrentSeason > 1) { userMultiplier = _lastSeasonStakeInfo(_msgSender()).multiplier; } userStakeInfo.multiplier = uint16( ( userMultiplier > currentMultiplier() ? userMultiplier : currentMultiplier() ) ); } // If the user has a bonus, apply it. if (bonus != 0) { userStakeInfo.multiplier = userStakeInfo.multiplier + uint16(bonus); } if ( seasonInfo[cachedCurrentSeason].seasonAbsoluteMax != 0 && userStakeInfo.multiplier > seasonInfo[cachedCurrentSeason].seasonAbsoluteMax ) { userStakeInfo.multiplier = uint16( seasonInfo[cachedCurrentSeason].seasonAbsoluteMax ); } emit Deposit(_msgSender(), amount, userStakeInfo.multiplier); } /** * @notice Calculate the base points earned by a user * @param season The season ID * @param userStakeInfo The user's staking information * @return The base points earned by the user */ function _basePoints( uint256 season, UserStakeInfo memory userStakeInfo ) private view returns (uint256) { uint256 endTime; uint256 seasonEndDate = seasonInfo[season].endDate; if (seasonEndDate == 0) { endTime = block.timestamp; } else { endTime = block.timestamp < seasonEndDate ? block.timestamp : seasonEndDate; } uint256 timeDifference = endTime > userStakeInfo.lastUpdatedTime ? endTime - userStakeInfo.lastUpdatedTime : 0; if (season <= 1) { return (userStakeInfo.erc20balance * timeDifference) / 1 hours; } else { return ((userStakeInfo.erc20balance * timeDifference) / 1 hours) + userStakeInfo.accumulatedPoints; } } /** * @notice Calculate the total points earned by a user * @param season The season ID * @param userStakeInfo The user's staking information * @return The total points earned by the user */ function _totalPoints( uint256 season, UserStakeInfo memory userStakeInfo ) private view returns (uint256) { if (season <= 1) { unchecked { // This is a max multiplier value is maxMultiplier * token max ~ 100 bits for a token capped at 10M 1e18 decimal tokens multiplied by a 64 bit number, so 164 bits, no overflow return ((_basePoints(season, userStakeInfo) * _getMultiplier(season, userStakeInfo)) / 100) + userStakeInfo.accumulatedPoints; } } else { return (_basePoints(season, userStakeInfo) * _getMultiplier(season, userStakeInfo)) / 100; } } /** * @notice Calculate the accumulated points earned by a user * @param who The address of the user * @return The accumulated points earned by the user */ function _accumulatedPoints(address who) private view returns (uint256) { if (currentSeason <= 1) { return getPointsBalance(currentSeason, who); } else { return getBasePoints(currentSeason, who); } } /** * @notice Get the user's staking information for a specific season * @param season The season ID * @param user The address of the user * @return The user's staking information */ function _seasonStakeInfo( uint256 season, address user ) private view returns (UserStakeInfo storage) { if (season <= 1) { return users[user]; } return seasonIdToUserToStakeInfo[season][user]; } /** * @notice Get the user's staking information for the last season * @param user The address of the user * @return The user's staking information */ function _lastSeasonStakeInfo( address user ) private view returns (UserStakeInfo storage) { if (currentSeason == 2) { return users[user]; } return seasonIdToUserToStakeInfo[currentSeason - 1][user]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 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; /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @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). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612]. * * Adds the {permit} method, which can be used to change an account's ERC-20 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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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 v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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] * ```solidity * 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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {OwnableUpgradeable} from "./OwnableUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step struct Ownable2StepStorage { address _pendingOwner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable2Step")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00; function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) { assembly { $.slot := Ownable2StepStorageLocation } } event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); function __Ownable2Step_init() internal onlyInitializing { } function __Ownable2Step_init_unchained() internal onlyInitializing { } /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); return $._pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); $._pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { Ownable2StepStorage storage $ = _getOwnable2StepStorage(); delete $._pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import {StorageSlot} from "./StorageSlot.sol"; /** * @dev Variant of {ReentrancyGuard} that uses transient storage. * * NOTE: This variant only works on networks where EIP-1153 is available. */ abstract contract ReentrancyGuardTransient { using StorageSlot for *; // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant REENTRANCY_GUARD_STORAGE = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_reentrancyGuardEntered()) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail REENTRANCY_GUARD_STORAGE.asBoolean().tstore(true); } function _nonReentrantAfter() private { REENTRANCY_GUARD_STORAGE.asBoolean().tstore(false); } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return REENTRANCY_GUARD_STORAGE.asBoolean().tload(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; import {Errors} from "./Errors.sol"; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert Errors.InsufficientBalance(address(this).balance, amount); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert Errors.FailedCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {Errors.FailedCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert Errors.InsufficientBalance(address(this).balance, value); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case * of an unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {Errors.FailedCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert Errors.FailedCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../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. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.24; /** * @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 ERC-1967 implementation slot: * ```solidity * contract ERC1967 { * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * Since version 5.1, this library also support writing and reading value types to and from transient storage. * * * Example using transient storage: * ```solidity * contract Lock { * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot. * bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542; * * modifier locked() { * require(!_LOCK_SLOT.asBoolean().tload()); * * _LOCK_SLOT.asBoolean().tstore(true); * _; * _LOCK_SLOT.asBoolean().tstore(false); * } * } * ``` * * TIP: Consider using this library along with {SlotDerivation}. */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct Int256Slot { int256 value; } struct StringSlot { string value; } struct BytesSlot { bytes 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 } } /** * @dev Returns an `Int256Slot` with member `value` located at `slot`. */ function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev UDVT that represent a slot holding a address. */ type AddressSlotType is bytes32; /** * @dev Cast an arbitrary slot to a AddressSlotType. */ function asAddress(bytes32 slot) internal pure returns (AddressSlotType) { return AddressSlotType.wrap(slot); } /** * @dev UDVT that represent a slot holding a bool. */ type BooleanSlotType is bytes32; /** * @dev Cast an arbitrary slot to a BooleanSlotType. */ function asBoolean(bytes32 slot) internal pure returns (BooleanSlotType) { return BooleanSlotType.wrap(slot); } /** * @dev UDVT that represent a slot holding a bytes32. */ type Bytes32SlotType is bytes32; /** * @dev Cast an arbitrary slot to a Bytes32SlotType. */ function asBytes32(bytes32 slot) internal pure returns (Bytes32SlotType) { return Bytes32SlotType.wrap(slot); } /** * @dev UDVT that represent a slot holding a uint256. */ type Uint256SlotType is bytes32; /** * @dev Cast an arbitrary slot to a Uint256SlotType. */ function asUint256(bytes32 slot) internal pure returns (Uint256SlotType) { return Uint256SlotType.wrap(slot); } /** * @dev UDVT that represent a slot holding a int256. */ type Int256SlotType is bytes32; /** * @dev Cast an arbitrary slot to a Int256SlotType. */ function asInt256(bytes32 slot) internal pure returns (Int256SlotType) { return Int256SlotType.wrap(slot); } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(AddressSlotType slot) internal view returns (address value) { /// @solidity memory-safe-assembly assembly { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(AddressSlotType slot, address value) internal { /// @solidity memory-safe-assembly assembly { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(BooleanSlotType slot) internal view returns (bool value) { /// @solidity memory-safe-assembly assembly { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(BooleanSlotType slot, bool value) internal { /// @solidity memory-safe-assembly assembly { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Bytes32SlotType slot) internal view returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Bytes32SlotType slot, bytes32 value) internal { /// @solidity memory-safe-assembly assembly { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Uint256SlotType slot) internal view returns (uint256 value) { /// @solidity memory-safe-assembly assembly { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Uint256SlotType slot, uint256 value) internal { /// @solidity memory-safe-assembly assembly { tstore(slot, value) } } /** * @dev Load the value held at location `slot` in transient storage. */ function tload(Int256SlotType slot) internal view returns (int256 value) { /// @solidity memory-safe-assembly assembly { value := tload(slot) } } /** * @dev Store `value` at location `slot` in transient storage. */ function tstore(Int256SlotType slot, int256 value) internal { /// @solidity memory-safe-assembly assembly { tstore(slot, value) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * @dev Collection of common custom errors used in multiple contracts * * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library. * It is recommended to avoid relying on the error API for critical functionality. */ library Errors { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error InsufficientBalance(uint256 balance, uint256 needed); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedCall(); /** * @dev The deployment failed. */ error FailedDeployment(); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@uniswap/merkle-distributor/=lib/merkle-distributor/contracts/", "@murky/=lib/murky/src/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "merkle-distributor/=lib/merkle-distributor/contracts/", "murky/=lib/murky/", "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/", "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"IncorrectAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidMaxGrowthMultiplier","type":"error"},{"inputs":[],"name":"InvalidMultiplier","type":"error"},{"inputs":[],"name":"InvalidPurchase","type":"error"},{"inputs":[],"name":"InvalidPurchaseContract","type":"error"},{"inputs":[],"name":"InvalidSeason","type":"error"},{"inputs":[],"name":"InvalidWeeklyMultiplierIncrement","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplier","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"multiplier","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bonusMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[{"internalType":"contract IClaim","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"claimAndDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"claimAndDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"permitAmount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"claimAndDepositPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"permitAmount","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"claimAndDepositSeasonPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentMultiplier","outputs":[{"internalType":"uint256","name":"multiplier","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentSeason","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"permitAmount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"depositPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"seasons","type":"uint256[]"},{"internalType":"address[]","name":"usersSet","type":"address[]"},{"internalType":"uint256[]","name":"newPoints","type":"uint256[]"}],"name":"fixUserPointCalculation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getBasePoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getErc20Balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getErc20Balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getPointsBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getPointsBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_claim","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"packedStartDateAndMaxMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"skuEntities","type":"uint256[]"},{"internalType":"uint256[]","name":"quantities","type":"uint256[]"}],"name":"purchase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seasonId","type":"uint256"},{"internalType":"address","name":"userWallet","type":"address"}],"name":"seasonIdToUserToStakeInfo","outputs":[{"internalType":"uint256","name":"erc20balance","type":"uint256"},{"internalType":"uint256","name":"erc20initial","type":"uint256"},{"internalType":"uint256","name":"accumulatedPoints","type":"uint256"},{"internalType":"uint64","name":"lastUpdatedTime","type":"uint64"},{"internalType":"uint16","name":"multiplier","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seasonId","type":"uint256"}],"name":"seasonInfo","outputs":[{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"uint256","name":"endDate","type":"uint256"},{"internalType":"uint256","name":"startingMultiplier","type":"uint256"},{"internalType":"uint256","name":"seasonAbsoluteMax","type":"uint256"},{"internalType":"uint256","name":"maximumGrowthMultiplier","type":"uint256"},{"internalType":"uint256","name":"claimMultiplier","type":"uint256"},{"internalType":"uint256","name":"weeklyMultiplierIncrement","type":"uint256"},{"internalType":"contract IClaim","name":"claimContract","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bonusMultiplier","type":"uint256"}],"name":"setBonusMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"}],"name":"setCurrentSeason","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"uint256","name":"endDate","type":"uint256"},{"internalType":"uint256","name":"startingMultiplier","type":"uint256"},{"internalType":"uint256","name":"seasonAbsoluteMax","type":"uint256"},{"internalType":"uint256","name":"maximumGrowthMultiplier","type":"uint256"},{"internalType":"uint256","name":"claimMultiplier","type":"uint256"},{"internalType":"uint256","name":"weeklyMultiplierIncrement","type":"uint256"},{"internalType":"address","name":"claimContract","type":"address"}],"name":"setSeasonInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_shopContract","type":"address"}],"name":"setShopContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_startDate","type":"uint64"},{"internalType":"uint192","name":"_maxMultiplier","type":"uint192"}],"name":"setStartDateAndMaxMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shopContract","outputs":[{"internalType":"contract ITokenShop","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"uint256","name":"newMax","type":"uint256"}],"name":"updateMaxGrowthMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"uint256","name":"newIncrement","type":"uint256"}],"name":"updateWeeklyMultiplierIncrement","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"uint256","name":"erc20balance","type":"uint256"},{"internalType":"uint256","name":"erc20initial","type":"uint256"},{"internalType":"uint256","name":"accumulatedPoints","type":"uint256"},{"internalType":"uint64","name":"lastUpdatedTime","type":"uint64"},{"internalType":"uint16","name":"multiplier","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052348015600e575f80fd5b5060156019565b60c9565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161560685760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b039081161460c65780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b612c59806100d65f395ff3fe608060405234801561000f575f80fd5b5060043610610255575f3560e01c80638456cb5911610140578063bcb39621116100bf578063dcbf534311610084578063dcbf53431461061b578063e30c39781461062e578063e707f36f14610636578063f2fde38b14610649578063fc0c546a1461065c578063fd58e63a1461066f575f80fd5b8063bcb39621146105c6578063bce2ff70146105cf578063c18a5f36146105e2578063cc42010b146105f5578063dc3de81114610608575f80fd5b8063a122ce7d11610105578063a122ce7d1461053a578063a87430ba1461054d578063a8b973a114610597578063a9d637e1146105a0578063b6b55f25146105b3575f80fd5b80638456cb591461047a57806386f3b23d146104825780638da5cb5b14610495578063910237071461049d578063983f5112146104b0575f80fd5b80633f4ba83a116101d75780636ad45e551161019c5780636ad45e55146104295780636fbaaa1e1461043c578063715018a61461044457806379ba50971461044c5780637af973c7146104545780637f80f9c314610467575f80fd5b80633f4ba83a146103c6578063485cc955146103ce5780634e71d92d146103e15780635c975abb146103f4578063668c45bd14610416575f80fd5b80631debe5031161021d5780631debe503146103635780632e1a7d4d14610384578063330728521461039757806336281086146103aa57806339e211c9146103b3575f80fd5b80630148a63414610259578063043a79261461026e57806306926bf91461031257806309090a51146103255780631aee31d014610350575b5f80fd5b61026c61026736600461257b565b610682565b005b6102c961027c3660046125c9565b600760208190525f9182526040909120805460018201546002830154600384015460048501546005860154600687015496909701549496939592949193909290916001600160a01b031688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c08301526001600160a01b031660e0820152610100015b60405180910390f35b61026c6103203660046125e0565b6106af565b600554610338906001600160a01b031681565b6040516001600160a01b039091168152602001610309565b61026c61035e366004612610565b6106eb565b6103766103713660046126ab565b610784565b604051908152602001610309565b61026c6103923660046125c9565b6108e7565b61026c6103a53660046125e0565b610aa6565b61037660035481565b61026c6103c13660046125c9565b610ae2565b61026c610b0f565b61026c6103dc3660046126d5565b610b21565b600254610338906001600160a01b031681565b5f80516020612c048339815191525460ff166040519015158152602001610309565b61026c6104243660046126fd565b610c8d565b61026c610437366004612716565b610dac565b610376610dd8565b61026c610e6a565b61026c610ebf565b61026c610462366004612771565b610f04565b6103766104753660046126ab565b610f5b565b61026c6110f5565b61026c6104903660046127be565b611105565b6103386113dd565b61026c6104ab366004612818565b611411565b6105056104be3660046126ab565b600860209081525f92835260408084209091529082529020805460018201546002830154600390930154919290916001600160401b03811690600160401b900461ffff1685565b604080519586526020860194909452928401919091526001600160401b0316606083015261ffff16608082015260a001610309565b6103766105483660046126ab565b6114de565b61050561055b3660046126fd565b5f602081905290815260409020805460018201546002830154600390930154919290916001600160401b03811690600160401b900461ffff1685565b61037660045481565b6103766105ae3660046126fd565b611542565b61026c6105c13660046125c9565b61154f565b61037660065481565b61026c6105dd3660046128aa565b611571565b6103766105f03660046126ab565b611609565b6103766106033660046126fd565b61161c565b61026c61061636600461293a565b61165d565b61026c610629366004612987565b6116ee565b61033861180e565b6103766106443660046126fd565b611836565b61026c6106573660046126fd565b611843565b600154610338906001600160a01b031681565b61026c61067d3660046125c9565b6118c8565b61068a6118f8565b610692611965565b6106a160065485858585611995565b6106a9611a5e565b50505050565b6106b7611a88565b805f036106d757604051635f0f164160e01b815260040160405180910390fd5b5f9182526007602052604090912060060155565b6106f36118f8565b6106fb611965565b6001546001600160a01b031663d505accf33308a888888886040518863ffffffff1660e01b815260040161073597969594939291906129f1565b5f604051808303815f87803b15801561074c575f80fd5b505af115801561075e573d5f803e3d5ffd5b505050506107716006548a8a8989611995565b610779611a5e565b505050505050505050565b5f600183116107f0576107e98361079b8585611aba565b6040805160a08101825282548152600183015460208201526002830154918101919091526003909101546001600160401b0381166060830152600160401b900461ffff166080820152611b07565b90506108e1565b5f6107fb8484611aba565b6040805160a081018252825481526001830154602082018190526002840154928201929092526003909201546001600160401b0381166060840152600160401b900461ffff16608083015290915015158061085857508360065414155b1561086f576108678482611b07565b9150506108e1565b5f6040518060a0016040528061088486611bc7565b5481525f60208083018290526040808401839052600654835260079091529020546001600160401b031660608201526080016108bf86611bc7565b60030154600160401b900461ffff16905290506108dc8582611b07565b925050505b92915050565b6108ef6118f8565b6108f7611965565b805f03610917576040516334b2073960e11b815260040160405180910390fd5b5f61092a6006546109253390565b611aba565b905061093533611c33565b600282015580548211156109e157600181015415801561095757506001600654115b156109bf575f61096633611bc7565b6040805160a0810182528254808252600180850154602084018190526002860154948401949094526003909401546001600160401b0381166060840152600160401b900461ffff16608090920191909152845590830155505b80548211156109e157604051631e9acf1760e31b815260040160405180910390fd5b80546109ee908390612a46565b815560038101805467ffffffffffffffff1916426001600160401b0316179055610a16610dd8565b60038201805461ffff92909216600160401b0261ffff60401b19909216919091179055610a50336001546001600160a01b03169084611c5b565b600381015460408051848152600160401b90920461ffff166020830152805133927ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56892908290030190a250610aa3611a5e565b50565b610aae611a88565b805f03610ace57604051635e3a626960e11b815260040160405180910390fd5b5f9182526007602052604090912060040155565b610aea611a88565b805f03610b0a5760405163d40820c360e01b815260040160405180910390fd5b600655565b610b17611a88565b610b1f611cbf565b565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f81158015610b655750825b90505f826001600160401b03166001148015610b805750303b155b905081158015610b8e575080155b15610bac5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610bd657845460ff60401b1916600160401b1785555b610bdf33611d1e565b610be7611d2f565b610bef611d37565b610bf7611d2f565b600180546001600160a01b03808a166001600160a01b031992831617835560028054918a16919092161790556101f44260c01b176003556032600455600655610c3e611d47565b8315610c8457845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b610c95611a88565b6005546001600160a01b031615610d1d5760015460055460405163095ea7b360e01b81526001600160a01b0391821660048201525f602482015291169063095ea7b3906044016020604051808303815f875af1158015610cf7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d1b9190612a59565b505b600580546001600160a01b0319166001600160a01b0383811691821790925560015460405163095ea7b360e01b815260048101929092525f1960248301529091169063095ea7b3906044016020604051808303815f875af1158015610d84573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610da89190612a59565b5050565b610db46118f8565b610dbc611965565b610dc98585858585611995565b610dd1611a5e565b5050505050565b6006545f90819060018111610e05576003546bffffffffffffffffffffffff8116935060c01c9150610e1f565b5f8181526007602052604090208054600290910154935091505b5f62015180610e2e8442612a46565b610e389190612a8c565b9050600a810284811015610e5e5780850394506064851015610e5957606494505b610e63565b606494505b5050505090565b610e72611a88565b60405162461bcd60e51b815260206004820152601960248201527f43616e6e6f742072656e6f756e6365206f776e6572736869700000000000000060448201526064015b60405180910390fd5b3380610ec961180e565b6001600160a01b031614610efb5760405163118cdaa760e01b81526001600160a01b0382166004820152602401610eb6565b610aa381611d8f565b610f0c611a88565b612710816001600160c01b03161115610f3857604051631bc4bcf760e21b815260040160405180910390fd5b806001600160c01b031660c0836001600160401b0316901b176003819055505050565b5f60018311610fd1576001600160a01b0382165f9081526020818152604091829020825160a081018452815481526001820154928101929092526002810154928201929092526003909101546001600160401b0381166060830152600160401b900461ffff1660808201526107e9908490611dc7565b5f8381526008602090815260408083206001600160a01b038616845290915290206001015415158061100557508260065414155b15611080575f8381526008602090815260408083206001600160a01b0386168452825291829020825160a081018452815481526001820154928101929092526002810154928201929092526003909101546001600160401b0381166060830152600160401b900461ffff1660808201526107e9908490611dc7565b5f6040518060a0016040528061109585611bc7565b5481525f60208083018290526040808401839052600654835260079091529020546001600160401b031660608201526080016110d085611bc7565b60030154600160401b900461ffff16905290506110ed8482611dc7565b949350505050565b6110fd611a88565b610b1f611d47565b61110d6118f8565b611115611965565b828114611135576040516329e89cc960e11b815260040160405180910390fd5b6005546001600160a01b031661115e57604051636833232560e01b815260040160405180910390fd5b5f61116c6006546109253390565b905061117733611c33565b6002820155600181015415801561119057506001600654115b15611213575f61119f33611bc7565b6040805160a0810182528254808252600180850154602084018190526002860154948401949094526003948501546001600160401b0381166060850152600160401b9081900461ffff166080909401849052918755860192909255918401805461ffff60401b191692909102919091179055505b60038101546001600160401b03161561129a576006546040805160a081018252835481526001840154602082015260028401549181019190915260038301546001600160401b0381166060830152600160401b900461ffff16608082015261127b9190611e2c565b8160030160086101000a81548161ffff021916908361ffff1602179055505b60038101805467ffffffffffffffff1916426001600160401b03161790556005545f9081906001600160a01b031663f3aff3fe33898989896040518663ffffffff1660e01b81526004016112f2959493929190612adb565b60408051808303815f875af115801561130d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113319190612b1e565b9150915080835f0154101561135957604051631e9acf1760e31b815260040160405180910390fd5b815f03611379576040516329e89cc960e11b815260040160405180910390fd5b8254611386908290612a46565b8355600383015460408051838152600160401b90920461ffff166020830152805133927ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56892908290030190a25050506106a9611a5e565b5f807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b611419611a88565b84831415806114285750848114155b156114465760405163d40820c360e01b815260040160405180910390fd5b5f5b85811015610c845782828281811061146257611462612b40565b9050602002013560085f89898581811061147e5761147e612b40565b9050602002013581526020019081526020015f205f8787858181106114a5576114a5612b40565b90506020020160208101906114ba91906126fd565b6001600160a01b0316815260208101919091526040015f2060020155600101611448565b5f61153b836114ed8585611aba565b6040805160a08101825282548152600183015460208201526002830154918101919091526003909101546001600160401b0381166060830152600160401b900461ffff166080820152611e2c565b9392505050565b5f6108e1600654836114de565b6115576118f8565b61155f611965565b611569815f611f41565b610aa3611a5e565b6115796118f8565b611581611965565b6001546001600160a01b031663d505accf33308a888888886040518863ffffffff1660e01b81526004016115bb97969594939291906129f1565b5f604051808303815f87803b1580156115d2575f80fd5b505af11580156115e4573d5f803e3d5ffd5b505050506115f58a8a8a8989611995565b6115fd611a5e565b50505050505050505050565b5f6116148383611aba565b549392505050565b5f61162960065483611aba565b6001015415801561163c57506001600654115b156116515761164a82611bc7565b5492915050565b61164a60065483611aba565b6116656118f8565b61166d611965565b6001546001600160a01b031663d505accf333088888888886040518863ffffffff1660e01b81526004016116a797969594939291906129f1565b5f604051808303815f87803b1580156116be575f80fd5b505af11580156116d0573d5f803e3d5ffd5b505050506116de865f611f41565b6116e6611a5e565b505050505050565b6116f6611a88565b878710801561170457508715155b801561170f57508615155b1561172d5760405163d40820c360e01b815260040160405180910390fd5b8385101561174e5760405163d40820c360e01b815260040160405180910390fd5b8382111561176f5760405163d40820c360e01b815260040160405180910390fd5b60408051610100810182529889526020808a0198895289820197885260608a0196875260808a0195865260a08a0194855260c08a019384526001600160a01b0392831660e08b019081525f9b8c5260079182905291909a20985189559651600189015594516002880155925160038701559051600486015551600585015551600684015590519190920180546001600160a01b03191691909216179055565b5f807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00611401565b5f6108e160065483610f5b565b61184b611a88565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b038316908117825561188f6113dd565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b6118d0611a88565b6103e88111156118f357604051631bc4bcf760e21b815260040160405180910390fd5b600455565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c1561193857604051633ee5aeb560e01b815260040160405180910390fd5b610b1f60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005b90612267565b5f80516020612c048339815191525460ff1615610b1f5760405163d93c066560e01b815260040160405180910390fd5b6006548511156119b85760405163d40820c360e01b815260040160405180910390fd5b5f85815260076020819052604090912001546001600160a01b0316632e7ba6ef85338686866040518663ffffffff1660e01b81526004016119fd959493929190612b54565b5f604051808303815f87803b158015611a14575f80fd5b505af1158015611a26573d5f803e3d5ffd5b505050508460065403611a54575f85815260076020526040902060050154611a4f908490611f41565b610dd1565b610dd1835f611f41565b610b1f5f7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0061195f565b33611a916113dd565b6001600160a01b031614610b1f5760405163118cdaa760e01b8152336004820152602401610eb6565b5f60018311611ae057506001600160a01b0381165f9081526020819052604090206108e1565b505f9182526008602090815260408084206001600160a01b03939093168452919052902090565b5f828152600760205260408120600101548190808203611b2957429150611b3b565b804210611b365780611b38565b425b91505b5f84606001516001600160401b03168311611b56575f611b6e565b6060850151611b6e906001600160401b031684612a46565b905060018611611b9d578451610e1090611b89908390612b8c565b611b939190612a8c565b93505050506108e1565b60408501518551610e1090611bb3908490612b8c565b611bbd9190612a8c565b611b939190612ba3565b5f600654600203611bec57506001600160a01b03165f90815260208190526040902090565b60085f6001600654611bfe9190612a46565b81526020019081526020015f205f836001600160a01b03166001600160a01b031681526020019081526020015f209050919050565b5f600160065411611c4a576108e160065483610f5b565b6108e160065483610784565b919050565b6040516001600160a01b03838116602483015260448201839052611cba91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061226e565b505050565b611cc76122cf565b5f80516020612c04833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b611d266122fe565b610aa381612347565b610b1f6122fe565b611d3f6122fe565b610b1f612378565b611d4f611965565b5f80516020612c04833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611d00565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319168155610da882612398565b5f60018311611e025781604001516064611de18585611e2c565b611deb8686611b07565b0281611df957611df9612a78565b040190506108e1565b6064611e0e8484611e2c565b611e188585611b07565b611e229190612b8c565b6107e99190612a8c565b5f60018311611e445750608081015161ffff166108e1565b5f83815260076020526040902060040154608083015161ffff16101580611e6a57508151155b15611e7e5750608081015161ffff166108e1565b60808201515f848152600760205260408120600401549091611ea69161ffff90911690612a46565b5f85815260076020526040812060010154919250819003611ec45750425b5f85815260076020526040812060060154606086015162093a8090611ef2906001600160401b031685612a46565b611efc9190612a8c565b611f069190612b8c565b9050828110611f235782856080015161ffff16611b939190612ba3565b80856080015161ffff16611f379190612ba3565b9695505050505050565b815f03611f61576040516334b2073960e11b815260040160405180910390fd5b611f79336001546001600160a01b0316903085612408565b6006545f611f878233611aba565b9050611f9233611c33565b60028201558054611fa4908590612ba3565b815560038101546001600160401b03161561202b576040805160a081018252825481526001830154602082015260028301549181019190915260038201546001600160401b0381166060830152600160401b900461ffff16608082015261200c908390611e2c565b8160030160086101000a81548161ffff021916908361ffff1602179055505b60038101805467ffffffffffffffff1916426001600160401b0316179055600181015415612057575f92505b80600101545f036120e75760018211156120d4575f612077600184612a46565b90505b80156120d2575f61208b8233611aba565b6001810154909150156120bf5780546120a5908790612ba3565b600184015580546120b7908790612ba3565b8355506120d2565b50806120ca81612bb6565b91505061207a565b505b80600101545f036120e757600181018490555b6003810154600160401b900461ffff165f0361215f575f60018311156121225761211033611bc7565b60030154600160401b900461ffff1690505b61212a610dd8565b811161213d57612138610dd8565b61213f565b805b8260030160086101000a81548161ffff021916908361ffff160217905550505b821561219f576003810154612180908490600160401b900461ffff16612bcb565b8160030160086101000a81548161ffff021916908361ffff1602179055505b5f82815260076020526040902060030154158015906121dd57505f82815260076020526040902060039081015490820154600160401b900461ffff16115b15612217575f828152600760205260409020600390810154908201805461ffff909216600160401b0261ffff60401b199092169190911790555b600381015460408051868152600160401b90920461ffff166020830152805133927f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1592908290030190a250505050565b80825d5050565b5f6122826001600160a01b03841683612441565b905080515f141580156122a65750808060200190518101906122a49190612a59565b155b15611cba57604051635274afe760e01b81526001600160a01b0384166004820152602401610eb6565b5f80516020612c048339815191525460ff16610b1f57604051638dfc202b60e01b815260040160405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610b1f57604051631afcd79f60e31b815260040160405180910390fd5b61234f6122fe565b6001600160a01b038116610efb57604051631e4fbdf760e01b81525f6004820152602401610eb6565b6123806122fe565b5f80516020612c04833981519152805460ff19169055565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526106a99186918216906323b872dd90608401611c88565b606061153b83835f845f80856001600160a01b031684866040516124659190612bed565b5f6040518083038185875af1925050503d805f811461249f576040519150601f19603f3d011682016040523d82523d5f602084013e6124a4565b606091505b5091509150611f378683836060826124c4576124bf8261250b565b61153b565b81511580156124db57506001600160a01b0384163b155b1561250457604051639996b31560e01b81526001600160a01b0385166004820152602401610eb6565b508061153b565b80511561251b5780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b5f8083601f840112612544575f80fd5b5081356001600160401b0381111561255a575f80fd5b6020830191508360208260051b8501011115612574575f80fd5b9250929050565b5f805f806060858703121561258e575f80fd5b843593506020850135925060408501356001600160401b038111156125b1575f80fd5b6125bd87828801612534565b95989497509550505050565b5f602082840312156125d9575f80fd5b5035919050565b5f80604083850312156125f1575f80fd5b50508035926020909101359150565b803560ff81168114611c56575f80fd5b5f805f805f805f805f6101008a8c031215612629575f80fd5b8935985060208a0135975060408a0135965060608a01356001600160401b03811115612653575f80fd5b61265f8c828d01612534565b90975095505060808a0135935061267860a08b01612600565b925060c08a0135915060e08a013590509295985092959850929598565b80356001600160a01b0381168114611c56575f80fd5b5f80604083850312156126bc575f80fd5b823591506126cc60208401612695565b90509250929050565b5f80604083850312156126e6575f80fd5b6126ef83612695565b91506126cc60208401612695565b5f6020828403121561270d575f80fd5b61153b82612695565b5f805f805f6080868803121561272a575f80fd5b85359450602086013593506040860135925060608601356001600160401b03811115612754575f80fd5b61276088828901612534565b969995985093965092949392505050565b5f8060408385031215612782575f80fd5b82356001600160401b0381168114612798575f80fd5b915060208301356001600160c01b03811681146127b3575f80fd5b809150509250929050565b5f805f80604085870312156127d1575f80fd5b84356001600160401b03808211156127e7575f80fd5b6127f388838901612534565b9096509450602087013591508082111561280b575f80fd5b506125bd87828801612534565b5f805f805f806060878903121561282d575f80fd5b86356001600160401b0380821115612843575f80fd5b61284f8a838b01612534565b90985096506020890135915080821115612867575f80fd5b6128738a838b01612534565b9096509450604089013591508082111561288b575f80fd5b5061289889828a01612534565b979a9699509497509295939492505050565b5f805f805f805f805f806101208b8d0312156128c4575f80fd5b8a35995060208b0135985060408b0135975060608b0135965060808b01356001600160401b038111156128f5575f80fd5b6129018d828e01612534565b90975095505060a08b0135935061291a60c08c01612600565b925060e08b013591506101008b013590509295989b9194979a5092959850565b5f805f805f8060c0878903121561294f575f80fd5b86359550602087013594506040870135935061296d60608801612600565b92506080870135915060a087013590509295509295509295565b5f805f805f805f805f6101208a8c0312156129a0575f80fd5b8935985060208a0135975060408a0135965060608a0135955060808a0135945060a08a0135935060c08a0135925060e08a013591506129e26101008b01612695565b90509295985092959850929598565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b634e487b7160e01b5f52601160045260245ffd5b818103818111156108e1576108e1612a32565b5f60208284031215612a69575f80fd5b8151801515811461153b575f80fd5b634e487b7160e01b5f52601260045260245ffd5b5f82612aa657634e487b7160e01b5f52601260045260245ffd5b500490565b8183525f6001600160fb1b03831115612ac2575f80fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b03861681526060602082018190525f90612aff9083018688612aab565b8281036040840152612b12818587612aab565b98975050505050505050565b5f8060408385031215612b2f575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52603260045260245ffd5b85815260018060a01b0385166020820152836040820152608060608201525f612b81608083018486612aab565b979650505050505050565b80820281158282048414176108e1576108e1612a32565b808201808211156108e1576108e1612a32565b5f81612bc457612bc4612a32565b505f190190565b61ffff818116838216019080821115612be657612be6612a32565b5092915050565b5f82518060208501845e5f92019182525091905056fecd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a26469706673582212200c338f32ceead59a79fa91b53e84dea3002dfe8df4ff91fe55455268f232c26764736f6c63430008190033
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610255575f3560e01c80638456cb5911610140578063bcb39621116100bf578063dcbf534311610084578063dcbf53431461061b578063e30c39781461062e578063e707f36f14610636578063f2fde38b14610649578063fc0c546a1461065c578063fd58e63a1461066f575f80fd5b8063bcb39621146105c6578063bce2ff70146105cf578063c18a5f36146105e2578063cc42010b146105f5578063dc3de81114610608575f80fd5b8063a122ce7d11610105578063a122ce7d1461053a578063a87430ba1461054d578063a8b973a114610597578063a9d637e1146105a0578063b6b55f25146105b3575f80fd5b80638456cb591461047a57806386f3b23d146104825780638da5cb5b14610495578063910237071461049d578063983f5112146104b0575f80fd5b80633f4ba83a116101d75780636ad45e551161019c5780636ad45e55146104295780636fbaaa1e1461043c578063715018a61461044457806379ba50971461044c5780637af973c7146104545780637f80f9c314610467575f80fd5b80633f4ba83a146103c6578063485cc955146103ce5780634e71d92d146103e15780635c975abb146103f4578063668c45bd14610416575f80fd5b80631debe5031161021d5780631debe503146103635780632e1a7d4d14610384578063330728521461039757806336281086146103aa57806339e211c9146103b3575f80fd5b80630148a63414610259578063043a79261461026e57806306926bf91461031257806309090a51146103255780631aee31d014610350575b5f80fd5b61026c61026736600461257b565b610682565b005b6102c961027c3660046125c9565b600760208190525f9182526040909120805460018201546002830154600384015460048501546005860154600687015496909701549496939592949193909290916001600160a01b031688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c08301526001600160a01b031660e0820152610100015b60405180910390f35b61026c6103203660046125e0565b6106af565b600554610338906001600160a01b031681565b6040516001600160a01b039091168152602001610309565b61026c61035e366004612610565b6106eb565b6103766103713660046126ab565b610784565b604051908152602001610309565b61026c6103923660046125c9565b6108e7565b61026c6103a53660046125e0565b610aa6565b61037660035481565b61026c6103c13660046125c9565b610ae2565b61026c610b0f565b61026c6103dc3660046126d5565b610b21565b600254610338906001600160a01b031681565b5f80516020612c048339815191525460ff166040519015158152602001610309565b61026c6104243660046126fd565b610c8d565b61026c610437366004612716565b610dac565b610376610dd8565b61026c610e6a565b61026c610ebf565b61026c610462366004612771565b610f04565b6103766104753660046126ab565b610f5b565b61026c6110f5565b61026c6104903660046127be565b611105565b6103386113dd565b61026c6104ab366004612818565b611411565b6105056104be3660046126ab565b600860209081525f92835260408084209091529082529020805460018201546002830154600390930154919290916001600160401b03811690600160401b900461ffff1685565b604080519586526020860194909452928401919091526001600160401b0316606083015261ffff16608082015260a001610309565b6103766105483660046126ab565b6114de565b61050561055b3660046126fd565b5f602081905290815260409020805460018201546002830154600390930154919290916001600160401b03811690600160401b900461ffff1685565b61037660045481565b6103766105ae3660046126fd565b611542565b61026c6105c13660046125c9565b61154f565b61037660065481565b61026c6105dd3660046128aa565b611571565b6103766105f03660046126ab565b611609565b6103766106033660046126fd565b61161c565b61026c61061636600461293a565b61165d565b61026c610629366004612987565b6116ee565b61033861180e565b6103766106443660046126fd565b611836565b61026c6106573660046126fd565b611843565b600154610338906001600160a01b031681565b61026c61067d3660046125c9565b6118c8565b61068a6118f8565b610692611965565b6106a160065485858585611995565b6106a9611a5e565b50505050565b6106b7611a88565b805f036106d757604051635f0f164160e01b815260040160405180910390fd5b5f9182526007602052604090912060060155565b6106f36118f8565b6106fb611965565b6001546001600160a01b031663d505accf33308a888888886040518863ffffffff1660e01b815260040161073597969594939291906129f1565b5f604051808303815f87803b15801561074c575f80fd5b505af115801561075e573d5f803e3d5ffd5b505050506107716006548a8a8989611995565b610779611a5e565b505050505050505050565b5f600183116107f0576107e98361079b8585611aba565b6040805160a08101825282548152600183015460208201526002830154918101919091526003909101546001600160401b0381166060830152600160401b900461ffff166080820152611b07565b90506108e1565b5f6107fb8484611aba565b6040805160a081018252825481526001830154602082018190526002840154928201929092526003909201546001600160401b0381166060840152600160401b900461ffff16608083015290915015158061085857508360065414155b1561086f576108678482611b07565b9150506108e1565b5f6040518060a0016040528061088486611bc7565b5481525f60208083018290526040808401839052600654835260079091529020546001600160401b031660608201526080016108bf86611bc7565b60030154600160401b900461ffff16905290506108dc8582611b07565b925050505b92915050565b6108ef6118f8565b6108f7611965565b805f03610917576040516334b2073960e11b815260040160405180910390fd5b5f61092a6006546109253390565b611aba565b905061093533611c33565b600282015580548211156109e157600181015415801561095757506001600654115b156109bf575f61096633611bc7565b6040805160a0810182528254808252600180850154602084018190526002860154948401949094526003909401546001600160401b0381166060840152600160401b900461ffff16608090920191909152845590830155505b80548211156109e157604051631e9acf1760e31b815260040160405180910390fd5b80546109ee908390612a46565b815560038101805467ffffffffffffffff1916426001600160401b0316179055610a16610dd8565b60038201805461ffff92909216600160401b0261ffff60401b19909216919091179055610a50336001546001600160a01b03169084611c5b565b600381015460408051848152600160401b90920461ffff166020830152805133927ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56892908290030190a250610aa3611a5e565b50565b610aae611a88565b805f03610ace57604051635e3a626960e11b815260040160405180910390fd5b5f9182526007602052604090912060040155565b610aea611a88565b805f03610b0a5760405163d40820c360e01b815260040160405180910390fd5b600655565b610b17611a88565b610b1f611cbf565b565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f81158015610b655750825b90505f826001600160401b03166001148015610b805750303b155b905081158015610b8e575080155b15610bac5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610bd657845460ff60401b1916600160401b1785555b610bdf33611d1e565b610be7611d2f565b610bef611d37565b610bf7611d2f565b600180546001600160a01b03808a166001600160a01b031992831617835560028054918a16919092161790556101f44260c01b176003556032600455600655610c3e611d47565b8315610c8457845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b610c95611a88565b6005546001600160a01b031615610d1d5760015460055460405163095ea7b360e01b81526001600160a01b0391821660048201525f602482015291169063095ea7b3906044016020604051808303815f875af1158015610cf7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d1b9190612a59565b505b600580546001600160a01b0319166001600160a01b0383811691821790925560015460405163095ea7b360e01b815260048101929092525f1960248301529091169063095ea7b3906044016020604051808303815f875af1158015610d84573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610da89190612a59565b5050565b610db46118f8565b610dbc611965565b610dc98585858585611995565b610dd1611a5e565b5050505050565b6006545f90819060018111610e05576003546bffffffffffffffffffffffff8116935060c01c9150610e1f565b5f8181526007602052604090208054600290910154935091505b5f62015180610e2e8442612a46565b610e389190612a8c565b9050600a810284811015610e5e5780850394506064851015610e5957606494505b610e63565b606494505b5050505090565b610e72611a88565b60405162461bcd60e51b815260206004820152601960248201527f43616e6e6f742072656e6f756e6365206f776e6572736869700000000000000060448201526064015b60405180910390fd5b3380610ec961180e565b6001600160a01b031614610efb5760405163118cdaa760e01b81526001600160a01b0382166004820152602401610eb6565b610aa381611d8f565b610f0c611a88565b612710816001600160c01b03161115610f3857604051631bc4bcf760e21b815260040160405180910390fd5b806001600160c01b031660c0836001600160401b0316901b176003819055505050565b5f60018311610fd1576001600160a01b0382165f9081526020818152604091829020825160a081018452815481526001820154928101929092526002810154928201929092526003909101546001600160401b0381166060830152600160401b900461ffff1660808201526107e9908490611dc7565b5f8381526008602090815260408083206001600160a01b038616845290915290206001015415158061100557508260065414155b15611080575f8381526008602090815260408083206001600160a01b0386168452825291829020825160a081018452815481526001820154928101929092526002810154928201929092526003909101546001600160401b0381166060830152600160401b900461ffff1660808201526107e9908490611dc7565b5f6040518060a0016040528061109585611bc7565b5481525f60208083018290526040808401839052600654835260079091529020546001600160401b031660608201526080016110d085611bc7565b60030154600160401b900461ffff16905290506110ed8482611dc7565b949350505050565b6110fd611a88565b610b1f611d47565b61110d6118f8565b611115611965565b828114611135576040516329e89cc960e11b815260040160405180910390fd5b6005546001600160a01b031661115e57604051636833232560e01b815260040160405180910390fd5b5f61116c6006546109253390565b905061117733611c33565b6002820155600181015415801561119057506001600654115b15611213575f61119f33611bc7565b6040805160a0810182528254808252600180850154602084018190526002860154948401949094526003948501546001600160401b0381166060850152600160401b9081900461ffff166080909401849052918755860192909255918401805461ffff60401b191692909102919091179055505b60038101546001600160401b03161561129a576006546040805160a081018252835481526001840154602082015260028401549181019190915260038301546001600160401b0381166060830152600160401b900461ffff16608082015261127b9190611e2c565b8160030160086101000a81548161ffff021916908361ffff1602179055505b60038101805467ffffffffffffffff1916426001600160401b03161790556005545f9081906001600160a01b031663f3aff3fe33898989896040518663ffffffff1660e01b81526004016112f2959493929190612adb565b60408051808303815f875af115801561130d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113319190612b1e565b9150915080835f0154101561135957604051631e9acf1760e31b815260040160405180910390fd5b815f03611379576040516329e89cc960e11b815260040160405180910390fd5b8254611386908290612a46565b8355600383015460408051838152600160401b90920461ffff166020830152805133927ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56892908290030190a25050506106a9611a5e565b5f807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b611419611a88565b84831415806114285750848114155b156114465760405163d40820c360e01b815260040160405180910390fd5b5f5b85811015610c845782828281811061146257611462612b40565b9050602002013560085f89898581811061147e5761147e612b40565b9050602002013581526020019081526020015f205f8787858181106114a5576114a5612b40565b90506020020160208101906114ba91906126fd565b6001600160a01b0316815260208101919091526040015f2060020155600101611448565b5f61153b836114ed8585611aba565b6040805160a08101825282548152600183015460208201526002830154918101919091526003909101546001600160401b0381166060830152600160401b900461ffff166080820152611e2c565b9392505050565b5f6108e1600654836114de565b6115576118f8565b61155f611965565b611569815f611f41565b610aa3611a5e565b6115796118f8565b611581611965565b6001546001600160a01b031663d505accf33308a888888886040518863ffffffff1660e01b81526004016115bb97969594939291906129f1565b5f604051808303815f87803b1580156115d2575f80fd5b505af11580156115e4573d5f803e3d5ffd5b505050506115f58a8a8a8989611995565b6115fd611a5e565b50505050505050505050565b5f6116148383611aba565b549392505050565b5f61162960065483611aba565b6001015415801561163c57506001600654115b156116515761164a82611bc7565b5492915050565b61164a60065483611aba565b6116656118f8565b61166d611965565b6001546001600160a01b031663d505accf333088888888886040518863ffffffff1660e01b81526004016116a797969594939291906129f1565b5f604051808303815f87803b1580156116be575f80fd5b505af11580156116d0573d5f803e3d5ffd5b505050506116de865f611f41565b6116e6611a5e565b505050505050565b6116f6611a88565b878710801561170457508715155b801561170f57508615155b1561172d5760405163d40820c360e01b815260040160405180910390fd5b8385101561174e5760405163d40820c360e01b815260040160405180910390fd5b8382111561176f5760405163d40820c360e01b815260040160405180910390fd5b60408051610100810182529889526020808a0198895289820197885260608a0196875260808a0195865260a08a0194855260c08a019384526001600160a01b0392831660e08b019081525f9b8c5260079182905291909a20985189559651600189015594516002880155925160038701559051600486015551600585015551600684015590519190920180546001600160a01b03191691909216179055565b5f807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00611401565b5f6108e160065483610f5b565b61184b611a88565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b038316908117825561188f6113dd565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b6118d0611a88565b6103e88111156118f357604051631bc4bcf760e21b815260040160405180910390fd5b600455565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c1561193857604051633ee5aeb560e01b815260040160405180910390fd5b610b1f60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005b90612267565b5f80516020612c048339815191525460ff1615610b1f5760405163d93c066560e01b815260040160405180910390fd5b6006548511156119b85760405163d40820c360e01b815260040160405180910390fd5b5f85815260076020819052604090912001546001600160a01b0316632e7ba6ef85338686866040518663ffffffff1660e01b81526004016119fd959493929190612b54565b5f604051808303815f87803b158015611a14575f80fd5b505af1158015611a26573d5f803e3d5ffd5b505050508460065403611a54575f85815260076020526040902060050154611a4f908490611f41565b610dd1565b610dd1835f611f41565b610b1f5f7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f0061195f565b33611a916113dd565b6001600160a01b031614610b1f5760405163118cdaa760e01b8152336004820152602401610eb6565b5f60018311611ae057506001600160a01b0381165f9081526020819052604090206108e1565b505f9182526008602090815260408084206001600160a01b03939093168452919052902090565b5f828152600760205260408120600101548190808203611b2957429150611b3b565b804210611b365780611b38565b425b91505b5f84606001516001600160401b03168311611b56575f611b6e565b6060850151611b6e906001600160401b031684612a46565b905060018611611b9d578451610e1090611b89908390612b8c565b611b939190612a8c565b93505050506108e1565b60408501518551610e1090611bb3908490612b8c565b611bbd9190612a8c565b611b939190612ba3565b5f600654600203611bec57506001600160a01b03165f90815260208190526040902090565b60085f6001600654611bfe9190612a46565b81526020019081526020015f205f836001600160a01b03166001600160a01b031681526020019081526020015f209050919050565b5f600160065411611c4a576108e160065483610f5b565b6108e160065483610784565b919050565b6040516001600160a01b03838116602483015260448201839052611cba91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061226e565b505050565b611cc76122cf565b5f80516020612c04833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b611d266122fe565b610aa381612347565b610b1f6122fe565b611d3f6122fe565b610b1f612378565b611d4f611965565b5f80516020612c04833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611d00565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319168155610da882612398565b5f60018311611e025781604001516064611de18585611e2c565b611deb8686611b07565b0281611df957611df9612a78565b040190506108e1565b6064611e0e8484611e2c565b611e188585611b07565b611e229190612b8c565b6107e99190612a8c565b5f60018311611e445750608081015161ffff166108e1565b5f83815260076020526040902060040154608083015161ffff16101580611e6a57508151155b15611e7e5750608081015161ffff166108e1565b60808201515f848152600760205260408120600401549091611ea69161ffff90911690612a46565b5f85815260076020526040812060010154919250819003611ec45750425b5f85815260076020526040812060060154606086015162093a8090611ef2906001600160401b031685612a46565b611efc9190612a8c565b611f069190612b8c565b9050828110611f235782856080015161ffff16611b939190612ba3565b80856080015161ffff16611f379190612ba3565b9695505050505050565b815f03611f61576040516334b2073960e11b815260040160405180910390fd5b611f79336001546001600160a01b0316903085612408565b6006545f611f878233611aba565b9050611f9233611c33565b60028201558054611fa4908590612ba3565b815560038101546001600160401b03161561202b576040805160a081018252825481526001830154602082015260028301549181019190915260038201546001600160401b0381166060830152600160401b900461ffff16608082015261200c908390611e2c565b8160030160086101000a81548161ffff021916908361ffff1602179055505b60038101805467ffffffffffffffff1916426001600160401b0316179055600181015415612057575f92505b80600101545f036120e75760018211156120d4575f612077600184612a46565b90505b80156120d2575f61208b8233611aba565b6001810154909150156120bf5780546120a5908790612ba3565b600184015580546120b7908790612ba3565b8355506120d2565b50806120ca81612bb6565b91505061207a565b505b80600101545f036120e757600181018490555b6003810154600160401b900461ffff165f0361215f575f60018311156121225761211033611bc7565b60030154600160401b900461ffff1690505b61212a610dd8565b811161213d57612138610dd8565b61213f565b805b8260030160086101000a81548161ffff021916908361ffff160217905550505b821561219f576003810154612180908490600160401b900461ffff16612bcb565b8160030160086101000a81548161ffff021916908361ffff1602179055505b5f82815260076020526040902060030154158015906121dd57505f82815260076020526040902060039081015490820154600160401b900461ffff16115b15612217575f828152600760205260409020600390810154908201805461ffff909216600160401b0261ffff60401b199092169190911790555b600381015460408051868152600160401b90920461ffff166020830152805133927f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1592908290030190a250505050565b80825d5050565b5f6122826001600160a01b03841683612441565b905080515f141580156122a65750808060200190518101906122a49190612a59565b155b15611cba57604051635274afe760e01b81526001600160a01b0384166004820152602401610eb6565b5f80516020612c048339815191525460ff16610b1f57604051638dfc202b60e01b815260040160405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610b1f57604051631afcd79f60e31b815260040160405180910390fd5b61234f6122fe565b6001600160a01b038116610efb57604051631e4fbdf760e01b81525f6004820152602401610eb6565b6123806122fe565b5f80516020612c04833981519152805460ff19169055565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a3505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526106a99186918216906323b872dd90608401611c88565b606061153b83835f845f80856001600160a01b031684866040516124659190612bed565b5f6040518083038185875af1925050503d805f811461249f576040519150601f19603f3d011682016040523d82523d5f602084013e6124a4565b606091505b5091509150611f378683836060826124c4576124bf8261250b565b61153b565b81511580156124db57506001600160a01b0384163b155b1561250457604051639996b31560e01b81526001600160a01b0385166004820152602401610eb6565b508061153b565b80511561251b5780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b5f8083601f840112612544575f80fd5b5081356001600160401b0381111561255a575f80fd5b6020830191508360208260051b8501011115612574575f80fd5b9250929050565b5f805f806060858703121561258e575f80fd5b843593506020850135925060408501356001600160401b038111156125b1575f80fd5b6125bd87828801612534565b95989497509550505050565b5f602082840312156125d9575f80fd5b5035919050565b5f80604083850312156125f1575f80fd5b50508035926020909101359150565b803560ff81168114611c56575f80fd5b5f805f805f805f805f6101008a8c031215612629575f80fd5b8935985060208a0135975060408a0135965060608a01356001600160401b03811115612653575f80fd5b61265f8c828d01612534565b90975095505060808a0135935061267860a08b01612600565b925060c08a0135915060e08a013590509295985092959850929598565b80356001600160a01b0381168114611c56575f80fd5b5f80604083850312156126bc575f80fd5b823591506126cc60208401612695565b90509250929050565b5f80604083850312156126e6575f80fd5b6126ef83612695565b91506126cc60208401612695565b5f6020828403121561270d575f80fd5b61153b82612695565b5f805f805f6080868803121561272a575f80fd5b85359450602086013593506040860135925060608601356001600160401b03811115612754575f80fd5b61276088828901612534565b969995985093965092949392505050565b5f8060408385031215612782575f80fd5b82356001600160401b0381168114612798575f80fd5b915060208301356001600160c01b03811681146127b3575f80fd5b809150509250929050565b5f805f80604085870312156127d1575f80fd5b84356001600160401b03808211156127e7575f80fd5b6127f388838901612534565b9096509450602087013591508082111561280b575f80fd5b506125bd87828801612534565b5f805f805f806060878903121561282d575f80fd5b86356001600160401b0380821115612843575f80fd5b61284f8a838b01612534565b90985096506020890135915080821115612867575f80fd5b6128738a838b01612534565b9096509450604089013591508082111561288b575f80fd5b5061289889828a01612534565b979a9699509497509295939492505050565b5f805f805f805f805f806101208b8d0312156128c4575f80fd5b8a35995060208b0135985060408b0135975060608b0135965060808b01356001600160401b038111156128f5575f80fd5b6129018d828e01612534565b90975095505060a08b0135935061291a60c08c01612600565b925060e08b013591506101008b013590509295989b9194979a5092959850565b5f805f805f8060c0878903121561294f575f80fd5b86359550602087013594506040870135935061296d60608801612600565b92506080870135915060a087013590509295509295509295565b5f805f805f805f805f6101208a8c0312156129a0575f80fd5b8935985060208a0135975060408a0135965060608a0135955060808a0135945060a08a0135935060c08a0135925060e08a013591506129e26101008b01612695565b90509295985092959850929598565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b634e487b7160e01b5f52601160045260245ffd5b818103818111156108e1576108e1612a32565b5f60208284031215612a69575f80fd5b8151801515811461153b575f80fd5b634e487b7160e01b5f52601260045260245ffd5b5f82612aa657634e487b7160e01b5f52601260045260245ffd5b500490565b8183525f6001600160fb1b03831115612ac2575f80fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b03861681526060602082018190525f90612aff9083018688612aab565b8281036040840152612b12818587612aab565b98975050505050505050565b5f8060408385031215612b2f575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52603260045260245ffd5b85815260018060a01b0385166020820152836040820152608060608201525f612b81608083018486612aab565b979650505050505050565b80820281158282048414176108e1576108e1612a32565b808201808211156108e1576108e1612a32565b5f81612bc457612bc4612a32565b505f190190565b61ffff818116838216019080821115612be657612be6612a32565b5092915050565b5f82518060208501845e5f92019182525091905056fecd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a26469706673582212200c338f32ceead59a79fa91b53e84dea3002dfe8df4ff91fe55455268f232c26764736f6c63430008190033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.