Source Code
Latest 25 from a total of 48 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Claim | 21932165 | 254 days ago | IN | 0 ETH | 0.00034234 | ||||
| Claim | 21874915 | 262 days ago | IN | 0 ETH | 0.00076748 | ||||
| Claim | 21703184 | 286 days ago | IN | 0 ETH | 0.00103288 | ||||
| Claim | 21588572 | 302 days ago | IN | 0 ETH | 0.00204204 | ||||
| Stake | 21587969 | 302 days ago | IN | 0 ETH | 0.00433534 | ||||
| Swap | 21586802 | 302 days ago | IN | 0 ETH | 0.00112974 | ||||
| Swap | 21575924 | 304 days ago | IN | 0 ETH | 0.00173647 | ||||
| Swap | 21572262 | 304 days ago | IN | 0 ETH | 0.00189386 | ||||
| Swap | 21557399 | 306 days ago | IN | 0 ETH | 0.00139504 | ||||
| Swap | 21554351 | 307 days ago | IN | 0 ETH | 0.00165326 | ||||
| Swap | 21551107 | 307 days ago | IN | 0 ETH | 0.0019819 | ||||
| Stake | 21550720 | 307 days ago | IN | 0 ETH | 0.0013679 | ||||
| Swap | 21550685 | 307 days ago | IN | 0 ETH | 0.00167885 | ||||
| Swap | 21550515 | 307 days ago | IN | 0 ETH | 0.00156219 | ||||
| Swap | 21544086 | 308 days ago | IN | 0 ETH | 0.00246069 | ||||
| Swap | 21526564 | 311 days ago | IN | 0 ETH | 0.0008674 | ||||
| Swap | 21525075 | 311 days ago | IN | 0 ETH | 0.00172965 | ||||
| Swap | 21524552 | 311 days ago | IN | 0 ETH | 0.00158286 | ||||
| Swap | 21524401 | 311 days ago | IN | 0 ETH | 0.00237822 | ||||
| Swap | 21524396 | 311 days ago | IN | 0 ETH | 0.00286481 | ||||
| Swap | 21511426 | 313 days ago | IN | 0 ETH | 0.00116413 | ||||
| Swap | 21503740 | 314 days ago | IN | 0 ETH | 0.00137394 | ||||
| Swap | 21497121 | 315 days ago | IN | 0 ETH | 0.00149009 | ||||
| Stake | 21496597 | 315 days ago | IN | 0 ETH | 0.00131066 | ||||
| Swap | 21496592 | 315 days ago | IN | 0 ETH | 0.00152873 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
EdenStax
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/interfaces/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "./interfaces/IEdenStaking.sol";
import "./lib/OracleLibrary.sol";
import "./lib/TickMath.sol";
import "./lib/constants.sol";
/// @title Stax Staking contract for Eden
contract EdenStax is Ownable2Step {
using SafeERC20 for IERC20;
// -------------------------- STATE VARIABLES -------------------------- //
IEdenStaking constant EdenStaking = IEdenStaking(EDEN_STAKING);
/// @notice Stax Vault address that stores and distributes all rewards.
address public immutable STAX_VAULT;
/// @notice Timestamp of the last swap.
uint256 public lastSwapTime;
/// @notice Timestamp of the last stake.
uint256 public lastStakeTime;
/// @notice Maximum amount per 1 swap in TitanX.
uint256 public maxSwapAmount = 2_000_000_000 ether;
/// @notice Minimum amount of Eden stake pool to omit cooldown restriction.
uint256 public constant intervalOverride = 1_000_000 ether;
/// @notice Minimum amount per 1 stake in Eden.
uint256 public minStakeAmount = 1_000_000 ether;
/// @notice Cooldown time between swaps in seconds.
uint64 public swapInterval = 30 minutes;
/// @notice Cooldown time between stakes in seconds.
uint64 public stakeInterval = 7 days;
/// @notice Basis point incentive fee paid out for swapping.
uint16 public swapIncentiveFeeBPS = 30;
/// @notice Basis point incentive fee paid out for staking.
uint16 public stakeIncentiveFeeBPS = 30;
/// @notice Basis point incentive fee paid out for claiming.
uint16 public claimIncentiveFeeBPS = 30;
/// @notice Time used for TWAP calculation
uint32 public secondsAgo = 5 * 60;
/// @notice Allowed deviation of the minAmountOut from historical price.
uint32 public deviation = 1000;
// ------------------------------- EVENTS ------------------------------ //
event Swap();
event Stake();
event Claim();
// ------------------------------- ERRORS ------------------------------ //
error Cooldown();
error InsufficientBalance();
error UnclaimedRewards();
error NothingToClaim();
error Prohibited();
error TWAP();
error Unauthorized();
error ZeroAddress();
error ZeroInput();
// ------------------------------ MODIFIERS ---------------------------- //
modifier originCheck() {
if (address(msg.sender).code.length != 0 || msg.sender != tx.origin) revert Unauthorized();
_;
}
// ----------------------------- CONSTRUCTOR --------------------------- //
constructor(address _owner, address _staxVault) Ownable(_owner) {
if (_staxVault == address(0)) revert ZeroAddress();
STAX_VAULT = _staxVault;
}
// --------------------------- PUBLIC FUNCTIONS ------------------------ //
/// @notice Swaps available TitanX to Eden for future stakes
/// @param minAmountOut Minimum Eden amount to receive in TitanX/Eden swap.
/// @param deadline Deadline timestamp to perform the swap.
function swap(uint256 minAmountOut, uint256 deadline) external originCheck {
(uint256 time, uint256 amount) = getNextSwapInfo();
if (time > block.timestamp) revert Cooldown();
if (amount == 0) revert InsufficientBalance();
lastSwapTime = block.timestamp;
uint256 incentive = _calculateIncentiveFee(amount, swapIncentiveFeeBPS);
IERC20(TITANX).safeTransfer(msg.sender, incentive);
_swapTitanXToEden(amount - incentive, minAmountOut, deadline);
emit Swap();
}
/// @notice Stakes all available Eden.
function stake() external originCheck {
(uint256 time, uint256 amount) = getNextStakeInfo();
if (amount < intervalOverride) {
if (time > block.timestamp) revert Cooldown();
if (amount < minStakeAmount) revert InsufficientBalance();
}
lastStakeTime = block.timestamp;
uint256 incentive = _calculateIncentiveFee(amount, stakeIncentiveFeeBPS);
uint160 stakeAmount = uint160(amount - incentive);
IERC20 eden = IERC20(EDEN);
eden.safeTransfer(msg.sender, incentive);
eden.safeIncreaseAllowance(EDEN_STAKING, stakeAmount);
EdenStaking.stake(STAKE_DURATION, stakeAmount);
emit Stake();
}
/// @notice Claims rewards for all available stakes.
function claim(uint160[] calldata ids) external originCheck {
uint256 claimAmount = EdenStaking.batchClaimableAmount(ids);
if (claimAmount == 0) revert NothingToClaim();
EdenStaking.batchClaim(ids, address(this));
uint256 incentive = _calculateIncentiveFee(claimAmount, claimIncentiveFeeBPS);
IERC20 titanX = IERC20(TITANX);
titanX.safeTransfer(msg.sender, incentive);
titanX.safeTransfer(STAX_VAULT, claimAmount - incentive);
emit Claim();
}
/// @notice Ends stake after its maturity.
/// @param ids Array of IDs of the stakes to end.
function endStakeAfterMaturity(uint160[] calldata ids) external originCheck {
EdenStaking.updateRewardsIfNecessary();
if (EdenStaking.batchClaimableAmount(ids) > 0) revert UnclaimedRewards();
EdenStaking.batchUnstake(ids, address(this));
}
// ----------------------- ADMINISTRATIVE FUNCTIONS -------------------- //
/// @notice Sets a new maximum amount of TitanX per swap.
/// @param limit Amount in WEI.
function setMaxSwapAmount(uint256 limit) external onlyOwner {
if (limit == 0) revert ZeroInput();
maxSwapAmount = limit;
}
/// @notice Sets a new minimum amount of Eden per stake.
/// @param limit Amount in WEI.
function setMinStakeAmount(uint256 limit) external onlyOwner {
minStakeAmount = limit;
}
/// @notice Sets a new cooldown time per TitanX/Eden swap.
/// @param limit Cooldown time in seconds.
function setSwapInterval(uint64 limit) external onlyOwner {
if (limit == 0) revert ZeroInput();
swapInterval = limit;
}
/// @notice Sets a new cooldown time per staking.
/// @param limit Cooldown time in seconds.
function setStakeInterval(uint64 limit) external onlyOwner {
if (limit == 0) revert ZeroInput();
stakeInterval = limit;
}
/// @notice Sets a new swap incentive fee basis points.
/// @param bps Incentive fee in basis points (1% = 100 bps).
function setSwapIncentiveFee(uint16 bps) external onlyOwner {
if (bps == 0 || bps > 1000) revert Prohibited();
swapIncentiveFeeBPS = bps;
}
/// @notice Sets a new stake incentive fee basis points.
/// @param bps Incentive fee in basis points (1% = 100 bps).
function setStakeIncentiveFee(uint16 bps) external onlyOwner {
if (bps == 0 || bps > 1000) revert Prohibited();
stakeIncentiveFeeBPS = bps;
}
/// @notice Sets a new claim incentive fee basis points.
/// @param bps Incentive fee in basis points (1% = 100 bps).
function setClaimIncentiveFee(uint16 bps) external onlyOwner {
if (bps == 0 || bps > 1000) revert Prohibited();
claimIncentiveFeeBPS = bps;
}
/// @notice Sets the number of seconds to look back for TWAP price calculations.
/// @param limit The number of seconds to use for TWAP price lookback.
function setSecondsAgo(uint32 limit) external onlyOwner {
if (limit == 0) revert ZeroInput();
secondsAgo = limit;
}
/// @notice Sets the allowed price deviation for TWAP checks.
/// @param limit The allowed deviation in basis points (e.g., 500 = 5%).
function setDeviation(uint32 limit) external onlyOwner {
if (limit == 0) revert ZeroInput();
if (limit > BPS_BASE) revert Prohibited();
deviation = limit;
}
// ---------------------------- VIEW FUNCTIONS ------------------------- //
/// @notice Returns the information for the next swap.
/// @return time The time next swap will be available.
/// @return amount TitanX available for the next swap.
function getNextSwapInfo() public view returns (uint256 time, uint256 amount) {
uint256 balance = IERC20(TITANX).balanceOf(address(this));
amount = balance > maxSwapAmount ? maxSwapAmount : balance;
time = lastSwapTime + swapInterval;
}
/// @notice Returns the information for the next stake.
/// @return time The time next stake will be available.
/// @return amount Eden available for the next stake.
function getNextStakeInfo() public view returns (uint256 time, uint256 amount) {
amount = IERC20(EDEN).balanceOf(address(this));
time = lastStakeTime + stakeInterval;
}
/// @notice Returns batch information about stakes
/// @param ids Stake IDs to query
/// @return matured A boolean array indicating if the corresponding stake has matured.
/// @return unstaked A boolean array indicating if the corresponding stake has been unstaked.
/// @return totalStaked Total Eden staked in active stakes.
function getStakeInfo(uint160[] calldata ids) external view returns (bool[] memory matured, bool[] memory unstaked, uint256 totalStaked) {
matured = new bool[](ids.length);
unstaked = new bool[](ids.length);
for (uint i = 0; i < ids.length; i++) {
IEdenStaking.UserRecord memory record = EdenStaking.userRecords(ids[i]);
if (record.shares == 0) {
unstaked[i] = true;
continue;
}
totalStaked += record.lockedEden;
if (record.endTime < block.timestamp) matured[i] = true;
}
}
// -------------------------- INTERNAL FUNCTIONS ----------------------- //
function _calculateIncentiveFee(uint256 amount, uint16 fee) internal pure returns (uint256) {
return amount * fee / BPS_BASE;
}
function _swapTitanXToEden(uint256 amountIn, uint256 minAmountOut, uint256 deadline) internal {
_twapCheckMultihop(amountIn, minAmountOut);
bytes memory path = abi.encodePacked(TITANX, POOL_FEE_1PERCENT, VOLT, POOL_FEE_1PERCENT, EDEN);
ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
path: path,
recipient: address(this),
deadline: deadline,
amountIn: amountIn,
amountOutMinimum: minAmountOut
});
IERC20(TITANX).safeIncreaseAllowance(UNISWAP_V3_ROUTER, amountIn);
ISwapRouter(UNISWAP_V3_ROUTER).exactInput(params);
}
function _twapCheckMultihop(uint256 amountIn, uint256 minAmountOut) internal view {
uint256 voltAmountOut = _getTwapValue(TITANX, VOLT, amountIn);
address poolAddress = VOLT_EDEN_POOL;
uint32 _secondsAgo = secondsAgo;
uint32 oldestObservation = OracleLibrary.getOldestObservationSecondsAgo(poolAddress);
if (oldestObservation < _secondsAgo) {
_secondsAgo = oldestObservation;
}
(int24 arithmeticMeanTick,) = OracleLibrary.consult(poolAddress, _secondsAgo);
uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(arithmeticMeanTick);
uint256 twapAmountOut =
OracleLibrary.getQuoteForSqrtRatioX96(sqrtPriceX96, uint128(voltAmountOut), VOLT, EDEN);
uint256 lowerBound = (twapAmountOut * (BPS_BASE - deviation)) / BPS_BASE;
if (minAmountOut < lowerBound) revert TWAP();
}
function _getTwapValue(address tokenIn, address tokenOut, uint256 amountIn) internal view returns (uint256) {
address poolAddress = TITANX_VOLT_POOL;
uint32 _secondsAgo = secondsAgo;
uint32 oldestObservation = OracleLibrary.getOldestObservationSecondsAgo(poolAddress);
if (oldestObservation < _secondsAgo) {
_secondsAgo = oldestObservation;
}
(int24 arithmeticMeanTick,) = OracleLibrary.consult(poolAddress, _secondsAgo);
uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(arithmeticMeanTick);
return OracleLibrary.getQuoteForSqrtRatioX96(sqrtPriceX96, uint128(amountIn), tokenIn, tokenOut);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success,) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(address target, bool success, bytes memory returndata)
internal
view
returns (bytes memory)
{
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @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 towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (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 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
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.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 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.
uint256 twos = denominator & (0 - denominator);
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 (unsignedRoundsUp(rounding) && 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
* towards zero.
*
* 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
/// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
/// @dev In the implementation you must pay the pool tokens owed for the swap.
/// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
/// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
/// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
/// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
/// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
import "./pool/IUniswapV3PoolImmutables.sol";
import "./pool/IUniswapV3PoolState.sol";
import "./pool/IUniswapV3PoolDerivedState.sol";
import "./pool/IUniswapV3PoolActions.sol";
import "./pool/IUniswapV3PoolOwnerActions.sol";
import "./pool/IUniswapV3PoolEvents.sol";
/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
IUniswapV3PoolImmutables,
IUniswapV3PoolState,
IUniswapV3PoolDerivedState,
IUniswapV3PoolActions,
IUniswapV3PoolOwnerActions,
IUniswapV3PoolEvents
{}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
/// @notice Sets the initial price for the pool
/// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
/// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
function initialize(uint160 sqrtPriceX96) external;
/// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
/// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
/// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
/// on tickLower, tickUpper, the amount of liquidity, and the current price.
/// @param recipient The address for which the liquidity will be created
/// @param tickLower The lower tick of the position in which to add liquidity
/// @param tickUpper The upper tick of the position in which to add liquidity
/// @param amount The amount of liquidity to mint
/// @param data Any data that should be passed through to the callback
/// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
/// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
function mint(address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data)
external
returns (uint256 amount0, uint256 amount1);
/// @notice Collects tokens owed to a position
/// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
/// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
/// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
/// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
/// @param recipient The address which should receive the fees collected
/// @param tickLower The lower tick of the position for which to collect fees
/// @param tickUpper The upper tick of the position for which to collect fees
/// @param amount0Requested How much token0 should be withdrawn from the fees owed
/// @param amount1Requested How much token1 should be withdrawn from the fees owed
/// @return amount0 The amount of fees collected in token0
/// @return amount1 The amount of fees collected in token1
function collect(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
/// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
/// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
/// @dev Fees must be collected separately via a call to #collect
/// @param tickLower The lower tick of the position for which to burn liquidity
/// @param tickUpper The upper tick of the position for which to burn liquidity
/// @param amount How much liquidity to burn
/// @return amount0 The amount of token0 sent to the recipient
/// @return amount1 The amount of token1 sent to the recipient
function burn(int24 tickLower, int24 tickUpper, uint128 amount)
external
returns (uint256 amount0, uint256 amount1);
/// @notice Swap token0 for token1, or token1 for token0
/// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
/// @param recipient The address to receive the output of the swap
/// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
/// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
/// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
/// value after the swap. If one for zero, the price cannot be greater than this value after the swap
/// @param data Any data to be passed through to the callback
/// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
/// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
/// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
/// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
/// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
/// with 0 amount{0,1} and sending the donation amount(s) from the callback
/// @param recipient The address which will receive the token0 and token1 amounts
/// @param amount0 The amount of token0 to send
/// @param amount1 The amount of token1 to send
/// @param data Any data to be passed through to the callback
function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;
/// @notice Increase the maximum number of price and liquidity observations that this pool will store
/// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
/// the input observationCardinalityNext.
/// @param observationCardinalityNext The desired minimum number of observations for the pool to store
function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
/// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
/// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
/// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
/// you must call it with secondsAgos = [3600, 0].
/// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
/// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
/// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
/// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
/// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
/// timestamp
function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
/// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
/// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
/// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
/// snapshot is taken and the second snapshot is taken.
/// @param tickLower The lower tick of the range
/// @param tickUpper The upper tick of the range
/// @return tickCumulativeInside The snapshot of the tick accumulator for the range
/// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
/// @return secondsInside The snapshot of seconds per liquidity for the range
function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
external
view
returns (int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
/// @notice Emitted exactly once by a pool when #initialize is first called on the pool
/// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
/// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
/// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
event Initialize(uint160 sqrtPriceX96, int24 tick);
/// @notice Emitted when liquidity is minted for a given position
/// @param sender The address that minted the liquidity
/// @param owner The owner of the position and recipient of any minted liquidity
/// @param tickLower The lower tick of the position
/// @param tickUpper The upper tick of the position
/// @param amount The amount of liquidity minted to the position range
/// @param amount0 How much token0 was required for the minted liquidity
/// @param amount1 How much token1 was required for the minted liquidity
event Mint(
address sender,
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
/// @notice Emitted when fees are collected by the owner of a position
/// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
/// @param owner The owner of the position for which fees are collected
/// @param tickLower The lower tick of the position
/// @param tickUpper The upper tick of the position
/// @param amount0 The amount of token0 fees collected
/// @param amount1 The amount of token1 fees collected
event Collect(
address indexed owner,
address recipient,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount0,
uint128 amount1
);
/// @notice Emitted when a position's liquidity is removed
/// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
/// @param owner The owner of the position for which liquidity is removed
/// @param tickLower The lower tick of the position
/// @param tickUpper The upper tick of the position
/// @param amount The amount of liquidity to remove
/// @param amount0 The amount of token0 withdrawn
/// @param amount1 The amount of token1 withdrawn
event Burn(
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
/// @notice Emitted by the pool for any swaps between token0 and token1
/// @param sender The address that initiated the swap call, and that received the callback
/// @param recipient The address that received the output of the swap
/// @param amount0 The delta of the token0 balance of the pool
/// @param amount1 The delta of the token1 balance of the pool
/// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
/// @param liquidity The liquidity of the pool after the swap
/// @param tick The log base 1.0001 of price of the pool after the swap
event Swap(
address indexed sender,
address indexed recipient,
int256 amount0,
int256 amount1,
uint160 sqrtPriceX96,
uint128 liquidity,
int24 tick
);
/// @notice Emitted by the pool for any flashes of token0/token1
/// @param sender The address that initiated the swap call, and that received the callback
/// @param recipient The address that received the tokens from flash
/// @param amount0 The amount of token0 that was flashed
/// @param amount1 The amount of token1 that was flashed
/// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
/// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
event Flash(
address indexed sender,
address indexed recipient,
uint256 amount0,
uint256 amount1,
uint256 paid0,
uint256 paid1
);
/// @notice Emitted by the pool for increases to the number of observations that can be stored
/// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
/// just before a mint/swap/burn.
/// @param observationCardinalityNextOld The previous value of the next observation cardinality
/// @param observationCardinalityNextNew The updated value of the next observation cardinality
event IncreaseObservationCardinalityNext(
uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew
);
/// @notice Emitted when the protocol fee is changed by the pool
/// @param feeProtocol0Old The previous value of the token0 protocol fee
/// @param feeProtocol1Old The previous value of the token1 protocol fee
/// @param feeProtocol0New The updated value of the token0 protocol fee
/// @param feeProtocol1New The updated value of the token1 protocol fee
event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);
/// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
/// @param sender The address that collects the protocol fees
/// @param recipient The address that receives the collected protocol fees
/// @param amount0 The amount of token0 protocol fees that is withdrawn
/// @param amount0 The amount of token1 protocol fees that is withdrawn
event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
/// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
/// @return The contract address
function factory() external view returns (address);
/// @notice The first of the two tokens of the pool, sorted by address
/// @return The token contract address
function token0() external view returns (address);
/// @notice The second of the two tokens of the pool, sorted by address
/// @return The token contract address
function token1() external view returns (address);
/// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
/// @return The fee
function fee() external view returns (uint24);
/// @notice The pool tick spacing
/// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
/// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
/// This value is an int24 to avoid casting even though it is always positive.
/// @return The tick spacing
function tickSpacing() external view returns (int24);
/// @notice The maximum amount of position liquidity that can use any tick in the range
/// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
/// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
/// @return The max amount of liquidity per tick
function maxLiquidityPerTick() external view returns (uint128);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
/// @notice Set the denominator of the protocol's % share of the fees
/// @param feeProtocol0 new protocol fee for token0 of the pool
/// @param feeProtocol1 new protocol fee for token1 of the pool
function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;
/// @notice Collect the protocol fee accrued to the pool
/// @param recipient The address to which collected protocol fees should be sent
/// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
/// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
/// @return amount0 The protocol fee collected in token0
/// @return amount1 The protocol fee collected in token1
function collectProtocol(address recipient, uint128 amount0Requested, uint128 amount1Requested)
external
returns (uint128 amount0, uint128 amount1);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
/// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
/// when accessed externally.
/// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
/// tick The current tick of the pool, i.e. according to the last tick transition that was run.
/// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
/// boundary.
/// observationIndex The index of the last oracle observation that was written,
/// observationCardinality The current maximum number of observations stored in the pool,
/// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
/// feeProtocol The protocol fee for both tokens of the pool.
/// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
/// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
/// unlocked Whether the pool is currently locked to reentrancy
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
bool unlocked
);
/// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
/// @dev This value can overflow the uint256
function feeGrowthGlobal0X128() external view returns (uint256);
/// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
/// @dev This value can overflow the uint256
function feeGrowthGlobal1X128() external view returns (uint256);
/// @notice The amounts of token0 and token1 that are owed to the protocol
/// @dev Protocol fees will never exceed uint128 max in either token
function protocolFees() external view returns (uint128 token0, uint128 token1);
/// @notice The currently in range liquidity available to the pool
/// @dev This value has no relationship to the total liquidity across all ticks
function liquidity() external view returns (uint128);
/// @notice Look up information about a specific tick in the pool
/// @param tick The tick to look up
/// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
/// tick upper,
/// liquidityNet how much liquidity changes when the pool price crosses the tick,
/// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
/// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
/// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
/// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
/// secondsOutside the seconds spent on the other side of the tick from the current tick,
/// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
/// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
/// In addition, these values are only relative and must be used only in comparison to previous snapshots for
/// a specific position.
function ticks(int24 tick)
external
view
returns (
uint128 liquidityGross,
int128 liquidityNet,
uint256 feeGrowthOutside0X128,
uint256 feeGrowthOutside1X128,
int56 tickCumulativeOutside,
uint160 secondsPerLiquidityOutsideX128,
uint32 secondsOutside,
bool initialized
);
/// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
function tickBitmap(int16 wordPosition) external view returns (uint256);
/// @notice Returns the information about a position by the position's key
/// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
/// @return _liquidity The amount of liquidity in the position,
/// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
/// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
/// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
/// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
function positions(bytes32 key)
external
view
returns (
uint128 _liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
/// @notice Returns data about a specific observation index
/// @param index The element of the observations array to fetch
/// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
/// ago, rather than at a specific index in the array.
/// @return blockTimestamp The timestamp of the observation,
/// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
/// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
/// Returns initialized whether the observation has been initialized and the values are safe to use
function observations(uint256 index)
external
view
returns (
uint32 blockTimestamp,
int56 tickCumulative,
uint160 secondsPerLiquidityCumulativeX128,
bool initialized
);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;
import "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol";
/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another token
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
/// @return amountOut The amount of the received token
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
struct ExactInputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);
struct ExactOutputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another token
/// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
/// @return amountIn The amount of the input token
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
struct ExactOutputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
/// @return amountIn The amount of the input token
function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IEdenStaking {
error EdenStaking__LockPeriodNotOver();
struct UserRecord {
uint160 shares;
uint160 lockedEden;
uint128 rewardDebt;
uint32 endTime;
}
event Staked(address indexed staker, uint256 indexed eden, uint152 indexed id, uint256 _shares, uint32 duration);
function stake(uint32 _duration, uint160 _edenAmount) external returns (uint96 _tokenId, uint160 shares);
function batchClaimableAmount(uint160[] calldata _ids) external view returns (uint256 toClaim);
function batchClaim(uint160[] calldata _ids, address _receiver) external;
function batchUnstake(uint160[] calldata _ids, address _receiver) external;
function balanceOf(address account) external view returns (uint256);
function ownerOf(uint256 tokenId) external view returns (address);
function updateRewardsIfNecessary() external;
function userRecords(uint256 id) external view returns (UserRecord memory);
}// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.26; address constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address constant TITANX = 0xF19308F923582A6f7c465e5CE7a9Dc1BEC6665B1; address constant VOLT = 0x66b5228CfD34d9f4d9f03188d67816286C7c0b74; address constant EDEN = 0x31b2c59d760058cfe57e59472E7542f776d987FB; address constant EDEN_STAKING = 0x32C611b0a96789BaA3d6bF9F0867b7E1b9d049Be; address constant TITANX_VOLT_POOL = 0x3F1A36B6C946E406f4295A89fF06a5c7d62F2fe2; address constant VOLT_EDEN_POOL = 0x23C1E54ef229966f2aC159F6f441D0780E8717ac; uint32 constant STAKE_DURATION = 1450 days; uint16 constant BPS_BASE = 100_00; address constant UNISWAP_V3_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564; uint24 constant POOL_FEE_1PERCENT = 10000;
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
// Uniswap
import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
// OpenZeppelin
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {TickMath} from "./TickMath.sol";
/**
* @notice Adapted Uniswap V3 OracleLibrary computation to be compliant with Solidity 0.8.x and later.
*
* Documentation for Auditors:
*
* Solidity Version: Updated the Solidity version pragma to ^0.8.0. This change ensures compatibility
* with Solidity version 0.8.x.
*
* Safe Arithmetic Operations: Solidity 0.8.x automatically checks for arithmetic overflows/underflows.
* Therefore, the code no longer needs to use SafeMath library (or similar) for basic arithmetic operations.
* This change simplifies the code and reduces the potential for errors related to manual overflow/underflow checking.
*
* Overflow/Underflow: With the introduction of automatic overflow/underflow checks in Solidity 0.8.x, the code is inherently
* safer and less prone to certain types of arithmetic errors.
*
* Removal of SafeMath Library: Since Solidity 0.8.x handles arithmetic operations safely, the use of SafeMath library
* is omitted in this update.
*
* Git-style diff for the `consult` function:
*
* ```diff
* function consult(address pool, uint32 secondsAgo)
* internal
* view
* returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity)
* {
* require(secondsAgo != 0, 'BP');
*
* uint32[] memory secondsAgos = new uint32[](2);
* secondsAgos[0] = secondsAgo;
* secondsAgos[1] = 0;
*
* (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) =
* IUniswapV3Pool(pool).observe(secondsAgos);
*
* int56 tickCumulativesDelta = tickCumulatives[1] - tickCumulatives[0];
* uint160 secondsPerLiquidityCumulativesDelta =
* secondsPerLiquidityCumulativeX128s[1] - secondsPerLiquidityCumulativeX128s[0];
*
* - arithmeticMeanTick = int24(tickCumulativesDelta / secondsAgo);
* + int56 secondsAgoInt56 = int56(uint56(secondsAgo));
* + arithmeticMeanTick = int24(tickCumulativesDelta / secondsAgoInt56);
* // Always round to negative infinity
* - if (tickCumulativesDelta < 0 && (tickCumulativesDelta % secondsAgo != 0)) arithmeticMeanTick--;
* + if (tickCumulativesDelta < 0 && (tickCumulativesDelta % secondsAgoInt56 != 0)) arithmeticMeanTick--;
*
* - uint192 secondsAgoX160 = uint192(secondsAgo) * type(uint160).max;
* + uint192 secondsAgoUint192 = uint192(secondsAgo);
* + uint192 secondsAgoX160 = secondsAgoUint192 * type(uint160).max;
* harmonicMeanLiquidity = uint128(secondsAgoX160 / (uint192(secondsPerLiquidityCumulativesDelta) << 32));
* }
* ```
*/
/// @title Oracle library
/// @notice Provides functions to integrate with V3 pool oracle
library OracleLibrary {
/// @notice Calculates time-weighted means of tick and liquidity for a given Uniswap V3 pool
/// @param pool Address of the pool that we want to observe
/// @param secondsAgo Number of seconds in the past from which to calculate the time-weighted means
/// @return arithmeticMeanTick The arithmetic mean tick from (block.timestamp - secondsAgo) to block.timestamp
/// @return harmonicMeanLiquidity The harmonic mean liquidity from (block.timestamp - secondsAgo) to block.timestamp
function consult(address pool, uint32 secondsAgo)
internal
view
returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity)
{
require(secondsAgo != 0, "BP");
uint32[] memory secondsAgos = new uint32[](2);
secondsAgos[0] = secondsAgo;
secondsAgos[1] = 0;
(int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) =
IUniswapV3Pool(pool).observe(secondsAgos);
int56 tickCumulativesDelta = tickCumulatives[1] - tickCumulatives[0];
uint160 secondsPerLiquidityCumulativesDelta =
secondsPerLiquidityCumulativeX128s[1] - secondsPerLiquidityCumulativeX128s[0];
// Safe casting of secondsAgo to int56 for division
int56 secondsAgoInt56 = int56(uint56(secondsAgo));
arithmeticMeanTick = int24(tickCumulativesDelta / secondsAgoInt56);
// Always round to negative infinity
if (tickCumulativesDelta < 0 && (tickCumulativesDelta % secondsAgoInt56 != 0)) arithmeticMeanTick--;
// Safe casting of secondsAgo to uint192 for multiplication
uint192 secondsAgoUint192 = uint192(secondsAgo);
harmonicMeanLiquidity = uint128(
(secondsAgoUint192 * uint192(type(uint160).max)) / (uint192(secondsPerLiquidityCumulativesDelta) << 32)
);
}
/// @notice Given a tick and a token amount, calculates the amount of token received in exchange
/// @param tick Tick value used to calculate the quote
/// @param baseAmount Amount of token to be converted
/// @param baseToken Address of an ERC20 token contract used as the baseAmount denomination
/// @param quoteToken Address of an ERC20 token contract used as the quoteAmount denomination
/// @return quoteAmount Amount of quoteToken received for baseAmount of baseToken
function getQuoteAtTick(int24 tick, uint128 baseAmount, address baseToken, address quoteToken)
internal
pure
returns (uint256 quoteAmount)
{
uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(tick);
// Calculate quoteAmount with better precision if it doesn't overflow when multiplied by itself
if (sqrtRatioX96 <= type(uint128).max) {
uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;
quoteAmount = baseToken < quoteToken
? Math.mulDiv(ratioX192, baseAmount, 1 << 192)
: Math.mulDiv(1 << 192, baseAmount, ratioX192);
} else {
uint256 ratioX128 = Math.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);
quoteAmount = baseToken < quoteToken
? Math.mulDiv(ratioX128, baseAmount, 1 << 128)
: Math.mulDiv(1 << 128, baseAmount, ratioX128);
}
}
/// @notice Given a pool, it returns the number of seconds ago of the oldest stored observation
/// @param pool Address of Uniswap V3 pool that we want to observe
/// @return secondsAgo The number of seconds ago of the oldest observation stored for the pool
function getOldestObservationSecondsAgo(address pool) internal view returns (uint32 secondsAgo) {
(,, uint16 observationIndex, uint16 observationCardinality,,,) = IUniswapV3Pool(pool).slot0();
require(observationCardinality > 0, "NI");
(uint32 observationTimestamp,,, bool initialized) =
IUniswapV3Pool(pool).observations((observationIndex + 1) % observationCardinality);
// The next index might not be initialized if the cardinality is in the process of increasing
// In this case the oldest observation is always in index 0
if (!initialized) {
(observationTimestamp,,,) = IUniswapV3Pool(pool).observations(0);
}
secondsAgo = uint32(block.timestamp) - observationTimestamp;
}
/// @notice Given a tick and a token amount, calculates the amount of token received in exchange
/// a slightly modified version of the UniSwap library getQuoteAtTick to accept a sqrtRatioX96 as input parameter
/// @param sqrtRatioX96 The sqrt ration
/// @param baseAmount Amount of token to be converted
/// @param baseToken Address of an ERC20 token contract used as the baseAmount denomination
/// @param quoteToken Address of an ERC20 token contract used as the quoteAmount denomination
/// @return quoteAmount Amount of quoteToken received for baseAmount of baseToken
function getQuoteForSqrtRatioX96(uint160 sqrtRatioX96, uint256 baseAmount, address baseToken, address quoteToken)
internal
pure
returns (uint256 quoteAmount)
{
// Calculate quoteAmount with better precision if it doesn't overflow when multiplied by itself
if (sqrtRatioX96 <= type(uint128).max) {
uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;
quoteAmount = baseToken < quoteToken
? Math.mulDiv(ratioX192, baseAmount, 1 << 192)
: Math.mulDiv(1 << 192, baseAmount, ratioX192);
} else {
uint256 ratioX128 = Math.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);
quoteAmount = baseToken < quoteToken
? Math.mulDiv(ratioX128, baseAmount, 1 << 128)
: Math.mulDiv(1 << 128, baseAmount, ratioX128);
}
}
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
error T();
error R();
/// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
int24 internal constant MIN_TICK = -887272;
/// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
int24 internal constant MAX_TICK = -MIN_TICK;
/// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
uint160 internal constant MIN_SQRT_RATIO = 4295128739;
/// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
/// @notice Calculates sqrt(1.0001^tick) * 2^96
/// @dev Throws if |tick| > max tick
/// @param tick The input tick for the above formula
/// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
/// at the given tick
function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
unchecked {
uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
if (absTick > uint256(int256(MAX_TICK))) revert T();
uint256 ratio =
absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;
if (tick > 0) ratio = type(uint256).max / ratio;
// this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
// we then downcast because we know the result always fits within 160 bits due to our tick input constraint
// we round up in the division so getTickAtSqrtRatio of the output price is always consistent
sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
}
}
/// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
/// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
/// ever return.
/// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
/// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
unchecked {
// second inequality must be < because the price can never reach the price at the max tick
if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert R();
uint256 ratio = uint256(sqrtPriceX96) << 32;
uint256 r = ratio;
uint256 msb = 0;
assembly {
let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(5, gt(r, 0xFFFFFFFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(4, gt(r, 0xFFFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(3, gt(r, 0xFF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(2, gt(r, 0xF))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := shl(1, gt(r, 0x3))
msb := or(msb, f)
r := shr(f, r)
}
assembly {
let f := gt(r, 0x1)
msb := or(msb, f)
}
if (msb >= 128) r = ratio >> (msb - 127);
else r = ratio << (127 - msb);
int256 log_2 = (int256(msb) - 128) << 64;
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(63, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(62, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(61, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(60, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(59, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(58, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(57, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(56, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(55, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(54, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(53, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(52, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(51, f))
r := shr(f, r)
}
assembly {
r := shr(127, mul(r, r))
let f := shr(128, r)
log_2 := or(log_2, shl(50, f))
}
int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number
int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);
tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_staxVault","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"Cooldown","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NothingToClaim","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"Prohibited","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"T","type":"error"},{"inputs":[],"name":"TWAP","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnclaimedRewards","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroInput","type":"error"},{"anonymous":false,"inputs":[],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[],"name":"Swap","type":"event"},{"inputs":[],"name":"STAX_VAULT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160[]","name":"ids","type":"uint160[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimIncentiveFeeBPS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deviation","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint160[]","name":"ids","type":"uint160[]"}],"name":"endStakeAfterMaturity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getNextStakeInfo","outputs":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextSwapInfo","outputs":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint160[]","name":"ids","type":"uint160[]"}],"name":"getStakeInfo","outputs":[{"internalType":"bool[]","name":"matured","type":"bool[]"},{"internalType":"bool[]","name":"unstaked","type":"bool[]"},{"internalType":"uint256","name":"totalStaked","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"intervalOverride","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastStakeTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSwapTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSwapAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"secondsAgo","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"bps","type":"uint16"}],"name":"setClaimIncentiveFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"limit","type":"uint32"}],"name":"setDeviation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setMaxSwapAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setMinStakeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"limit","type":"uint32"}],"name":"setSecondsAgo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"bps","type":"uint16"}],"name":"setStakeIncentiveFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"limit","type":"uint64"}],"name":"setStakeInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"bps","type":"uint16"}],"name":"setSwapIncentiveFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"limit","type":"uint64"}],"name":"setSwapInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeIncentiveFeeBPS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeInterval","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapIncentiveFeeBPS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapInterval","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a03461015657601f612e3538819003918201601f19168301916001600160401b0383118484101761015b57808492604094855283398101031261015657610052602061004b83610171565b9201610171565b6001600160a01b0390911690811561014057600180546001600160a01b0319908116909155600080549182168417815560405193916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36b06765c793fa10079d000000060045569d3c21bcecceda1000000600555600680546001600160f01b0319167b03e80000012c001e001e001e0000000000093a8000000000000007081790556001600160a01b0381161561012f57608052612caf90816101868239608051818181611c1b01526121530152f35b63d92e233d60e01b60005260046000fd5b631e4fbdf760e01b600052600060045260246000fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036101565756fe608080604052600436101561001357600080fd5b600090813560e01c908162be36561461213f575080630dd87157146121215780631ad7b127146120cb5780632ace03ad1461206e5780632d6e1408146120535780632f84cbf51461202c5780633a4b66f114611cea5780634a1d0f5a14611b36578063633dd14514611b0f578063639097a114611ae857806364d4db1014611aca578063664d4e9814611aa5578063715018a614611a4057806373199228146119da57806379ba5097146119555780638166b316146118ef5780638da5cb5b146118c8578063a5f7f99d1461189f578063af1a3d0414611839578063b1283c1c14611812578063c0794e71146117ed578063cce987d4146117cf578063d43b51b6146117aa578063d65a562314611780578063d6c2b423146115dc578063d96073cf14610552578063d9ad02e1146104fb578063daf8c5aa1461047a578063e30c397814610451578063eb4af0451461042e578063f188768414610410578063f2fde38b14610399578063f3cdb351146103745763f99453ec1461019657600080fd5b34610371576101a436612182565b9091806101b083612454565b936101ba84612454565b90835b8581101561033c57600581901b8201356001600160a01b038116949085900361032557604051946330979fdf60e11b86526004860152608085602481600080516020612c5a8339815191525afa94851561033157869561027f575b5084516001600160a01b03161561026f57602085015160019291610245916001600160a01b031690612250565b9463ffffffff606042920151161061025e575b016101bd565b81610269828a6124ca565b52610258565b93508060016102698193866124ca565b9094506080813d8211610329575b8161029a6080938361220a565b810103126103255760405190608082018281106001600160401b03821117610311576040526102c8816123bb565b82526102d6602082016123bb565b602083015260408101516001600160801b038116810361030d57604083015261030190606001612486565b60608201529338610218565b8780fd5b634e487b7160e01b88526041600452602488fd5b8580fd5b3d915061028d565b6040513d88823e3d90fd5b6103598785610367866040519485946060865260608601906121d4565b9084820360208601526121d4565b9060408301520390f35b80fd5b5034610371578060031936011261037157602061ffff60065460801c16604051908152f35b5034610371576020366003190112610371576004356001600160a01b0381169081900361040c576103c86124de565b600180546001600160a01b0319168217905581546001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b5080fd5b50346103715780600319360112610371576020600554604051908152f35b5034610371576020366003190112610371576104486124de565b60043560055580f35b50346103715780600319360112610371576001546040516001600160a01b039091168152602090f35b50346103715760203660031901126103715760043563ffffffff81168082036104f7576104a56124de565b80156104e857612710106104d9576006805463ffffffff60d01b191660d09290921b63ffffffff60d01b1691909117905580f35b632b0039c760e21b8252600482fd5b63af458c0760e01b8352600483fd5b8280fd5b5034610371576020366003190112610371576004356001600160401b03811680910361040c576105296124de565b8015610543576001600160401b0319600654161760065580f35b63af458c0760e01b8252600482fd5b50346103715760403660031901126103715760043590333b158015906115d2575b6115c45761057f61230f565b9042106115b55780156115a6576105bb90426002556127106105aa61ffff60065460801c1683612507565b04906105b6823361253a565b6123ae565b600654604051633850c7bd60e01b815260b082901c63ffffffff16949092918560e085600481733f1a36b6c946e406f4295a89ff06a5c7d62f2fe25afa80156103315786958791611516575b5061ffff169485156111cf5761ffff60019116019661ffff88116115025761ffff600096816040519a63252c09d760e01b8c521606166004890152608088602481733f1a36b6c946e406f4295a89ff06a5c7d62f2fe25afa9788156114d057879088996114db575b50971561145e575b63ffffffff9061068a824216998a6125f8565b8183821610611456575b501680156110cf57606097604051916106ad8a8461220a565b600283526020830190601f198b019384368437816106ca82612497565b528a6106d5826124ba565b528a604051809463883bdbfd60e01b825260248201936020600484015251809452604482019093835b818110611432575050819293500381733f1a36b6c946e406f4295a89ff06a5c7d62f2fe25afa918215611427578a908b9361130d575b5061074b610741826124ba565b5160060b91612497565b5160060b900391667fffffffffffff198312667fffffffffffff8413176112c0576001600160a01b0361077d826124ba565b5116906001600160a01b039061079290612497565b511690036001600160a01b0381116112c0578160060b9260060b83156112f957667fffffffffffff1981146000198514166111bb5783810560020b938c821291826112ea575b50506112d4575b6001600160a01b038281026001600160c01b031692830490036112c05760201b640100000000600160c01b03169081156112ac575061081f9190506126ac565b6001600160801b03878116918a916001600160a01b03909116908111611296578061084991612507565b9015611288579061085991612ba9565b925b604051633850c7bd60e01b8152819060e0816004817323c1e54ef229966f2ac159f6f441d0780e8717ac5afa801561118b578b918c916111f9575b5061ffff169081156111cf5761ffff60019116019061ffff82116111bb5761ffff90816040519363252c09d760e01b855216061660048201526080816024817323c1e54ef229966f2ac159f6f441d0780e8717ac5afa90811561118b578b908c92611196575b509015611101575b6109139063ffffffff946125f8565b90838216106110f9575b501680156110cf576040516109328a8261220a565b6002815260208101923684378161094882612497565b5288610953826124ba565b5288604051809463883bdbfd60e01b825260248201936020600484015251809452604482019093835b8181106110ad5750508192935003817323c1e54ef229966f2ac159f6f441d0780e8717ac5afa918215610ea65788908993610f87575b506109bf610741826124ba565b5160060b900391667fffffffffffff198312667fffffffffffff841317610f26576001600160a01b036109f1826124ba565b5116906001600160a01b0390610a0690612497565b511690036001600160a01b038111610f26578160060b9260060b8315610f7357667fffffffffffff198114600019851416610f5f5783810560020b938a82129182610f50575b5050610f3a575b6001600160a01b038281026001600160c01b03169283049003610f265760201b640100000000600160c01b0316908115610f12575063ffffffff92916001600160801b039150610aa2906126ac565b91169087906001600160a01b03166001600160801b038111610ef65780610ac891612507565b9015610ee85790610ad891612ba9565b915b60d01c166127100363ffffffff8111610ed4576127109163ffffffff610b01921690612507565b048110610ec55760405173f19308f923582a6f7c465e5ce7a9dc1bec6665b160601b602082015261027160ec1b603482018190527319ad48a33f4d367d367c0c62359e058a1b1f02dd60621b6037830152604b8201527331b2c59d760058cfe57e59472e7542f776d987fb60601b604e8201526042815292610b8460628561220a565b6040519360a085018581106001600160401b03821117610eb157604052845260208401923084526040850196602435885285019181835260808601938452604051636eb1769f60e11b815230600482015273e592427a0aece92de3edee1f18e0157c05861564602482015260208160448173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa918215610ea6578892610e6f575b505090610c2691612250565b858060405192602084019063095ea7b360e01b825273e592427a0aece92de3edee1f18e0157c058615646024860152604485015260448452610c6960648561220a565b8351908273f19308f923582a6f7c465e5ce7a9dc1bec6665b15af1610c8c612612565b81610e34575b5080610e16575b15610db0575b506040519363c04b8d5960e01b855260206004860152519560a060248601528651938460c4870152865b858110610d9a575060e4858701810188905290516001600160a01b031660448701529051606486015290516084850152905160a48401526020918391601f909101601f1916820182900301818573e592427a0aece92de3edee1f18e0157c058615645af18015610d8f57610d60575b507f3ebfdaaf4031bec9a2b7b0a1c594d2d03f3d0b8d68531c9164c2829bac00fefa8180a180f35b610d819060203d602011610d88575b610d79818361220a565b810190612241565b5081610d38565b503d610d6f565b6040513d84823e3d90fd5b80602080928b01015160e4828a01015201610cc9565b610e1090610df660405163095ea7b360e01b602082015273e592427a0aece92de3edee1f18e0157c05861564602482015288604482015260448152610df660648261220a565b73f19308f923582a6f7c465e5ce7a9dc1bec6665b1612582565b38610c9f565b5073f19308f923582a6f7c465e5ce7a9dc1bec6665b13b1515610c99565b8051801592508215610e49575b505038610c92565b8192509060209181010312610e6b576020610e649101612575565b3880610e41565b8680fd5b9091506020823d602011610e9e575b81610e8b6020938361220a565b81010312610371575051610c2638610c1a565b3d9150610e7e565b6040513d8a823e3d90fd5b634e487b7160e01b87526041600452602487fd5b63431653f160e11b8452600484fd5b634e487b7160e01b86526011600452602486fd5b610ef191612b24565b610ad8565b610f0c92915080610f0691612a23565b90612a82565b91610ada565b634e487b7160e01b89526012600452602489fd5b634e487b7160e01b89526011600452602489fd5b91627fffff198114610f26576000190191610a53565b0760060b151590503880610a4c565b634e487b7160e01b8a52601160045260248afd5b634e487b7160e01b8a52601260045260248afd5b9250503d8089843e610f99818461220a565b8201916040818403126110a95780516001600160401b0381116110855781019083601f8301121561108557815191610fd08361243d565b92610fde604051948561220a565b80845260208085019160051b830101918683116110a557602001905b82821061108d575050506020810151906001600160401b03821161108957019280601f850112156110855783516110308161243d565b9461103e604051968761220a565b81865260208087019260051b82010192831161108157602001905b82821061106957505050386109b2565b60208091611076846123bb565b815201910190611059565b8b80fd5b8980fd5b8a80fd5b6020809161109a84612660565b815201910190610ffa565b8c80fd5b8880fd5b855163ffffffff1683526020958601958e95508894509092019160010161097c565b60405162461bcd60e51b8152602060048201526002602482015261042560f41b6044820152606490fd5b90503861091d565b50909160405163252c09d760e01b81528a60048201526080816024817323c1e54ef229966f2ac159f6f441d0780e8717ac5afa90811561118b57916109139163ffffffff9594938d91611159575b5091509350610904565b61117b915060803d608011611184575b611173818361220a565b81019061266e565b5050503861114f565b503d611169565b6040513d8d823e3d90fd5b90506111b1915060803d60801161118457611173818361220a565b92915050386108fc565b634e487b7160e01b8c52601160045260248cfd5b60405162461bcd60e51b81526020600482015260026024820152614e4960f01b6044820152606490fd5b91505060e0813d60e011611280575b8161121560e0938361220a565b8101031261108957611226816123bb565b5060208101518060020b036110895761124160408201612651565b61124c8d8301612651565b9161125960808201612651565b5060a081015160ff8116036110a5579061127860c061ffff9301612575565b509190610896565b3d9150611208565b61129191612b24565b610859565b6112a692915080610f0691612a23565b9261085b565b634e487b7160e01b8b52601260045260248bfd5b634e487b7160e01b8b52601160045260248bfd5b91627fffff1981146112c05760001901916107df565b0760060b1515905038806107d8565b634e487b7160e01b8c52601260045260248cfd5b9250503d808b843e61131f818461220a565b8201916040818403126110895780516001600160401b0381116110815781019083601f83011215611081578151916113568361243d565b92611364604051948561220a565b80845260208085019160051b8301019186831161142357602001905b82821061140b575050506020810151906001600160401b0382116110a557019280601f850112156110815783516113b68161243d565b946113c4604051968761220a565b81865260208087019260051b82010192831161140757602001905b8282106113ef5750505038610734565b602080916113fc846123bb565b8152019101906113df565b8d80fd5b6020809161141884612660565b815201910190611380565b8e80fd5b6040513d8c823e3d90fd5b9250925060208060019263ffffffff87511681520194019101928d928692946106fe565b905038610694565b965060405163252c09d760e01b8152866004820152608081602481733f1a36b6c946e406f4295a89ff06a5c7d62f2fe25afa9081156114d0579063ffffffff9188916114ae575b50979050610677565b6114c7915060803d60801161118457611173818361220a565b505050386114a5565b6040513d89823e3d90fd5b90506114f791985060803d60801161118457611173818361220a565b99929150503861066f565b634e487b7160e01b87526011600452602487fd5b95505060e0853d60e01161159e575b8161153260e0938361220a565b8101031261032557611543856123bb565b5060208501518060020b036103255761155e60408601612651565b61156a60608701612651565b9561157760808201612651565b5060a081015160ff81160361030d579061159660c061ffff9301612575565b509590610607565b3d9150611525565b631e9acf1760e31b8252600482fd5b63b0782df760e01b8252600482fd5b6282b42960e81b8152600490fd5b5032331415610573565b5034610371576115eb36612182565b9190333b15801590611776575b61176857600080516020612c5a8339815191523b1561040c576040516376a814c360e11b8152828160048183600080516020612c5a8339815191525af1801561174857908391611753575b505060405163367b97ef60e11b8152602060048201819052818061166b6024820188876123cf565b0381600080516020612c5a8339815191525afa908115611748578391611711575b50611702578192600080516020612c5a8339815191523b156116fe576040516317a2245560e01b8152918391839182916116cc9130919060048501612414565b038183600080516020612c5a8339815191525af18015610d8f576116ed5750f35b816116f79161220a565b6103715780f35b5050fd5b6307ede9a360e31b8252600482fd5b90506020813d602011611740575b8161172c6020938361220a565b8101031261173b57513861168c565b600080fd5b3d915061171f565b6040513d85823e3d90fd5b8161175d9161220a565b61040c578138611643565b6282b42960e81b8252600482fd5b50323314156115f8565b503461037157806003193601126103715760206001600160401b0360065460401c16604051908152f35b5034610371578060031936011261037157602061ffff60065460901c16604051908152f35b50346103715780600319360112610371576020600454604051908152f35b5034610371578060031936011261037157602060405169d3c21bcecceda10000008152f35b503461037157806003193601126103715760206001600160401b0360065416604051908152f35b50346103715760203660031901126103715760043561ffff81168082036104f7576118626124de565b8015908115611893575b506104d9576006805461ffff60901b191660909290921b61ffff60901b1691909117905580f35b6103e89150113861186c565b5034610371576020366003190112610371576004356118bc6124de565b80156105435760045580f35b5034610371578060031936011261037157546040516001600160a01b039091168152602090f35b50346103715760203660031901126103715760043561ffff81168082036104f7576119186124de565b8015908115611949575b506104d9576006805461ffff60a01b191660a09290921b61ffff60a01b1691909117905580f35b6103e891501138611922565b5034610371578060031936011261037157600154336001600160a01b03909116036119c757600180546001600160a01b0319908116909155815433918116821783556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b63118cdaa760e01b815233600452602490fd5b50346103715760203660031901126103715760043561ffff81168082036104f757611a036124de565b8015908115611a34575b506104d9576006805461ffff60801b191660809290921b61ffff60801b1691909117905580f35b6103e891501138611a0d565b5034610371578060031936011261037157611a596124de565b600180546001600160a01b03199081169091558154908116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5034610371578060031936011261037157602061ffff60065460a01c16604051908152f35b50346103715780600319360112610371576020600354604051908152f35b5034610371578060031936011261037157602063ffffffff60065460d01c16604051908152f35b5034610371578060031936011261037157602063ffffffff60065460b01c16604051908152f35b503461037157611b4536612182565b333b15801590611ce0575b611cd2576040519163367b97ef60e11b83526020600484015260208380611b7b6024820186866123cf565b0381600080516020612c5a8339815191525afa928315611cc7578493611c8f575b508215611c80578390600080516020612c5a8339815191523b1561040c5760405163024ff33160e21b81529283918291611bdc9130919060048501612414565b038183600080516020612c5a8339815191525af1801561174857611c66575b50611c19611c3f916127106105aa61ffff60065460a01c1683612507565b7f000000000000000000000000000000000000000000000000000000000000000061253a565b7f3158952e7c791deb52750003dbcb0fb942106f2bcd1005fb946a83cd6646fdc48180a180f35b82611c78611c3f9394611c199361220a565b929150611bfb565b6312d37ee560e31b8452600484fd5b9092506020813d602011611cbf575b81611cab6020938361220a565b81010312611cbb57519138611b9c565b8380fd5b3d9150611c9e565b6040513d86823e3d90fd5b6282b42960e81b8352600483fd5b5032331415611b50565b5034610371578060031936011261037157333b15801590612022575b6115c457611d12612273565b9069d3c21bcecceda1000000821061200d575b5042600355611db1611d89611d97612710611d4961ffff60065460901c1686612507565b04936001600160a01b0390611d5f9086906123ae565b60405163a9059cbb60e01b6020820152336024820152604481019690965216939182906064820190565b03601f19810183528261220a565b7331b2c59d760058cfe57e59472e7542f776d987fb612582565b604051636eb1769f60e11b8152306004820152600080516020612c5a83398151915260248201526020816044817331b2c59d760058cfe57e59472e7542f776d987fb5afa80156117485782908490611fd7575b611e0e9250612250565b828060405192602084019063095ea7b360e01b8252600080516020612c5a8339815191526024860152604485015260448452611e4b60648561220a565b835190827331b2c59d760058cfe57e59472e7542f776d987fb5af1611e6e612612565b81611fa0575b5080611f82575b15611f3c575b5060405190635cacc5fb60e11b82526307779f006004830152602482015260408160448185600080516020612c5a8339815191525af18015610d8f57611eea575b507fde20bc92f9195457f9ba0ec9258c42c0814617c756a597287307a20494e839928180a180f35b6040813d604011611f34575b81611f036040938361220a565b8101031261040c5780516bffffffffffffffffffffffff81160361040c576020611f2d91016123bb565b5038611ec2565b3d9150611ef6565b611f7c90611d9760405163095ea7b360e01b6020820152600080516020612c5a833981519152602482015285604482015260448152611d9760648261220a565b38611e81565b507331b2c59d760058cfe57e59472e7542f776d987fb3b1515611e7b565b8051801592508215611fb5575b505038611e74565b8192509060209181010312611cbb576020611fd09101612575565b3880611fad565b50506020813d602011612005575b81611ff26020938361220a565b810103126104f75781611e0e9151611e04565b3d9150611fe5565b42106115b55760055481106115a65738611d25565b5032331415611d06565b5034610371578060031936011261037157604061204761230f565b82519182526020820152f35b50346103715780600319360112610371576040612047612273565b5034610371576020366003190112610371576004356001600160401b0381168082036104f75761209c6124de565b156105435767ffffffffffffffff60401b6006549160401b169067ffffffffffffffff60401b19161760065580f35b50346103715760203660031901126103715760043563ffffffff81168082036104f7576120f66124de565b15610543576006805463ffffffff60b01b191660b09290921b63ffffffff60b01b1691909117905580f35b50346103715780600319360112610371576020600254604051908152f35b90503461040c578160031936011261040c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b90602060031983011261173b576004356001600160401b03811161173b578260238201121561173b578060040135926001600160401b03841161173b5760248460051b8301011161173b576024019190565b906020808351928381520192019060005b8181106121f25750505090565b825115158452602093840193909201916001016121e5565b90601f801991011681019081106001600160401b0382111761222b57604052565b634e487b7160e01b600052604160045260246000fd5b9081602091031261173b575190565b9190820180921161225d57565b634e487b7160e01b600052601160045260246000fd5b6040516370a0823160e01b81523060048201526020816024817331b2c59d760058cfe57e59472e7542f776d987fb5afa908115612303576000916122d1575b506122ce6003546001600160401b0360065460401c1690612250565b91565b90506020813d6020116122fb575b816122ec6020938361220a565b8101031261173b5751386122b2565b3d91506122df565b6040513d6000823e3d90fd5b6040516370a0823160e01b815230600482015260208160248173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa9081156123035760009161237c575b50600454908181111561237557505b6122ce6002546001600160401b036006541690612250565b905061235d565b906020823d6020116123a6575b816123966020938361220a565b810103126103715750513861234e565b3d9150612389565b9190820391821161225d57565b51906001600160a01b038216820361173b57565b916020908281520191906000905b8082106123ea5750505090565b90919283359060018060a01b03821680920361173b576020816001938293520194019201906123dd565b9160209161242d919594956040855260408501916123cf565b6001600160a01b03909416910152565b6001600160401b03811161222b5760051b60200190565b9061245e8261243d565b61246b604051918261220a565b828152809261247c601f199161243d565b0190602036910137565b519063ffffffff8216820361173b57565b8051156124a45760200190565b634e487b7160e01b600052603260045260246000fd5b8051600110156124a45760400190565b80518210156124a45760209160051b010190565b6000546001600160a01b031633036124f257565b63118cdaa760e01b6000523360045260246000fd5b8181029291811591840414171561225d57565b8115612524570490565b634e487b7160e01b600052601260045260246000fd5b60405163a9059cbb60e01b60208201526001600160a01b039091166024820152604481019190915261257390610df68160648101611d89565b565b5190811515820361173b57565b6000806125ab9260018060a01b03169360208151910182865af16125a4612612565b9083612bf8565b80519081151591826125d5575b50506125c15750565b635274afe760e01b60005260045260246000fd5b819250906020918101031261173b5760206125f09101612575565b1538806125b8565b9063ffffffff8091169116039063ffffffff821161225d57565b3d1561264c573d906001600160401b03821161222b5760405191612640601f8201601f19166020018461220a565b82523d6000602084013e565b606090565b519061ffff8216820361173b57565b51908160060b820361173b57565b919082608091031261173b5761268382612486565b9161269060208201612660565b916126a960606126a2604085016123bb565b9301612575565b90565b60020b6000811215612a1d5780600003905b620d89e88211612a0c5760018216156129fa576001600160881b036ffffcb933bd6fad37aa2d162d1a5940015b1691600281166129de575b600481166129c2575b600881166129a6575b6010811661298a575b6020811661296e575b60408116612952575b60808116612936575b610100811661291a575b61020081166128fe575b61040081166128e2575b61080081166128c6575b61100081166128aa575b612000811661288e575b6140008116612872575b6180008116612856575b62010000811661283a575b62020000811661281f575b620400008116612804575b62080000166127eb575b6000126127dc575b63ffffffff81166127d4576000905b60201c60ff91909116016001600160a01b031690565b6001906127be565b801561252457600019046127af565b6b048a170391f7dc42444e8fa290910260801c906127a7565b6d2216e584f5fa1ea926041bedfe9890920260801c9161279d565b916e5d6af8dedb81196699c329225ee6040260801c91612792565b916f09aa508b5b7a84e1c677de54f3e99bc90260801c91612787565b916f31be135f97d08fd981231505542fcfa60260801c9161277c565b916f70d869a156d2a1b890bb3df62baf32f70260801c91612772565b916fa9f746462d870fdf8a65dc1f90e061e50260801c91612768565b916fd097f3bdfd2022b8845ad8f792aa58250260801c9161275e565b916fe7159475a2c29b7443b29c7fa6e889d90260801c91612754565b916ff3392b0822b70005940c7a398e4b70f30260801c9161274a565b916ff987a7253ac413176f2b074cf7815e540260801c91612740565b916ffcbe86c7900a88aedcffc83b479aa3a40260801c91612736565b916ffe5dee046a99a2a811c461f1969c30530260801c9161272c565b916fff2ea16466c96a3843ec78b326b528610260801c91612723565b916fff973b41fa98c081472e6896dfb254c00260801c9161271a565b916fffcb9843d60f6159c9db58835c9266440260801c91612711565b916fffe5caca7e10e4e61c3624eaa0941cd00260801c91612708565b916ffff2e50f5f656932ef12357cf3c7fdcc0260801c916126ff565b916ffff97272373d413259a46990580e213a0260801c916126f6565b6001600160881b03600160801b6126eb565b6315e4079d60e11b60005260046000fd5b806126be565b8181029160009160001982820992848085109403938085039414612a775783600160401b1115612a68575090600160401b910990828211900360c01b910360401c1790565b63227bc15360e01b8152600490fd5b925050505060401c90565b90608082901b9060001983600160801b0992828085109403938085039414612b185783821115612b07578190600160801b09816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b63227bc15360e01b60005260046000fd5b50906126a9925061251a565b9060c082901b9060001983600160c01b0992828085109403938085039414612b185783821115612b07578190600160c01b09816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b6000908281029260001981830992848085109403938085039414612bed57600160c01b841015612a685750600160c01b910990828211900360401b910360c01c1790565b925050505060c01c90565b90612c1e5750805115612c0d57805190602001fd5b630a12f52160e11b60005260046000fd5b81511580612c50575b612c2f575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b15612c2756fe00000000000000000000000032c611b0a96789baa3d6bf9f0867b7e1b9d049bea26469706673582212207965d6ee30d73d1e23d540f915457690f6cd7b80c8cbdebc6aad6309e52f733f64736f6c634300081a0033000000000000000000000000eb430c15ff72fec66f382e6905e2dcb88a805c510000000000000000000000005d27813c32dd705404d1a78c9444dab523331717
Deployed Bytecode
0x608080604052600436101561001357600080fd5b600090813560e01c908162be36561461213f575080630dd87157146121215780631ad7b127146120cb5780632ace03ad1461206e5780632d6e1408146120535780632f84cbf51461202c5780633a4b66f114611cea5780634a1d0f5a14611b36578063633dd14514611b0f578063639097a114611ae857806364d4db1014611aca578063664d4e9814611aa5578063715018a614611a4057806373199228146119da57806379ba5097146119555780638166b316146118ef5780638da5cb5b146118c8578063a5f7f99d1461189f578063af1a3d0414611839578063b1283c1c14611812578063c0794e71146117ed578063cce987d4146117cf578063d43b51b6146117aa578063d65a562314611780578063d6c2b423146115dc578063d96073cf14610552578063d9ad02e1146104fb578063daf8c5aa1461047a578063e30c397814610451578063eb4af0451461042e578063f188768414610410578063f2fde38b14610399578063f3cdb351146103745763f99453ec1461019657600080fd5b34610371576101a436612182565b9091806101b083612454565b936101ba84612454565b90835b8581101561033c57600581901b8201356001600160a01b038116949085900361032557604051946330979fdf60e11b86526004860152608085602481600080516020612c5a8339815191525afa94851561033157869561027f575b5084516001600160a01b03161561026f57602085015160019291610245916001600160a01b031690612250565b9463ffffffff606042920151161061025e575b016101bd565b81610269828a6124ca565b52610258565b93508060016102698193866124ca565b9094506080813d8211610329575b8161029a6080938361220a565b810103126103255760405190608082018281106001600160401b03821117610311576040526102c8816123bb565b82526102d6602082016123bb565b602083015260408101516001600160801b038116810361030d57604083015261030190606001612486565b60608201529338610218565b8780fd5b634e487b7160e01b88526041600452602488fd5b8580fd5b3d915061028d565b6040513d88823e3d90fd5b6103598785610367866040519485946060865260608601906121d4565b9084820360208601526121d4565b9060408301520390f35b80fd5b5034610371578060031936011261037157602061ffff60065460801c16604051908152f35b5034610371576020366003190112610371576004356001600160a01b0381169081900361040c576103c86124de565b600180546001600160a01b0319168217905581546001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b5080fd5b50346103715780600319360112610371576020600554604051908152f35b5034610371576020366003190112610371576104486124de565b60043560055580f35b50346103715780600319360112610371576001546040516001600160a01b039091168152602090f35b50346103715760203660031901126103715760043563ffffffff81168082036104f7576104a56124de565b80156104e857612710106104d9576006805463ffffffff60d01b191660d09290921b63ffffffff60d01b1691909117905580f35b632b0039c760e21b8252600482fd5b63af458c0760e01b8352600483fd5b8280fd5b5034610371576020366003190112610371576004356001600160401b03811680910361040c576105296124de565b8015610543576001600160401b0319600654161760065580f35b63af458c0760e01b8252600482fd5b50346103715760403660031901126103715760043590333b158015906115d2575b6115c45761057f61230f565b9042106115b55780156115a6576105bb90426002556127106105aa61ffff60065460801c1683612507565b04906105b6823361253a565b6123ae565b600654604051633850c7bd60e01b815260b082901c63ffffffff16949092918560e085600481733f1a36b6c946e406f4295a89ff06a5c7d62f2fe25afa80156103315786958791611516575b5061ffff169485156111cf5761ffff60019116019661ffff88116115025761ffff600096816040519a63252c09d760e01b8c521606166004890152608088602481733f1a36b6c946e406f4295a89ff06a5c7d62f2fe25afa9788156114d057879088996114db575b50971561145e575b63ffffffff9061068a824216998a6125f8565b8183821610611456575b501680156110cf57606097604051916106ad8a8461220a565b600283526020830190601f198b019384368437816106ca82612497565b528a6106d5826124ba565b528a604051809463883bdbfd60e01b825260248201936020600484015251809452604482019093835b818110611432575050819293500381733f1a36b6c946e406f4295a89ff06a5c7d62f2fe25afa918215611427578a908b9361130d575b5061074b610741826124ba565b5160060b91612497565b5160060b900391667fffffffffffff198312667fffffffffffff8413176112c0576001600160a01b0361077d826124ba565b5116906001600160a01b039061079290612497565b511690036001600160a01b0381116112c0578160060b9260060b83156112f957667fffffffffffff1981146000198514166111bb5783810560020b938c821291826112ea575b50506112d4575b6001600160a01b038281026001600160c01b031692830490036112c05760201b640100000000600160c01b03169081156112ac575061081f9190506126ac565b6001600160801b03878116918a916001600160a01b03909116908111611296578061084991612507565b9015611288579061085991612ba9565b925b604051633850c7bd60e01b8152819060e0816004817323c1e54ef229966f2ac159f6f441d0780e8717ac5afa801561118b578b918c916111f9575b5061ffff169081156111cf5761ffff60019116019061ffff82116111bb5761ffff90816040519363252c09d760e01b855216061660048201526080816024817323c1e54ef229966f2ac159f6f441d0780e8717ac5afa90811561118b578b908c92611196575b509015611101575b6109139063ffffffff946125f8565b90838216106110f9575b501680156110cf576040516109328a8261220a565b6002815260208101923684378161094882612497565b5288610953826124ba565b5288604051809463883bdbfd60e01b825260248201936020600484015251809452604482019093835b8181106110ad5750508192935003817323c1e54ef229966f2ac159f6f441d0780e8717ac5afa918215610ea65788908993610f87575b506109bf610741826124ba565b5160060b900391667fffffffffffff198312667fffffffffffff841317610f26576001600160a01b036109f1826124ba565b5116906001600160a01b0390610a0690612497565b511690036001600160a01b038111610f26578160060b9260060b8315610f7357667fffffffffffff198114600019851416610f5f5783810560020b938a82129182610f50575b5050610f3a575b6001600160a01b038281026001600160c01b03169283049003610f265760201b640100000000600160c01b0316908115610f12575063ffffffff92916001600160801b039150610aa2906126ac565b91169087906001600160a01b03166001600160801b038111610ef65780610ac891612507565b9015610ee85790610ad891612ba9565b915b60d01c166127100363ffffffff8111610ed4576127109163ffffffff610b01921690612507565b048110610ec55760405173f19308f923582a6f7c465e5ce7a9dc1bec6665b160601b602082015261027160ec1b603482018190527319ad48a33f4d367d367c0c62359e058a1b1f02dd60621b6037830152604b8201527331b2c59d760058cfe57e59472e7542f776d987fb60601b604e8201526042815292610b8460628561220a565b6040519360a085018581106001600160401b03821117610eb157604052845260208401923084526040850196602435885285019181835260808601938452604051636eb1769f60e11b815230600482015273e592427a0aece92de3edee1f18e0157c05861564602482015260208160448173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa918215610ea6578892610e6f575b505090610c2691612250565b858060405192602084019063095ea7b360e01b825273e592427a0aece92de3edee1f18e0157c058615646024860152604485015260448452610c6960648561220a565b8351908273f19308f923582a6f7c465e5ce7a9dc1bec6665b15af1610c8c612612565b81610e34575b5080610e16575b15610db0575b506040519363c04b8d5960e01b855260206004860152519560a060248601528651938460c4870152865b858110610d9a575060e4858701810188905290516001600160a01b031660448701529051606486015290516084850152905160a48401526020918391601f909101601f1916820182900301818573e592427a0aece92de3edee1f18e0157c058615645af18015610d8f57610d60575b507f3ebfdaaf4031bec9a2b7b0a1c594d2d03f3d0b8d68531c9164c2829bac00fefa8180a180f35b610d819060203d602011610d88575b610d79818361220a565b810190612241565b5081610d38565b503d610d6f565b6040513d84823e3d90fd5b80602080928b01015160e4828a01015201610cc9565b610e1090610df660405163095ea7b360e01b602082015273e592427a0aece92de3edee1f18e0157c05861564602482015288604482015260448152610df660648261220a565b73f19308f923582a6f7c465e5ce7a9dc1bec6665b1612582565b38610c9f565b5073f19308f923582a6f7c465e5ce7a9dc1bec6665b13b1515610c99565b8051801592508215610e49575b505038610c92565b8192509060209181010312610e6b576020610e649101612575565b3880610e41565b8680fd5b9091506020823d602011610e9e575b81610e8b6020938361220a565b81010312610371575051610c2638610c1a565b3d9150610e7e565b6040513d8a823e3d90fd5b634e487b7160e01b87526041600452602487fd5b63431653f160e11b8452600484fd5b634e487b7160e01b86526011600452602486fd5b610ef191612b24565b610ad8565b610f0c92915080610f0691612a23565b90612a82565b91610ada565b634e487b7160e01b89526012600452602489fd5b634e487b7160e01b89526011600452602489fd5b91627fffff198114610f26576000190191610a53565b0760060b151590503880610a4c565b634e487b7160e01b8a52601160045260248afd5b634e487b7160e01b8a52601260045260248afd5b9250503d8089843e610f99818461220a565b8201916040818403126110a95780516001600160401b0381116110855781019083601f8301121561108557815191610fd08361243d565b92610fde604051948561220a565b80845260208085019160051b830101918683116110a557602001905b82821061108d575050506020810151906001600160401b03821161108957019280601f850112156110855783516110308161243d565b9461103e604051968761220a565b81865260208087019260051b82010192831161108157602001905b82821061106957505050386109b2565b60208091611076846123bb565b815201910190611059565b8b80fd5b8980fd5b8a80fd5b6020809161109a84612660565b815201910190610ffa565b8c80fd5b8880fd5b855163ffffffff1683526020958601958e95508894509092019160010161097c565b60405162461bcd60e51b8152602060048201526002602482015261042560f41b6044820152606490fd5b90503861091d565b50909160405163252c09d760e01b81528a60048201526080816024817323c1e54ef229966f2ac159f6f441d0780e8717ac5afa90811561118b57916109139163ffffffff9594938d91611159575b5091509350610904565b61117b915060803d608011611184575b611173818361220a565b81019061266e565b5050503861114f565b503d611169565b6040513d8d823e3d90fd5b90506111b1915060803d60801161118457611173818361220a565b92915050386108fc565b634e487b7160e01b8c52601160045260248cfd5b60405162461bcd60e51b81526020600482015260026024820152614e4960f01b6044820152606490fd5b91505060e0813d60e011611280575b8161121560e0938361220a565b8101031261108957611226816123bb565b5060208101518060020b036110895761124160408201612651565b61124c8d8301612651565b9161125960808201612651565b5060a081015160ff8116036110a5579061127860c061ffff9301612575565b509190610896565b3d9150611208565b61129191612b24565b610859565b6112a692915080610f0691612a23565b9261085b565b634e487b7160e01b8b52601260045260248bfd5b634e487b7160e01b8b52601160045260248bfd5b91627fffff1981146112c05760001901916107df565b0760060b1515905038806107d8565b634e487b7160e01b8c52601260045260248cfd5b9250503d808b843e61131f818461220a565b8201916040818403126110895780516001600160401b0381116110815781019083601f83011215611081578151916113568361243d565b92611364604051948561220a565b80845260208085019160051b8301019186831161142357602001905b82821061140b575050506020810151906001600160401b0382116110a557019280601f850112156110815783516113b68161243d565b946113c4604051968761220a565b81865260208087019260051b82010192831161140757602001905b8282106113ef5750505038610734565b602080916113fc846123bb565b8152019101906113df565b8d80fd5b6020809161141884612660565b815201910190611380565b8e80fd5b6040513d8c823e3d90fd5b9250925060208060019263ffffffff87511681520194019101928d928692946106fe565b905038610694565b965060405163252c09d760e01b8152866004820152608081602481733f1a36b6c946e406f4295a89ff06a5c7d62f2fe25afa9081156114d0579063ffffffff9188916114ae575b50979050610677565b6114c7915060803d60801161118457611173818361220a565b505050386114a5565b6040513d89823e3d90fd5b90506114f791985060803d60801161118457611173818361220a565b99929150503861066f565b634e487b7160e01b87526011600452602487fd5b95505060e0853d60e01161159e575b8161153260e0938361220a565b8101031261032557611543856123bb565b5060208501518060020b036103255761155e60408601612651565b61156a60608701612651565b9561157760808201612651565b5060a081015160ff81160361030d579061159660c061ffff9301612575565b509590610607565b3d9150611525565b631e9acf1760e31b8252600482fd5b63b0782df760e01b8252600482fd5b6282b42960e81b8152600490fd5b5032331415610573565b5034610371576115eb36612182565b9190333b15801590611776575b61176857600080516020612c5a8339815191523b1561040c576040516376a814c360e11b8152828160048183600080516020612c5a8339815191525af1801561174857908391611753575b505060405163367b97ef60e11b8152602060048201819052818061166b6024820188876123cf565b0381600080516020612c5a8339815191525afa908115611748578391611711575b50611702578192600080516020612c5a8339815191523b156116fe576040516317a2245560e01b8152918391839182916116cc9130919060048501612414565b038183600080516020612c5a8339815191525af18015610d8f576116ed5750f35b816116f79161220a565b6103715780f35b5050fd5b6307ede9a360e31b8252600482fd5b90506020813d602011611740575b8161172c6020938361220a565b8101031261173b57513861168c565b600080fd5b3d915061171f565b6040513d85823e3d90fd5b8161175d9161220a565b61040c578138611643565b6282b42960e81b8252600482fd5b50323314156115f8565b503461037157806003193601126103715760206001600160401b0360065460401c16604051908152f35b5034610371578060031936011261037157602061ffff60065460901c16604051908152f35b50346103715780600319360112610371576020600454604051908152f35b5034610371578060031936011261037157602060405169d3c21bcecceda10000008152f35b503461037157806003193601126103715760206001600160401b0360065416604051908152f35b50346103715760203660031901126103715760043561ffff81168082036104f7576118626124de565b8015908115611893575b506104d9576006805461ffff60901b191660909290921b61ffff60901b1691909117905580f35b6103e89150113861186c565b5034610371576020366003190112610371576004356118bc6124de565b80156105435760045580f35b5034610371578060031936011261037157546040516001600160a01b039091168152602090f35b50346103715760203660031901126103715760043561ffff81168082036104f7576119186124de565b8015908115611949575b506104d9576006805461ffff60a01b191660a09290921b61ffff60a01b1691909117905580f35b6103e891501138611922565b5034610371578060031936011261037157600154336001600160a01b03909116036119c757600180546001600160a01b0319908116909155815433918116821783556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b63118cdaa760e01b815233600452602490fd5b50346103715760203660031901126103715760043561ffff81168082036104f757611a036124de565b8015908115611a34575b506104d9576006805461ffff60801b191660809290921b61ffff60801b1691909117905580f35b6103e891501138611a0d565b5034610371578060031936011261037157611a596124de565b600180546001600160a01b03199081169091558154908116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5034610371578060031936011261037157602061ffff60065460a01c16604051908152f35b50346103715780600319360112610371576020600354604051908152f35b5034610371578060031936011261037157602063ffffffff60065460d01c16604051908152f35b5034610371578060031936011261037157602063ffffffff60065460b01c16604051908152f35b503461037157611b4536612182565b333b15801590611ce0575b611cd2576040519163367b97ef60e11b83526020600484015260208380611b7b6024820186866123cf565b0381600080516020612c5a8339815191525afa928315611cc7578493611c8f575b508215611c80578390600080516020612c5a8339815191523b1561040c5760405163024ff33160e21b81529283918291611bdc9130919060048501612414565b038183600080516020612c5a8339815191525af1801561174857611c66575b50611c19611c3f916127106105aa61ffff60065460a01c1683612507565b7f0000000000000000000000005d27813c32dd705404d1a78c9444dab52333171761253a565b7f3158952e7c791deb52750003dbcb0fb942106f2bcd1005fb946a83cd6646fdc48180a180f35b82611c78611c3f9394611c199361220a565b929150611bfb565b6312d37ee560e31b8452600484fd5b9092506020813d602011611cbf575b81611cab6020938361220a565b81010312611cbb57519138611b9c565b8380fd5b3d9150611c9e565b6040513d86823e3d90fd5b6282b42960e81b8352600483fd5b5032331415611b50565b5034610371578060031936011261037157333b15801590612022575b6115c457611d12612273565b9069d3c21bcecceda1000000821061200d575b5042600355611db1611d89611d97612710611d4961ffff60065460901c1686612507565b04936001600160a01b0390611d5f9086906123ae565b60405163a9059cbb60e01b6020820152336024820152604481019690965216939182906064820190565b03601f19810183528261220a565b7331b2c59d760058cfe57e59472e7542f776d987fb612582565b604051636eb1769f60e11b8152306004820152600080516020612c5a83398151915260248201526020816044817331b2c59d760058cfe57e59472e7542f776d987fb5afa80156117485782908490611fd7575b611e0e9250612250565b828060405192602084019063095ea7b360e01b8252600080516020612c5a8339815191526024860152604485015260448452611e4b60648561220a565b835190827331b2c59d760058cfe57e59472e7542f776d987fb5af1611e6e612612565b81611fa0575b5080611f82575b15611f3c575b5060405190635cacc5fb60e11b82526307779f006004830152602482015260408160448185600080516020612c5a8339815191525af18015610d8f57611eea575b507fde20bc92f9195457f9ba0ec9258c42c0814617c756a597287307a20494e839928180a180f35b6040813d604011611f34575b81611f036040938361220a565b8101031261040c5780516bffffffffffffffffffffffff81160361040c576020611f2d91016123bb565b5038611ec2565b3d9150611ef6565b611f7c90611d9760405163095ea7b360e01b6020820152600080516020612c5a833981519152602482015285604482015260448152611d9760648261220a565b38611e81565b507331b2c59d760058cfe57e59472e7542f776d987fb3b1515611e7b565b8051801592508215611fb5575b505038611e74565b8192509060209181010312611cbb576020611fd09101612575565b3880611fad565b50506020813d602011612005575b81611ff26020938361220a565b810103126104f75781611e0e9151611e04565b3d9150611fe5565b42106115b55760055481106115a65738611d25565b5032331415611d06565b5034610371578060031936011261037157604061204761230f565b82519182526020820152f35b50346103715780600319360112610371576040612047612273565b5034610371576020366003190112610371576004356001600160401b0381168082036104f75761209c6124de565b156105435767ffffffffffffffff60401b6006549160401b169067ffffffffffffffff60401b19161760065580f35b50346103715760203660031901126103715760043563ffffffff81168082036104f7576120f66124de565b15610543576006805463ffffffff60b01b191660b09290921b63ffffffff60b01b1691909117905580f35b50346103715780600319360112610371576020600254604051908152f35b90503461040c578160031936011261040c577f0000000000000000000000005d27813c32dd705404d1a78c9444dab5233317176001600160a01b03168152602090f35b90602060031983011261173b576004356001600160401b03811161173b578260238201121561173b578060040135926001600160401b03841161173b5760248460051b8301011161173b576024019190565b906020808351928381520192019060005b8181106121f25750505090565b825115158452602093840193909201916001016121e5565b90601f801991011681019081106001600160401b0382111761222b57604052565b634e487b7160e01b600052604160045260246000fd5b9081602091031261173b575190565b9190820180921161225d57565b634e487b7160e01b600052601160045260246000fd5b6040516370a0823160e01b81523060048201526020816024817331b2c59d760058cfe57e59472e7542f776d987fb5afa908115612303576000916122d1575b506122ce6003546001600160401b0360065460401c1690612250565b91565b90506020813d6020116122fb575b816122ec6020938361220a565b8101031261173b5751386122b2565b3d91506122df565b6040513d6000823e3d90fd5b6040516370a0823160e01b815230600482015260208160248173f19308f923582a6f7c465e5ce7a9dc1bec6665b15afa9081156123035760009161237c575b50600454908181111561237557505b6122ce6002546001600160401b036006541690612250565b905061235d565b906020823d6020116123a6575b816123966020938361220a565b810103126103715750513861234e565b3d9150612389565b9190820391821161225d57565b51906001600160a01b038216820361173b57565b916020908281520191906000905b8082106123ea5750505090565b90919283359060018060a01b03821680920361173b576020816001938293520194019201906123dd565b9160209161242d919594956040855260408501916123cf565b6001600160a01b03909416910152565b6001600160401b03811161222b5760051b60200190565b9061245e8261243d565b61246b604051918261220a565b828152809261247c601f199161243d565b0190602036910137565b519063ffffffff8216820361173b57565b8051156124a45760200190565b634e487b7160e01b600052603260045260246000fd5b8051600110156124a45760400190565b80518210156124a45760209160051b010190565b6000546001600160a01b031633036124f257565b63118cdaa760e01b6000523360045260246000fd5b8181029291811591840414171561225d57565b8115612524570490565b634e487b7160e01b600052601260045260246000fd5b60405163a9059cbb60e01b60208201526001600160a01b039091166024820152604481019190915261257390610df68160648101611d89565b565b5190811515820361173b57565b6000806125ab9260018060a01b03169360208151910182865af16125a4612612565b9083612bf8565b80519081151591826125d5575b50506125c15750565b635274afe760e01b60005260045260246000fd5b819250906020918101031261173b5760206125f09101612575565b1538806125b8565b9063ffffffff8091169116039063ffffffff821161225d57565b3d1561264c573d906001600160401b03821161222b5760405191612640601f8201601f19166020018461220a565b82523d6000602084013e565b606090565b519061ffff8216820361173b57565b51908160060b820361173b57565b919082608091031261173b5761268382612486565b9161269060208201612660565b916126a960606126a2604085016123bb565b9301612575565b90565b60020b6000811215612a1d5780600003905b620d89e88211612a0c5760018216156129fa576001600160881b036ffffcb933bd6fad37aa2d162d1a5940015b1691600281166129de575b600481166129c2575b600881166129a6575b6010811661298a575b6020811661296e575b60408116612952575b60808116612936575b610100811661291a575b61020081166128fe575b61040081166128e2575b61080081166128c6575b61100081166128aa575b612000811661288e575b6140008116612872575b6180008116612856575b62010000811661283a575b62020000811661281f575b620400008116612804575b62080000166127eb575b6000126127dc575b63ffffffff81166127d4576000905b60201c60ff91909116016001600160a01b031690565b6001906127be565b801561252457600019046127af565b6b048a170391f7dc42444e8fa290910260801c906127a7565b6d2216e584f5fa1ea926041bedfe9890920260801c9161279d565b916e5d6af8dedb81196699c329225ee6040260801c91612792565b916f09aa508b5b7a84e1c677de54f3e99bc90260801c91612787565b916f31be135f97d08fd981231505542fcfa60260801c9161277c565b916f70d869a156d2a1b890bb3df62baf32f70260801c91612772565b916fa9f746462d870fdf8a65dc1f90e061e50260801c91612768565b916fd097f3bdfd2022b8845ad8f792aa58250260801c9161275e565b916fe7159475a2c29b7443b29c7fa6e889d90260801c91612754565b916ff3392b0822b70005940c7a398e4b70f30260801c9161274a565b916ff987a7253ac413176f2b074cf7815e540260801c91612740565b916ffcbe86c7900a88aedcffc83b479aa3a40260801c91612736565b916ffe5dee046a99a2a811c461f1969c30530260801c9161272c565b916fff2ea16466c96a3843ec78b326b528610260801c91612723565b916fff973b41fa98c081472e6896dfb254c00260801c9161271a565b916fffcb9843d60f6159c9db58835c9266440260801c91612711565b916fffe5caca7e10e4e61c3624eaa0941cd00260801c91612708565b916ffff2e50f5f656932ef12357cf3c7fdcc0260801c916126ff565b916ffff97272373d413259a46990580e213a0260801c916126f6565b6001600160881b03600160801b6126eb565b6315e4079d60e11b60005260046000fd5b806126be565b8181029160009160001982820992848085109403938085039414612a775783600160401b1115612a68575090600160401b910990828211900360c01b910360401c1790565b63227bc15360e01b8152600490fd5b925050505060401c90565b90608082901b9060001983600160801b0992828085109403938085039414612b185783821115612b07578190600160801b09816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b63227bc15360e01b60005260046000fd5b50906126a9925061251a565b9060c082901b9060001983600160c01b0992828085109403938085039414612b185783821115612b07578190600160c01b09816000038216809204600281600302188082026002030280820260020302808202600203028082026002030280820260020302809102600203029360018380600003040190848311900302920304170290565b6000908281029260001981830992848085109403938085039414612bed57600160c01b841015612a685750600160c01b910990828211900360401b910360c01c1790565b925050505060c01c90565b90612c1e5750805115612c0d57805190602001fd5b630a12f52160e11b60005260046000fd5b81511580612c50575b612c2f575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b15612c2756fe00000000000000000000000032c611b0a96789baa3d6bf9f0867b7e1b9d049bea26469706673582212207965d6ee30d73d1e23d540f915457690f6cd7b80c8cbdebc6aad6309e52f733f64736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000eb430c15ff72fec66f382e6905e2dcb88a805c510000000000000000000000005d27813c32dd705404d1a78c9444dab523331717
-----Decoded View---------------
Arg [0] : _owner (address): 0xeB430C15Ff72feC66f382E6905e2DCB88a805C51
Arg [1] : _staxVault (address): 0x5D27813C32dD705404d1A78c9444dAb523331717
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000eb430c15ff72fec66f382e6905e2dcb88a805c51
Arg [1] : 0000000000000000000000005d27813c32dd705404d1a78c9444dab523331717
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.