More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 494 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Claim | 21806530 | 5 hrs ago | IN | 0 ETH | 0.00017961 | ||||
Stake | 21801654 | 21 hrs ago | IN | 0 ETH | 0.00028992 | ||||
Stake | 21801155 | 23 hrs ago | IN | 0 ETH | 0.00038305 | ||||
Claim | 21800226 | 26 hrs ago | IN | 0 ETH | 0.00019876 | ||||
Withdraw | 21799551 | 28 hrs ago | IN | 0 ETH | 0.00039254 | ||||
Claim | 21796030 | 40 hrs ago | IN | 0 ETH | 0.00029942 | ||||
Claim | 21796026 | 40 hrs ago | IN | 0 ETH | 0.00033168 | ||||
Stake | 21796018 | 40 hrs ago | IN | 0 ETH | 0.00063581 | ||||
Stake | 21795935 | 40 hrs ago | IN | 0 ETH | 0.00045484 | ||||
Withdraw | 21794681 | 44 hrs ago | IN | 0 ETH | 0.00033334 | ||||
Withdraw | 21794421 | 45 hrs ago | IN | 0 ETH | 0.0004113 | ||||
Withdraw | 21794379 | 45 hrs ago | IN | 0 ETH | 0.00043014 | ||||
Withdraw | 21793464 | 2 days ago | IN | 0 ETH | 0.00056719 | ||||
Withdraw | 21792593 | 2 days ago | IN | 0 ETH | 0.00030556 | ||||
Claim | 21791919 | 2 days ago | IN | 0 ETH | 0.00022045 | ||||
Withdraw | 21791599 | 2 days ago | IN | 0 ETH | 0.00042181 | ||||
Claim | 21791215 | 2 days ago | IN | 0 ETH | 0.00014867 | ||||
Claim | 21791213 | 2 days ago | IN | 0 ETH | 0.00013172 | ||||
Claim | 21791213 | 2 days ago | IN | 0 ETH | 0.00013961 | ||||
Claim | 21791210 | 2 days ago | IN | 0 ETH | 0.00022139 | ||||
Claim | 21791162 | 2 days ago | IN | 0 ETH | 0.00021329 | ||||
Claim | 21791149 | 2 days ago | IN | 0 ETH | 0.00022457 | ||||
Claim | 21785879 | 3 days ago | IN | 0 ETH | 0.00022461 | ||||
Claim | 21781802 | 3 days ago | IN | 0 ETH | 0.00040396 | ||||
Withdraw | 21777959 | 4 days ago | IN | 0 ETH | 0.00021973 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
21775166 | 4 days ago | 0.22188765 ETH | ||||
21775166 | 4 days ago | 0.35815142 ETH | ||||
21770840 | 5 days ago | 0.22099252 ETH | ||||
21770840 | 5 days ago | 0.53822206 ETH | ||||
21744818 | 8 days ago | 0.21661052 ETH | ||||
21744818 | 8 days ago | 1.0480992 ETH | ||||
21729689 | 10 days ago | 0.20038943 ETH | ||||
21729689 | 10 days ago | 0.88882081 ETH | ||||
21729686 | 10 days ago | 0.19177581 ETH | ||||
21729686 | 10 days ago | 0.74374761 ETH | ||||
21729685 | 10 days ago | 0.18584665 ETH | ||||
21729685 | 10 days ago | 0.95431863 ETH | ||||
21724533 | 11 days ago | 0.17519837 ETH | ||||
21724533 | 11 days ago | 0.58120858 ETH | ||||
21724523 | 11 days ago | 0.17172628 ETH | ||||
21724523 | 11 days ago | 0.33395177 ETH | ||||
21722526 | 11 days ago | 0.17098123 ETH | ||||
21722526 | 11 days ago | 0.29932446 ETH | ||||
21721061 | 12 days ago | 0.17039284 ETH | ||||
21721061 | 12 days ago | 0.38357705 ETH | ||||
21721056 | 12 days ago | 0.16917223 ETH | ||||
21721056 | 12 days ago | 0.73589817 ETH | ||||
21715021 | 12 days ago | 0.1630838 ETH | ||||
21715021 | 12 days ago | 0.2708425 ETH | ||||
21712941 | 13 days ago | 0.16268588 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
LiquidityPot
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './Game.sol'; import './interfaces/ISoup.sol'; import './interfaces/IOracle.sol'; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol'; // Join us: https://soup.game /** * @title LiquidityPot * @dev Manages staking and distribution of rewards for liquidity provider (LP) tokens. It facilitates * the staking of LP tokens, allowing users to earn rewards derived from bridge fees collected and * distributed by the OsakCollector. This contract retrieves these fees and streams them to stakers * over a defined reward period, initially set to 7 days. * * Functionalities include: * - Staking and withdrawing LP tokens. * - Claiming rewards based on the user's stake percentage. * - Automatic retrieval and distribution of fees collected by OsakCollector. * - Configurable parameters for reward and epoch durations * * Rewards Calculation: * - Dynamic reward updates based on the collected fees and the current total stake. * - Secure transfer and calculation mechanisms to ensure accurate reward allocation. * */ contract LiquidityPot is Ownable, ReentrancyGuard { uint256 public constant PRECISION = 10**20; uint256 public rewardDuration = 7 days; uint256 public nextRewardRetrieval; uint256 public rewardsPerSecond; uint256 public claimableBalance; uint256 public rewardsPerStake; uint256 public rewardEndTime; uint256 public totalStaked; uint256 public updatedAt; Game public game; ISoup public soup; IOracle public oracle; IERC20 public stakingToken; mapping(address => uint256) unlockAt; address public usdAddress = 0xdAC17F958D2ee523a2206206994597C13D831ec7; IUniswapV2Router02 public router; address public wethAddress; struct Stake { uint256 excluded; uint256 amount; } struct UserInfo { uint256 stakingTokenBalance; uint256 userAllocatedAmount; uint256 userStakedAmount; uint256 rewardsPerSecond; uint256 nextRewardRetrieval; uint256 rewardsPerStake; uint256 rewardEndTime; uint256 lockDuration; uint256 totalStaked; uint256 ethPerToken; uint256 totalSupply; uint256 ethPerUSD; uint256 unlockAt; uint256 ethPerLP; } mapping(address => Stake) public stakes; event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardClaimed(address indexed user, uint256 reward); event AddedToLiquidityPot(address indexed user, uint256 lpAmount, uint256 soupAmount, uint256 ethAmount); event EpochDurationUpdated(uint256 duration); event RewardDurationUpdated(uint256 duration); event RewardsUpdated(uint256 rewardsPerSecond); /** * @dev Constructor for LPFarm contract initializing staking and reward tokens, and osakCollector fees interface. * @param _lpToken Address of the staking token contract * @param _soup Address of the reward token contract * @param _game Address of the game variables contract */ constructor(IERC20 _lpToken, ISoup _soup, Game _game, IOracle _oracle) { game = _game; soup = _soup; oracle = _oracle; stakingToken = _lpToken; wethAddress = oracle.WETH(); router = IUniswapV2Router02(oracle.routerV2()); } function setUSD(address usd) external onlyOwner { usdAddress = usd; } /** * @dev Returns user info, including staking balance and rewards info. * @param user The address of the user to retrieve info for * @return UserInfo struct containing detailed user information */ function getInfo(address user) public view returns (UserInfo memory) { uint256 userAllocatedAmount; uint256 stakingTokenBalance; uint256 userStakedAmount; uint256 unlocksAt; if (user != address(0)) { stakingTokenBalance = stakingToken.balanceOf(user); userAllocatedAmount = allocatedAmount(user); userStakedAmount = stakes[user].amount; unlocksAt = unlockAt[user]; } return UserInfo({ ethPerLP: oracle.ethPerToken(address(stakingToken)), ethPerToken: oracle.ethPerToken(address(soup)), ethPerUSD: oracle.ethPerToken(usdAddress), lockDuration: game.get('lpLockDuration'), userAllocatedAmount: userAllocatedAmount, stakingTokenBalance: stakingTokenBalance, nextRewardRetrieval: nextRewardRetrieval, userStakedAmount: userStakedAmount, rewardsPerSecond: rewardsPerSecond, rewardsPerStake: rewardsPerStake, totalSupply: soup.totalSupply(), rewardEndTime: rewardEndTime, totalStaked: totalStaked, unlockAt: unlocksAt }); } /** * @dev Sets the reward duration. * @param _rewardDuration The new reward duration in seconds */ function setRewardDuration(uint256 _rewardDuration) external onlyOwner { require(_rewardDuration <= 2 weeks, "Reward duration must be less than 2 weeks"); require(_rewardDuration > 1 days, "Reward duration must be more than 1 day"); rewardDuration = _rewardDuration; emit RewardDurationUpdated(_rewardDuration); } /** * @dev Stakes a specified amount of tokens. * @param amount The amount of tokens to stake */ function stake(uint256 amount) external { stakeFor(msg.sender, amount); } /** * @dev Stakes a specified amount of tokens on behalf of another address. * @param user The address on whose behalf to stake * @param amount The amount of tokens to stake */ function stakeFor(address user, uint256 amount) public nonReentrant { require(amount > 0, "Cannot stake 0"); require(game.get('publicDepositsEnabled') > 0, "deposits disabled"); unlockAt[user] = block.timestamp + game.get('lpLockDuration'); // Always taking from the msg.sender. // stakeFor is intended for a zap function, in which the stakingTokens // would come from the zap contract. stakingToken.transferFrom(msg.sender, address(this), amount); bool isFirstStake = totalStaked == 0; _claim(user); totalStaked += amount; stakes[user].amount += amount; if (isFirstStake) _retrieveAndReward(); emit Staked(user, amount); } /** * @notice Internal function to add liquidity to the Uniswap pool * @param soupAmount The amount of soup tokens to add * @param recipient The recipient address for LP tokens */ function _addLiquidity(uint256 soupAmount, address recipient) internal { // Approve the router to spend the specified amount of soup tokens soup.approve(address(router), soupAmount); // Add liquidity to the Uniswap pool // Slippage is taken into account in the functions that call this one. router.addLiquidityETH{ value: address(this).balance }( address(soup), // Token address soupAmount, // Amount of tokens to add 0, // Minimum amount of tokens to add (slippage protection) 0, // Minimum amount of ETH to add (slippage protection) recipient, // Recipient address for LP tokens block.timestamp + 1800 // Deadline: 30 minutes from the current block time ); } /** * @notice Compounds user's rewards into LP and stakes */ function compound() external payable { unlockAt[msg.sender] = block.timestamp + game.get('lpLockDuration'); uint256 underlyingReward = allocatedUnderlyingAmount(msg.sender) / PRECISION; require(underlyingReward > 0, 'nothing to compound'); if (block.timestamp >= nextRewardRetrieval) _retrieveAndReward(); else updateRewards(); claimableBalance -= underlyingReward; stakes[msg.sender].excluded = rewardsPerStake; address[] memory path = new address[](2); path[0] = wethAddress; path[1] = address(soup); uint256[] memory amounts = router.getAmountsOut(msg.value, path); uint256 reward = soup.soupToFragment(underlyingReward); require(amounts[1] > (reward * liquiditySlippage())/100, 'Supplied ETH should be worth the reward amount after slippage is applied'); uint256 lpBalanceWas = stakingToken.balanceOf(address(this)); _addLiquidity(reward, address(this)); uint256 lpBalance = stakingToken.balanceOf(address(this)); uint256 lpAmount = lpBalance - lpBalanceWas; totalStaked += lpAmount; stakes[msg.sender].amount += lpAmount; emit AddedToLiquidityPot(msg.sender, lpBalance, reward, msg.value); soup.debase(); } /** * @dev Withdraws staked tokens. * @param amount The amount of tokens to withdraw */ function withdraw(uint256 amount) external nonReentrant { require(amount <= stakes[msg.sender].amount, "Withdraw amount exceeds balance"); require(unlockAt[msg.sender] <= block.timestamp, "tokens not yet unlocked"); unlockAt[msg.sender] = block.timestamp + game.get('lpLockDuration'); _claim(msg.sender); totalStaked -= amount; stakes[msg.sender].amount -= amount; stakingToken.transfer(msg.sender, amount); emit Withdrawn(msg.sender, amount); } /** * @dev Claims the accumulated rewards for the caller. */ function claim() external nonReentrant { _claim(msg.sender); } /** * @dev Internal function to handle the claiming process for rewards. * @param user The user who is claiming their rewards */ function _claim(address user) internal { uint256 reward = allocatedUnderlyingAmount(user) / PRECISION; unlockAt[user] = block.timestamp + game.get('lpLockDuration'); if (block.timestamp >= nextRewardRetrieval && totalStaked > 0) _retrieveAndReward(); else updateRewards(); claimableBalance -= reward; stakes[user].excluded = rewardsPerStake; if (reward > 0) { soup.transferUnderlying(user, reward); emit RewardClaimed(user, soup.soupToFragment(reward)); } soup.debase(); } /** * @dev External function to trigger the reward retrieval and distribution. */ function retrieveAndReward() external nonReentrant { require(totalStaked > 0, "Can not update rewards until users have staked"); if (rewardsPerSecond != 0) require(block.timestamp >= nextRewardRetrieval, "Cannot update rewards yet"); _retrieveAndReward(); } /** * @dev Internal function to update the rewards for the entire pool. */ function updateRewards() internal { if (totalStaked == 0) return; uint256 currentAllocation = currentAllocationPeriod() * rewardsPerSecond; rewardsPerStake += currentAllocation / totalStaked; claimableBalance += currentAllocation / PRECISION; updatedAt = block.timestamp; emit RewardsUpdated(rewardsPerSecond); } /** * @notice Get the permitted liquidity slippage * @return The permitted liquidity slippage */ function liquiditySlippage() public view returns (uint256) { return game.get('liquiditySlippage'); } /** * @dev Internal function to retrieve external fees and update the reward rate. */ function _retrieveAndReward() internal { nextRewardRetrieval = block.timestamp + rewardDuration; try soup.requestRewards(game.get('lpRewardBips')) { } catch { } uint256 balance = soup.balanceOfUnderlying(address(this)); updateRewards(); if (balance <= claimableBalance) rewardsPerSecond = 0; else rewardsPerSecond = PRECISION * (balance - claimableBalance) / rewardDuration; rewardEndTime = rewardDuration + block.timestamp; } function allocatedAmount(address user) public view returns (uint256) { return soup.soupToFragment(allocatedUnderlyingAmount(user) / PRECISION); } /** * @dev Calculates the allocated amount of rewards for a user. * @param user The user for whom to calculate the allocated rewards * @return The amount of allocated rewards for the user */ function allocatedUnderlyingAmount(address user) public view returns (uint256) { if (totalStaked == 0) return 0; uint256 currentAllocation = currentAllocationPeriod() * rewardsPerSecond * stakes[user].amount / totalStaked; uint256 previousAllocation = stakes[user].amount * (rewardsPerStake - stakes[user].excluded); return (previousAllocation + currentAllocation); } /** * @dev Calculates the current allocation period based on the last update time and current time. * @return The number of seconds in the current allocation period */ function currentAllocationPeriod() public view returns (uint256) { if (rewardEndTime <= updatedAt) return 0; return Math.min(rewardEndTime, block.timestamp) - updatedAt; } /** * @dev Allows a user to withdraw some or all of their staked LP tokens without claiming * any pending rewards. This respects the `unlockAt[user]` lock time, meaning the user * cannot withdraw if still locked. The user forfeits any unclaimed rewards as a result. * * @param amount The amount of LP tokens to withdraw from the user's stake. */ function emergencyWithdraw(uint256 amount) external nonReentrant { // Enforce that user's tokens are actually unlocked require(unlockAt[msg.sender] <= block.timestamp, "tokens not yet unlocked"); // Validate the user has enough staked to withdraw uint256 stakedBalance = stakes[msg.sender].amount; require(amount > 0 && amount <= stakedBalance, "Invalid withdraw amount"); totalStaked -= amount; stakes[msg.sender].amount = stakedBalance - amount; // Reset user's reward exclusion to the current rewardsPerStake, // effectively discarding any unclaimed rewards up to this point. stakes[msg.sender].excluded = rewardsPerStake; // Transfer the LP tokens back to the user stakingToken.transfer(msg.sender, amount); // Emit a Withdraw event, or a dedicated "EmergencyWithdraw" event if desired emit Withdrawn(msg.sender, amount); } receive() external payable {} fallback() external payable {} }
pragma solidity ^0.8.22; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ISoup is IERC20 { function debase() external; function burn(uint256 amount) external; function freeze(uint256 amount) external; function mint(address to, uint256 amount) external; function deflationRate() external returns (int128); function requestRewards(uint256 rewardBips) external; function totalLiquidSupply() external view returns (uint256); function accountForDefrostedDeflation(uint256 leftover) external; function unfreeze(address to, uint256 amount) external returns (bool); function soupToFragment(uint256 soup) external view returns (uint256); function fragmentToSoup(uint256 value) external view returns (uint256); function balanceOfUnderlying(address who) external view returns (uint256); function transferUnderlying(address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IOracle { function ethPerToken(address token) external view returns (uint256); function routerV2() external view returns (address); function WETH() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.25; import '@openzeppelin/contracts/access/Ownable.sol'; import "abdk-libraries-solidity/ABDKMath64x64.sol"; /** * @title Game * @dev Serves as a central configuration contract for the Soup ecosystem, storing adjustable variables * that can be updated or permanently renounced. These variables control parameters such as batch sizes, * reward rates, freezer settings, rental prices, and time durations. Ownership is restricted, ensuring * only the contract owner can make changes or renounce them. * * Key Features: * - Variable storage: Keeps track of integer values under string identifiers, adjustable by the owner. * - Renounce mechanism: Once renounced, a variable can no longer be changed. * - Freezer and rental setups: Defines separate configurations (e.g., capacity, basePrice, expoRate) * and multiple rental price tiers. * - Event logging: Emits events on every update or renouncement for transparent off-chain monitoring. */ contract Game is Ownable { using ABDKMath64x64 for int128; // Struct to hold the value and renounce status of a variable struct Variable { uint256 value; bool isRenounced; } struct FreezerConfig { int128 expoRate; uint256 capacity; uint256 basePrice; uint256 _nextMintCost; } // Mapping to store the variables with string identifiers mapping(string => Variable) public variables; FreezerConfig[] public freezers; uint256[] public rentalPrices; // Event to log changes to variables event VariableChanged(string indexed name, uint256 newValue); // Event to log renouncement of variables event VariableRenounced(string indexed name); event FreezerChanged(uint256 index, uint256 capacity, uint256 basePrice, uint256 expoRateBips); event RentalPriceChanged(uint256 index, uint256 soupPerSecond); constructor() { //batch sizes divided by 100_000 set('minBatchSize', 50); // 50 => 0.05% of the circulating liquid supply set('maxBatchSize', 250); // 250 => 0.25% of the circulating supply set('lpRewardBips', 2700); // 27% of remaining rewards set('sssRewardBips', 300); // 3% of remaining rewards set('lpLockDuration', 24 hours); set('sssLockDuration', 24 hours); set('freezerCapacity', 320); set('publicDepositsEnabled', 0); set('batchDefrostTime', 3 days); set('freezerGracePeriod', 7 days); set('rewardRetrievalDuration', 7 days); set('liquiditySlippage', 95); // rental price % in bips setRentalPrice(0, 30); setRentalPrice(1, 50); setRentalPrice(2, 100); setFreezer(0, 10, 1 ether, 50); setFreezer(1, 25, 2 ether, 75); setFreezer(2, 50, 3 ether, 100); } // Modifier to check if a variable is renounced modifier notRenounced(string memory name) { require(!variables[name].isRenounced, "Variable has been renounced"); _; } function freezerCount() public view returns (uint256) { return freezers.length; } function rentalPriceCount() public view returns (uint256) { return rentalPrices.length; } function getRentalPrice(uint256 index) public view returns (uint256){ require(index < rentalPrices.length, "Invalid rental price index"); return rentalPrices[index]; } // Function to create or change a rental price option function setRentalPrice(uint256 index, uint256 soupPerSecond) public notRenounced('rentalPrices') onlyOwner { require(index <= rentalPrices.length, "Invalid index"); if (rentalPrices.length == index) rentalPrices.push(); rentalPrices[index] = soupPerSecond; emit RentalPriceChanged(index, soupPerSecond); } // Function to get a freezer configuration function getFreezer(uint256 freezerIndex) public view returns (FreezerConfig memory) { require(freezerIndex < freezers.length, "Invalid freezer size"); return freezers[freezerIndex]; } // Function to create or change a freezer configuration function setFreezer(uint256 index, uint256 capacity, uint256 basePrice, uint256 expoRateBips) public notRenounced('freezers') onlyOwner { require(index <= freezers.length, "Invalid index"); if (freezers.length == index) freezers.push(); freezers[index].capacity = capacity; freezers[index].basePrice = basePrice; int128 one = ABDKMath64x64.fromUInt(1); freezers[index].expoRate = one.add(ABDKMath64x64.divu(expoRateBips, 10000)); emit FreezerChanged(index, capacity, basePrice, expoRateBips); } // Function to set the value of a variable function set(string memory name, uint256 newValue) public notRenounced(name) onlyOwner { variables[name].value = newValue; emit VariableChanged(name, newValue); } // Function to renounce a variable function renounce(string memory name) external notRenounced(name) onlyOwner { variables[name].isRenounced = true; emit VariableRenounced(name); } // Function to get the value of a variable function get(string memory name) external view returns (uint256) { return variables[name].value; } // Function to check if a variable is renounced function isRenounced(string memory name) external view returns (bool) { return variables[name].isRenounced; } }
// SPDX-License-Identifier: BSD-4-Clause /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <[email protected]> */ pragma solidity ^0.8.0; /** * Smart contract library of mathematical functions operating with signed * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is * basically a simple fraction whose numerator is signed 128-bit integer and * denominator is 2^64. As long as denominator is always the same, there is no * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are * represented by int128 type holding only the numerator. */ library ABDKMath64x64 { /* * Minimum value signed 64.64-bit fixed point number may have. */ int128 private constant MIN_64x64 = -0x80000000000000000000000000000000; /* * Maximum value signed 64.64-bit fixed point number may have. */ int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Convert signed 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromInt (int256 x) internal pure returns (int128) { unchecked { require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF); return int128 (x << 64); } } /** * Convert signed 64.64 fixed point number into signed 64-bit integer number * rounding down. * * @param x signed 64.64-bit fixed point number * @return signed 64-bit integer number */ function toInt (int128 x) internal pure returns (int64) { unchecked { return int64 (x >> 64); } } /** * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromUInt (uint256 x) internal pure returns (int128) { unchecked { require (x <= 0x7FFFFFFFFFFFFFFF); return int128 (int256 (x << 64)); } } /** * Convert signed 64.64 fixed point number into unsigned 64-bit integer * number rounding down. Revert on underflow. * * @param x signed 64.64-bit fixed point number * @return unsigned 64-bit integer number */ function toUInt (int128 x) internal pure returns (uint64) { unchecked { require (x >= 0); return uint64 (uint128 (x >> 64)); } } /** * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point * number rounding down. Revert on overflow. * * @param x signed 128.128-bin fixed point number * @return signed 64.64-bit fixed point number */ function from128x128 (int256 x) internal pure returns (int128) { unchecked { int256 result = x >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Convert signed 64.64 fixed point number into signed 128.128 fixed point * number. * * @param x signed 64.64-bit fixed point number * @return signed 128.128 fixed point number */ function to128x128 (int128 x) internal pure returns (int256) { unchecked { return int256 (x) << 64; } } /** * Calculate x + y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function add (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) + y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x - y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sub (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) - y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x * y rounding down. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function mul (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) * y >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point * number and y is signed 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y signed 256-bit integer number * @return signed 256-bit integer number */ function muli (int128 x, int256 y) internal pure returns (int256) { unchecked { if (x == MIN_64x64) { require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && y <= 0x1000000000000000000000000000000000000000000000000); return -y << 63; } else { bool negativeResult = false; if (x < 0) { x = -x; negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint256 absoluteResult = mulu (x, uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x8000000000000000000000000000000000000000000000000000000000000000); return -int256 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int256 (absoluteResult); } } } } /** * Calculate x * y rounding down, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y unsigned 256-bit integer number * @return unsigned 256-bit integer number */ function mulu (int128 x, uint256 y) internal pure returns (uint256) { unchecked { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (int256 (x)) * (y >> 128); require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); hi <<= 64; require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo); return hi + lo; } } /** * Calculate x / y rounding towards zero. Revert on overflow or when y is * zero. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function div (int128 x, int128 y) internal pure returns (int128) { unchecked { require (y != 0); int256 result = (int256 (x) << 64) / y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x / y rounding towards zero, where x and y are signed 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x signed 256-bit integer number * @param y signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function divi (int256 x, int256 y) internal pure returns (int128) { unchecked { require (y != 0); bool negativeResult = false; if (x < 0) { x = -x; // We rely on overflow behavior here negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint128 absoluteResult = divuu (uint256 (x), uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x80000000000000000000000000000000); return -int128 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int128 (absoluteResult); // We rely on overflow behavior here } } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function divu (uint256 x, uint256 y) internal pure returns (int128) { unchecked { require (y != 0); uint128 result = divuu (x, y); require (result <= uint128 (MAX_64x64)); return int128 (result); } } /** * Calculate -x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function neg (int128 x) internal pure returns (int128) { unchecked { require (x != MIN_64x64); return -x; } } /** * Calculate |x|. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function abs (int128 x) internal pure returns (int128) { unchecked { require (x != MIN_64x64); return x < 0 ? -x : x; } } /** * Calculate 1 / x rounding towards zero. Revert on overflow or when x is * zero. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function inv (int128 x) internal pure returns (int128) { unchecked { require (x != 0); int256 result = int256 (0x100000000000000000000000000000000) / x; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function avg (int128 x, int128 y) internal pure returns (int128) { unchecked { return int128 ((int256 (x) + int256 (y)) >> 1); } } /** * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down. * Revert on overflow or in case x * y is negative. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function gavg (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 m = int256 (x) * int256 (y); require (m >= 0); require (m < 0x4000000000000000000000000000000000000000000000000000000000000000); return int128 (sqrtu (uint256 (m))); } } /** * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y uint256 value * @return signed 64.64-bit fixed point number */ function pow (int128 x, uint256 y) internal pure returns (int128) { unchecked { bool negative = x < 0 && y & 1 == 1; uint256 absX = uint128 (x < 0 ? -x : x); uint256 absResult; absResult = 0x100000000000000000000000000000000; if (absX <= 0x10000000000000000) { absX <<= 63; while (y != 0) { if (y & 0x1 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x2 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x4 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x8 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; y >>= 4; } absResult >>= 64; } else { uint256 absXShift = 63; if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; } if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; } if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; } if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; } if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; } if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; } uint256 resultShift = 0; while (y != 0) { require (absXShift < 64); if (y & 0x1 != 0) { absResult = absResult * absX >> 127; resultShift += absXShift; if (absResult > 0x100000000000000000000000000000000) { absResult >>= 1; resultShift += 1; } } absX = absX * absX >> 127; absXShift <<= 1; if (absX >= 0x100000000000000000000000000000000) { absX >>= 1; absXShift += 1; } y >>= 1; } require (resultShift < 64); absResult >>= 64 - resultShift; } int256 result = negative ? -int256 (absResult) : int256 (absResult); require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate sqrt (x) rounding down. Revert if x < 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sqrt (int128 x) internal pure returns (int128) { unchecked { require (x >= 0); return int128 (sqrtu (uint256 (int256 (x)) << 64)); } } /** * Calculate binary logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function log_2 (int128 x) internal pure returns (int128) { unchecked { require (x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 result = msb - 64 << 64; uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb); for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) { ux *= ux; uint256 b = ux >> 255; ux >>= 127 + b; result += bit * int256 (b); } return int128 (result); } } /** * Calculate natural logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function ln (int128 x) internal pure returns (int128) { unchecked { require (x > 0); return int128 (int256 ( uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128)); } } /** * Calculate binary exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp_2 (int128 x) internal pure returns (int128) { unchecked { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128; if (x & 0x4000000000000000 > 0) result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128; if (x & 0x2000000000000000 > 0) result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128; if (x & 0x1000000000000000 > 0) result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128; if (x & 0x800000000000000 > 0) result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128; if (x & 0x400000000000000 > 0) result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128; if (x & 0x200000000000000 > 0) result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128; if (x & 0x100000000000000 > 0) result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128; if (x & 0x80000000000000 > 0) result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128; if (x & 0x40000000000000 > 0) result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128; if (x & 0x20000000000000 > 0) result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128; if (x & 0x10000000000000 > 0) result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128; if (x & 0x8000000000000 > 0) result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128; if (x & 0x4000000000000 > 0) result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128; if (x & 0x2000000000000 > 0) result = result * 0x1000162E525EE054754457D5995292026 >> 128; if (x & 0x1000000000000 > 0) result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128; if (x & 0x800000000000 > 0) result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128; if (x & 0x400000000000 > 0) result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128; if (x & 0x200000000000 > 0) result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128; if (x & 0x100000000000 > 0) result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128; if (x & 0x80000000000 > 0) result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128; if (x & 0x40000000000 > 0) result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128; if (x & 0x20000000000 > 0) result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128; if (x & 0x10000000000 > 0) result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128; if (x & 0x8000000000 > 0) result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128; if (x & 0x4000000000 > 0) result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128; if (x & 0x2000000000 > 0) result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128; if (x & 0x1000000000 > 0) result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128; if (x & 0x800000000 > 0) result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128; if (x & 0x400000000 > 0) result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128; if (x & 0x200000000 > 0) result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128; if (x & 0x100000000 > 0) result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128; if (x & 0x80000000 > 0) result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128; if (x & 0x40000000 > 0) result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128; if (x & 0x20000000 > 0) result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128; if (x & 0x10000000 > 0) result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128; if (x & 0x8000000 > 0) result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128; if (x & 0x4000000 > 0) result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128; if (x & 0x2000000 > 0) result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128; if (x & 0x1000000 > 0) result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128; if (x & 0x800000 > 0) result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128; if (x & 0x400000 > 0) result = result * 0x100000000002C5C85FDF477B662B26945 >> 128; if (x & 0x200000 > 0) result = result * 0x10000000000162E42FEFA3AE53369388C >> 128; if (x & 0x100000 > 0) result = result * 0x100000000000B17217F7D1D351A389D40 >> 128; if (x & 0x80000 > 0) result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128; if (x & 0x40000 > 0) result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128; if (x & 0x20000 > 0) result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128; if (x & 0x10000 > 0) result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128; if (x & 0x8000 > 0) result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128; if (x & 0x4000 > 0) result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128; if (x & 0x2000 > 0) result = result * 0x1000000000000162E42FEFA39F02B772C >> 128; if (x & 0x1000 > 0) result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128; if (x & 0x800 > 0) result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128; if (x & 0x400 > 0) result = result * 0x100000000000002C5C85FDF473DEA871F >> 128; if (x & 0x200 > 0) result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128; if (x & 0x100 > 0) result = result * 0x100000000000000B17217F7D1CF79E949 >> 128; if (x & 0x80 > 0) result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128; if (x & 0x40 > 0) result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128; if (x & 0x20 > 0) result = result * 0x100000000000000162E42FEFA39EF366F >> 128; if (x & 0x10 > 0) result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128; if (x & 0x8 > 0) result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128; if (x & 0x4 > 0) result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128; if (x & 0x2 > 0) result = result * 0x1000000000000000162E42FEFA39EF358 >> 128; if (x & 0x1 > 0) result = result * 0x10000000000000000B17217F7D1CF79AB >> 128; result >>= uint256 (int256 (63 - (x >> 64))); require (result <= uint256 (int256 (MAX_64x64))); return int128 (int256 (result)); } } /** * Calculate natural exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp (int128 x) internal pure returns (int128) { unchecked { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow return exp_2 ( int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128)); } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return unsigned 64.64-bit fixed point number */ function divuu (uint256 x, uint256 y) private pure returns (uint128) { unchecked { require (y != 0); uint256 result; if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) result = (x << 64) / y; else { uint256 msb = 192; uint256 xc = x >> 192; if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1); require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 hi = result * (y >> 128); uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 xh = x >> 192; uint256 xl = x << 64; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here lo = hi << 128; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here result += xh == hi >> 128 ? xl / y : 1; } require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return uint128 (result); } } /** * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer * number. * * @param x unsigned 256-bit integer number * @return unsigned 128-bit integer number */ function sqrtu (uint256 x) private pure returns (uint128) { unchecked { if (x == 0) return 0; else { uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x4) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return uint128 (r < r1 ? r : r1); } } } }
pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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 v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../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. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. 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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "cancun", "viaIR": true, "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"contract ISoup","name":"_soup","type":"address"},{"internalType":"contract Game","name":"_game","type":"address"},{"internalType":"contract IOracle","name":"_oracle","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"lpAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"soupAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"}],"name":"AddedToLiquidityPot","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"EpochDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":"duration","type":"uint256"}],"name":"RewardDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardsPerSecond","type":"uint256"}],"name":"RewardsUpdated","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":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"allocatedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"allocatedUnderlyingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimableBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"compound","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"currentAllocationPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"game","outputs":[{"internalType":"contract Game","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getInfo","outputs":[{"components":[{"internalType":"uint256","name":"stakingTokenBalance","type":"uint256"},{"internalType":"uint256","name":"userAllocatedAmount","type":"uint256"},{"internalType":"uint256","name":"userStakedAmount","type":"uint256"},{"internalType":"uint256","name":"rewardsPerSecond","type":"uint256"},{"internalType":"uint256","name":"nextRewardRetrieval","type":"uint256"},{"internalType":"uint256","name":"rewardsPerStake","type":"uint256"},{"internalType":"uint256","name":"rewardEndTime","type":"uint256"},{"internalType":"uint256","name":"lockDuration","type":"uint256"},{"internalType":"uint256","name":"totalStaked","type":"uint256"},{"internalType":"uint256","name":"ethPerToken","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"ethPerUSD","type":"uint256"},{"internalType":"uint256","name":"unlockAt","type":"uint256"},{"internalType":"uint256","name":"ethPerLP","type":"uint256"}],"internalType":"struct LiquidityPot.UserInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquiditySlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextRewardRetrieval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"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":"retrieveAndReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardDuration","type":"uint256"}],"name":"setRewardDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"usd","type":"address"}],"name":"setUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"soup","outputs":[{"internalType":"contract ISoup","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"excluded","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updatedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wethAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604090808252346101c557608081612516803803809161002182856101c9565b8339810103126101c55780516001600160a01b0390818116908190036101c55760209081840151908382168092036101c55785850151948486168096036101c55760600151908482168092036101c5575f549260018060a01b03199633888616175f55885194873391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a36001805562093a8060025573dac17f958d2ee523a2206206994597c13d831ec788600f541617600f5587600a541617600a5586600b541617600b558186600c541617600c5585600d541617600d556315ab88c960e31b82528282600481845afa9081156101bb578484926004945f9161019e575b5016866011541617601155865192838092632817ba2360e11b82525afa918215610194575f92610167575b505016906010541617601055516122f690816102208239f35b6101869250803d1061018d575b61017e81836101c9565b810190610200565b5f8061014e565b503d610174565b85513d5f823e3d90fd5b6101b59150843d861161018d5761017e81836101c9565b5f610123565b86513d5f823e3d90fd5b5f80fd5b601f909101601f19168101906001600160401b038211908210176101ec57604052565b634e487b7160e01b5f52604160045260245ffd5b908160209103126101c557516001600160a01b03811681036101c5579056fe608080604052600436101561001a575b50361561001857005b005b5f905f3560e01c90816316934fc414611a58575080632e1a7d4d146118e35780632ee4090814611672578063310bf1c81461165557806333bcfcbe1461157a57806337e9f64a1461155d578063417d020b146115405780634e71d92d146115195780634f0e0ef3146114f15780635312ea8e146113855780636faa5b5c1461136b578063715018a61461131457806372f702f3146112ec5780637519ab50146112cf5780637dc0d1d0146112a7578063817b1cd21461128a5780638da5cb5b146112635780638ea42976146112405780639e1a861314611218578063a694fc3a14610fb3578063a78793b614610f90578063aaf5eb6814610f6d578063b4852e7a14610f45578063c0ed00c914610e37578063c3fe3e2814610e0f578063c4f4542314610df2578063d545e0a214610dd0578063dbc4d32d14610d8d578063eacdaabc14610d70578063f2fde38b14610caa578063f520e7e514610c8d578063f69e20461461066c578063f887ea40146106435763ffdd5cf10361000f5734610640576020366003190112610640576101b1611a98565b90806101a06040516101c281611b0e565b8281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e08201528261010082015282610120820152826101408201528261016082015282610180820152015280918180809260018060a01b0381169081610598575b5050600c54600d5460405163b8e86aa560e01b81526001600160a01b0391821660048201529691169290602087602481875afa96871561058d578397610559575b50600b5460405163b8e86aa560e01b81526001600160a01b03909116600482018190529092602084602481895afa93841561051a578594610525575b50602060018060a01b03600f541660246040518099819363b8e86aa560e01b835260048301525afa95861561051a5785966104e6575b50600a5460405163349f642f60e11b8152929060209084906001600160a01b0316818061030c60048201611b4d565b03915afa9283156104db5786936104a7575b506003546004546004602060065494604051928380926318160ddd60e01b82525afa98891561049b579861044f575b50928a9895926101c09c9895926101a09b9895600754936008549660206040519e8f9061037982611b0e565b8152015260408d015260608c015260808b015260a08a015260c089015260e0880152610100870152610120860152610140850152610160840152610180830152828201526040519283526020810151602084015260408101516040840152606081015160608401526080810151608084015260a081015160a084015260c081015160c084015260e081015160e084015261010081015161010084015261012081015161012084015261014081015161014084015261016081015161016084015261018081015161018084015201516101a0820152f35b9895929b975093909895926020893d602011610493575b8161047360209383611b2b565b8101031261048f579751969a959894979295919490938a61034d565b5f80fd5b3d9150610466565b604051903d90823e3d90fd5b9092506020813d6020116104d3575b816104c360209383611b2b565b8101031261048f5751915f61031e565b3d91506104b6565b6040513d88823e3d90fd5b9095506020813d602011610512575b8161050260209383611b2b565b8101031261048f5751945f6102dd565b3d91506104f5565b6040513d87823e3d90fd5b9093506020813d602011610551575b8161054160209383611b2b565b8101031261048f5751925f6102a7565b3d9150610534565b9096506020813d602011610585575b8161057560209383611b2b565b8101031261048f5751955f61026b565b3d9150610568565b6040513d85823e3d90fd5b945094509150506024602060018060a01b03600d5416604051928380926370a0823160e01b82528860048301525afa8015610635578290610601575b6105df915092611c68565b92815260126020526001604082200154600e6020526040822054915f8061022a565b506020813d60201161062d575b8161061b60209383611b2b565b8101031261048f576105df90516105d4565b3d915061060e565b6040513d84823e3d90fd5b80fd5b50346106405780600319360112610640576010546040516001600160a01b039091168152602090f35b505f36600319011261048f57600a5460405163349f642f60e11b81526001600160a01b03916020919082908290851681806106a960048201611b4d565b03915afa80156109ae575f90610c5e575b6106c5915042611b76565b335f52600e825260405f205568056bc75e2d631000006106e433611ccb565b048015610c23576003544210610c16576106fc61203b565b61070881600554611b97565b600555600654335f526012835260405f2055604051906060908183019367ffffffffffffffff9484811086821117610c02576040526002845280840160403682378660115416855115610bee57815286600b5416908161076787611d72565b528760105416966040519163d06ca61f60e01b8352826044810134600483015260249960408b840152518091526064820192908c885f915b838310610bd4575050505050805f9203818b5afa9182156109ae575f92610b36575b50506040519363170ddc3160e11b8552600485015282848781855afa9384156109ae575f94610b05575b506107f590611d72565b516064610809610803611bbc565b86611cb8565b041015610a8a5786600d54169060405196838888816370a0823160e01b968782523060048301525afa9788156109ae575f98610a59575b5060405163095ea7b360e01b81526001600160a01b0391909116600482015260248101859052908390829060449082905f905af180156109ae57610a2c575b508660105416904788600b5416610708420191824211610a195787929160c491604051968794859363f305d71960e01b855260048501528a8d8501525f60448501525f606485015230608485015260a48401525af180156109ae57839286916109ea575b505087600d5416956040518097819382523060048301525afa9384156109ae575f946109b9575b5061093784957f99082720b1979c9cb4d4828fa54b1029b4f9ce9fdf788123e3814018c338ac7d95611b97565b61094381600854611b76565b600855335f526012825261095f600160405f2001918254611b76565b90556040519485528401523460408401523392a2600b5416803b1561048f575f80916004604051809481936332111c0560e11b83525af180156109ae576109a4575080f35b6100189150611afa565b6040513d5f823e3d90fd5b93508084813d83116109e3575b6109d08183611b2b565b8101031261048f5792519261093761090a565b503d6109c6565b90809293503d8311610a12575b610a018183611b2b565b8101031261048f578190845f6108e3565b503d6109f7565b88634e487b7160e01b5f5260116004525ffd5b610a4b90833d8511610a52575b610a438183611b2b565b810190611ba4565b505f61087f565b503d610a39565b919097508382813d8311610a83575b610a728183611b2b565b8101031261048f5790519684610840565b503d610a68565b60405162461bcd60e51b8152600481018390526048818701527f537570706c696564204554482073686f756c6420626520776f7274682074686560448201527f2072657761726420616d6f756e7420616674657220736c69707061676520697360648201526708185c1c1b1a595960c21b608482015260a490fd5b9093508281813d8311610b2f575b610b1d8183611b2b565b8101031261048f5751926107f56107eb565b503d610b13565b9091503d805f833e610b488183611b2b565b810190848183031261048f5780519083821161048f570181601f8201121561048f578051928311610bc1578260051b9060405193610b8887840186611b2b565b8452858085019282010192831161048f5785809101915b838310610bb157505050505f806107c1565b8251815291810191869101610b9f565b87634e487b7160e01b5f5260416004525ffd5b84511686529485019487945090920191600101888e61079f565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b610c1e61223c565b6106fc565b60405162461bcd60e51b81526004810183905260136024820152721b9bdd1a1a5b99c81d1bc818dbdb5c1bdd5b99606a1b6044820152606490fd5b508181813d8311610c86575b610c748183611b2b565b8101031261048f576106c590516106ba565b503d610c6a565b3461048f575f36600319011261048f576020600254604051908152f35b3461048f57602036600319011261048f57610cc3611a98565b610ccb6121e5565b6001600160a01b03908116908115610d1c575f54826bffffffffffffffffffffffff60a01b8216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b3461048f575f36600319011261048f576020600454604051908152f35b3461048f57602036600319011261048f57610da6611a98565b610dae6121e5565b600f80546001600160a01b0319166001600160a01b0392909216919091179055005b3461048f575f36600319011261048f576020610dea611d52565b604051908152f35b3461048f575f36600319011261048f576020600554604051908152f35b3461048f575f36600319011261048f57600a546040516001600160a01b039091168152602090f35b3461048f57602036600319011261048f57600435610e536121e5565b621275008111610eee5762015180811115610e99576020817ffeece2f615b2fecca6c26deadea49416a6ba6b52b2cd2613065fd6a787cf124092600255604051908152a1005b60405162461bcd60e51b815260206004820152602760248201527f526577617264206475726174696f6e206d757374206265206d6f7265207468616044820152666e20312064617960c81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f526577617264206475726174696f6e206d757374206265206c657373207468616044820152686e2032207765656b7360b81b6064820152608490fd5b3461048f575f36600319011261048f57600b546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f57602060405168056bc75e2d631000008152f35b3461048f57602036600319011261048f576020610dea610fae611a98565b611ccb565b3461048f5760208060031936011261048f5760043590610fd1611d82565b81156111e357600a5460405163349f642f60e11b8082526004820184905260156024830152741c1d589b1a58d1195c1bdcda5d1cd15b98589b1959605a1b60448301526001600160a01b0393928416918381606481865afa9081156109ae575f916111b6575b501561117d5782906040519283918252818061105560048201611b4d565b03915afa9081156109ae575f91611150575b505f92611075839242611b76565b338552600e83526040852055600d54166064604051809581936323b872dd60e01b83523360048401523060248401528860448401525af19182156109ae577f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d92611133575b50600854156110e833611dd8565b6110f484600854611b76565b600855335f5260128252600160405f2001611110858254611b76565b9055611126575b6040519283523392a260018055005b61112e61203b565b611117565b61114990823d8411610a5257610a438183611b2b565b50836110da565b90508181813d8311611176575b6111678183611b2b565b8101031261048f57515f611067565b503d61115d565b60405162461bcd60e51b815260048101849052601160248201527019195c1bdcda5d1cc8191a5cd8589b1959607a1b6044820152606490fd5b90508381813d83116111dc575b6111cd8183611b2b565b8101031261048f575186611037565b503d6111c3565b6064906040519062461bcd60e51b82526004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152fd5b3461048f575f36600319011261048f57600f546040516001600160a01b039091168152602090f35b3461048f57602036600319011261048f576020610dea61125e611a98565b611c68565b3461048f575f36600319011261048f575f546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f576020600854604051908152f35b3461048f575f36600319011261048f57600c546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f576020600954604051908152f35b3461048f575f36600319011261048f57600d546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f5761132c6121e5565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461048f575f36600319011261048f576020610dea611bbc565b3461048f5760208060031936011261048f57600435906113a3611d82565b335f52600e81526113ba60405f2054421015611aae565b335f5260128152600160405f200154821515806114e7575b156114a257826113f0916113e882600854611b97565b600855611b97565b335f8181526012845260408082206001810194909455600654909355600d54925163a9059cbb60e01b8152600481019290925260248201859052909291829184916001600160a01b031690829081604481015b03925af19182156109ae577f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592611485575b506040519283523392a260018055005b61149b90823d8411610a5257610a438183611b2b565b5083611475565b60405162461bcd60e51b815260048101839052601760248201527f496e76616c696420776974686472617720616d6f756e740000000000000000006044820152606490fd5b50808311156113d2565b3461048f575f36600319011261048f576011546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f57611531611d82565b61153a33611dd8565b60018055005b3461048f575f36600319011261048f576020600354604051908152f35b3461048f575f36600319011261048f576020600754604051908152f35b3461048f575f36600319011261048f57611592611d82565b600854156115f9576004546115aa575b61153a61203b565b6003544210156115a25760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f7420757064617465207265776172647320796574000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602e60248201527f43616e206e6f7420757064617465207265776172647320756e74696c2075736560448201526d1c9cc81a185d99481cdd185ad95960921b6064820152608490fd5b3461048f575f36600319011261048f576020600654604051908152f35b3461048f57604036600319011261048f5761168b611a98565b602435611696611d82565b80156118ad5760018060a01b039182600a5416916040519163349f642f60e11b80845260209384600482015260156024820152741c1d589b1a58d1195c1bdcda5d1cd15b98589b1959605a1b60448201528481606481895afa9081156109ae575f91611880575b50156118475783906040519586918252818061171b60048201611b4d565b03915afa9384156109ae575f94611818575b508261173a5f9542611b76565b9580831696878752600e83526040872055600d54166064604051809781936323b872dd60e01b83523360048401523060248401528760448401525af19384156109ae577f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d946117fb575b506117b26008541591611dd8565b6117be82600854611b76565b600855845f5260128352600160405f20016117da838254611b76565b90556117ee575b604051908152a260018055005b6117f661203b565b6117e1565b61181190843d8611610a5257610a438183611b2b565b50856117a4565b93508284813d8311611840575b61182f8183611b2b565b8101031261048f579251928261172d565b503d611825565b60405162461bcd60e51b815260048101859052601160248201527019195c1bdcda5d1cc8191a5cd8589b1959607a1b6044820152606490fd5b90508481813d83116118a6575b6118978183611b2b565b8101031261048f5751876116fd565b503d61188d565b60405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606490fd5b3461048f5760208060031936011261048f5760043590611901611d82565b335f5260128152600160405f2001548211611a1457335f52600e815261192d60405f2054421015611aae565b600a5460405163349f642f60e11b81526001600160a01b0391839082908416818061195a60048201611b4d565b03915afa80156109ae575f906119e5575b611976915042611b76565b335f52600e835260405f205561198b33611dd8565b61199783600854611b97565b600855335f5260128252600160405f20016119b3848254611b97565b9055600d5460405163a9059cbb60e01b81523360048201526024810185905292918291849116815f8160448101611443565b508281813d8311611a0d575b6119fb8183611b2b565b8101031261048f57611976905161196b565b503d6119f1565b6064906040519062461bcd60e51b82526004820152601f60248201527f576974686472617720616d6f756e7420657863656564732062616c616e6365006044820152fd5b3461048f57602036600319011261048f576040906001600160a01b03611a7c611a98565b165f526012602052815f20600181549101549082526020820152f35b600435906001600160a01b038216820361048f57565b15611ab557565b60405162461bcd60e51b815260206004820152601760248201527f746f6b656e73206e6f742079657420756e6c6f636b65640000000000000000006044820152606490fd5b67ffffffffffffffff8111610c0257604052565b6101c0810190811067ffffffffffffffff821117610c0257604052565b90601f8019910116810190811067ffffffffffffffff821117610c0257604052565b60609060208152600e60208201526d36382637b1b5a23ab930ba34b7b760911b60408201520190565b91908201809211611b8357565b634e487b7160e01b5f52601160045260245ffd5b91908203918211611b8357565b9081602091031261048f5751801515810361048f5790565b600a5460405163349f642f60e11b815260206004820181905260116024830152706c6971756964697479536c69707061676560781b60448301529091829060649082906001600160a01b03165afa9081156109ae575f91611c1b575090565b90506020813d602011611c42575b81611c3660209383611b2b565b8101031261048f575190565b3d9150611c29565b8115611c54570490565b634e487b7160e01b5f52601260045260245ffd5b600b546001600160a01b03169060209068056bc75e2d6310000090611c8c90611ccb565b0460246040518094819363170ddc3160e11b835260048301525afa9081156109ae575f91611c1b575090565b81810292918115918404141715611b8357565b600854908115611d4c57611d1b611d4992611d16611cf3611cea611d52565b60045490611cb8565b6001600160a01b039094165f818152601260205260409020600101549094611cb8565b611c4a565b905f526012602052611d4460405f20611d3e600182015491600654905490611b97565b90611cb8565b611b76565b90565b50505f90565b60075460095480821115611d4c57611d4991428110611b97575042611b97565b805160011015610bee5760400190565b600260015414611d93576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b68056bc75e2d63100000611deb82611ccb565b600a546040805163349f642f60e11b815290946001600160a01b039490930491602091908290829087168180611e2360048201611b4d565b03915afa8015611fea575f9061200c575b611e3f915042611b76565b9284811693845f52600e8352865f205560035442101580612001575b15611ff457611e6861203b565b611e7483600554611b97565b600555600654845f5260128352865f205582611ed5575b50505050600b541690813b1561048f575f809260048351809581936332111c0560e11b83525af1908115611ecc5750611ec15750565b611eca90611afa565b565b513d5f823e3d90fd5b600b5486516319b6934960e11b81526001600160a01b03929092166004830152602482018490528290829060449082905f908a165af18015611fea57611fcd575b508084600b541692602487518095819363170ddc3160e11b835260048301525afa8015611fc3575f90611f76575b7f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f724192508551908152a25f808080611e8b565b508082813d8311611fbc575b611f8c8183611b2b565b8101031261048f577f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419151611f44565b503d611f82565b85513d5f823e3d90fd5b611fe390823d8411610a5257610a438183611b2b565b505f611f16565b86513d5f823e3d90fd5b611ffc61223c565b611e68565b506008541515611e5b565b508181813d8311612034575b6120228183611b2b565b8101031261048f57611e3f9051611e34565b503d612018565b6002546120495f9142611b76565b60035560018060a01b039081600b541682600a5416926040519163349f642f60e11b8352826004958160646020968793848b830152600c60248301526b6c705265776172644269707360a01b60448301525afa9081156109ae575f916121b8575b50813b1561048f575f91602483926040519485938492637705a5f760e11b84528b8401525af16121a5575b5081602491600b541660405192838092633af9e66960e01b825230898301525afa91821561058d578392612177575b505061210e61223c565b6005549081811161212f57505090555b61212a42600254611b76565b600755565b9061213991611b97565b9068056bc75e2d631000009180830292830403612164575060025461215d91611c4a565b905561211e565b634e487b7160e01b815260118352602490fd5b90809250813d831161219e575b61218e8183611b2b565b8101031261048f57515f80612104565b503d612184565b6121b0919350611afa565b5f91816120d5565b90508381813d83116121de575b6121cf8183611b2b565b8101031261048f57515f6120aa565b503d6121c5565b5f546001600160a01b031633036121f857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60085480156122bd5760207fc9a5a3fd7d347387e8e94486e0a318555c954a59ef909437cba032eabbd87def916122ad68056bc75e2d6310000061227e611d52565b926122a16122996122926004548097611cb8565b9283611c4a565b600654611b76565b60065504600554611b76565b60055542600955604051908152a1565b5056fea2646970667358221220ee276f48626130ce18d24e74e474a48deb8d7111eabb17b90a8557f9bbf839b164736f6c634300081900330000000000000000000000000cc7ddb867d89a9a56e56509d4d7d676968f535c00000000000000000000000028cfe98c33b8a8bb5f5ac5068a95d9db6bee5ffd000000000000000000000000791d99e6287ec2ca7e0244e96f51b884b725394d0000000000000000000000006777a99e8c6740b436b9ff9a49288acf1cac77a5
Deployed Bytecode
0x608080604052600436101561001a575b50361561001857005b005b5f905f3560e01c90816316934fc414611a58575080632e1a7d4d146118e35780632ee4090814611672578063310bf1c81461165557806333bcfcbe1461157a57806337e9f64a1461155d578063417d020b146115405780634e71d92d146115195780634f0e0ef3146114f15780635312ea8e146113855780636faa5b5c1461136b578063715018a61461131457806372f702f3146112ec5780637519ab50146112cf5780637dc0d1d0146112a7578063817b1cd21461128a5780638da5cb5b146112635780638ea42976146112405780639e1a861314611218578063a694fc3a14610fb3578063a78793b614610f90578063aaf5eb6814610f6d578063b4852e7a14610f45578063c0ed00c914610e37578063c3fe3e2814610e0f578063c4f4542314610df2578063d545e0a214610dd0578063dbc4d32d14610d8d578063eacdaabc14610d70578063f2fde38b14610caa578063f520e7e514610c8d578063f69e20461461066c578063f887ea40146106435763ffdd5cf10361000f5734610640576020366003190112610640576101b1611a98565b90806101a06040516101c281611b0e565b8281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e08201528261010082015282610120820152826101408201528261016082015282610180820152015280918180809260018060a01b0381169081610598575b5050600c54600d5460405163b8e86aa560e01b81526001600160a01b0391821660048201529691169290602087602481875afa96871561058d578397610559575b50600b5460405163b8e86aa560e01b81526001600160a01b03909116600482018190529092602084602481895afa93841561051a578594610525575b50602060018060a01b03600f541660246040518099819363b8e86aa560e01b835260048301525afa95861561051a5785966104e6575b50600a5460405163349f642f60e11b8152929060209084906001600160a01b0316818061030c60048201611b4d565b03915afa9283156104db5786936104a7575b506003546004546004602060065494604051928380926318160ddd60e01b82525afa98891561049b579861044f575b50928a9895926101c09c9895926101a09b9895600754936008549660206040519e8f9061037982611b0e565b8152015260408d015260608c015260808b015260a08a015260c089015260e0880152610100870152610120860152610140850152610160840152610180830152828201526040519283526020810151602084015260408101516040840152606081015160608401526080810151608084015260a081015160a084015260c081015160c084015260e081015160e084015261010081015161010084015261012081015161012084015261014081015161014084015261016081015161016084015261018081015161018084015201516101a0820152f35b9895929b975093909895926020893d602011610493575b8161047360209383611b2b565b8101031261048f579751969a959894979295919490938a61034d565b5f80fd5b3d9150610466565b604051903d90823e3d90fd5b9092506020813d6020116104d3575b816104c360209383611b2b565b8101031261048f5751915f61031e565b3d91506104b6565b6040513d88823e3d90fd5b9095506020813d602011610512575b8161050260209383611b2b565b8101031261048f5751945f6102dd565b3d91506104f5565b6040513d87823e3d90fd5b9093506020813d602011610551575b8161054160209383611b2b565b8101031261048f5751925f6102a7565b3d9150610534565b9096506020813d602011610585575b8161057560209383611b2b565b8101031261048f5751955f61026b565b3d9150610568565b6040513d85823e3d90fd5b945094509150506024602060018060a01b03600d5416604051928380926370a0823160e01b82528860048301525afa8015610635578290610601575b6105df915092611c68565b92815260126020526001604082200154600e6020526040822054915f8061022a565b506020813d60201161062d575b8161061b60209383611b2b565b8101031261048f576105df90516105d4565b3d915061060e565b6040513d84823e3d90fd5b80fd5b50346106405780600319360112610640576010546040516001600160a01b039091168152602090f35b505f36600319011261048f57600a5460405163349f642f60e11b81526001600160a01b03916020919082908290851681806106a960048201611b4d565b03915afa80156109ae575f90610c5e575b6106c5915042611b76565b335f52600e825260405f205568056bc75e2d631000006106e433611ccb565b048015610c23576003544210610c16576106fc61203b565b61070881600554611b97565b600555600654335f526012835260405f2055604051906060908183019367ffffffffffffffff9484811086821117610c02576040526002845280840160403682378660115416855115610bee57815286600b5416908161076787611d72565b528760105416966040519163d06ca61f60e01b8352826044810134600483015260249960408b840152518091526064820192908c885f915b838310610bd4575050505050805f9203818b5afa9182156109ae575f92610b36575b50506040519363170ddc3160e11b8552600485015282848781855afa9384156109ae575f94610b05575b506107f590611d72565b516064610809610803611bbc565b86611cb8565b041015610a8a5786600d54169060405196838888816370a0823160e01b968782523060048301525afa9788156109ae575f98610a59575b5060405163095ea7b360e01b81526001600160a01b0391909116600482015260248101859052908390829060449082905f905af180156109ae57610a2c575b508660105416904788600b5416610708420191824211610a195787929160c491604051968794859363f305d71960e01b855260048501528a8d8501525f60448501525f606485015230608485015260a48401525af180156109ae57839286916109ea575b505087600d5416956040518097819382523060048301525afa9384156109ae575f946109b9575b5061093784957f99082720b1979c9cb4d4828fa54b1029b4f9ce9fdf788123e3814018c338ac7d95611b97565b61094381600854611b76565b600855335f526012825261095f600160405f2001918254611b76565b90556040519485528401523460408401523392a2600b5416803b1561048f575f80916004604051809481936332111c0560e11b83525af180156109ae576109a4575080f35b6100189150611afa565b6040513d5f823e3d90fd5b93508084813d83116109e3575b6109d08183611b2b565b8101031261048f5792519261093761090a565b503d6109c6565b90809293503d8311610a12575b610a018183611b2b565b8101031261048f578190845f6108e3565b503d6109f7565b88634e487b7160e01b5f5260116004525ffd5b610a4b90833d8511610a52575b610a438183611b2b565b810190611ba4565b505f61087f565b503d610a39565b919097508382813d8311610a83575b610a728183611b2b565b8101031261048f5790519684610840565b503d610a68565b60405162461bcd60e51b8152600481018390526048818701527f537570706c696564204554482073686f756c6420626520776f7274682074686560448201527f2072657761726420616d6f756e7420616674657220736c69707061676520697360648201526708185c1c1b1a595960c21b608482015260a490fd5b9093508281813d8311610b2f575b610b1d8183611b2b565b8101031261048f5751926107f56107eb565b503d610b13565b9091503d805f833e610b488183611b2b565b810190848183031261048f5780519083821161048f570181601f8201121561048f578051928311610bc1578260051b9060405193610b8887840186611b2b565b8452858085019282010192831161048f5785809101915b838310610bb157505050505f806107c1565b8251815291810191869101610b9f565b87634e487b7160e01b5f5260416004525ffd5b84511686529485019487945090920191600101888e61079f565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b610c1e61223c565b6106fc565b60405162461bcd60e51b81526004810183905260136024820152721b9bdd1a1a5b99c81d1bc818dbdb5c1bdd5b99606a1b6044820152606490fd5b508181813d8311610c86575b610c748183611b2b565b8101031261048f576106c590516106ba565b503d610c6a565b3461048f575f36600319011261048f576020600254604051908152f35b3461048f57602036600319011261048f57610cc3611a98565b610ccb6121e5565b6001600160a01b03908116908115610d1c575f54826bffffffffffffffffffffffff60a01b8216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b3461048f575f36600319011261048f576020600454604051908152f35b3461048f57602036600319011261048f57610da6611a98565b610dae6121e5565b600f80546001600160a01b0319166001600160a01b0392909216919091179055005b3461048f575f36600319011261048f576020610dea611d52565b604051908152f35b3461048f575f36600319011261048f576020600554604051908152f35b3461048f575f36600319011261048f57600a546040516001600160a01b039091168152602090f35b3461048f57602036600319011261048f57600435610e536121e5565b621275008111610eee5762015180811115610e99576020817ffeece2f615b2fecca6c26deadea49416a6ba6b52b2cd2613065fd6a787cf124092600255604051908152a1005b60405162461bcd60e51b815260206004820152602760248201527f526577617264206475726174696f6e206d757374206265206d6f7265207468616044820152666e20312064617960c81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f526577617264206475726174696f6e206d757374206265206c657373207468616044820152686e2032207765656b7360b81b6064820152608490fd5b3461048f575f36600319011261048f57600b546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f57602060405168056bc75e2d631000008152f35b3461048f57602036600319011261048f576020610dea610fae611a98565b611ccb565b3461048f5760208060031936011261048f5760043590610fd1611d82565b81156111e357600a5460405163349f642f60e11b8082526004820184905260156024830152741c1d589b1a58d1195c1bdcda5d1cd15b98589b1959605a1b60448301526001600160a01b0393928416918381606481865afa9081156109ae575f916111b6575b501561117d5782906040519283918252818061105560048201611b4d565b03915afa9081156109ae575f91611150575b505f92611075839242611b76565b338552600e83526040852055600d54166064604051809581936323b872dd60e01b83523360048401523060248401528860448401525af19182156109ae577f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d92611133575b50600854156110e833611dd8565b6110f484600854611b76565b600855335f5260128252600160405f2001611110858254611b76565b9055611126575b6040519283523392a260018055005b61112e61203b565b611117565b61114990823d8411610a5257610a438183611b2b565b50836110da565b90508181813d8311611176575b6111678183611b2b565b8101031261048f57515f611067565b503d61115d565b60405162461bcd60e51b815260048101849052601160248201527019195c1bdcda5d1cc8191a5cd8589b1959607a1b6044820152606490fd5b90508381813d83116111dc575b6111cd8183611b2b565b8101031261048f575186611037565b503d6111c3565b6064906040519062461bcd60e51b82526004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152fd5b3461048f575f36600319011261048f57600f546040516001600160a01b039091168152602090f35b3461048f57602036600319011261048f576020610dea61125e611a98565b611c68565b3461048f575f36600319011261048f575f546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f576020600854604051908152f35b3461048f575f36600319011261048f57600c546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f576020600954604051908152f35b3461048f575f36600319011261048f57600d546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f5761132c6121e5565b5f80546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461048f575f36600319011261048f576020610dea611bbc565b3461048f5760208060031936011261048f57600435906113a3611d82565b335f52600e81526113ba60405f2054421015611aae565b335f5260128152600160405f200154821515806114e7575b156114a257826113f0916113e882600854611b97565b600855611b97565b335f8181526012845260408082206001810194909455600654909355600d54925163a9059cbb60e01b8152600481019290925260248201859052909291829184916001600160a01b031690829081604481015b03925af19182156109ae577f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592611485575b506040519283523392a260018055005b61149b90823d8411610a5257610a438183611b2b565b5083611475565b60405162461bcd60e51b815260048101839052601760248201527f496e76616c696420776974686472617720616d6f756e740000000000000000006044820152606490fd5b50808311156113d2565b3461048f575f36600319011261048f576011546040516001600160a01b039091168152602090f35b3461048f575f36600319011261048f57611531611d82565b61153a33611dd8565b60018055005b3461048f575f36600319011261048f576020600354604051908152f35b3461048f575f36600319011261048f576020600754604051908152f35b3461048f575f36600319011261048f57611592611d82565b600854156115f9576004546115aa575b61153a61203b565b6003544210156115a25760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f7420757064617465207265776172647320796574000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152602e60248201527f43616e206e6f7420757064617465207265776172647320756e74696c2075736560448201526d1c9cc81a185d99481cdd185ad95960921b6064820152608490fd5b3461048f575f36600319011261048f576020600654604051908152f35b3461048f57604036600319011261048f5761168b611a98565b602435611696611d82565b80156118ad5760018060a01b039182600a5416916040519163349f642f60e11b80845260209384600482015260156024820152741c1d589b1a58d1195c1bdcda5d1cd15b98589b1959605a1b60448201528481606481895afa9081156109ae575f91611880575b50156118475783906040519586918252818061171b60048201611b4d565b03915afa9384156109ae575f94611818575b508261173a5f9542611b76565b9580831696878752600e83526040872055600d54166064604051809781936323b872dd60e01b83523360048401523060248401528760448401525af19384156109ae577f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d946117fb575b506117b26008541591611dd8565b6117be82600854611b76565b600855845f5260128352600160405f20016117da838254611b76565b90556117ee575b604051908152a260018055005b6117f661203b565b6117e1565b61181190843d8611610a5257610a438183611b2b565b50856117a4565b93508284813d8311611840575b61182f8183611b2b565b8101031261048f579251928261172d565b503d611825565b60405162461bcd60e51b815260048101859052601160248201527019195c1bdcda5d1cc8191a5cd8589b1959607a1b6044820152606490fd5b90508481813d83116118a6575b6118978183611b2b565b8101031261048f5751876116fd565b503d61188d565b60405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606490fd5b3461048f5760208060031936011261048f5760043590611901611d82565b335f5260128152600160405f2001548211611a1457335f52600e815261192d60405f2054421015611aae565b600a5460405163349f642f60e11b81526001600160a01b0391839082908416818061195a60048201611b4d565b03915afa80156109ae575f906119e5575b611976915042611b76565b335f52600e835260405f205561198b33611dd8565b61199783600854611b97565b600855335f5260128252600160405f20016119b3848254611b97565b9055600d5460405163a9059cbb60e01b81523360048201526024810185905292918291849116815f8160448101611443565b508281813d8311611a0d575b6119fb8183611b2b565b8101031261048f57611976905161196b565b503d6119f1565b6064906040519062461bcd60e51b82526004820152601f60248201527f576974686472617720616d6f756e7420657863656564732062616c616e6365006044820152fd5b3461048f57602036600319011261048f576040906001600160a01b03611a7c611a98565b165f526012602052815f20600181549101549082526020820152f35b600435906001600160a01b038216820361048f57565b15611ab557565b60405162461bcd60e51b815260206004820152601760248201527f746f6b656e73206e6f742079657420756e6c6f636b65640000000000000000006044820152606490fd5b67ffffffffffffffff8111610c0257604052565b6101c0810190811067ffffffffffffffff821117610c0257604052565b90601f8019910116810190811067ffffffffffffffff821117610c0257604052565b60609060208152600e60208201526d36382637b1b5a23ab930ba34b7b760911b60408201520190565b91908201809211611b8357565b634e487b7160e01b5f52601160045260245ffd5b91908203918211611b8357565b9081602091031261048f5751801515810361048f5790565b600a5460405163349f642f60e11b815260206004820181905260116024830152706c6971756964697479536c69707061676560781b60448301529091829060649082906001600160a01b03165afa9081156109ae575f91611c1b575090565b90506020813d602011611c42575b81611c3660209383611b2b565b8101031261048f575190565b3d9150611c29565b8115611c54570490565b634e487b7160e01b5f52601260045260245ffd5b600b546001600160a01b03169060209068056bc75e2d6310000090611c8c90611ccb565b0460246040518094819363170ddc3160e11b835260048301525afa9081156109ae575f91611c1b575090565b81810292918115918404141715611b8357565b600854908115611d4c57611d1b611d4992611d16611cf3611cea611d52565b60045490611cb8565b6001600160a01b039094165f818152601260205260409020600101549094611cb8565b611c4a565b905f526012602052611d4460405f20611d3e600182015491600654905490611b97565b90611cb8565b611b76565b90565b50505f90565b60075460095480821115611d4c57611d4991428110611b97575042611b97565b805160011015610bee5760400190565b600260015414611d93576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b68056bc75e2d63100000611deb82611ccb565b600a546040805163349f642f60e11b815290946001600160a01b039490930491602091908290829087168180611e2360048201611b4d565b03915afa8015611fea575f9061200c575b611e3f915042611b76565b9284811693845f52600e8352865f205560035442101580612001575b15611ff457611e6861203b565b611e7483600554611b97565b600555600654845f5260128352865f205582611ed5575b50505050600b541690813b1561048f575f809260048351809581936332111c0560e11b83525af1908115611ecc5750611ec15750565b611eca90611afa565b565b513d5f823e3d90fd5b600b5486516319b6934960e11b81526001600160a01b03929092166004830152602482018490528290829060449082905f908a165af18015611fea57611fcd575b508084600b541692602487518095819363170ddc3160e11b835260048301525afa8015611fc3575f90611f76575b7f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f724192508551908152a25f808080611e8b565b508082813d8311611fbc575b611f8c8183611b2b565b8101031261048f577f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419151611f44565b503d611f82565b85513d5f823e3d90fd5b611fe390823d8411610a5257610a438183611b2b565b505f611f16565b86513d5f823e3d90fd5b611ffc61223c565b611e68565b506008541515611e5b565b508181813d8311612034575b6120228183611b2b565b8101031261048f57611e3f9051611e34565b503d612018565b6002546120495f9142611b76565b60035560018060a01b039081600b541682600a5416926040519163349f642f60e11b8352826004958160646020968793848b830152600c60248301526b6c705265776172644269707360a01b60448301525afa9081156109ae575f916121b8575b50813b1561048f575f91602483926040519485938492637705a5f760e11b84528b8401525af16121a5575b5081602491600b541660405192838092633af9e66960e01b825230898301525afa91821561058d578392612177575b505061210e61223c565b6005549081811161212f57505090555b61212a42600254611b76565b600755565b9061213991611b97565b9068056bc75e2d631000009180830292830403612164575060025461215d91611c4a565b905561211e565b634e487b7160e01b815260118352602490fd5b90809250813d831161219e575b61218e8183611b2b565b8101031261048f57515f80612104565b503d612184565b6121b0919350611afa565b5f91816120d5565b90508381813d83116121de575b6121cf8183611b2b565b8101031261048f57515f6120aa565b503d6121c5565b5f546001600160a01b031633036121f857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60085480156122bd5760207fc9a5a3fd7d347387e8e94486e0a318555c954a59ef909437cba032eabbd87def916122ad68056bc75e2d6310000061227e611d52565b926122a16122996122926004548097611cb8565b9283611c4a565b600654611b76565b60065504600554611b76565b60055542600955604051908152a1565b5056fea2646970667358221220ee276f48626130ce18d24e74e474a48deb8d7111eabb17b90a8557f9bbf839b164736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000cc7ddb867d89a9a56e56509d4d7d676968f535c00000000000000000000000028cfe98c33b8a8bb5f5ac5068a95d9db6bee5ffd000000000000000000000000791d99e6287ec2ca7e0244e96f51b884b725394d0000000000000000000000006777a99e8c6740b436b9ff9a49288acf1cac77a5
-----Decoded View---------------
Arg [0] : _lpToken (address): 0x0cC7ddB867D89A9a56e56509d4d7d676968F535C
Arg [1] : _soup (address): 0x28cFE98c33b8A8Bb5F5aC5068A95D9db6bEE5FfD
Arg [2] : _game (address): 0x791d99E6287ec2ca7E0244e96F51b884B725394D
Arg [3] : _oracle (address): 0x6777a99E8C6740B436B9ff9a49288aCf1cAC77a5
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000cc7ddb867d89a9a56e56509d4d7d676968f535c
Arg [1] : 00000000000000000000000028cfe98c33b8a8bb5f5ac5068a95d9db6bee5ffd
Arg [2] : 000000000000000000000000791d99e6287ec2ca7e0244e96f51b884b725394d
Arg [3] : 0000000000000000000000006777a99e8c6740b436b9ff9a49288acf1cac77a5
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.