ERC-20
Overview
Max Total Supply
5,424,224.331376711040133508 ERC20 ***
Holders
20
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.46323674697069579 ERC20 ***Value
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
MaxStakingVault
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "@openzeppelin/contracts/interfaces/IERC165.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; import "@uniswap/swap-router-contracts/contracts/interfaces/IV3SwapRouter.sol"; import "./IV3OracleHelper.sol"; import "./IYieldWrapper.sol"; import "./IWrappedTokenPriceOracle.sol"; import "./IBasePriceOracle.sol"; contract MaxStakingVault is ERC20, Ownable, ReentrancyGuard { using SafeERC20 for IERC20; // --------------------------------------------------------- // STATE VARIABLES // --------------------------------------------------------- IERC20 public baseToken; // The token users deposit/withdraw IERC20 public rewardToken; // The token distributed as rewards IERC20 public baseRewardToken; // base token of reward token IV3SwapRouter public swapRouter; IYieldWrapper public yieldWrapperAddress; IUniswapV3Pool public Pair; IV3OracleHelper public V3OracleHelper; uint24 public defaultPoolFee; uint256 public depositFeeRate; // E.g. 0–500 => 0% to 5% uint256 public withdrawFeeRate; // E.g. 0–500 => 0% to 5% address public depositFeeCollector; address public withdrawFeeCollector; uint256 public constant MAX_FEE = 500; // 5% max // Slippage protection settings uint32 public twapSecondsAgo = 1800; // Default 30-minute TWAP uint256 public slippageTolerance = 500; // 500 = 5% max slippage // Reward math uint256 private rewardRate; // How many rewardTokens are distributed per second uint256 public lastUpdateTime; // Last time we calculated reward distribution uint256 private rewardPerTokenStored;// Accumulated reward per staked token in 1e18 precision uint256 private totalRewardsDeposited; // Sum of all reward tokens funded by admin uint256 private poolStartTime; // Timestamp when the reward pool starts uint256 private poolEndTime; // Timestamp when reward pool ends uint256 private poolDuration; // How long the reward pool lasts in seconds // Reward tracking mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; // Unclaimed reward tokens for each user mapping(address => uint256) private claimedRewards; // Total claimed by each user historically // Admin controlling which addresses can add new rewards mapping(address => bool) public allowedAccounts; // Price oracles (optional logic for APR calculations) address public basePriceOracle; address public wrappedTokenPriceOracle; uint8 public basePriceDecimals; uint8 public wrappedTokenPriceDecimals; // The base token’s decimals for consistency in the vault token uint8 private immutable _baseTokenDecimals; // --------------------------------------------------------- // EVENTS // --------------------------------------------------------- event FeeUpdated(string feeType, uint256 newRate); event FeeCollectorUpdated(string collectorType, address newCollector); event RewardsAdded(uint256 amount, uint256 newDuration); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardClaimed(address indexed user, uint256 reward); event Exit(address indexed user, uint256 amount, uint256 reward); event PriceOraclesUpdated( address basePriceOracle, address wrappedTokenPriceOracle, uint8 basePriceDecimals, uint8 wrappedTokenPriceDecimals ); event AllowedAccountUpdated(address account, bool status); event Sweep(address token, uint256 amount, address to); event Burn(address indexed user, uint256 amount); // --------------------------------------------------------- // CONSTRUCTOR // --------------------------------------------------------- constructor( address _baseToken, address _rewardToken, address _baseRewardToken, address _depositFeeCollector, address _withdrawFeeCollector, string memory name, string memory symbol ) ERC20(name, symbol) Ownable(msg.sender) { baseToken = IERC20(_baseToken); rewardToken = IERC20(_rewardToken); baseRewardToken = IERC20(_baseRewardToken); depositFeeCollector = _depositFeeCollector; withdrawFeeCollector = _withdrawFeeCollector; depositFeeRate = 0; // Initially 0% withdrawFeeRate = 0; // Initially 0% _baseTokenDecimals = ERC20(_baseToken).decimals(); } // --------------------------------------------------------- // ERC20 DECIMALS // --------------------------------------------------------- function decimals() public view override returns (uint8) { return _baseTokenDecimals; } // --------------------------------------------------------- // MODIFIERS // --------------------------------------------------------- modifier updateReward(address account) { // 1) Update the 'rewardPerTokenStored' to reflect all distribution up to now rewardPerTokenStored = rewardPerToken(); // 2) Update lastUpdateTime to be “now or poolEndTime” lastUpdateTime = block.timestamp > poolEndTime ? poolEndTime : block.timestamp; // 3) If we have a real account, finalize the user’s 'rewards[account]' to date if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } modifier onlyAllowed() { require(allowedAccounts[msg.sender], "Not allowed"); _; } // ----------------------------------------- // Configure the swap router & pool fee // ----------------------------------------- function setSwapConfig(address _router, uint24 _fee) external onlyOwner { swapRouter = IV3SwapRouter(_router); defaultPoolFee = _fee; } function setYieldWrapper(address _wrapper) external onlyOwner { yieldWrapperAddress = IYieldWrapper(_wrapper); } function setTwapSecondsAgo(uint32 _secondsAgo) external onlyOwner { require(_secondsAgo > 0, "Invalid TWAP window"); twapSecondsAgo = _secondsAgo; } function setSlippageTolerance(uint256 _slippage) external onlyOwner { require(_slippage <= 10000, "Slippage too high"); // Max 100% slippageTolerance = _slippage; } function setUniswapPool(address _pool) external onlyOwner { require(_pool != address(0), "Invalid pool address"); Pair = IUniswapV3Pool(_pool); } function setOracleHelper(address _helper) external onlyOwner { require(_helper != address(0), "Invalid address"); V3OracleHelper = IV3OracleHelper(_helper); } // --------------------------------------------------------- // VIEW FUNCTIONS // --------------------------------------------------------- function rewardPerToken() public view returns (uint256) { if (totalSupply() == 0) { return rewardPerTokenStored; } uint256 applicableTime = block.timestamp > poolEndTime ? poolEndTime : block.timestamp; // rewardRate * (delta time) * 1e18 / totalSupply return rewardPerTokenStored + ((applicableTime - lastUpdateTime) * rewardRate * 1e18) / totalSupply(); } function earned(address account) public view returns (uint256) { // (vaultTokenBalance * (rewardPerToken - userRewardPerTokenPaid)) / 1e18 + stored rewards return (balanceOf(account) * (rewardPerToken() - userRewardPerTokenPaid[account])) / 1e18 + rewards[account]; } function getBaseToken() external view returns (address) { return address(baseToken); } function getCurrentBalance() public view returns (uint256) { // This is how many baseTokens the vault contract currently holds return baseToken.balanceOf(address(this)); } function getRewardToken() external view returns (address) { return address(rewardToken); } function getDepositFee() external view returns (uint256) { return depositFeeRate; } function getWithdrawFee() external view returns (uint256) { return withdrawFeeRate; } function getTotalStaked() external view returns (uint256) { // The total supply of vault tokens return totalSupply(); } function getTotalRewardsDeposited() external view returns (uint256) { return totalRewardsDeposited; } function getBalanceOfUser(address account) external view returns (uint256) { // The user's vault token balance return balanceOf(account); } function getClaimedByUser(address account) external view returns (uint256) { return claimedRewards[account]; } function getUserPendingRewards(address account) external view returns (uint256) { return earned(account); } function getRewardRate() external view returns (uint256) { return rewardRate; } function getPoolStartTime() external view returns (uint256) { return poolStartTime; } function getPoolEndTime() external view returns (uint256) { return poolEndTime; } function getCurrentTime() external view returns (uint256) { return block.timestamp; } function getPoolDuration() external view returns (uint256) { return poolDuration; } // --------------------------------------------------------- // PRICE ORACLES (OPTIONAL) // --------------------------------------------------------- function getBasetokenPrice() external view returns (uint256) { uint256 basePrice = IBasePriceOracle(basePriceOracle).getMaxPrice(); return basePrice; } function getRewardTokenPrice() external view returns (uint256) { uint256 wrappedTokenUSDValue = IWrappedTokenPriceOracle(wrappedTokenPriceOracle).getWrappedTokenUSDValue(); return wrappedTokenUSDValue; } function burn(uint256 amount) external { require(amount > 0, "Burn amount must be > 0"); require(balanceOf(msg.sender) >= amount, "Insufficient vault token balance"); _burn(msg.sender, amount); emit Burn(msg.sender, amount); } function updatePriceOracles( address _basePriceOracle, address _wrappedTokenPriceOracle, uint8 _basePriceDecimals, uint8 _wrappedTokenPriceDecimals ) external onlyOwner { basePriceOracle = _basePriceOracle; wrappedTokenPriceOracle = _wrappedTokenPriceOracle; basePriceDecimals = _basePriceDecimals; wrappedTokenPriceDecimals = _wrappedTokenPriceDecimals; emit PriceOraclesUpdated( basePriceOracle, wrappedTokenPriceOracle, basePriceDecimals, wrappedTokenPriceDecimals ); } function calculateAPR() external view returns (uint256 aprIn1e18) { uint256 stakedSupply = totalSupply(); if (stakedSupply == 0) { return 0; } if (block.timestamp >= poolEndTime) { return 0; } uint256 basePrice = IBasePriceOracle(basePriceOracle).getMaxPrice(); uint256 rewardPrice = IWrappedTokenPriceOracle(wrappedTokenPriceOracle) .getWrappedTokenUSDValue(); uint256 normalizedBasePrice = basePrice * (10 ** (18 - basePriceDecimals)); uint256 normalizedRewardPrice = rewardPrice * (10 ** (18 - wrappedTokenPriceDecimals)); uint256 secondsPerYear = 31536000; uint256 yearlyRewardTokens = rewardRate * secondsPerYear; uint256 yearlyRewardsInUSD = (yearlyRewardTokens * normalizedRewardPrice) / 1e18; uint256 totalStakedValueInUSD = (stakedSupply * normalizedBasePrice) / 1e18; if (totalStakedValueInUSD == 0) { return 0; } aprIn1e18 = (yearlyRewardsInUSD * 1e18) / totalStakedValueInUSD; return aprIn1e18; } // --------------------------------------------------------- // ADMIN FUNCTIONS // --------------------------------------------------------- function setAllowedAccount(address account, bool status) external onlyOwner { allowedAccounts[account] = status; emit AllowedAccountUpdated(account, status); } function addRewards(uint256 rewardAmount, uint256 duration) external onlyAllowed updateReward(address(0)) { require(block.timestamp >= poolEndTime, "Current pool not ended yet"); require(rewardAmount > duration, "rewardAmount must be > duration (safety check)"); rewardRate = rewardAmount / duration; totalRewardsDeposited += rewardAmount; poolStartTime = block.timestamp; poolEndTime = block.timestamp + duration; poolDuration = duration; rewardToken.safeTransferFrom(msg.sender, address(this), rewardAmount); lastUpdateTime = block.timestamp; emit RewardsAdded(rewardAmount, duration); } // --------------------------------------------------------- // STAKE / WITHDRAW // --------------------------------------------------------- function stake(uint256 amount) external nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); uint256 fee = (amount * depositFeeRate) / 10000; uint256 amountAfterFee = amount - fee; // Transfer fee portion to fee collector (if set) if (fee > 0 && depositFeeCollector != address(0)) { baseToken.safeTransferFrom(msg.sender, depositFeeCollector, fee); } // Transfer the staked portion into the vault baseToken.safeTransferFrom(msg.sender, address(this), amountAfterFee); // Mint the vault tokens to the user, reflecting their share _mint(msg.sender, amountAfterFee); emit Staked(msg.sender, amountAfterFee); } function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); // Make sure user has that many vault tokens require(balanceOf(msg.sender) >= amount, "Insufficient vault token balance"); uint256 fee = (amount * withdrawFeeRate) / 10000; uint256 amountAfterFee = amount - fee; // Burn user’s vault tokens first _burn(msg.sender, amount); // Send fee to fee collector if (fee > 0 && withdrawFeeCollector != address(0)) { baseToken.safeTransfer(withdrawFeeCollector, fee); } // Transfer out the net base tokens baseToken.safeTransfer(msg.sender, amountAfterFee); emit Withdrawn(msg.sender, amountAfterFee); } // --------------------------------------------------------- // REWARDS // --------------------------------------------------------- function claimReward() public nonReentrant updateReward(msg.sender) { uint256 reward = rewards[msg.sender]; if (reward > 0) { require( rewardToken.balanceOf(address(this)) >= reward, "Not enough reward tokens in contract" ); // Reset the unclaimed before transferring out rewards[msg.sender] = 0; claimedRewards[msg.sender] += reward; rewardToken.safeTransfer(msg.sender, reward); emit RewardClaimed(msg.sender, reward); } } function exit() external { // Claim everything claimReward(); // Withdraw all vault tokens withdraw(balanceOf(msg.sender)); } // --------------------------------------------------------- // FORCE CLAIM ON TRANSFER // --------------------------------------------------------- /** * @dev Overridden to force a claim of rewards for both sender and recipient, * based on their balances *before* this transfer occurs. */ function transfer(address recipient, uint256 amount) public override updateReward(msg.sender) updateReward(recipient) returns (bool) { // First, forcibly claim the sender’s accrued reward uint256 senderReward = rewards[msg.sender]; if (senderReward > 0) { rewards[msg.sender] = 0; claimedRewards[msg.sender] += senderReward; rewardToken.safeTransfer(msg.sender, senderReward); emit RewardClaimed(msg.sender, senderReward); } // Next, forcibly claim the recipient’s accrued reward (if any) uint256 recipientReward = rewards[recipient]; if (recipientReward > 0) { rewards[recipient] = 0; claimedRewards[recipient] += recipientReward; rewardToken.safeTransfer(recipient, recipientReward); emit RewardClaimed(recipient, recipientReward); } return super.transfer(recipient, amount); } function transferFrom( address sender, address recipient, uint256 amount ) public override updateReward(sender) updateReward(recipient) returns (bool) { // Force-claim for sender uint256 senderReward = rewards[sender]; if (senderReward > 0) { rewards[sender] = 0; claimedRewards[sender] += senderReward; rewardToken.safeTransfer(sender, senderReward); emit RewardClaimed(sender, senderReward); } // Force-claim for recipient uint256 recipientReward = rewards[recipient]; if (recipientReward > 0) { rewards[recipient] = 0; claimedRewards[recipient] += recipientReward; rewardToken.safeTransfer(recipient, recipientReward); emit RewardClaimed(recipient, recipientReward); } // Normal ERC20 transferFrom return super.transferFrom(sender, recipient, amount); } // --------------------------------------------------------- // FEE SETTERS // --------------------------------------------------------- function setDepositFeeRate(uint256 _rate) external onlyOwner { require(_rate <= MAX_FEE, "Fee exceeds maximum"); depositFeeRate = _rate; emit FeeUpdated("Deposit", _rate); } function setWithdrawFeeRate(uint256 _rate) external onlyOwner { require(_rate <= MAX_FEE, "Fee exceeds maximum"); withdrawFeeRate = _rate; emit FeeUpdated("Withdraw", _rate); } function setDepositFeeCollector(address _collector) external onlyOwner { depositFeeCollector = _collector; emit FeeCollectorUpdated("Deposit", _collector); } function setWithdrawFeeCollector(address _collector) external onlyOwner { withdrawFeeCollector = _collector; emit FeeCollectorUpdated("Withdraw", _collector); } // --------------------------------------------------------- // SWEEP FUNCTION (EMERGENCY RECOVERY) // --------------------------------------------------------- function sweep(address token, address to) external onlyOwner { if (token == address(0)) { // Sweep native ETH payable(to).transfer(address(this).balance); } else { // Prevent sweeping base or reward tokens require(token != address(baseToken), "Cannot sweep base token"); require(token != address(rewardToken), "Cannot sweep reward token"); uint256 amount = IERC20(token).balanceOf(address(this)); IERC20(token).transfer(to, amount); emit Sweep(token, amount, to); } } // ----------------------------------------- // Compound function // ----------------------------------------- function compound() external nonReentrant updateReward(msg.sender) { uint256 rewardOwed = rewards[msg.sender]; require(rewardOwed > 0, "No rewards to compound"); rewards[msg.sender] = 0; claimedRewards[msg.sender] += rewardOwed; uint256 tokensToProcess = rewardOwed; uint256 tokensToSwap; if (address(rewardToken) == address(baseRewardToken)) { tokensToSwap = tokensToProcess; } else if (address(rewardToken) != address(baseRewardToken) && address(baseRewardToken) != address(0)) { require(rewardToken.balanceOf(address(this)) >= tokensToProcess,"Vault doesn't have enough rewardToken"); uint256 balanceBefore = baseRewardToken.balanceOf(address(this)); yieldWrapperAddress.withdraw(tokensToProcess); uint256 balanceAfter = baseRewardToken.balanceOf(address(this)); uint256 baseOut = balanceAfter - balanceBefore; tokensToSwap = baseOut; } else { revert("Invalid reward token"); } require(tokensToSwap > 0, "No tokens to swap"); baseRewardToken.approve(address(swapRouter), tokensToSwap); uint256 expectedAmount = _getExpectedOutput(tokensToSwap, address(baseRewardToken), address(baseToken)); uint256 minAmountOut = (expectedAmount * (10000 - slippageTolerance)) / 10000; IV3SwapRouter.ExactInputSingleParams memory params = IV3SwapRouter.ExactInputSingleParams({ tokenIn: address(baseRewardToken), tokenOut: address(baseToken), fee: defaultPoolFee, recipient: address(this), amountIn: tokensToSwap, amountOutMinimum: minAmountOut, sqrtPriceLimitX96: 0 }); uint256 swappedAmount = swapRouter.exactInputSingle(params); require(swappedAmount > 0, "Swap failed"); _stakeCompounded(msg.sender, swappedAmount); } function _stakeCompounded(address user, uint256 amount) internal { _mint(user, amount); emit Staked(user, amount); } function _getExpectedOutput(uint256 amountIn, address tokenIn, address tokenOut) internal view returns (uint256 expectedAmount) { require(address(Pair) != address(0), "Uniswap pool not set"); int24 twapTick = V3OracleHelper.getTWAPTick(address(Pair), twapSecondsAgo); expectedAmount = V3OracleHelper._getExpectedOutput(twapTick, uint128(amountIn), tokenIn, tokenOut); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; interface IBasePriceOracle { function getMaxPrice() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; interface IWrappedTokenPriceOracle { function getWrappedTokenUSDValue() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; interface IYieldWrapper { function withdraw(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; /** * @title IV3OracleHelper * @notice Interface for interacting with V3OracleHelper */ interface IV3OracleHelper { /// @notice Fetches the TWAP tick from a Uniswap V3 pool /// @param pool The address of the Uniswap V3 pool /// @param secondsAgo How far back to fetch the TWAP tick /// @return arithmeticMeanTick The computed TWAP tick function getTWAPTick(address pool, uint32 secondsAgo) external view returns (int24 arithmeticMeanTick); /// @notice Computes expected output based on a given tick and input amount /// @param tick The TWAP tick /// @param baseAmount The amount of the base token to be converted /// @param baseToken The input token address /// @param quoteToken The output token address /// @return quoteAmount The expected output amount in `quoteToken` function _getExpectedOutput( int24 tick, uint128 baseAmount, address baseToken, address quoteToken ) external pure returns (uint256 quoteAmount); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol'; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface IV3SwapRouter is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance, /// and swap the entire amount, enabling contracts to send tokens before calling this function. /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance, /// and swap the entire amount, enabling contracts to send tokens before calling this function. /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// that may remain in the router after the swap. /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// that may remain in the router after the swap. /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import './pool/IUniswapV3PoolImmutables.sol'; import './pool/IUniswapV3PoolState.sol'; import './pool/IUniswapV3PoolDerivedState.sol'; import './pool/IUniswapV3PoolActions.sol'; import './pool/IUniswapV3PoolOwnerActions.sol'; import './pool/IUniswapV3PoolEvents.sol'; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState, IUniswapV3PoolDerivedState, IUniswapV3PoolActions, IUniswapV3PoolOwnerActions, IUniswapV3PoolEvents { }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// 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.1.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 { /** * @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. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ 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. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ 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. * * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being * set here. */ 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). * * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements. */ function _callOptionalReturn(IERC20 token, bytes memory data) private { uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) // bubble errors if iszero(success) { let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize()) revert(ptr, returndatasize()) } returnSize := returndatasize() returnValue := mload(0) } if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) { 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 silently catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC-20 * applications. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Skips emitting an {Approval} event indicating an allowance update. This is not * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve]. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * * ```solidity * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IUniswapV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees /// @param feeProtocol0 new protocol fee for token0 of the pool /// @param feeProtocol1 new protocol fee for token1 of the pool function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IUniswapV3PoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IUniswapV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.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 assembly ("memory-safe") { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert Errors.FailedCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.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.1.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.1.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC-20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC-721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC-1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC-20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol) 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. * * _Available since v5.1._ */ 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(); /** * @dev A necessary precompile is missing. */ error MissingPrecompile(address); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "remappings": [] }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_baseToken","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_baseRewardToken","type":"address"},{"internalType":"address","name":"_depositFeeCollector","type":"address"},{"internalType":"address","name":"_withdrawFeeCollector","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","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":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"AllowedAccountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Burn","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":"reward","type":"uint256"}],"name":"Exit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"collectorType","type":"string"},{"indexed":false,"internalType":"address","name":"newCollector","type":"address"}],"name":"FeeCollectorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"feeType","type":"string"},{"indexed":false,"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"FeeUpdated","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":"basePriceOracle","type":"address"},{"indexed":false,"internalType":"address","name":"wrappedTokenPriceOracle","type":"address"},{"indexed":false,"internalType":"uint8","name":"basePriceDecimals","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"wrappedTokenPriceDecimals","type":"uint8"}],"name":"PriceOraclesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"RewardsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"Sweep","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"Pair","outputs":[{"internalType":"contract IUniswapV3Pool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"V3OracleHelper","outputs":[{"internalType":"contract IV3OracleHelper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"addRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedAccounts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"basePriceDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"basePriceOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseRewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"calculateAPR","outputs":[{"internalType":"uint256","name":"aprIn1e18","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"compound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultPoolFee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositFeeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getBalanceOfUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBasetokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getClaimedByUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDepositFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalRewardsDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getUserPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWithdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setAllowedAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collector","type":"address"}],"name":"setDepositFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"setDepositFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_helper","type":"address"}],"name":"setOracleHelper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"setSlippageTolerance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"},{"internalType":"uint24","name":"_fee","type":"uint24"}],"name":"setSwapConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_secondsAgo","type":"uint32"}],"name":"setTwapSecondsAgo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"setUniswapPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collector","type":"address"}],"name":"setWithdrawFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"setWithdrawFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wrapper","type":"address"}],"name":"setYieldWrapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slippageTolerance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapRouter","outputs":[{"internalType":"contract IV3SwapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"twapSecondsAgo","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_basePriceOracle","type":"address"},{"internalType":"address","name":"_wrappedTokenPriceOracle","type":"address"},{"internalType":"uint8","name":"_basePriceDecimals","type":"uint8"},{"internalType":"uint8","name":"_wrappedTokenPriceDecimals","type":"uint8"}],"name":"updatePriceOracles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFeeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wrappedTokenPriceDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wrappedTokenPriceOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yieldWrapperAddress","outputs":[{"internalType":"contract IYieldWrapper","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a06040526011805463ffffffff60a01b191660e160a31b1790556101f460125534801561002b575f5ffd5b506040516139a43803806139a483398101604081905261004a9161027c565b338282600361005983826103b6565b50600461006682826103b6565b5050506001600160a01b03811661009657604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61009f81610173565b506001600655600780546001600160a01b03808a166001600160a01b03199283168117909355600880548a8316908416179055600980548983169084161790556010805488831690841617905560118054918716919092161790555f600e819055600f556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa15801561013c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101609190610470565b60ff166080525061049795505050505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b80516001600160a01b03811681146101da575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610202575f5ffd5b81516001600160401b0381111561021b5761021b6101df565b604051601f8201601f19908116603f011681016001600160401b0381118282101715610249576102496101df565b604052818152838201602001851015610260575f5ffd5b8160208501602083015e5f918101602001919091529392505050565b5f5f5f5f5f5f5f60e0888a031215610292575f5ffd5b61029b886101c4565b96506102a9602089016101c4565b95506102b7604089016101c4565b94506102c5606089016101c4565b93506102d3608089016101c4565b60a08901519093506001600160401b038111156102ee575f5ffd5b6102fa8a828b016101f3565b60c08a015190935090506001600160401b03811115610317575f5ffd5b6103238a828b016101f3565b91505092959891949750929550565b600181811c9082168061034657607f821691505b60208210810361036457634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156103b157805f5260205f20601f840160051c8101602085101561038f5750805b601f840160051c820191505b818110156103ae575f815560010161039b565b50505b505050565b81516001600160401b038111156103cf576103cf6101df565b6103e3816103dd8454610332565b8461036a565b6020601f821160018114610415575f83156103fe5750848201515b5f19600385901b1c1916600184901b1784556103ae565b5f84815260208120601f198516915b828110156104445787850151825560209485019460019092019101610424565b508482101561046157868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f60208284031215610480575f5ffd5b815160ff81168114610490575f5ffd5b9392505050565b6080516134f56104af5f395f6105a501526134f55ff3fe608060405234801561000f575f5ffd5b5060043610610437575f3560e01c80638e691b9a11610237578063cd3daf9d11610135578063ea99e689116100bf578063f69e204611610084578063f69e204614610979578063f7c618c114610981578063f7d57b8114610994578063f9a9cab41461099c578063fc41aa09146109af575f5ffd5b8063ea99e6891461093a578063ee0f0e0514610943578063f2494f3b14610956578063f2fde38b1461095e578063f567bf0214610971575f5ffd5b8063dc345c9011610105578063dc345c90146108b2578063dd62ed3e146108c5578063e04610ed146108fd578063e921b0061461091f578063e9fad8ee14610932575f5ffd5b8063cd3daf9d1461087b578063cf7c11fa14610883578063d03153aa14610896578063d0fb90ca1461089f575f5ffd5b8063aae555de116101c1578063bf5f1c1211610186578063bf5f1c121461081c578063c0477b9214610844578063c31c9c071461084c578063c55dae631461085f578063c8f33c9114610872575f5ffd5b8063aae555de146107d1578063adc1f0d7146107e5578063b88a802f146107f8578063b8dc491b14610800578063bc063e1a14610813575f5ffd5b806397a268621161020757806397a268621461077f57806398acd7a614610792578063a5749710146107a3578063a694fc3a146107ab578063a9059cbb146107be575f5ffd5b80638e691b9a1461073e5780638f90e9021461075157806390f595981461076457806395d89b4114610777575f5ffd5b8063367dfede116103445780636f60a6dd116102ce5780637e1a3786116102935780637e1a3786146106ea578063852cb9b8146106f257806389114268146106fb5780638b8763471461070e5780638da5cb5b1461072d575f5ffd5b80636f60a6dd1461065c57806370a0823114610686578063715018a6146106ae578063784c6524146106b657806379ef2771146106e2575f5ffd5b806342966c681161031457806342966c68146105ff57806345909a6f146106125780635d2e64011461062557806365c21d921461063857806369940d791461064b575f5ffd5b8063367dfede146105c95780633736421b146105d157806339916f74146105e45780633d6be31f146105f7575f5ffd5b80630de705b5116103c557806318160ddd1161039557806318160ddd1461056f57806323b872dd1461057757806329cb924d1461058a5780632e1a7d4d14610590578063313ce567146105a3575f5ffd5b80630de705b514610526578063106848441461052e578063117da1ee146105545780631540aa8914610567575f5ffd5b8063072d05991161040b578063072d0599146104c057806308941b1f146104d55780630917e776146104e8578063095ea7b3146104f0578063096015b014610513575f5ffd5b80628cc2621461043b57806301d3ee0a1461046157806306fdde031461048c5780630700037d146104a1575b5f5ffd5b61044e610449366004612fc3565b6109c2565b6040519081526020015b60405180910390f35b600d54610474906001600160a01b031681565b6040516001600160a01b039091168152602001610458565b610494610a3d565b6040516104589190612fe3565b61044e6104af366004612fc3565b601b6020525f908152604090205481565b6104d36104ce366004613018565b610acd565b005b601e54610474906001600160a01b031681565b61044e610b1b565b6105036104fe366004613054565b610b2a565b6040519015158152602001610458565b6104d361052136600461307c565b610b41565b600e5461044e565b601f5461054290600160a01b900460ff1681565b60405160ff9091168152602001610458565b6104d361056236600461307c565b610bd6565b600f5461044e565b60025461044e565b610503610585366004613093565b610c29565b4261044e565b6104d361059e36600461307c565b610e49565b7f0000000000000000000000000000000000000000000000000000000000000000610542565b60175461044e565b600c54610474906001600160a01b031681565b6104d36105f23660046130cd565b611024565b60165461044e565b6104d361060d36600461307c565b61109d565b61044e610620366004612fc3565b61118c565b6104d3610633366004612fc3565b6111a9565b6104d3610646366004612fc3565b61121b565b6008546001600160a01b0316610474565b600d5461067290600160a01b900462ffffff1681565b60405162ffffff9091168152602001610458565b61044e610694366004612fc3565b6001600160a01b03165f9081526020819052604090205490565b6104d3611245565b6011546106cd90600160a01b900463ffffffff1681565b60405163ffffffff9091168152602001610458565b61044e611258565b60135461044e565b61044e600e5481565b601f54610474906001600160a01b031681565b61044e61071c366004612fc3565b601a6020525f908152604090205481565b6005546001600160a01b0316610474565b6104d361074c36600461307c565b6112ce565b6104d361075f366004612fc3565b611353565b6104d36107723660046130fd565b6113ca565b610494611434565b6104d361078d366004613137565b611443565b6007546001600160a01b0316610474565b61044e611502565b6104d36107b936600461307c565b61156c565b6105036107cc366004613054565b6116d5565b601f5461054290600160a81b900460ff1681565b6104d36107f3366004612fc3565b6118d3565b6104d3611926565b6104d361080e366004613188565b611ae2565b61044e6101f481565b61044e61082a366004612fc3565b6001600160a01b03165f908152601c602052604090205490565b60185461044e565b600a54610474906001600160a01b031681565b600754610474906001600160a01b031681565b61044e60145481565b61044e611d1d565b61044e610891366004612fc3565b611d9c565b61044e60125481565b600954610474906001600160a01b031681565b6104d36108c0366004612fc3565b611da6565b61044e6108d3366004613188565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b61050361090b366004612fc3565b601d6020525f908152604090205460ff1681565b601054610474906001600160a01b031681565b6104d3611df9565b61044e600f5481565b601154610474906001600160a01b031681565b61044e611e19565b6104d361096c366004612fc3565b612026565b61044e612060565b6104d36120b2565b600854610474906001600160a01b031681565b60195461044e565b600b54610474906001600160a01b031681565b6104d36109bd3660046131b9565b612697565b6001600160a01b0381165f908152601b6020908152604080832054601a909252822054670de0b6b3a7640000906109f7611d1d565b610a0191906131ed565b6001600160a01b0385165f90815260208190526040902054610a239190613200565b610a2d9190613217565b610a379190613236565b92915050565b606060038054610a4c90613249565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7890613249565b8015610ac35780601f10610a9a57610100808354040283529160200191610ac3565b820191905f5260205f20905b815481529060010190602001808311610aa657829003601f168201915b5050505050905090565b610ad5612891565b600a80546001600160a01b039093166001600160a01b031990931692909217909155600d805462ffffff909216600160a01b0262ffffff60a01b19909216919091179055565b5f610b2560025490565b905090565b5f33610b378185856128be565b5060019392505050565b610b49612891565b6101f4811115610b965760405162461bcd60e51b81526020600482015260136024820152724665652065786365656473206d6178696d756d60681b60448201526064015b60405180910390fd5b600f8190556040517fc5dbbc1a39078c6d41f75645288952af1adce3154214371d76e773566564245390610bcb908390613281565b60405180910390a150565b610bde612891565b612710811115610c245760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b6044820152606401610b8d565b601255565b5f83610c33611d1d565b6015556018544211610c455742610c49565b6018545b6014556001600160a01b03811615610c8f57610c64816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b83610c98611d1d565b6015556018544211610caa5742610cae565b6018545b6014556001600160a01b03811615610cf457610cc9816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b6001600160a01b0386165f908152601b60205260409020548015610d93576001600160a01b0387165f908152601b60209081526040808320839055601c90915281208054839290610d46908490613236565b9091555050600854610d62906001600160a01b031688836128cb565b866001600160a01b03165f5160206134a05f395f51905f5282604051610d8a91815260200190565b60405180910390a25b6001600160a01b0386165f908152601b60205260409020548015610e32576001600160a01b0387165f908152601b60209081526040808320839055601c90915281208054839290610de5908490613236565b9091555050600854610e01906001600160a01b031688836128cb565b866001600160a01b03165f5160206134a05f395f51905f5282604051610e2991815260200190565b60405180910390a25b610e3d88888861292a565b98975050505050505050565b610e5161294d565b33610e5a611d1d565b6015556018544211610e6c5742610e70565b6018545b6014556001600160a01b03811615610eb657610e8b816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b5f8211610ef95760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b6044820152606401610b8d565b335f90815260208190526040902054821115610f575760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e74207661756c7420746f6b656e2062616c616e63656044820152606401610b8d565b5f612710600f5484610f699190613200565b610f739190613217565b90505f610f8082856131ed565b9050610f8c33856129a6565b5f82118015610fa557506011546001600160a01b031615155b15610fc757601154600754610fc7916001600160a01b039182169116846128cb565b600754610fde906001600160a01b031633836128cb565b60405181815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a25050506110216001600655565b50565b61102c612891565b5f8163ffffffff16116110775760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420545741502077696e646f7760681b6044820152606401610b8d565b6011805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b5f81116110ec5760405162461bcd60e51b815260206004820152601760248201527f4275726e20616d6f756e74206d757374206265203e20300000000000000000006044820152606401610b8d565b335f9081526020819052604090205481111561114a5760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e74207661756c7420746f6b656e2062616c616e63656044820152606401610b8d565b61115433826129a6565b60405181815233907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59060200160405180910390a250565b6001600160a01b0381165f90815260208190526040812054610a37565b6111b1612891565b6001600160a01b0381166111f95760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610b8d565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b611223612891565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b61124d612891565b6112565f6129da565b565b5f5f601f5f9054906101000a90046001600160a01b03166001600160a01b0316639feb838f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112aa573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a3791906132b6565b6112d6612891565b6101f481111561131e5760405162461bcd60e51b81526020600482015260136024820152724665652065786365656473206d6178696d756d60681b6044820152606401610b8d565b600e8190556040517fc5dbbc1a39078c6d41f75645288952af1adce3154214371d76e773566564245390610bcb9083906132cd565b61135b612891565b6001600160a01b0381166113a85760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420706f6f6c206164647265737360601b6044820152606401610b8d565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6113d2612891565b6001600160a01b0382165f818152601d6020908152604091829020805460ff19168515159081179091558251938452908301527f85a68034076f99047d5db3dd6a0adaa05addad1c2d330a044b888fbf7aa47e93910160405180910390a15050565b606060048054610a4c90613249565b61144b612891565b601e80546001600160a01b0319166001600160a01b03868116918217909255601f80548684166001600160a81b031990911617600160a01b60ff87811682029290921760ff60a81b198116600160a81b888516810291821795869055604080519788529288169190971617602086015290830482169084015292900490911660608201527fd77682fd3b49e38bc0fbb20604d768b100437ddca38938ab52b5a35de6b6ae5f9060800160405180910390a150505050565b6007546040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa158015611548573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b2591906132b6565b61157461294d565b3361157d611d1d565b601555601854421161158f5742611593565b6018545b6014556001600160a01b038116156115d9576115ae816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b5f82116116195760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606401610b8d565b5f612710600e548461162b9190613200565b6116359190613217565b90505f61164282856131ed565b90505f8211801561165d57506010546001600160a01b031615155b1561168157601054600754611681916001600160a01b039182169133911685612a2b565b600754611699906001600160a01b0316333084612a2b565b6116a33382612a6a565b60405181815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200161100c565b5f336116df611d1d565b60155560185442116116f157426116f5565b6018545b6014556001600160a01b0381161561173b57611710816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b83611744611d1d565b6015556018544211611756574261175a565b6018545b6014556001600160a01b038116156117a057611775816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b335f908152601b6020526040902054801561181f57335f908152601b60209081526040808320839055601c909152812080548392906117e0908490613236565b90915550506008546117fc906001600160a01b031633836128cb565b60405181815233905f5160206134a05f395f51905f529060200160405180910390a25b6001600160a01b0386165f908152601b602052604090205480156118be576001600160a01b0387165f908152601b60209081526040808320839055601c90915281208054839290611871908490613236565b909155505060085461188d906001600160a01b031688836128cb565b866001600160a01b03165f5160206134a05f395f51905f52826040516118b591815260200190565b60405180910390a25b6118c88787612a9e565b979650505050505050565b6118db612891565b601180546001600160a01b0319166001600160a01b0383161790556040517f90a902de365607bc2642db48414bf5c3e05c90f87dfef76d6bab1f39a9feecbf90610bcb9083906132f3565b61192e61294d565b33611937611d1d565b6015556018544211611949574261194d565b6018545b6014556001600160a01b0381161561199357611968816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b335f908152601b60205260409020548015611ad6576008546040516370a0823160e01b815230600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa1580156119ee573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a1291906132b6565b1015611a6c5760405162461bcd60e51b8152602060048201526024808201527f4e6f7420656e6f7567682072657761726420746f6b656e7320696e20636f6e746044820152631c9858dd60e21b6064820152608401610b8d565b335f908152601b60209081526040808320839055601c90915281208054839290611a97908490613236565b9091555050600854611ab3906001600160a01b031633836128cb565b60405181815233905f5160206134a05f395f51905f529060200160405180910390a25b50506112566001600655565b611aea612891565b6001600160a01b038216611b2f576040516001600160a01b038216904780156108fc02915f818181858888f19350505050158015611b2a573d5f5f3e3d5ffd5b505050565b6007546001600160a01b0390811690831603611b8d5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207377656570206261736520746f6b656e0000000000000000006044820152606401610b8d565b6008546001600160a01b0390811690831603611beb5760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f742073776565702072657761726420746f6b656e000000000000006044820152606401610b8d565b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa158015611c2f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c5391906132b6565b60405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390529192509084169063a9059cbb906044016020604051808303815f875af1158015611ca3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cc79190613334565b50604080516001600160a01b038086168252602082018490528416918101919091527f8d71d334346acd8aade4cdca3af39a37fca2620cd870d28ccf94ae4ade61c8f3906060015b60405180910390a1505b5050565b5f611d2760025490565b5f03611d34575060155490565b5f6018544211611d445742611d48565b6018545b9050611d5360025490565b601354601454611d6390846131ed565b611d6d9190613200565b611d7f90670de0b6b3a7640000613200565b611d899190613217565b601554611d969190613236565b91505090565b5f610a37826109c2565b611dae612891565b601080546001600160a01b0319166001600160a01b0383161790556040517f90a902de365607bc2642db48414bf5c3e05c90f87dfef76d6bab1f39a9feecbf90610bcb90839061334f565b611e01611926565b335f9081526020819052604090205461125690610e49565b5f5f611e2460025490565b9050805f03611e34575f91505090565b6018544210611e44575f91505090565b601e546040805163416c6ffb60e11b815290515f926001600160a01b0316916382d8dff69160048083019260209291908290030181865afa158015611e8b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611eaf91906132b6565b90505f601f5f9054906101000a90046001600160a01b03166001600160a01b0316639feb838f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f02573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f2691906132b6565b601f549091505f90611f4390600160a01b900460ff166012613375565b611f4e90600a613471565b611f589084613200565b601f549091505f90611f7590600160a81b900460ff166012613375565b611f8090600a613471565b611f8a9084613200565b90505f6301e1338090505f81601354611fa39190613200565b90505f670de0b6b3a7640000611fb98584613200565b611fc39190613217565b90505f670de0b6b3a7640000611fd9878b613200565b611fe39190613217565b9050805f03611ffb575f995050505050505050505090565b8061200e83670de0b6b3a7640000613200565b6120189190613217565b995050505050505050505090565b61202e612891565b6001600160a01b03811661205757604051631e4fbdf760e01b81525f6004820152602401610b8d565b611021816129da565b5f5f601e5f9054906101000a90046001600160a01b03166001600160a01b03166382d8dff66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112aa573d5f5f3e3d5ffd5b6120ba61294d565b336120c3611d1d565b60155560185442116120d557426120d9565b6018545b6014556001600160a01b0381161561211f576120f4816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b335f908152601b6020526040902054806121745760405162461bcd60e51b8152602060048201526016602482015275139bc81c995dd85c991cc81d1bc818dbdb5c1bdd5b9960521b6044820152606401610b8d565b335f908152601b60209081526040808320839055601c9091528120805483929061219f908490613236565b909155505060095460085482915f916001600160a01b039182169116036121c7575080612444565b6009546008546001600160a01b039081169116148015906121f257506009546001600160a01b031615155b15612405576008546040516370a0823160e01b815230600482015283916001600160a01b0316906370a0823190602401602060405180830381865afa15801561223d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061226191906132b6565b10156122bd5760405162461bcd60e51b815260206004820152602560248201527f5661756c7420646f65736e2774206861766520656e6f756768207265776172646044820152642a37b5b2b760d91b6064820152608401610b8d565b6009546040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa158015612303573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061232791906132b6565b600b54604051632e1a7d4d60e01b8152600481018690529192506001600160a01b031690632e1a7d4d906024015f604051808303815f87803b15801561236b575f5ffd5b505af115801561237d573d5f5f3e3d5ffd5b50506009546040516370a0823160e01b81523060048201525f93506001600160a01b0390911691506370a0823190602401602060405180830381865afa1580156123c9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123ed91906132b6565b90505f6123fa83836131ed565b935061244492505050565b60405162461bcd60e51b815260206004820152601460248201527324b73b30b634b2103932bbb0b932103a37b5b2b760611b6044820152606401610b8d565b5f81116124875760405162461bcd60e51b815260206004820152601160248201527004e6f20746f6b656e7320746f207377617607c1b6044820152606401610b8d565b600954600a5460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b3906044016020604051808303815f875af11580156124d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124fd9190613334565b506009546007545f9161251e9184916001600160a01b039081169116612aab565b90505f61271060125461271061253491906131ed565b61253e9084613200565b6125489190613217565b6040805160e0810182526009546001600160a01b039081168252600754811660208301908152600d54600160a01b900462ffffff9081168486019081523060608601908152608086018b815260a087018981525f60c08901818152600a549a516304e45aaf60e01b81528a518a166004820152975189166024890152945190951660448701529151861660648601525160848501525160a484015251831660c483015294955091939216906304e45aaf9060e4016020604051808303815f875af1158015612618573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061263c91906132b6565b90505f811161267b5760405162461bcd60e51b815260206004820152600b60248201526a14ddd85c0819985a5b195960aa1b6044820152606401610b8d565b6126853382612c25565b50505050505050506112566001600655565b335f908152601d602052604090205460ff166126e35760405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b6044820152606401610b8d565b5f6126ec611d1d565b60155560185442116126fe5742612702565b6018545b6014556001600160a01b038116156127485761271d816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b60185442101561279a5760405162461bcd60e51b815260206004820152601a60248201527f43757272656e7420706f6f6c206e6f7420656e646564207965740000000000006044820152606401610b8d565b8183116128005760405162461bcd60e51b815260206004820152602e60248201527f726577617264416d6f756e74206d757374206265203e206475726174696f6e2060448201526d2873616665747920636865636b2960901b6064820152608401610b8d565b61280a8284613217565b6013819055508260165f8282546128219190613236565b9091555050426017819055612837908390613236565b6018556019829055600854612857906001600160a01b0316333086612a2b565b4260145560408051848152602081018490527f40df43107e8b4d467127964bd3c966687c0a6a39aaede970755397fd09535e989101611d0f565b6005546001600160a01b031633146112565760405163118cdaa760e01b8152336004820152602401610b8d565b611b2a8383836001612c76565b6040516001600160a01b03838116602483015260448201839052611b2a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050612d48565b5f33612937858285612db4565b612942858585612e29565b506001949350505050565b60026006540361299f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b8d565b6002600655565b6001600160a01b0382166129cf57604051634b637e8f60e11b81525f6004820152602401610b8d565b611d19825f83612e82565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6040516001600160a01b038481166024830152838116604483015260648201839052612a649186918216906323b872dd906084016128f8565b50505050565b6001600160a01b038216612a935760405163ec442f0560e01b81525f6004820152602401610b8d565b611d195f8383612e82565b5f33610b37818585612e29565b600c545f906001600160a01b0316612afc5760405162461bcd60e51b8152602060048201526014602482015273155b9a5cddd85c081c1bdbdb081b9bdd081cd95d60621b6044820152606401610b8d565b600d54600c546011546040516310b3596960e11b81526001600160a01b039283166004820152600160a01b90910463ffffffff1660248201525f929190911690632166b2d290604401602060405180830381865afa158015612b60573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b84919061347f565b600d5460405163993c04ab60e01b8152600283900b60048201526fffffffffffffffffffffffffffffffff881660248201526001600160a01b038781166044830152868116606483015292935091169063993c04ab90608401602060405180830381865afa158015612bf8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c1c91906132b6565b95945050505050565b612c2f8282612a6a565b816001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d82604051612c6a91815260200190565b60405180910390a25050565b6001600160a01b038416612c9f5760405163e602df0560e01b81525f6004820152602401610b8d565b6001600160a01b038316612cc857604051634a1406b160e11b81525f6004820152602401610b8d565b6001600160a01b038085165f9081526001602090815260408083209387168352929052208290558015612a6457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051612d3a91815260200190565b60405180910390a350505050565b5f5f60205f8451602086015f885af180612d67576040513d5f823e3d81fd5b50505f513d91508115612d7e578060011415612d8b565b6001600160a01b0384163b155b15612a6457604051635274afe760e01b81526001600160a01b0385166004820152602401610b8d565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f198114612a645781811015612e1b57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610b8d565b612a6484848484035f612c76565b6001600160a01b038316612e5257604051634b637e8f60e11b81525f6004820152602401610b8d565b6001600160a01b038216612e7b5760405163ec442f0560e01b81525f6004820152602401610b8d565b611b2a8383835b6001600160a01b038316612eac578060025f828254612ea19190613236565b90915550612f1c9050565b6001600160a01b0383165f9081526020819052604090205481811015612efe5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610b8d565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216612f3857600280548290039055612f56565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612f9b91815260200190565b60405180910390a3505050565b80356001600160a01b0381168114612fbe575f5ffd5b919050565b5f60208284031215612fd3575f5ffd5b612fdc82612fa8565b9392505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f5f60408385031215613029575f5ffd5b61303283612fa8565b9150602083013562ffffff81168114613049575f5ffd5b809150509250929050565b5f5f60408385031215613065575f5ffd5b61306e83612fa8565b946020939093013593505050565b5f6020828403121561308c575f5ffd5b5035919050565b5f5f5f606084860312156130a5575f5ffd5b6130ae84612fa8565b92506130bc60208501612fa8565b929592945050506040919091013590565b5f602082840312156130dd575f5ffd5b813563ffffffff81168114612fdc575f5ffd5b8015158114611021575f5ffd5b5f5f6040838503121561310e575f5ffd5b61311783612fa8565b91506020830135613049816130f0565b803560ff81168114612fbe575f5ffd5b5f5f5f5f6080858703121561314a575f5ffd5b61315385612fa8565b935061316160208601612fa8565b925061316f60408601613127565b915061317d60608601613127565b905092959194509250565b5f5f60408385031215613199575f5ffd5b6131a283612fa8565b91506131b060208401612fa8565b90509250929050565b5f5f604083850312156131ca575f5ffd5b50508035926020909101359150565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610a3757610a376131d9565b8082028115828204841417610a3757610a376131d9565b5f8261323157634e487b7160e01b5f52601260045260245ffd5b500490565b80820180821115610a3757610a376131d9565b600181811c9082168061325d57607f821691505b60208210810361327b57634e487b7160e01b5f52602260045260245ffd5b50919050565b604081525f6132a8604083016008815267576974686472617760c01b602082015260400190565b905082602083015292915050565b5f602082840312156132c6575f5ffd5b5051919050565b604081525f6132a860408301600781526611195c1bdcda5d60ca1b602082015260400190565b604081525f61331a604083016008815267576974686472617760c01b602082015260400190565b6001600160a01b0393909316602092909201919091525090565b5f60208284031215613344575f5ffd5b8151612fdc816130f0565b604081525f61331a60408301600781526611195c1bdcda5d60ca1b602082015260400190565b60ff8281168282160390811115610a3757610a376131d9565b6001815b60018411156133c9578085048111156133ad576133ad6131d9565b60018416156133bb57908102905b60019390931c928002613392565b935093915050565b5f826133df57506001610a37565b816133eb57505f610a37565b8160018114613401576002811461340b57613427565b6001915050610a37565b60ff84111561341c5761341c6131d9565b50506001821b610a37565b5060208310610133831016604e8410600b841016171561344a575081810a610a37565b6134565f19848461338e565b805f1904821115613469576134696131d9565b029392505050565b5f612fdc60ff8416836133d1565b5f6020828403121561348f575f5ffd5b81518060020b8114612fdc575f5ffdfe106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241a2646970667358221220c0110b15ee50e4d6ae8184322d0ab7befbc7ef816e4638c07d0aad02aefe23ae64736f6c634300081c00330000000000000000000000008805792d41facb22b6f47d468b06af36ff3fc1c5000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000d98ed1716e011ee5549ffcf10159bd25dfed8ade000000000000000000000000d98ed1716e011ee5549ffcf10159bd25dfed8ade00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000084d4158765553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064d76555344430000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561000f575f5ffd5b5060043610610437575f3560e01c80638e691b9a11610237578063cd3daf9d11610135578063ea99e689116100bf578063f69e204611610084578063f69e204614610979578063f7c618c114610981578063f7d57b8114610994578063f9a9cab41461099c578063fc41aa09146109af575f5ffd5b8063ea99e6891461093a578063ee0f0e0514610943578063f2494f3b14610956578063f2fde38b1461095e578063f567bf0214610971575f5ffd5b8063dc345c9011610105578063dc345c90146108b2578063dd62ed3e146108c5578063e04610ed146108fd578063e921b0061461091f578063e9fad8ee14610932575f5ffd5b8063cd3daf9d1461087b578063cf7c11fa14610883578063d03153aa14610896578063d0fb90ca1461089f575f5ffd5b8063aae555de116101c1578063bf5f1c1211610186578063bf5f1c121461081c578063c0477b9214610844578063c31c9c071461084c578063c55dae631461085f578063c8f33c9114610872575f5ffd5b8063aae555de146107d1578063adc1f0d7146107e5578063b88a802f146107f8578063b8dc491b14610800578063bc063e1a14610813575f5ffd5b806397a268621161020757806397a268621461077f57806398acd7a614610792578063a5749710146107a3578063a694fc3a146107ab578063a9059cbb146107be575f5ffd5b80638e691b9a1461073e5780638f90e9021461075157806390f595981461076457806395d89b4114610777575f5ffd5b8063367dfede116103445780636f60a6dd116102ce5780637e1a3786116102935780637e1a3786146106ea578063852cb9b8146106f257806389114268146106fb5780638b8763471461070e5780638da5cb5b1461072d575f5ffd5b80636f60a6dd1461065c57806370a0823114610686578063715018a6146106ae578063784c6524146106b657806379ef2771146106e2575f5ffd5b806342966c681161031457806342966c68146105ff57806345909a6f146106125780635d2e64011461062557806365c21d921461063857806369940d791461064b575f5ffd5b8063367dfede146105c95780633736421b146105d157806339916f74146105e45780633d6be31f146105f7575f5ffd5b80630de705b5116103c557806318160ddd1161039557806318160ddd1461056f57806323b872dd1461057757806329cb924d1461058a5780632e1a7d4d14610590578063313ce567146105a3575f5ffd5b80630de705b514610526578063106848441461052e578063117da1ee146105545780631540aa8914610567575f5ffd5b8063072d05991161040b578063072d0599146104c057806308941b1f146104d55780630917e776146104e8578063095ea7b3146104f0578063096015b014610513575f5ffd5b80628cc2621461043b57806301d3ee0a1461046157806306fdde031461048c5780630700037d146104a1575b5f5ffd5b61044e610449366004612fc3565b6109c2565b6040519081526020015b60405180910390f35b600d54610474906001600160a01b031681565b6040516001600160a01b039091168152602001610458565b610494610a3d565b6040516104589190612fe3565b61044e6104af366004612fc3565b601b6020525f908152604090205481565b6104d36104ce366004613018565b610acd565b005b601e54610474906001600160a01b031681565b61044e610b1b565b6105036104fe366004613054565b610b2a565b6040519015158152602001610458565b6104d361052136600461307c565b610b41565b600e5461044e565b601f5461054290600160a01b900460ff1681565b60405160ff9091168152602001610458565b6104d361056236600461307c565b610bd6565b600f5461044e565b60025461044e565b610503610585366004613093565b610c29565b4261044e565b6104d361059e36600461307c565b610e49565b7f0000000000000000000000000000000000000000000000000000000000000012610542565b60175461044e565b600c54610474906001600160a01b031681565b6104d36105f23660046130cd565b611024565b60165461044e565b6104d361060d36600461307c565b61109d565b61044e610620366004612fc3565b61118c565b6104d3610633366004612fc3565b6111a9565b6104d3610646366004612fc3565b61121b565b6008546001600160a01b0316610474565b600d5461067290600160a01b900462ffffff1681565b60405162ffffff9091168152602001610458565b61044e610694366004612fc3565b6001600160a01b03165f9081526020819052604090205490565b6104d3611245565b6011546106cd90600160a01b900463ffffffff1681565b60405163ffffffff9091168152602001610458565b61044e611258565b60135461044e565b61044e600e5481565b601f54610474906001600160a01b031681565b61044e61071c366004612fc3565b601a6020525f908152604090205481565b6005546001600160a01b0316610474565b6104d361074c36600461307c565b6112ce565b6104d361075f366004612fc3565b611353565b6104d36107723660046130fd565b6113ca565b610494611434565b6104d361078d366004613137565b611443565b6007546001600160a01b0316610474565b61044e611502565b6104d36107b936600461307c565b61156c565b6105036107cc366004613054565b6116d5565b601f5461054290600160a81b900460ff1681565b6104d36107f3366004612fc3565b6118d3565b6104d3611926565b6104d361080e366004613188565b611ae2565b61044e6101f481565b61044e61082a366004612fc3565b6001600160a01b03165f908152601c602052604090205490565b60185461044e565b600a54610474906001600160a01b031681565b600754610474906001600160a01b031681565b61044e60145481565b61044e611d1d565b61044e610891366004612fc3565b611d9c565b61044e60125481565b600954610474906001600160a01b031681565b6104d36108c0366004612fc3565b611da6565b61044e6108d3366004613188565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b61050361090b366004612fc3565b601d6020525f908152604090205460ff1681565b601054610474906001600160a01b031681565b6104d3611df9565b61044e600f5481565b601154610474906001600160a01b031681565b61044e611e19565b6104d361096c366004612fc3565b612026565b61044e612060565b6104d36120b2565b600854610474906001600160a01b031681565b60195461044e565b600b54610474906001600160a01b031681565b6104d36109bd3660046131b9565b612697565b6001600160a01b0381165f908152601b6020908152604080832054601a909252822054670de0b6b3a7640000906109f7611d1d565b610a0191906131ed565b6001600160a01b0385165f90815260208190526040902054610a239190613200565b610a2d9190613217565b610a379190613236565b92915050565b606060038054610a4c90613249565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7890613249565b8015610ac35780601f10610a9a57610100808354040283529160200191610ac3565b820191905f5260205f20905b815481529060010190602001808311610aa657829003601f168201915b5050505050905090565b610ad5612891565b600a80546001600160a01b039093166001600160a01b031990931692909217909155600d805462ffffff909216600160a01b0262ffffff60a01b19909216919091179055565b5f610b2560025490565b905090565b5f33610b378185856128be565b5060019392505050565b610b49612891565b6101f4811115610b965760405162461bcd60e51b81526020600482015260136024820152724665652065786365656473206d6178696d756d60681b60448201526064015b60405180910390fd5b600f8190556040517fc5dbbc1a39078c6d41f75645288952af1adce3154214371d76e773566564245390610bcb908390613281565b60405180910390a150565b610bde612891565b612710811115610c245760405162461bcd60e51b81526020600482015260116024820152700a6d8d2e0e0c2ceca40e8dede40d0d2ced607b1b6044820152606401610b8d565b601255565b5f83610c33611d1d565b6015556018544211610c455742610c49565b6018545b6014556001600160a01b03811615610c8f57610c64816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b83610c98611d1d565b6015556018544211610caa5742610cae565b6018545b6014556001600160a01b03811615610cf457610cc9816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b6001600160a01b0386165f908152601b60205260409020548015610d93576001600160a01b0387165f908152601b60209081526040808320839055601c90915281208054839290610d46908490613236565b9091555050600854610d62906001600160a01b031688836128cb565b866001600160a01b03165f5160206134a05f395f51905f5282604051610d8a91815260200190565b60405180910390a25b6001600160a01b0386165f908152601b60205260409020548015610e32576001600160a01b0387165f908152601b60209081526040808320839055601c90915281208054839290610de5908490613236565b9091555050600854610e01906001600160a01b031688836128cb565b866001600160a01b03165f5160206134a05f395f51905f5282604051610e2991815260200190565b60405180910390a25b610e3d88888861292a565b98975050505050505050565b610e5161294d565b33610e5a611d1d565b6015556018544211610e6c5742610e70565b6018545b6014556001600160a01b03811615610eb657610e8b816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b5f8211610ef95760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b6044820152606401610b8d565b335f90815260208190526040902054821115610f575760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e74207661756c7420746f6b656e2062616c616e63656044820152606401610b8d565b5f612710600f5484610f699190613200565b610f739190613217565b90505f610f8082856131ed565b9050610f8c33856129a6565b5f82118015610fa557506011546001600160a01b031615155b15610fc757601154600754610fc7916001600160a01b039182169116846128cb565b600754610fde906001600160a01b031633836128cb565b60405181815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a25050506110216001600655565b50565b61102c612891565b5f8163ffffffff16116110775760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420545741502077696e646f7760681b6044820152606401610b8d565b6011805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b5f81116110ec5760405162461bcd60e51b815260206004820152601760248201527f4275726e20616d6f756e74206d757374206265203e20300000000000000000006044820152606401610b8d565b335f9081526020819052604090205481111561114a5760405162461bcd60e51b815260206004820181905260248201527f496e73756666696369656e74207661756c7420746f6b656e2062616c616e63656044820152606401610b8d565b61115433826129a6565b60405181815233907fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59060200160405180910390a250565b6001600160a01b0381165f90815260208190526040812054610a37565b6111b1612891565b6001600160a01b0381166111f95760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610b8d565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b611223612891565b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b61124d612891565b6112565f6129da565b565b5f5f601f5f9054906101000a90046001600160a01b03166001600160a01b0316639feb838f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112aa573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a3791906132b6565b6112d6612891565b6101f481111561131e5760405162461bcd60e51b81526020600482015260136024820152724665652065786365656473206d6178696d756d60681b6044820152606401610b8d565b600e8190556040517fc5dbbc1a39078c6d41f75645288952af1adce3154214371d76e773566564245390610bcb9083906132cd565b61135b612891565b6001600160a01b0381166113a85760405162461bcd60e51b8152602060048201526014602482015273496e76616c696420706f6f6c206164647265737360601b6044820152606401610b8d565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6113d2612891565b6001600160a01b0382165f818152601d6020908152604091829020805460ff19168515159081179091558251938452908301527f85a68034076f99047d5db3dd6a0adaa05addad1c2d330a044b888fbf7aa47e93910160405180910390a15050565b606060048054610a4c90613249565b61144b612891565b601e80546001600160a01b0319166001600160a01b03868116918217909255601f80548684166001600160a81b031990911617600160a01b60ff87811682029290921760ff60a81b198116600160a81b888516810291821795869055604080519788529288169190971617602086015290830482169084015292900490911660608201527fd77682fd3b49e38bc0fbb20604d768b100437ddca38938ab52b5a35de6b6ae5f9060800160405180910390a150505050565b6007546040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa158015611548573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b2591906132b6565b61157461294d565b3361157d611d1d565b601555601854421161158f5742611593565b6018545b6014556001600160a01b038116156115d9576115ae816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b5f82116116195760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606401610b8d565b5f612710600e548461162b9190613200565b6116359190613217565b90505f61164282856131ed565b90505f8211801561165d57506010546001600160a01b031615155b1561168157601054600754611681916001600160a01b039182169133911685612a2b565b600754611699906001600160a01b0316333084612a2b565b6116a33382612a6a565b60405181815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200161100c565b5f336116df611d1d565b60155560185442116116f157426116f5565b6018545b6014556001600160a01b0381161561173b57611710816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b83611744611d1d565b6015556018544211611756574261175a565b6018545b6014556001600160a01b038116156117a057611775816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b335f908152601b6020526040902054801561181f57335f908152601b60209081526040808320839055601c909152812080548392906117e0908490613236565b90915550506008546117fc906001600160a01b031633836128cb565b60405181815233905f5160206134a05f395f51905f529060200160405180910390a25b6001600160a01b0386165f908152601b602052604090205480156118be576001600160a01b0387165f908152601b60209081526040808320839055601c90915281208054839290611871908490613236565b909155505060085461188d906001600160a01b031688836128cb565b866001600160a01b03165f5160206134a05f395f51905f52826040516118b591815260200190565b60405180910390a25b6118c88787612a9e565b979650505050505050565b6118db612891565b601180546001600160a01b0319166001600160a01b0383161790556040517f90a902de365607bc2642db48414bf5c3e05c90f87dfef76d6bab1f39a9feecbf90610bcb9083906132f3565b61192e61294d565b33611937611d1d565b6015556018544211611949574261194d565b6018545b6014556001600160a01b0381161561199357611968816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b335f908152601b60205260409020548015611ad6576008546040516370a0823160e01b815230600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa1580156119ee573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a1291906132b6565b1015611a6c5760405162461bcd60e51b8152602060048201526024808201527f4e6f7420656e6f7567682072657761726420746f6b656e7320696e20636f6e746044820152631c9858dd60e21b6064820152608401610b8d565b335f908152601b60209081526040808320839055601c90915281208054839290611a97908490613236565b9091555050600854611ab3906001600160a01b031633836128cb565b60405181815233905f5160206134a05f395f51905f529060200160405180910390a25b50506112566001600655565b611aea612891565b6001600160a01b038216611b2f576040516001600160a01b038216904780156108fc02915f818181858888f19350505050158015611b2a573d5f5f3e3d5ffd5b505050565b6007546001600160a01b0390811690831603611b8d5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207377656570206261736520746f6b656e0000000000000000006044820152606401610b8d565b6008546001600160a01b0390811690831603611beb5760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f742073776565702072657761726420746f6b656e000000000000006044820152606401610b8d565b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa158015611c2f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c5391906132b6565b60405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390529192509084169063a9059cbb906044016020604051808303815f875af1158015611ca3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cc79190613334565b50604080516001600160a01b038086168252602082018490528416918101919091527f8d71d334346acd8aade4cdca3af39a37fca2620cd870d28ccf94ae4ade61c8f3906060015b60405180910390a1505b5050565b5f611d2760025490565b5f03611d34575060155490565b5f6018544211611d445742611d48565b6018545b9050611d5360025490565b601354601454611d6390846131ed565b611d6d9190613200565b611d7f90670de0b6b3a7640000613200565b611d899190613217565b601554611d969190613236565b91505090565b5f610a37826109c2565b611dae612891565b601080546001600160a01b0319166001600160a01b0383161790556040517f90a902de365607bc2642db48414bf5c3e05c90f87dfef76d6bab1f39a9feecbf90610bcb90839061334f565b611e01611926565b335f9081526020819052604090205461125690610e49565b5f5f611e2460025490565b9050805f03611e34575f91505090565b6018544210611e44575f91505090565b601e546040805163416c6ffb60e11b815290515f926001600160a01b0316916382d8dff69160048083019260209291908290030181865afa158015611e8b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611eaf91906132b6565b90505f601f5f9054906101000a90046001600160a01b03166001600160a01b0316639feb838f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f02573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f2691906132b6565b601f549091505f90611f4390600160a01b900460ff166012613375565b611f4e90600a613471565b611f589084613200565b601f549091505f90611f7590600160a81b900460ff166012613375565b611f8090600a613471565b611f8a9084613200565b90505f6301e1338090505f81601354611fa39190613200565b90505f670de0b6b3a7640000611fb98584613200565b611fc39190613217565b90505f670de0b6b3a7640000611fd9878b613200565b611fe39190613217565b9050805f03611ffb575f995050505050505050505090565b8061200e83670de0b6b3a7640000613200565b6120189190613217565b995050505050505050505090565b61202e612891565b6001600160a01b03811661205757604051631e4fbdf760e01b81525f6004820152602401610b8d565b611021816129da565b5f5f601e5f9054906101000a90046001600160a01b03166001600160a01b03166382d8dff66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112aa573d5f5f3e3d5ffd5b6120ba61294d565b336120c3611d1d565b60155560185442116120d557426120d9565b6018545b6014556001600160a01b0381161561211f576120f4816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b335f908152601b6020526040902054806121745760405162461bcd60e51b8152602060048201526016602482015275139bc81c995dd85c991cc81d1bc818dbdb5c1bdd5b9960521b6044820152606401610b8d565b335f908152601b60209081526040808320839055601c9091528120805483929061219f908490613236565b909155505060095460085482915f916001600160a01b039182169116036121c7575080612444565b6009546008546001600160a01b039081169116148015906121f257506009546001600160a01b031615155b15612405576008546040516370a0823160e01b815230600482015283916001600160a01b0316906370a0823190602401602060405180830381865afa15801561223d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061226191906132b6565b10156122bd5760405162461bcd60e51b815260206004820152602560248201527f5661756c7420646f65736e2774206861766520656e6f756768207265776172646044820152642a37b5b2b760d91b6064820152608401610b8d565b6009546040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa158015612303573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061232791906132b6565b600b54604051632e1a7d4d60e01b8152600481018690529192506001600160a01b031690632e1a7d4d906024015f604051808303815f87803b15801561236b575f5ffd5b505af115801561237d573d5f5f3e3d5ffd5b50506009546040516370a0823160e01b81523060048201525f93506001600160a01b0390911691506370a0823190602401602060405180830381865afa1580156123c9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123ed91906132b6565b90505f6123fa83836131ed565b935061244492505050565b60405162461bcd60e51b815260206004820152601460248201527324b73b30b634b2103932bbb0b932103a37b5b2b760611b6044820152606401610b8d565b5f81116124875760405162461bcd60e51b815260206004820152601160248201527004e6f20746f6b656e7320746f207377617607c1b6044820152606401610b8d565b600954600a5460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b3906044016020604051808303815f875af11580156124d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124fd9190613334565b506009546007545f9161251e9184916001600160a01b039081169116612aab565b90505f61271060125461271061253491906131ed565b61253e9084613200565b6125489190613217565b6040805160e0810182526009546001600160a01b039081168252600754811660208301908152600d54600160a01b900462ffffff9081168486019081523060608601908152608086018b815260a087018981525f60c08901818152600a549a516304e45aaf60e01b81528a518a166004820152975189166024890152945190951660448701529151861660648601525160848501525160a484015251831660c483015294955091939216906304e45aaf9060e4016020604051808303815f875af1158015612618573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061263c91906132b6565b90505f811161267b5760405162461bcd60e51b815260206004820152600b60248201526a14ddd85c0819985a5b195960aa1b6044820152606401610b8d565b6126853382612c25565b50505050505050506112566001600655565b335f908152601d602052604090205460ff166126e35760405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b6044820152606401610b8d565b5f6126ec611d1d565b60155560185442116126fe5742612702565b6018545b6014556001600160a01b038116156127485761271d816109c2565b6001600160a01b0382165f908152601b6020908152604080832093909355601554601a909152919020555b60185442101561279a5760405162461bcd60e51b815260206004820152601a60248201527f43757272656e7420706f6f6c206e6f7420656e646564207965740000000000006044820152606401610b8d565b8183116128005760405162461bcd60e51b815260206004820152602e60248201527f726577617264416d6f756e74206d757374206265203e206475726174696f6e2060448201526d2873616665747920636865636b2960901b6064820152608401610b8d565b61280a8284613217565b6013819055508260165f8282546128219190613236565b9091555050426017819055612837908390613236565b6018556019829055600854612857906001600160a01b0316333086612a2b565b4260145560408051848152602081018490527f40df43107e8b4d467127964bd3c966687c0a6a39aaede970755397fd09535e989101611d0f565b6005546001600160a01b031633146112565760405163118cdaa760e01b8152336004820152602401610b8d565b611b2a8383836001612c76565b6040516001600160a01b03838116602483015260448201839052611b2a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050612d48565b5f33612937858285612db4565b612942858585612e29565b506001949350505050565b60026006540361299f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b8d565b6002600655565b6001600160a01b0382166129cf57604051634b637e8f60e11b81525f6004820152602401610b8d565b611d19825f83612e82565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6040516001600160a01b038481166024830152838116604483015260648201839052612a649186918216906323b872dd906084016128f8565b50505050565b6001600160a01b038216612a935760405163ec442f0560e01b81525f6004820152602401610b8d565b611d195f8383612e82565b5f33610b37818585612e29565b600c545f906001600160a01b0316612afc5760405162461bcd60e51b8152602060048201526014602482015273155b9a5cddd85c081c1bdbdb081b9bdd081cd95d60621b6044820152606401610b8d565b600d54600c546011546040516310b3596960e11b81526001600160a01b039283166004820152600160a01b90910463ffffffff1660248201525f929190911690632166b2d290604401602060405180830381865afa158015612b60573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b84919061347f565b600d5460405163993c04ab60e01b8152600283900b60048201526fffffffffffffffffffffffffffffffff881660248201526001600160a01b038781166044830152868116606483015292935091169063993c04ab90608401602060405180830381865afa158015612bf8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c1c91906132b6565b95945050505050565b612c2f8282612a6a565b816001600160a01b03167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d82604051612c6a91815260200190565b60405180910390a25050565b6001600160a01b038416612c9f5760405163e602df0560e01b81525f6004820152602401610b8d565b6001600160a01b038316612cc857604051634a1406b160e11b81525f6004820152602401610b8d565b6001600160a01b038085165f9081526001602090815260408083209387168352929052208290558015612a6457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051612d3a91815260200190565b60405180910390a350505050565b5f5f60205f8451602086015f885af180612d67576040513d5f823e3d81fd5b50505f513d91508115612d7e578060011415612d8b565b6001600160a01b0384163b155b15612a6457604051635274afe760e01b81526001600160a01b0385166004820152602401610b8d565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f198114612a645781811015612e1b57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610b8d565b612a6484848484035f612c76565b6001600160a01b038316612e5257604051634b637e8f60e11b81525f6004820152602401610b8d565b6001600160a01b038216612e7b5760405163ec442f0560e01b81525f6004820152602401610b8d565b611b2a8383835b6001600160a01b038316612eac578060025f828254612ea19190613236565b90915550612f1c9050565b6001600160a01b0383165f9081526020819052604090205481811015612efe5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610b8d565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216612f3857600280548290039055612f56565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612f9b91815260200190565b60405180910390a3505050565b80356001600160a01b0381168114612fbe575f5ffd5b919050565b5f60208284031215612fd3575f5ffd5b612fdc82612fa8565b9392505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f5f60408385031215613029575f5ffd5b61303283612fa8565b9150602083013562ffffff81168114613049575f5ffd5b809150509250929050565b5f5f60408385031215613065575f5ffd5b61306e83612fa8565b946020939093013593505050565b5f6020828403121561308c575f5ffd5b5035919050565b5f5f5f606084860312156130a5575f5ffd5b6130ae84612fa8565b92506130bc60208501612fa8565b929592945050506040919091013590565b5f602082840312156130dd575f5ffd5b813563ffffffff81168114612fdc575f5ffd5b8015158114611021575f5ffd5b5f5f6040838503121561310e575f5ffd5b61311783612fa8565b91506020830135613049816130f0565b803560ff81168114612fbe575f5ffd5b5f5f5f5f6080858703121561314a575f5ffd5b61315385612fa8565b935061316160208601612fa8565b925061316f60408601613127565b915061317d60608601613127565b905092959194509250565b5f5f60408385031215613199575f5ffd5b6131a283612fa8565b91506131b060208401612fa8565b90509250929050565b5f5f604083850312156131ca575f5ffd5b50508035926020909101359150565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610a3757610a376131d9565b8082028115828204841417610a3757610a376131d9565b5f8261323157634e487b7160e01b5f52601260045260245ffd5b500490565b80820180821115610a3757610a376131d9565b600181811c9082168061325d57607f821691505b60208210810361327b57634e487b7160e01b5f52602260045260245ffd5b50919050565b604081525f6132a8604083016008815267576974686472617760c01b602082015260400190565b905082602083015292915050565b5f602082840312156132c6575f5ffd5b5051919050565b604081525f6132a860408301600781526611195c1bdcda5d60ca1b602082015260400190565b604081525f61331a604083016008815267576974686472617760c01b602082015260400190565b6001600160a01b0393909316602092909201919091525090565b5f60208284031215613344575f5ffd5b8151612fdc816130f0565b604081525f61331a60408301600781526611195c1bdcda5d60ca1b602082015260400190565b60ff8281168282160390811115610a3757610a376131d9565b6001815b60018411156133c9578085048111156133ad576133ad6131d9565b60018416156133bb57908102905b60019390931c928002613392565b935093915050565b5f826133df57506001610a37565b816133eb57505f610a37565b8160018114613401576002811461340b57613427565b6001915050610a37565b60ff84111561341c5761341c6131d9565b50506001821b610a37565b5060208310610133831016604e8410600b841016171561344a575081810a610a37565b6134565f19848461338e565b805f1904821115613469576134696131d9565b029392505050565b5f612fdc60ff8416836133d1565b5f6020828403121561348f575f5ffd5b81518060020b8114612fdc575f5ffdfe106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241a2646970667358221220c0110b15ee50e4d6ae8184322d0ab7befbc7ef816e4638c07d0aad02aefe23ae64736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000008805792d41facb22b6f47d468b06af36ff3fc1c5000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000d98ed1716e011ee5549ffcf10159bd25dfed8ade000000000000000000000000d98ed1716e011ee5549ffcf10159bd25dfed8ade00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000084d4158765553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064d76555344430000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _baseToken (address): 0x8805792D41Facb22b6F47d468B06AF36Ff3fc1c5
Arg [1] : _rewardToken (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [2] : _baseRewardToken (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [3] : _depositFeeCollector (address): 0xd98ED1716e011EE5549FFCF10159bD25DfEd8Ade
Arg [4] : _withdrawFeeCollector (address): 0xd98ED1716e011EE5549FFCF10159bD25DfEd8Ade
Arg [5] : name (string): MAXvUSDC
Arg [6] : symbol (string): MvUSDC
-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 0000000000000000000000008805792d41facb22b6f47d468b06af36ff3fc1c5
Arg [1] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [2] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [3] : 000000000000000000000000d98ed1716e011ee5549ffcf10159bd25dfed8ade
Arg [4] : 000000000000000000000000d98ed1716e011ee5549ffcf10159bd25dfed8ade
Arg [5] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [8] : 4d41587655534443000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [10] : 4d76555344430000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.