Overview
S Balance
0 S
S Value
-More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 31 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Open Settle | 2935825 | 11 hrs ago | IN | 0 S | 0.00160887 | ||||
Open Settle | 2913758 | 17 hrs ago | IN | 0 S | 0.00138667 | ||||
Open Settle | 2912314 | 17 hrs ago | IN | 0 S | 0.00157706 | ||||
Open Settle | 2912301 | 17 hrs ago | IN | 0 S | 0.00145522 | ||||
Open Settle | 2912292 | 17 hrs ago | IN | 0 S | 0.0012446 | ||||
Open Settle | 2912284 | 17 hrs ago | IN | 0 S | 0.00255312 | ||||
Open Settle | 2900713 | 19 hrs ago | IN | 0 S | 0.00283638 | ||||
Open Settle | 2891981 | 20 hrs ago | IN | 0 S | 0.00138486 | ||||
Open Settle | 2365649 | 5 days ago | IN | 0 S | 0.00028115 | ||||
Open Settle | 2365152 | 5 days ago | IN | 0 S | 0.00084707 | ||||
Open Settle | 2356988 | 5 days ago | IN | 0 S | 0.0002807 | ||||
Open Settle | 2340089 | 5 days ago | IN | 0 S | 0.00024863 | ||||
Open Settle | 2340081 | 5 days ago | IN | 0 S | 0.00039377 | ||||
Open Settle | 2340070 | 5 days ago | IN | 0 S | 0.0002495 | ||||
Open Settle | 2340064 | 5 days ago | IN | 0 S | 0.0002495 | ||||
Open Settle | 2340056 | 5 days ago | IN | 0 S | 0.0002495 | ||||
Open Settle | 2340052 | 5 days ago | IN | 0 S | 0.00024901 | ||||
Open Settle | 2340043 | 5 days ago | IN | 0 S | 0.00024851 | ||||
Open Settle | 2340037 | 5 days ago | IN | 0 S | 0.00024852 | ||||
Open Settle | 2340028 | 5 days ago | IN | 0 S | 0.0002657 | ||||
Open Settle | 2340025 | 5 days ago | IN | 0 S | 0.00026577 | ||||
Open Settle | 2340018 | 5 days ago | IN | 0 S | 0.00026577 | ||||
Open Settle | 2340013 | 5 days ago | IN | 0 S | 0.0002658 | ||||
Open Settle | 2340005 | 5 days ago | IN | 0 S | 0.00024852 | ||||
Open Settle | 2340001 | 5 days ago | IN | 0 S | 0.00026573 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
OpenSettlement
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; import {IOptionMarketOTMFE} from "../interfaces/apps/options/IOptionMarketOTMFE.sol"; import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol"; import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; import {ERC20} from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import {ISwapper} from "../interfaces/ISwapper.sol"; /// @title OpenSettlement /// @notice Contract that handles the settlement of expired options with a two-tier fee structure /// @dev Inherits from Ownable and uses SafeERC20 for token transfers contract OpenSettlement is Ownable { using SafeERC20 for ERC20; // events event LogSettleOptionsOpen( address indexed market, uint256 indexed optionId, uint256 totalProfitForUser, uint256 settledFeeProtocol, uint256 settledFeePublic ); // errors /// @notice Thrown when attempting to settle an option that hasn't been settled by the market error OptionNotSettled(); /// @notice Fee percentage for whitelisted settlers (in SETTLE_FEE_PRECISION basis points) uint256 public settleFeeProtocol; /// @notice Fee percentage for public settlers (in SETTLE_FEE_PRECISION basis points) uint256 public settleFeePublic; /// @notice Precision for fee calculations (10,000 = 100%) uint256 public constant SETTLE_FEE_PRECISION = 10_000; /// @notice Address that receives settlement fees address public publicFeeRecipient; /// @notice Mapping of addresses to their whitelisted settler status mapping(address => bool) public isWhitelistedSettler; /// @notice Constructs the OpenSettlement contract /// @param _isWhitelistedSettler Initial whitelisted settler address /// @param _publicFeeRecipient Address to receive settlement fees /// @param _settleFeeProtocol Fee percentage for whitelisted settlers /// @param _settleFeePublic Fee percentage for public settlers constructor( address _isWhitelistedSettler, address _publicFeeRecipient, uint256 _settleFeeProtocol, uint256 _settleFeePublic ) Ownable(msg.sender) { settleFeeProtocol = _settleFeeProtocol; settleFeePublic = _settleFeePublic; isWhitelistedSettler[_isWhitelistedSettler] = true; publicFeeRecipient = _publicFeeRecipient; } /// @notice Settles an option and distributes profits according to the fee structure /// @dev Whitelisted settlers pay a lower fee than public settlers /// @param market The option market contract /// @param optionId The ID of the option to settle /// @param settleParams Parameters required for settlement /// @return AssetsCache struct containing settlement results function openSettle( IOptionMarketOTMFE market, uint256 optionId, IOptionMarketOTMFE.SettleOptionParams memory settleParams ) external returns (IOptionMarketOTMFE.AssetsCache memory) { (IOptionMarketOTMFE.AssetsCache memory ac) = market.settleOption(settleParams); if (!ac.isSettle) revert OptionNotSettled(); if (ac.totalProfit > 0) { if (settleFeeProtocol > 0) { uint256 feeProtocol; uint256 feePublic; if (isWhitelistedSettler[msg.sender]) { feeProtocol = (ac.totalProfit * settleFeeProtocol) / SETTLE_FEE_PRECISION; ac.assetToGet.safeTransfer(publicFeeRecipient, feeProtocol); ac.assetToGet.safeTransfer(market.ownerOf(optionId), ac.totalProfit - feeProtocol); } else { feeProtocol = (ac.totalProfit * (settleFeeProtocol - settleFeePublic)) / SETTLE_FEE_PRECISION; feePublic = (ac.totalProfit * settleFeePublic) / SETTLE_FEE_PRECISION; ac.assetToGet.safeTransfer(publicFeeRecipient, feeProtocol); ac.assetToGet.safeTransfer(msg.sender, feePublic); ac.assetToGet.safeTransfer(market.ownerOf(optionId), ac.totalProfit - feeProtocol - feePublic); } emit LogSettleOptionsOpen( address(market), optionId, ac.totalProfit - feeProtocol - feePublic, feeProtocol, feePublic ); } else { ac.assetToGet.safeTransfer(market.ownerOf(optionId), ac.totalProfit); emit LogSettleOptionsOpen(address(market), optionId, ac.totalProfit, 0, 0); } } return ac; } /// @notice Updates the protocol fee percentage for whitelisted settlers /// @param _settleFeeProtocol New fee percentage in SETTLE_FEE_PRECISION basis points function setSettleFeeProtocol(uint256 _settleFeeProtocol) external onlyOwner { settleFeeProtocol = _settleFeeProtocol; } /// @notice Updates the public fee percentage for non-whitelisted settlers /// @param _settleFeePublic New fee percentage in SETTLE_FEE_PRECISION basis points function setSettleFeePublic(uint256 _settleFeePublic) external onlyOwner { settleFeePublic = _settleFeePublic; } /// @notice Updates the whitelisted status of a settler address /// @param _isWhitelistedSettler Address to update /// @param _isWhitelistedSettlerStatus New whitelisted status function setIsWhitelistedSettler(address _isWhitelistedSettler, bool _isWhitelistedSettlerStatus) external onlyOwner { isWhitelistedSettler[_isWhitelistedSettler] = _isWhitelistedSettlerStatus; } /// @notice Updates the address that receives settlement fees /// @param _publicFeeRecipient New fee recipient address function setPublicFeeRecipient(address _publicFeeRecipient) external onlyOwner { publicFeeRecipient = _publicFeeRecipient; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; import {IHandler} from "../../IHandler.sol"; import {ISwapper} from "../../ISwapper.sol"; import {ERC20} from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; interface IOptionMarketOTMFE { /// @notice Struct to store option data struct OptionData { uint256 opTickArrayLen; uint256 expiry; int24 tickLower; int24 tickUpper; bool isCall; } /// @notice Struct to store option ticks data struct OptionTicks { IHandler _handler; IUniswapV3Pool pool; address hook; int24 tickLower; int24 tickUpper; uint256 liquidityToUse; } /// @notice Struct for option parameters struct OptionParams { OptionTicks[] optionTicks; uint256 ttl; uint256 maxCostAllowance; int24 tickLower; int24 tickUpper; bool isCall; } /// @notice Struct for settling option parameters struct SettleOptionParams { uint256 optionId; ISwapper[] swapper; bytes[] swapData; uint256[] liquidityToSettle; } /// @notice Struct for position splitter parameters struct PositionSplitterParams { uint256 optionId; address to; uint256[] liquidityToSplit; } /// @notice Struct to cache asset-related data during option settlement struct AssetsCache { uint256 totalProfit; uint256 totalAssetRelocked; ERC20 assetToUse; ERC20 assetToGet; bool isSettle; } /// @notice Mints a new option /// @param _params The option parameters function mintOption(OptionParams calldata _params) external; /// @notice Settles an option /// @param _params The settlement parameters /// @return ac The assets cache containing settlement results function settleOption(SettleOptionParams calldata _params) external returns (AssetsCache memory ac); /// @notice Splits a position into a new option /// @param _params The position splitter parameters function positionSplitter(PositionSplitterParams calldata _params) external; /// @notice Updates the exercise delegate for the caller /// @param _delegateTo The address to delegate to /// @param _status The delegation status function updateExerciseDelegate(address _delegateTo, bool _status) external; /// @notice Gets the price per call asset via a specific tick /// @param _pool The Uniswap V3 pool /// @param _tick The tick to get the price for /// @return uint256 The price per call asset function getPricePerCallAssetViaTick(IUniswapV3Pool _pool, int24 _tick) external view returns (uint256); /// @notice Gets the premium amount for an option /// @param hook The hook address /// @param isPut Whether the option is a put /// @param expiry The expiry timestamp /// @param ttl The time-to-live /// @param strike The strike price /// @param lastPrice The last price /// @param amount The option amount /// @return uint256 The premium amount function getPremiumAmount( address hook, bool isPut, uint256 expiry, uint256 ttl, uint256 strike, uint256 lastPrice, uint256 amount ) external view returns (uint256); /// @notice Gets the fee for a given amount and premium /// @param amount The option amount /// @param premium The option premium /// @return uint256 The calculated fee function getFee(uint256 amount, uint256 premium) external view returns (uint256); /// @notice Updates pool approvals and settings /// @param _settler The settler address /// @param _statusSettler The settler status /// @param _pool The pool address /// @param _statusPools The pool status /// @param ttl The time-to-live /// @param ttlStatus The TTL status /// @param _BUFFER_TIME The buffer time function updatePoolApporvals( address _settler, bool _statusSettler, address _pool, bool _statusPools, uint256 ttl, bool ttlStatus, uint256 _BUFFER_TIME ) external; /// @notice Updates pool settings /// @param _feeTo The fee recipient address /// @param _tokenURIFetcher The token URI fetcher address /// @param _dpFee The fee strategy address /// @param _optionPricing The option pricing address /// @param _verifiedSpotPrice The verified spot price address function updatePoolSettings( address _feeTo, address _tokenURIFetcher, address _dpFee, address _optionPricing, address _verifiedSpotPrice ) external; /// @notice Emergency withdraw function /// @param token The token address to withdraw function emergencyWithdraw(address token) external; /// @notice Returns the owner of a token /// @param id The token ID /// @return address The owner of the token function ownerOf(uint256 id) external view returns (address); }
// 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) (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) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; interface ISwapper { function onSwapReceived(address _tokenIn, address _tokenOut, uint256 _amountIn, bytes calldata _swapData) external returns (uint256 amountOut); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import {IUniswapV3PoolImmutables} from './pool/IUniswapV3PoolImmutables.sol'; import {IUniswapV3PoolState} from './pool/IUniswapV3PoolState.sol'; import {IUniswapV3PoolDerivedState} from './pool/IUniswapV3PoolDerivedState.sol'; import {IUniswapV3PoolActions} from './pool/IUniswapV3PoolActions.sol'; import {IUniswapV3PoolOwnerActions} from './pool/IUniswapV3PoolOwnerActions.sol'; import {IUniswapV3PoolErrors} from './pool/IUniswapV3PoolErrors.sol'; import {IUniswapV3PoolEvents} from './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, IUniswapV3PoolErrors, IUniswapV3PoolEvents { }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; interface IHandler { struct HookPermInfo { bool onMint; bool onBurn; bool onUse; bool onUnuse; bool onDonate; bool allowSplit; } function registerHook(address _hook, HookPermInfo memory _info) external; function getHandlerIdentifier(bytes calldata _data) external view returns (uint256 handlerIdentifierId); function tokensToPullForMint(bytes calldata _mintPositionData) external view returns (address[] memory tokens, uint256[] memory amounts); function mintPositionHandler(address context, bytes calldata _mintPositionData) external returns (uint256 sharesMinted); function burnPositionHandler(address context, bytes calldata _burnPositionData) external returns (uint256 sharesBurned); function usePositionHandler(bytes calldata _usePositionData) external returns (address[] memory tokens, uint256[] memory amounts, uint256 liquidityUsed); function wildcardHandler(address context, bytes calldata _wildcardData) external returns (bytes memory wildcardRetData); function tokensToPullForUnUse(bytes calldata _unusePositionData) external view returns (address[] memory tokens, uint256[] memory amounts); function unusePositionHandler(bytes calldata _unusePositionData) external returns (uint256[] memory amounts, uint256 liquidity); function donateToPosition(bytes calldata _donatePosition) external returns (uint256[] memory amounts, uint256 liquidity); function tokensToPullForDonate(bytes calldata _donatePosition) external view returns (address[] memory tokens, uint256[] memory amounts); function tokensToPullForWildcard(bytes calldata _wildcardData) external view returns (address[] memory tokens, uint256[] memory amounts); }
// 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) (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/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) (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.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: 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 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 /// @return 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. /// @return observationIndex The index of the last oracle observation that was written, /// @return observationCardinality The current maximum number of observations stored in the pool, /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// @return 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 /// @return The liquidity at the current price of the pool 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 /// @return liquidityNet how much liquidity changes when the pool price crosses the tick, /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// @return secondsOutside the seconds spent on the other side of the tick from the current tick, /// @return 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, /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// @return 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, /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// @return initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that 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 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 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 Errors emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolErrors { error LOK(); error TLU(); error TLM(); error TUM(); error AI(); error M0(); error M1(); error AS(); error IIA(); error L(); error F0(); error F1(); }
// 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); }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "v3-core/=lib/v3-core/contracts/", "v3-periphery/=lib/v3-periphery/contracts/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "@openzeppelin/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_isWhitelistedSettler","type":"address"},{"internalType":"address","name":"_publicFeeRecipient","type":"address"},{"internalType":"uint256","name":"_settleFeeProtocol","type":"uint256"},{"internalType":"uint256","name":"_settleFeePublic","type":"uint256"}],"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":"FailedInnerCall","type":"error"},{"inputs":[],"name":"OptionNotSettled","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalProfitForUser","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settledFeeProtocol","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settledFeePublic","type":"uint256"}],"name":"LogSettleOptionsOpen","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"},{"inputs":[],"name":"SETTLE_FEE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelistedSettler","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IOptionMarketOTMFE","name":"market","type":"address"},{"internalType":"uint256","name":"optionId","type":"uint256"},{"components":[{"internalType":"uint256","name":"optionId","type":"uint256"},{"internalType":"contract ISwapper[]","name":"swapper","type":"address[]"},{"internalType":"bytes[]","name":"swapData","type":"bytes[]"},{"internalType":"uint256[]","name":"liquidityToSettle","type":"uint256[]"}],"internalType":"struct IOptionMarketOTMFE.SettleOptionParams","name":"settleParams","type":"tuple"}],"name":"openSettle","outputs":[{"components":[{"internalType":"uint256","name":"totalProfit","type":"uint256"},{"internalType":"uint256","name":"totalAssetRelocked","type":"uint256"},{"internalType":"contract ERC20","name":"assetToUse","type":"address"},{"internalType":"contract ERC20","name":"assetToGet","type":"address"},{"internalType":"bool","name":"isSettle","type":"bool"}],"internalType":"struct IOptionMarketOTMFE.AssetsCache","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicFeeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_isWhitelistedSettler","type":"address"},{"internalType":"bool","name":"_isWhitelistedSettlerStatus","type":"bool"}],"name":"setIsWhitelistedSettler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_publicFeeRecipient","type":"address"}],"name":"setPublicFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_settleFeeProtocol","type":"uint256"}],"name":"setSettleFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_settleFeePublic","type":"uint256"}],"name":"setSettleFeePublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleFeeProtocol","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"settleFeePublic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561000f575f80fd5b5060405161114d38038061114d83398101604081905261002e9161010c565b338061005357604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61005c816100a2565b5060019182556002556001600160a01b039283165f908152600460205260409020805460ff19169091179055600380546001600160a01b0319169190921617905561014c565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114610107575f80fd5b919050565b5f805f806080858703121561011f575f80fd5b610128856100f1565b9350610136602086016100f1565b6040860151606090960151949790965092505050565b610ff4806101595f395ff3fe608060405234801561000f575f80fd5b50600436106100cb575f3560e01c80638da5cb5b11610088578063e5fd1bf611610063578063e5fd1bf6146101f8578063ec47cb5a1461020b578063f2fde38b14610214578063f359e9c314610227575f80fd5b80638da5cb5b146101cc578063ce48a9c2146101dc578063dac5c327146101e5575f80fd5b80631e010c70146100cf5780634ab68ff11461013b57806358a4c5ef14610152578063715018a6146101675780637c4374aa1461016f578063882939d5146101a1575b5f80fd5b6100e26100dd366004610b5a565b61023a565b604051610132919081518152602080830151908201526040808301516001600160a01b03908116918301919091526060808401519091169082015260809182015115159181019190915260a00190565b60405180910390f35b61014461271081565b604051908152602001610132565b610165610160366004610ca3565b61063b565b005b610165610648565b61019161017d366004610cba565b60046020525f908152604090205460ff1681565b6040519015158152602001610132565b6003546101b4906001600160a01b031681565b6040516001600160a01b039091168152602001610132565b5f546001600160a01b03166101b4565b61014460025481565b6101656101f3366004610ca3565b61065b565b610165610206366004610ce2565b610668565b61014460015481565b610165610222366004610cba565b61069a565b610165610235366004610cba565b6106dc565b6040805160a0810182525f80825260208201819052918101829052606081018290526080810191909152604051635569201560e11b81525f906001600160a01b0386169063aad2402a90610292908690600401610deb565b60a0604051808303815f875af11580156102ae573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102d29190610e8a565b905080608001516102f6576040516309900c9b60e41b815260040160405180910390fd5b805115610631576001541561056157335f90815260046020526040812054819060ff16156103ee5760015483516127109161033091610f24565b61033a9190610f3b565b600354606085015191935061035c916001600160a01b03908116911684610706565b6040516331a9108f60e11b8152600481018790526103e9906001600160a01b03891690636352211e90602401602060405180830381865afa1580156103a3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c79190610f5a565b84516103d4908590610f75565b60608601516001600160a01b03169190610706565b6104f6565b6127106002546001546104019190610f75565b845161040d9190610f24565b6104179190610f3b565b9150612710600254845f015161042d9190610f24565b6104379190610f3b565b6003546060850151919250610459916001600160a01b03908116911684610706565b6060830151610472906001600160a01b03163383610706565b6040516331a9108f60e11b8152600481018790526104f6906001600160a01b03891690636352211e90602401602060405180830381865afa1580156104b9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104dd9190610f5a565b845183906104ec908690610f75565b6103d49190610f75565b85876001600160a01b03167f7c6ea5f27200caa4d784cbdc279e8478e309c9fcaf121743c7756ea8a19da9f58385875f01516105329190610f75565b61053c9190610f75565b6040805191825260208201879052810185905260600160405180910390a35050610631565b6040516331a9108f60e11b8152600481018590526105e3906001600160a01b03871690636352211e90602401602060405180830381865afa1580156105a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105cc9190610f5a565b825160608401516001600160a01b03169190610706565b8051604080519182525f60208301819052828201525185916001600160a01b038816917f7c6ea5f27200caa4d784cbdc279e8478e309c9fcaf121743c7756ea8a19da9f59181900360600190a35b90505b9392505050565b61064361075d565b600155565b61065061075d565b6106595f610789565b565b61066361075d565b600255565b61067061075d565b6001600160a01b03919091165f908152600460205260409020805460ff1916911515919091179055565b6106a261075d565b6001600160a01b0381166106d057604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6106d981610789565b50565b6106e461075d565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526107589084906107d8565b505050565b5f546001600160a01b031633146106595760405163118cdaa760e01b81523360048201526024016106c7565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6107ec6001600160a01b03841683610839565b905080515f1415801561081057508080602001905181019061080e9190610f88565b155b1561075857604051635274afe760e01b81526001600160a01b03841660048201526024016106c7565b606061084683835f61084f565b90505b92915050565b6060814710156108745760405163cd78605960e01b81523060048201526024016106c7565b5f80856001600160a01b0316848660405161088f9190610fa3565b5f6040518083038185875af1925050503d805f81146108c9576040519150601f19603f3d011682016040523d82523d5f602084013e6108ce565b606091505b50915091506108de8683836108e8565b9695505050505050565b6060826108fd576108f882610944565b610634565b815115801561091457506001600160a01b0384163b155b1561093d57604051639996b31560e01b81526001600160a01b03851660048201526024016106c7565b5080610634565b8051156109545780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b03811681146106d9575f80fd5b634e487b7160e01b5f52604160045260245ffd5b6040516080810167ffffffffffffffff811182821017156109b8576109b8610981565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156109e7576109e7610981565b604052919050565b5f67ffffffffffffffff821115610a0857610a08610981565b5060051b60200190565b5f82601f830112610a21575f80fd5b8135610a34610a2f826109ef565b6109be565b8082825260208201915060208360051b860101925085831115610a55575f80fd5b602085015b83811015610af557803567ffffffffffffffff811115610a78575f80fd5b8601603f81018813610a88575f80fd5b602081013567ffffffffffffffff811115610aa557610aa5610981565b610ab8601f8201601f19166020016109be565b8181526040838301018a1015610acc575f80fd5b816040840160208301375f60208383010152808652505050602083019250602081019050610a5a565b5095945050505050565b5f82601f830112610b0e575f80fd5b8135610b1c610a2f826109ef565b8082825260208201915060208360051b860101925085831115610b3d575f80fd5b602085015b83811015610af5578035835260209283019201610b42565b5f805f60608486031215610b6c575f80fd5b8335610b778161096d565b925060208401359150604084013567ffffffffffffffff811115610b99575f80fd5b840160808187031215610baa575f80fd5b610bb2610995565b81358152602082013567ffffffffffffffff811115610bcf575f80fd5b8201601f81018813610bdf575f80fd5b8035610bed610a2f826109ef565b8082825260208201915060208360051b85010192508a831115610c0e575f80fd5b6020840193505b82841015610c39578335610c288161096d565b825260209384019390910190610c15565b6020850152505050604082013567ffffffffffffffff811115610c5a575f80fd5b610c6688828501610a12565b604083015250606082013567ffffffffffffffff811115610c85575f80fd5b610c9188828501610aff565b60608301525080925050509250925092565b5f60208284031215610cb3575f80fd5b5035919050565b5f60208284031215610cca575f80fd5b81356106348161096d565b80151581146106d9575f80fd5b5f8060408385031215610cf3575f80fd5b8235610cfe8161096d565b91506020830135610d0e81610cd5565b809150509250929050565b5f5b83811015610d33578181015183820152602001610d1b565b50505f910152565b5f82825180855260208501945060208160051b830101602085015f5b83811015610da557601f1985840301885281518051808552610d80816020870160208501610d19565b6020998a0199601f91909101601f191694909401840193929092019150600101610d57565b50909695505050505050565b5f8151808452602084019350602083015f5b82811015610de1578151865260209586019590910190600101610dc3565b5093949350505050565b60208082528251828201528281015160806040840152805160a084018190525f929190910190829060c08501905b80831015610e445783516001600160a01b031682526020938401936001939093019290910190610e19565b506040860151858203601f190160608701529250610e628184610d3b565b925050506060840151601f19848303016080850152610e818282610db1565b95945050505050565b5f60a0828403128015610e9b575f80fd5b5060405160a0810167ffffffffffffffff81118282101715610ebf57610ebf610981565b60409081528351825260208085015190830152830151610ede8161096d565b60408201526060830151610ef18161096d565b60608201526080830151610f0481610cd5565b60808201529392505050565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761084957610849610f10565b5f82610f5557634e487b7160e01b5f52601260045260245ffd5b500490565b5f60208284031215610f6a575f80fd5b81516106348161096d565b8181038181111561084957610849610f10565b5f60208284031215610f98575f80fd5b815161063481610cd5565b5f8251610fb4818460208701610d19565b919091019291505056fea2646970667358221220a3d90ff71cb0f2fd9abc40780ffbccb87a4729125ad7aa06b5a2e04bc09a4f6764736f6c634300081a003300000000000000000000000071e4cf78d8842c452de813eb78e13c0db463fed90000000000000000000000009dc698c4c72e407eccb8244bf341e90ce71026b200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106100cb575f3560e01c80638da5cb5b11610088578063e5fd1bf611610063578063e5fd1bf6146101f8578063ec47cb5a1461020b578063f2fde38b14610214578063f359e9c314610227575f80fd5b80638da5cb5b146101cc578063ce48a9c2146101dc578063dac5c327146101e5575f80fd5b80631e010c70146100cf5780634ab68ff11461013b57806358a4c5ef14610152578063715018a6146101675780637c4374aa1461016f578063882939d5146101a1575b5f80fd5b6100e26100dd366004610b5a565b61023a565b604051610132919081518152602080830151908201526040808301516001600160a01b03908116918301919091526060808401519091169082015260809182015115159181019190915260a00190565b60405180910390f35b61014461271081565b604051908152602001610132565b610165610160366004610ca3565b61063b565b005b610165610648565b61019161017d366004610cba565b60046020525f908152604090205460ff1681565b6040519015158152602001610132565b6003546101b4906001600160a01b031681565b6040516001600160a01b039091168152602001610132565b5f546001600160a01b03166101b4565b61014460025481565b6101656101f3366004610ca3565b61065b565b610165610206366004610ce2565b610668565b61014460015481565b610165610222366004610cba565b61069a565b610165610235366004610cba565b6106dc565b6040805160a0810182525f80825260208201819052918101829052606081018290526080810191909152604051635569201560e11b81525f906001600160a01b0386169063aad2402a90610292908690600401610deb565b60a0604051808303815f875af11580156102ae573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102d29190610e8a565b905080608001516102f6576040516309900c9b60e41b815260040160405180910390fd5b805115610631576001541561056157335f90815260046020526040812054819060ff16156103ee5760015483516127109161033091610f24565b61033a9190610f3b565b600354606085015191935061035c916001600160a01b03908116911684610706565b6040516331a9108f60e11b8152600481018790526103e9906001600160a01b03891690636352211e90602401602060405180830381865afa1580156103a3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c79190610f5a565b84516103d4908590610f75565b60608601516001600160a01b03169190610706565b6104f6565b6127106002546001546104019190610f75565b845161040d9190610f24565b6104179190610f3b565b9150612710600254845f015161042d9190610f24565b6104379190610f3b565b6003546060850151919250610459916001600160a01b03908116911684610706565b6060830151610472906001600160a01b03163383610706565b6040516331a9108f60e11b8152600481018790526104f6906001600160a01b03891690636352211e90602401602060405180830381865afa1580156104b9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104dd9190610f5a565b845183906104ec908690610f75565b6103d49190610f75565b85876001600160a01b03167f7c6ea5f27200caa4d784cbdc279e8478e309c9fcaf121743c7756ea8a19da9f58385875f01516105329190610f75565b61053c9190610f75565b6040805191825260208201879052810185905260600160405180910390a35050610631565b6040516331a9108f60e11b8152600481018590526105e3906001600160a01b03871690636352211e90602401602060405180830381865afa1580156105a8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105cc9190610f5a565b825160608401516001600160a01b03169190610706565b8051604080519182525f60208301819052828201525185916001600160a01b038816917f7c6ea5f27200caa4d784cbdc279e8478e309c9fcaf121743c7756ea8a19da9f59181900360600190a35b90505b9392505050565b61064361075d565b600155565b61065061075d565b6106595f610789565b565b61066361075d565b600255565b61067061075d565b6001600160a01b03919091165f908152600460205260409020805460ff1916911515919091179055565b6106a261075d565b6001600160a01b0381166106d057604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6106d981610789565b50565b6106e461075d565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526107589084906107d8565b505050565b5f546001600160a01b031633146106595760405163118cdaa760e01b81523360048201526024016106c7565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f6107ec6001600160a01b03841683610839565b905080515f1415801561081057508080602001905181019061080e9190610f88565b155b1561075857604051635274afe760e01b81526001600160a01b03841660048201526024016106c7565b606061084683835f61084f565b90505b92915050565b6060814710156108745760405163cd78605960e01b81523060048201526024016106c7565b5f80856001600160a01b0316848660405161088f9190610fa3565b5f6040518083038185875af1925050503d805f81146108c9576040519150601f19603f3d011682016040523d82523d5f602084013e6108ce565b606091505b50915091506108de8683836108e8565b9695505050505050565b6060826108fd576108f882610944565b610634565b815115801561091457506001600160a01b0384163b155b1561093d57604051639996b31560e01b81526001600160a01b03851660048201526024016106c7565b5080610634565b8051156109545780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b03811681146106d9575f80fd5b634e487b7160e01b5f52604160045260245ffd5b6040516080810167ffffffffffffffff811182821017156109b8576109b8610981565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156109e7576109e7610981565b604052919050565b5f67ffffffffffffffff821115610a0857610a08610981565b5060051b60200190565b5f82601f830112610a21575f80fd5b8135610a34610a2f826109ef565b6109be565b8082825260208201915060208360051b860101925085831115610a55575f80fd5b602085015b83811015610af557803567ffffffffffffffff811115610a78575f80fd5b8601603f81018813610a88575f80fd5b602081013567ffffffffffffffff811115610aa557610aa5610981565b610ab8601f8201601f19166020016109be565b8181526040838301018a1015610acc575f80fd5b816040840160208301375f60208383010152808652505050602083019250602081019050610a5a565b5095945050505050565b5f82601f830112610b0e575f80fd5b8135610b1c610a2f826109ef565b8082825260208201915060208360051b860101925085831115610b3d575f80fd5b602085015b83811015610af5578035835260209283019201610b42565b5f805f60608486031215610b6c575f80fd5b8335610b778161096d565b925060208401359150604084013567ffffffffffffffff811115610b99575f80fd5b840160808187031215610baa575f80fd5b610bb2610995565b81358152602082013567ffffffffffffffff811115610bcf575f80fd5b8201601f81018813610bdf575f80fd5b8035610bed610a2f826109ef565b8082825260208201915060208360051b85010192508a831115610c0e575f80fd5b6020840193505b82841015610c39578335610c288161096d565b825260209384019390910190610c15565b6020850152505050604082013567ffffffffffffffff811115610c5a575f80fd5b610c6688828501610a12565b604083015250606082013567ffffffffffffffff811115610c85575f80fd5b610c9188828501610aff565b60608301525080925050509250925092565b5f60208284031215610cb3575f80fd5b5035919050565b5f60208284031215610cca575f80fd5b81356106348161096d565b80151581146106d9575f80fd5b5f8060408385031215610cf3575f80fd5b8235610cfe8161096d565b91506020830135610d0e81610cd5565b809150509250929050565b5f5b83811015610d33578181015183820152602001610d1b565b50505f910152565b5f82825180855260208501945060208160051b830101602085015f5b83811015610da557601f1985840301885281518051808552610d80816020870160208501610d19565b6020998a0199601f91909101601f191694909401840193929092019150600101610d57565b50909695505050505050565b5f8151808452602084019350602083015f5b82811015610de1578151865260209586019590910190600101610dc3565b5093949350505050565b60208082528251828201528281015160806040840152805160a084018190525f929190910190829060c08501905b80831015610e445783516001600160a01b031682526020938401936001939093019290910190610e19565b506040860151858203601f190160608701529250610e628184610d3b565b925050506060840151601f19848303016080850152610e818282610db1565b95945050505050565b5f60a0828403128015610e9b575f80fd5b5060405160a0810167ffffffffffffffff81118282101715610ebf57610ebf610981565b60409081528351825260208085015190830152830151610ede8161096d565b60408201526060830151610ef18161096d565b60608201526080830151610f0481610cd5565b60808201529392505050565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761084957610849610f10565b5f82610f5557634e487b7160e01b5f52601260045260245ffd5b500490565b5f60208284031215610f6a575f80fd5b81516106348161096d565b8181038181111561084957610849610f10565b5f60208284031215610f98575f80fd5b815161063481610cd5565b5f8251610fb4818460208701610d19565b919091019291505056fea2646970667358221220a3d90ff71cb0f2fd9abc40780ffbccb87a4729125ad7aa06b5a2e04bc09a4f6764736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000071e4cf78d8842c452de813eb78e13c0db463fed90000000000000000000000009dc698c4c72e407eccb8244bf341e90ce71026b200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _isWhitelistedSettler (address): 0x71E4Cf78D8842c452DE813EB78E13C0db463Fed9
Arg [1] : _publicFeeRecipient (address): 0x9DC698C4c72e407ECcb8244bf341e90CE71026b2
Arg [2] : _settleFeeProtocol (uint256): 0
Arg [3] : _settleFeePublic (uint256): 0
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000071e4cf78d8842c452de813eb78e13c0db463fed9
Arg [1] : 0000000000000000000000009dc698c4c72e407eccb8244bf341e90ce71026b2
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.