Overview
ETH Balance
ETH Value
$0.00Latest 1 from a total of 1 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Set Authorized F... | 38284554 | 5 days ago | IN | 0 ETH | 0.00000006 |
Latest 1 internal transaction
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 38317313 | 5 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.26;
import {UnilaunchBuyback} from "./UnilaunchBuyback.sol";
/// @title UnilaunchBuybackDeployer
/// @notice Deploys UnilaunchBuyback contracts for UnilaunchTokenLaunchFactory
contract UnilaunchBuybackDeployer {
address public authorizedFactory;
address public immutable admin;
error UnauthorizedCaller();
constructor(address _admin) {
if (_admin == address(0)) revert UnauthorizedCaller();
admin = _admin;
}
function setAuthorizedFactory(address factory) external {
if (msg.sender != admin) revert UnauthorizedCaller();
if (authorizedFactory != address(0)) revert UnauthorizedCaller();
authorizedFactory = factory;
}
function deploy(
address treasury,
address token,
address buybackRouter
) external returns (address buyback) {
if (msg.sender != authorizedFactory) revert UnauthorizedCaller();
buyback = address(new UnilaunchBuyback(treasury, token, buybackRouter, authorizedFactory));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {PoolKey} from "v4-core/types/PoolKey.sol";
import {BalanceDelta} from "v4-core/types/BalanceDelta.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
interface IUnilaunchSwapRouter {
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
bool zeroForOne,
PoolKey calldata poolKey,
bytes calldata hookData,
address receiver,
uint256 deadline
) external payable returns (BalanceDelta balanceDelta);
}
/// @title UnilaunchBuyback
/// @notice Executes ETH buybacks and burns tokens
contract UnilaunchBuyback is AccessControl {
using SafeERC20 for IERC20;
bytes32 public constant BUYBACK_EXECUTOR_ROLE = keccak256("BUYBACK_EXECUTOR_ROLE");
IERC20 public immutable token;
address public strategy;
bool public strategySet;
address public immutable strategySetter;
address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;
address public router;
PoolKey public poolKey;
bool public poolKeySet;
uint256 public totalETHUsed;
uint256 public totalTokenBurned;
event PoolKeySet();
event RouterUpdated(address indexed newRouter);
event BuybackExecuted(uint256 ethUsed, uint256 tokensBurned, uint256 totalETHUsed, uint256 totalTokenBurned);
error InvalidAddress();
error PoolKeyAlreadySet();
error PoolKeyNotSet();
error InvalidPercentage();
error InsufficientBalance();
error SwapFailed();
constructor(address admin, address _token, address _router, address _strategySetter) {
if (admin == address(0) || _token == address(0) || _router == address(0)) {
revert InvalidAddress();
}
token = IERC20(_token);
router = _router;
strategySetter = _strategySetter;
_grantRole(DEFAULT_ADMIN_ROLE, admin);
_grantRole(BUYBACK_EXECUTOR_ROLE, admin);
}
function setStrategy(address newStrategy) external {
if (msg.sender != strategySetter) revert InvalidAddress();
if (newStrategy == address(0)) revert InvalidAddress();
if (strategySet) revert InvalidAddress();
strategy = newStrategy;
strategySet = true;
}
function setPoolKey(PoolKey calldata key) external {
if (msg.sender != strategy) revert InvalidAddress();
if (poolKeySet) revert PoolKeyAlreadySet();
poolKey = key;
poolKeySet = true;
emit PoolKeySet();
}
function setRouter(address newRouter) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (newRouter == address(0)) revert InvalidAddress();
router = newRouter;
emit RouterUpdated(newRouter);
}
function executeBuyback(uint24 percentageToUse, uint256 amountOutMin) external onlyRole(BUYBACK_EXECUTOR_ROLE) {
if (!poolKeySet) revert PoolKeyNotSet();
if (percentageToUse == 0 || percentageToUse > 10000) revert InvalidPercentage();
uint256 contractBalance = address(this).balance;
if (contractBalance == 0) revert InsufficientBalance();
uint256 ethToUse = (contractBalance * percentageToUse) / 10000;
if (ethToUse == 0) revert InsufficientBalance();
try IUnilaunchSwapRouter(router).swapExactTokensForTokens{value: ethToUse}(
ethToUse,
amountOutMin,
true,
poolKey,
"",
address(this),
block.timestamp + 1000
) {
uint256 tokenBalance = token.balanceOf(address(this));
if (tokenBalance == 0) revert SwapFailed();
token.safeTransfer(BURN_ADDRESS, tokenBalance);
totalETHUsed += ethToUse;
totalTokenBurned += tokenBalance;
emit BuybackExecuted(ethToUse, tokenBalance, totalETHUsed, totalTokenBurned);
} catch {
revert SwapFailed();
}
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Currency} from "./Currency.sol";
import {IHooks} from "../interfaces/IHooks.sol";
import {PoolIdLibrary} from "./PoolId.sol";
using PoolIdLibrary for PoolKey global;
/// @notice Returns the key for identifying a pool
struct PoolKey {
/// @notice The lower currency of the pool, sorted numerically
Currency currency0;
/// @notice The higher currency of the pool, sorted numerically
Currency currency1;
/// @notice The pool LP fee, capped at 1_000_000. If the highest bit is 1, the pool has a dynamic fee and must be exactly equal to 0x800000
uint24 fee;
/// @notice Ticks that involve positions must be a multiple of tick spacing
int24 tickSpacing;
/// @notice The hooks of the pool
IHooks hooks;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {SafeCast} from "../libraries/SafeCast.sol";
/// @dev Two `int128` values packed into a single `int256` where the upper 128 bits represent the amount0
/// and the lower 128 bits represent the amount1.
type BalanceDelta is int256;
using {add as +, sub as -, eq as ==, neq as !=} for BalanceDelta global;
using BalanceDeltaLibrary for BalanceDelta global;
using SafeCast for int256;
function toBalanceDelta(int128 _amount0, int128 _amount1) pure returns (BalanceDelta balanceDelta) {
assembly ("memory-safe") {
balanceDelta := or(shl(128, _amount0), and(sub(shl(128, 1), 1), _amount1))
}
}
function add(BalanceDelta a, BalanceDelta b) pure returns (BalanceDelta) {
int256 res0;
int256 res1;
assembly ("memory-safe") {
let a0 := sar(128, a)
let a1 := signextend(15, a)
let b0 := sar(128, b)
let b1 := signextend(15, b)
res0 := add(a0, b0)
res1 := add(a1, b1)
}
return toBalanceDelta(res0.toInt128(), res1.toInt128());
}
function sub(BalanceDelta a, BalanceDelta b) pure returns (BalanceDelta) {
int256 res0;
int256 res1;
assembly ("memory-safe") {
let a0 := sar(128, a)
let a1 := signextend(15, a)
let b0 := sar(128, b)
let b1 := signextend(15, b)
res0 := sub(a0, b0)
res1 := sub(a1, b1)
}
return toBalanceDelta(res0.toInt128(), res1.toInt128());
}
function eq(BalanceDelta a, BalanceDelta b) pure returns (bool) {
return BalanceDelta.unwrap(a) == BalanceDelta.unwrap(b);
}
function neq(BalanceDelta a, BalanceDelta b) pure returns (bool) {
return BalanceDelta.unwrap(a) != BalanceDelta.unwrap(b);
}
/// @notice Library for getting the amount0 and amount1 deltas from the BalanceDelta type
library BalanceDeltaLibrary {
/// @notice A BalanceDelta of 0
BalanceDelta public constant ZERO_DELTA = BalanceDelta.wrap(0);
function amount0(BalanceDelta balanceDelta) internal pure returns (int128 _amount0) {
assembly ("memory-safe") {
_amount0 := sar(128, balanceDelta)
}
}
function amount1(BalanceDelta balanceDelta) internal pure returns (int128 _amount1) {
assembly ("memory-safe") {
_amount1 := signextend(15, balanceDelta)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20Minimal} from "../interfaces/external/IERC20Minimal.sol";
import {CustomRevert} from "../libraries/CustomRevert.sol";
type Currency is address;
using {greaterThan as >, lessThan as <, greaterThanOrEqualTo as >=, equals as ==} for Currency global;
using CurrencyLibrary for Currency global;
function equals(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) == Currency.unwrap(other);
}
function greaterThan(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) > Currency.unwrap(other);
}
function lessThan(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) < Currency.unwrap(other);
}
function greaterThanOrEqualTo(Currency currency, Currency other) pure returns (bool) {
return Currency.unwrap(currency) >= Currency.unwrap(other);
}
/// @title CurrencyLibrary
/// @dev This library allows for transferring and holding native tokens and ERC20 tokens
library CurrencyLibrary {
/// @notice Additional context for ERC-7751 wrapped error when a native transfer fails
error NativeTransferFailed();
/// @notice Additional context for ERC-7751 wrapped error when an ERC20 transfer fails
error ERC20TransferFailed();
/// @notice A constant to represent the native currency
Currency public constant ADDRESS_ZERO = Currency.wrap(address(0));
function transfer(Currency currency, address to, uint256 amount) internal {
// altered from https://github.com/transmissions11/solmate/blob/44a9963d4c78111f77caa0e65d677b8b46d6f2e6/src/utils/SafeTransferLib.sol
// modified custom error selectors
bool success;
if (currency.isAddressZero()) {
assembly ("memory-safe") {
// Transfer the ETH and revert if it fails.
success := call(gas(), to, amount, 0, 0, 0, 0)
}
// revert with NativeTransferFailed, containing the bubbled up error as an argument
if (!success) {
CustomRevert.bubbleUpAndRevertWith(to, bytes4(0), NativeTransferFailed.selector);
}
} else {
assembly ("memory-safe") {
// Get a pointer to some free memory.
let fmp := mload(0x40)
// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(fmp, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
mstore(add(fmp, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
mstore(add(fmp, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.
success :=
and(
// Set success to whether the call reverted, if not we check it either
// returned exactly 1 (can't just be non-zero data), or had no return data.
or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
// We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
// We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
// Counterintuitively, this call must be positioned second to the or() call in the
// surrounding and() call or else returndatasize() will be zero during the computation.
call(gas(), currency, 0, fmp, 68, 0, 32)
)
// Now clean the memory we used
mstore(fmp, 0) // 4 byte `selector` and 28 bytes of `to` were stored here
mstore(add(fmp, 0x20), 0) // 4 bytes of `to` and 28 bytes of `amount` were stored here
mstore(add(fmp, 0x40), 0) // 4 bytes of `amount` were stored here
}
// revert with ERC20TransferFailed, containing the bubbled up error as an argument
if (!success) {
CustomRevert.bubbleUpAndRevertWith(
Currency.unwrap(currency), IERC20Minimal.transfer.selector, ERC20TransferFailed.selector
);
}
}
}
function balanceOfSelf(Currency currency) internal view returns (uint256) {
if (currency.isAddressZero()) {
return address(this).balance;
} else {
return IERC20Minimal(Currency.unwrap(currency)).balanceOf(address(this));
}
}
function balanceOf(Currency currency, address owner) internal view returns (uint256) {
if (currency.isAddressZero()) {
return owner.balance;
} else {
return IERC20Minimal(Currency.unwrap(currency)).balanceOf(owner);
}
}
function isAddressZero(Currency currency) internal pure returns (bool) {
return Currency.unwrap(currency) == Currency.unwrap(ADDRESS_ZERO);
}
function toId(Currency currency) internal pure returns (uint256) {
return uint160(Currency.unwrap(currency));
}
// If the upper 12 bytes are non-zero, they will be zero-ed out
// Therefore, fromId() and toId() are not inverses of each other
function fromId(uint256 id) internal pure returns (Currency) {
return Currency.wrap(address(uint160(id)));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "../types/PoolKey.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
import {ModifyLiquidityParams, SwapParams} from "../types/PoolOperation.sol";
import {BeforeSwapDelta} from "../types/BeforeSwapDelta.sol";
/// @notice V4 decides whether to invoke specific hooks by inspecting the least significant bits
/// of the address that the hooks contract is deployed to.
/// For example, a hooks contract deployed to address: 0x0000000000000000000000000000000000002400
/// has the lowest bits '10 0100 0000 0000' which would cause the 'before initialize' and 'after add liquidity' hooks to be used.
/// See the Hooks library for the full spec.
/// @dev Should only be callable by the v4 PoolManager.
interface IHooks {
/// @notice The hook called before the state of a pool is initialized
/// @param sender The initial msg.sender for the initialize call
/// @param key The key for the pool being initialized
/// @param sqrtPriceX96 The sqrt(price) of the pool as a Q64.96
/// @return bytes4 The function selector for the hook
function beforeInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96) external returns (bytes4);
/// @notice The hook called after the state of a pool is initialized
/// @param sender The initial msg.sender for the initialize call
/// @param key The key for the pool being initialized
/// @param sqrtPriceX96 The sqrt(price) of the pool as a Q64.96
/// @param tick The current tick after the state of a pool is initialized
/// @return bytes4 The function selector for the hook
function afterInitialize(address sender, PoolKey calldata key, uint160 sqrtPriceX96, int24 tick)
external
returns (bytes4);
/// @notice The hook called before liquidity is added
/// @param sender The initial msg.sender for the add liquidity call
/// @param key The key for the pool
/// @param params The parameters for adding liquidity
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeAddLiquidity(
address sender,
PoolKey calldata key,
ModifyLiquidityParams calldata params,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after liquidity is added
/// @param sender The initial msg.sender for the add liquidity call
/// @param key The key for the pool
/// @param params The parameters for adding liquidity
/// @param delta The caller's balance delta after adding liquidity; the sum of principal delta, fees accrued, and hook delta
/// @param feesAccrued The fees accrued since the last time fees were collected from this position
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterAddLiquidity(
address sender,
PoolKey calldata key,
ModifyLiquidityParams calldata params,
BalanceDelta delta,
BalanceDelta feesAccrued,
bytes calldata hookData
) external returns (bytes4, BalanceDelta);
/// @notice The hook called before liquidity is removed
/// @param sender The initial msg.sender for the remove liquidity call
/// @param key The key for the pool
/// @param params The parameters for removing liquidity
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeRemoveLiquidity(
address sender,
PoolKey calldata key,
ModifyLiquidityParams calldata params,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after liquidity is removed
/// @param sender The initial msg.sender for the remove liquidity call
/// @param key The key for the pool
/// @param params The parameters for removing liquidity
/// @param delta The caller's balance delta after removing liquidity; the sum of principal delta, fees accrued, and hook delta
/// @param feesAccrued The fees accrued since the last time fees were collected from this position
/// @param hookData Arbitrary data handed into the PoolManager by the liquidity provider to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BalanceDelta The hook's delta in token0 and token1. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterRemoveLiquidity(
address sender,
PoolKey calldata key,
ModifyLiquidityParams calldata params,
BalanceDelta delta,
BalanceDelta feesAccrued,
bytes calldata hookData
) external returns (bytes4, BalanceDelta);
/// @notice The hook called before a swap
/// @param sender The initial msg.sender for the swap call
/// @param key The key for the pool
/// @param params The parameters for the swap
/// @param hookData Arbitrary data handed into the PoolManager by the swapper to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return BeforeSwapDelta The hook's delta in specified and unspecified currencies. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
/// @return uint24 Optionally override the lp fee, only used if three conditions are met: 1. the Pool has a dynamic fee, 2. the value's 2nd highest bit is set (23rd bit, 0x400000), and 3. the value is less than or equal to the maximum fee (1 million)
function beforeSwap(address sender, PoolKey calldata key, SwapParams calldata params, bytes calldata hookData)
external
returns (bytes4, BeforeSwapDelta, uint24);
/// @notice The hook called after a swap
/// @param sender The initial msg.sender for the swap call
/// @param key The key for the pool
/// @param params The parameters for the swap
/// @param delta The amount owed to the caller (positive) or owed to the pool (negative)
/// @param hookData Arbitrary data handed into the PoolManager by the swapper to be be passed on to the hook
/// @return bytes4 The function selector for the hook
/// @return int128 The hook's delta in unspecified currency. Positive: the hook is owed/took currency, negative: the hook owes/sent currency
function afterSwap(
address sender,
PoolKey calldata key,
SwapParams calldata params,
BalanceDelta delta,
bytes calldata hookData
) external returns (bytes4, int128);
/// @notice The hook called before donate
/// @param sender The initial msg.sender for the donate call
/// @param key The key for the pool
/// @param amount0 The amount of token0 being donated
/// @param amount1 The amount of token1 being donated
/// @param hookData Arbitrary data handed into the PoolManager by the donor to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function beforeDonate(
address sender,
PoolKey calldata key,
uint256 amount0,
uint256 amount1,
bytes calldata hookData
) external returns (bytes4);
/// @notice The hook called after donate
/// @param sender The initial msg.sender for the donate call
/// @param key The key for the pool
/// @param amount0 The amount of token0 being donated
/// @param amount1 The amount of token1 being donated
/// @param hookData Arbitrary data handed into the PoolManager by the donor to be be passed on to the hook
/// @return bytes4 The function selector for the hook
function afterDonate(
address sender,
PoolKey calldata key,
uint256 amount0,
uint256 amount1,
bytes calldata hookData
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "./PoolKey.sol";
type PoolId is bytes32;
/// @notice Library for computing the ID of a pool
library PoolIdLibrary {
/// @notice Returns value equal to keccak256(abi.encode(poolKey))
function toId(PoolKey memory poolKey) internal pure returns (PoolId poolId) {
assembly ("memory-safe") {
// 0xa0 represents the total size of the poolKey struct (5 slots of 32 bytes)
poolId := keccak256(poolKey, 0xa0)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {CustomRevert} from "./CustomRevert.sol";
/// @title Safe casting methods
/// @notice Contains methods for safely casting between types
library SafeCast {
using CustomRevert for bytes4;
error SafeCastOverflow();
/// @notice Cast a uint256 to a uint160, revert on overflow
/// @param x The uint256 to be downcasted
/// @return y The downcasted integer, now type uint160
function toUint160(uint256 x) internal pure returns (uint160 y) {
y = uint160(x);
if (y != x) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a uint128, revert on overflow
/// @param x The uint256 to be downcasted
/// @return y The downcasted integer, now type uint128
function toUint128(uint256 x) internal pure returns (uint128 y) {
y = uint128(x);
if (x != y) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a int128 to a uint128, revert on overflow or underflow
/// @param x The int128 to be casted
/// @return y The casted integer, now type uint128
function toUint128(int128 x) internal pure returns (uint128 y) {
if (x < 0) SafeCastOverflow.selector.revertWith();
y = uint128(x);
}
/// @notice Cast a int256 to a int128, revert on overflow or underflow
/// @param x The int256 to be downcasted
/// @return y The downcasted integer, now type int128
function toInt128(int256 x) internal pure returns (int128 y) {
y = int128(x);
if (y != x) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a int256, revert on overflow
/// @param x The uint256 to be casted
/// @return y The casted integer, now type int256
function toInt256(uint256 x) internal pure returns (int256 y) {
y = int256(x);
if (y < 0) SafeCastOverflow.selector.revertWith();
}
/// @notice Cast a uint256 to a int128, revert on overflow
/// @param x The uint256 to be downcasted
/// @return The downcasted integer, now type int128
function toInt128(uint256 x) internal pure returns (int128) {
if (x >= 1 << 127) SafeCastOverflow.selector.revertWith();
return int128(int256(x));
}
}// 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) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Minimal ERC20 interface for Uniswap
/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3
interface IERC20Minimal {
/// @notice Returns an account's balance in the token
/// @param account The account for which to look up the number of tokens it has, i.e. its balance
/// @return The number of tokens held by the account
function balanceOf(address account) external view returns (uint256);
/// @notice Transfers the amount of token from the `msg.sender` to the recipient
/// @param recipient The account that will receive the amount transferred
/// @param amount The number of tokens to send from the sender to the recipient
/// @return Returns true for a successful transfer, false for an unsuccessful transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/// @notice Returns the current allowance given to a spender by an owner
/// @param owner The account of the token owner
/// @param spender The account of the token spender
/// @return The current allowance granted by `owner` to `spender`
function allowance(address owner, address spender) external view returns (uint256);
/// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`
/// @param spender The account which will be allowed to spend a given amount of the owners tokens
/// @param amount The amount of tokens allowed to be used by `spender`
/// @return Returns true for a successful approval, false for unsuccessful
function approve(address spender, uint256 amount) external returns (bool);
/// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`
/// @param sender The account from which the transfer will be initiated
/// @param recipient The recipient of the transfer
/// @param amount The amount of the transfer
/// @return Returns true for a successful transfer, false for unsuccessful
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.
/// @param from The account from which the tokens were sent, i.e. the balance decreased
/// @param to The account to which the tokens were sent, i.e. the balance increased
/// @param value The amount of tokens that were transferred
event Transfer(address indexed from, address indexed to, uint256 value);
/// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.
/// @param owner The account that approved spending of its tokens
/// @param spender The account for which the spending allowance was modified
/// @param value The new allowance from the owner to the spender
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Library for reverting with custom errors efficiently
/// @notice Contains functions for reverting with custom errors with different argument types efficiently
/// @dev To use this library, declare `using CustomRevert for bytes4;` and replace `revert CustomError()` with
/// `CustomError.selector.revertWith()`
/// @dev The functions may tamper with the free memory pointer but it is fine since the call context is exited immediately
library CustomRevert {
/// @dev ERC-7751 error for wrapping bubbled up reverts
error WrappedError(address target, bytes4 selector, bytes reason, bytes details);
/// @dev Reverts with the selector of a custom error in the scratch space
function revertWith(bytes4 selector) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
revert(0, 0x04)
}
}
/// @dev Reverts with a custom error with an address argument in the scratch space
function revertWith(bytes4 selector, address addr) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, and(addr, 0xffffffffffffffffffffffffffffffffffffffff))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with an int24 argument in the scratch space
function revertWith(bytes4 selector, int24 value) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, signextend(2, value))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with a uint160 argument in the scratch space
function revertWith(bytes4 selector, uint160 value) internal pure {
assembly ("memory-safe") {
mstore(0, selector)
mstore(0x04, and(value, 0xffffffffffffffffffffffffffffffffffffffff))
revert(0, 0x24)
}
}
/// @dev Reverts with a custom error with two int24 arguments
function revertWith(bytes4 selector, int24 value1, int24 value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), signextend(2, value1))
mstore(add(fmp, 0x24), signextend(2, value2))
revert(fmp, 0x44)
}
}
/// @dev Reverts with a custom error with two uint160 arguments
function revertWith(bytes4 selector, uint160 value1, uint160 value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), and(value1, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(fmp, 0x24), and(value2, 0xffffffffffffffffffffffffffffffffffffffff))
revert(fmp, 0x44)
}
}
/// @dev Reverts with a custom error with two address arguments
function revertWith(bytes4 selector, address value1, address value2) internal pure {
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(fmp, selector)
mstore(add(fmp, 0x04), and(value1, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(fmp, 0x24), and(value2, 0xffffffffffffffffffffffffffffffffffffffff))
revert(fmp, 0x44)
}
}
/// @notice bubble up the revert message returned by a call and revert with a wrapped ERC-7751 error
/// @dev this method can be vulnerable to revert data bombs
function bubbleUpAndRevertWith(
address revertingContract,
bytes4 revertingFunctionSelector,
bytes4 additionalContext
) internal pure {
bytes4 wrappedErrorSelector = WrappedError.selector;
assembly ("memory-safe") {
// Ensure the size of the revert data is a multiple of 32 bytes
let encodedDataSize := mul(div(add(returndatasize(), 31), 32), 32)
let fmp := mload(0x40)
// Encode wrapped error selector, address, function selector, offset, additional context, size, revert reason
mstore(fmp, wrappedErrorSelector)
mstore(add(fmp, 0x04), and(revertingContract, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(
add(fmp, 0x24),
and(revertingFunctionSelector, 0xffffffff00000000000000000000000000000000000000000000000000000000)
)
// offset revert reason
mstore(add(fmp, 0x44), 0x80)
// offset additional context
mstore(add(fmp, 0x64), add(0xa0, encodedDataSize))
// size revert reason
mstore(add(fmp, 0x84), returndatasize())
// revert reason
returndatacopy(add(fmp, 0xa4), 0, returndatasize())
// size additional context
mstore(add(fmp, add(0xa4, encodedDataSize)), 0x04)
// additional context
mstore(
add(fmp, add(0xc4, encodedDataSize)),
and(additionalContext, 0xffffffff00000000000000000000000000000000000000000000000000000000)
)
revert(fmp, add(0xe4, encodedDataSize))
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {PoolKey} from "../types/PoolKey.sol";
import {BalanceDelta} from "../types/BalanceDelta.sol";
/// @notice Parameter struct for `ModifyLiquidity` pool operations
struct ModifyLiquidityParams {
// the lower and upper tick of the position
int24 tickLower;
int24 tickUpper;
// how to modify the liquidity
int256 liquidityDelta;
// a value to set if you want unique liquidity positions at the same range
bytes32 salt;
}
/// @notice Parameter struct for `Swap` pool operations
struct SwapParams {
/// Whether to swap token0 for token1 or vice versa
bool zeroForOne;
/// The desired input amount if negative (exactIn), or the desired output amount if positive (exactOut)
int256 amountSpecified;
/// The sqrt price at which, if reached, the swap will stop executing
uint160 sqrtPriceLimitX96;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Return type of the beforeSwap hook.
// Upper 128 bits is the delta in specified tokens. Lower 128 bits is delta in unspecified tokens (to match the afterSwap hook)
type BeforeSwapDelta is int256;
// Creates a BeforeSwapDelta from specified and unspecified
function toBeforeSwapDelta(int128 deltaSpecified, int128 deltaUnspecified)
pure
returns (BeforeSwapDelta beforeSwapDelta)
{
assembly ("memory-safe") {
beforeSwapDelta := or(shl(128, deltaSpecified), and(sub(shl(128, 1), 1), deltaUnspecified))
}
}
/// @notice Library for getting the specified and unspecified deltas from the BeforeSwapDelta type
library BeforeSwapDeltaLibrary {
/// @notice A BeforeSwapDelta of 0
BeforeSwapDelta public constant ZERO_DELTA = BeforeSwapDelta.wrap(0);
/// extracts int128 from the upper 128 bits of the BeforeSwapDelta
/// returned by beforeSwap
function getSpecifiedDelta(BeforeSwapDelta delta) internal pure returns (int128 deltaSpecified) {
assembly ("memory-safe") {
deltaSpecified := sar(128, delta)
}
}
/// extracts int128 from the lower 128 bits of the BeforeSwapDelta
/// returned by beforeSwap and afterSwap
function getUnspecifiedDelta(BeforeSwapDelta delta) internal pure returns (int128 deltaUnspecified) {
assembly ("memory-safe") {
deltaUnspecified := signextend(15, delta)
}
}
}{
"remappings": [
"@ensdomains/=lib/v4-periphery/lib/v4-core/node_modules/@ensdomains/",
"@openzeppelin/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
"@openzeppelin/contracts/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/contracts/",
"@uniswap/v4-core/=lib/v4-periphery/lib/v4-core/",
"ds-test/=lib/v4-periphery/lib/v4-core/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=lib/v4-periphery/lib/forge-gas-snapshot/src/",
"forge-std/=lib/forge-std/src/",
"hardhat/=lib/v4-periphery/lib/v4-core/node_modules/hardhat/",
"openzeppelin-contracts/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
"permit2/=lib/v4-periphery/lib/permit2/",
"solmate/=lib/v4-periphery/lib/v4-core/lib/solmate/",
"v4-core/=lib/v4-periphery/lib/v4-core/src/",
"v4-periphery/=lib/v4-periphery/",
"scripts/=lib/liquidity-launcher/lib/optimism/packages/contracts-bedrock/scripts/",
"@openzeppelin-latest/=lib/liquidity-launcher/lib/openzeppelin-contracts/",
"@optimism/=lib/liquidity-launcher/lib/optimism/packages/contracts-bedrock/",
"@solady/=lib/liquidity-launcher/lib/solady/",
"@uniswap/v4-periphery/=lib/liquidity-launcher/lib/v4-periphery/",
"btt/=lib/liquidity-launcher/lib/continuous-clearing-auction/test/btt/",
"continuous-clearing-auction/=lib/liquidity-launcher/lib/continuous-clearing-auction/",
"halmos-cheatcodes/=lib/liquidity-launcher/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"kontrol-cheatcodes/=lib/liquidity-launcher/lib/optimism/packages/contracts-bedrock/lib/kontrol-cheatcodes/src/",
"lib-keccak/=lib/liquidity-launcher/lib/optimism/packages/contracts-bedrock/lib/lib-keccak/contracts/",
"liquidity-launcher/=lib/liquidity-launcher/",
"merkle-distributor/=lib/liquidity-launcher/lib/merkle-distributor/",
"openzeppelin-contracts-4.7/=lib/liquidity-launcher/lib/openzeppelin-contracts-4.7/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts-v5/=lib/liquidity-launcher/lib/optimism/packages/contracts-bedrock/lib/openzeppelin-contracts-v5/",
"openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
"optimism/=lib/liquidity-launcher/lib/optimism/",
"safe-contracts/=lib/liquidity-launcher/lib/optimism/packages/contracts-bedrock/lib/safe-contracts/contracts/",
"solady-v0.0.245/=lib/liquidity-launcher/lib/optimism/packages/contracts-bedrock/lib/solady-v0.0.245/src/",
"solady/=lib/liquidity-launcher/lib/solady/src/",
"test/=lib/liquidity-launcher/lib/continuous-clearing-auction/test/"
],
"optimizer": {
"enabled": true,
"runs": 800
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"UnauthorizedCaller","type":"error"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"authorizedFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"buybackRouter","type":"address"}],"name":"deploy","outputs":[{"internalType":"address","name":"buyback","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"factory","type":"address"}],"name":"setAuthorizedFactory","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a0604052348015600e575f80fd5b50604051611784380380611784833981016040819052602b916061565b6001600160a01b038116605157604051635c427cd960e01b815260040160405180910390fd5b6001600160a01b0316608052608c565b5f602082840312156070575f80fd5b81516001600160a01b03811681146085575f80fd5b9392505050565b6080516116db6100a95f395f818160a9015260d601526116db5ff3fe608060405234801561000f575f80fd5b506004361061004a575f3560e01c80630852f9f31461004e5780632625dbae1461007c578063d9181cd314610091578063f851a440146100a4575b5f80fd5b5f54610060906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61008f61008a366004610231565b6100cb565b005b61006061009f366004610251565b610176565b6100607f000000000000000000000000000000000000000000000000000000000000000081565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461011457604051635c427cd960e01b815260040160405180910390fd5b5f546001600160a01b03161561013d57604051635c427cd960e01b815260040160405180910390fd5b5f80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b5f80546001600160a01b031633146101a157604051635c427cd960e01b815260040160405180910390fd5b5f546040518591859185916001600160a01b0316906101bf90610209565b6001600160a01b039485168152928416602084015290831660408301529091166060820152608001604051809103905ff080158015610200573d5f803e3d5ffd5b50949350505050565b6114148061029283390190565b80356001600160a01b038116811461022c575f80fd5b919050565b5f60208284031215610241575f80fd5b61024a82610216565b9392505050565b5f805f60608486031215610263575f80fd5b61026c84610216565b925061027a60208501610216565b915061028860408501610216565b9050925092509256fe60c060405234801561000f575f80fd5b5060405161141438038061141483398101604081905261002e916101a5565b6001600160a01b038416158061004b57506001600160a01b038316155b8061005d57506001600160a01b038216155b1561007b5760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03838116608052600280546001600160a01b031916848316179055811660a0526100ac5f856100e1565b506100d77f2428c18a3329b64725bb2335478a6d7d04d4165bd1ef6929879fae9b7ae51e70856100e1565b50505050506101f6565b5f828152602081815260408083206001600160a01b038516845290915281205460ff16610181575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556101393390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610184565b505f5b92915050565b80516001600160a01b03811681146101a0575f80fd5b919050565b5f805f80608085870312156101b8575f80fd5b6101c18561018a565b93506101cf6020860161018a565b92506101dd6040860161018a565b91506101eb6060860161018a565b905092959194509250565b60805160a0516111e861022c5f395f81816101c0015261058701525f81816104e50152818161082801526108c801526111e85ff3fe608060405260043610610170575f3560e01c806391d14854116100c6578063d547741f1161007c578063f887ea4011610057578063f887ea40146104b5578063fc0c546a146104d4578063fccc281314610507575f80fd5b8063d547741f14610444578063db684c0b14610463578063f0ec98d714610496575f80fd5b8063a8c62e76116100ac578063a8c62e76146103ed578063ab0abb4a1461040c578063c0d7865514610425575f80fd5b806391d1485414610398578063a217fddf146103da575f80fd5b80632f2ff15d1161012657806354d25faf1161010157806354d25faf1461034457806375dbec12146103595780637ee383be14610378575f80fd5b80632f2ff15d146102e557806333a100ca1461030657806336568abe14610325575f80fd5b8063182148ef11610156578063182148ef146101fa5780632221466c14610294578063248a9ca3146102b7575f80fd5b806301ffc9a71461017b57806313074d76146101af575f80fd5b3661017757005b5f80fd5b348015610186575f80fd5b5061019a610195366004610e33565b61051c565b60405190151581526020015b60405180910390f35b3480156101ba575f80fd5b506101e27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101a6565b348015610205575f80fd5b50600354600454600554610254926001600160a01b03908116928082169262ffffff600160a01b830416927701000000000000000000000000000000000000000000000090920460020b911685565b604080516001600160a01b039687168152948616602086015262ffffff9093169284019290925260020b606083015291909116608082015260a0016101a6565b34801561029f575f80fd5b506102a960085481565b6040519081526020016101a6565b3480156102c2575f80fd5b506102a96102d1366004610e5a565b5f9081526020819052604090206001015490565b3480156102f0575f80fd5b506103046102ff366004610e85565b610552565b005b348015610311575f80fd5b50610304610320366004610eb3565b61057c565b348015610330575f80fd5b5061030461033f366004610e85565b610656565b34801561034f575f80fd5b506102a960075481565b348015610364575f80fd5b50610304610373366004610ede565b61068e565b348015610383575f80fd5b5060015461019a90600160a01b900460ff1681565b3480156103a3575f80fd5b5061019a6103b2366004610e85565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156103e5575f80fd5b506102a95f81565b3480156103f8575f80fd5b506001546101e2906001600160a01b031681565b348015610417575f80fd5b5060065461019a9060ff1681565b348015610430575f80fd5b5061030461043f366004610eb3565b610974565b34801561044f575f80fd5b5061030461045e366004610e85565b6109ef565b34801561046e575f80fd5b506102a97f2428c18a3329b64725bb2335478a6d7d04d4165bd1ef6929879fae9b7ae51e7081565b3480156104a1575f80fd5b506103046104b0366004610f08565b610a13565b3480156104c0575f80fd5b506002546101e2906001600160a01b031681565b3480156104df575f80fd5b506101e27f000000000000000000000000000000000000000000000000000000000000000081565b348015610512575f80fd5b506101e261dead81565b5f6001600160e01b03198216637965db0b60e01b148061054c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f8281526020819052604090206001015461056c81610aa9565b6105768383610ab6565b50505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105c55760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b0381166105ec5760405163e6c4247b60e01b815260040160405180910390fd5b600154600160a01b900460ff16156106175760405163e6c4247b60e01b815260040160405180910390fd5b600180547fffffffffffffffffffffff000000000000000000000000000000000000000000166001600160a01b0390921691909117600160a01b179055565b6001600160a01b038116331461067f5760405163334bd91960e11b815260040160405180910390fd5b6106898282610b5d565b505050565b7f2428c18a3329b64725bb2335478a6d7d04d4165bd1ef6929879fae9b7ae51e706106b881610aa9565b60065460ff166106db57604051633382f3a560e01b815260040160405180910390fd5b62ffffff831615806106f357506127108362ffffff16115b1561071157604051631f3b85d360e01b815260040160405180910390fd5b475f81900361073357604051631e9acf1760e31b815260040160405180910390fd5b5f61271061074662ffffff871684610f35565b6107509190610f4c565b9050805f0361077257604051631e9acf1760e31b815260040160405180910390fd5b6002546001600160a01b031663b1a0d5718280876001600330610797426103e8610f6b565b6040518863ffffffff1660e01b81526004016107b896959493929190610f7e565b60206040518083038185885af1935050505080156107f3575060408051601f3d908101601f191682019092526107f091810190611026565b60015b6108105760405163081ceff360e41b815260040160405180910390fd5b506040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610875573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108999190611026565b9050805f036108bb5760405163081ceff360e41b815260040160405180910390fd5b6108f16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661dead83610bde565b8160075f8282546109029190610f6b565b925050819055508060085f82825461091a9190610f6b565b909155505060075460085460408051858152602081018590529081019290925260608201527f42659a4aa613c1e350c764f0ff2be36a175ac2a1e4b77b8e1467d1fed32becc89060800160405180910390a1505050505050565b5f61097e81610aa9565b6001600160a01b0382166109a55760405163e6c4247b60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0384169081179091556040517f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc80905f90a25050565b5f82815260208190526040902060010154610a0981610aa9565b6105768383610b5d565b6001546001600160a01b03163314610a3e5760405163e6c4247b60e01b815260040160405180910390fd5b60065460ff1615610a6257604051635a4ef2d360e01b815260040160405180910390fd5b806003610a6f8282611049565b50506006805460ff191660011790556040517f124339d9fade6161abb9b8aa74ff4ab3c07a643fdaa2eac599ec96985268f47b905f90a150565b610ab38133610c45565b50565b5f828152602081815260408083206001600160a01b038516845290915281205460ff16610b56575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055610b0e3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161054c565b505f61054c565b5f828152602081815260408083206001600160a01b038516845290915281205460ff1615610b56575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161054c565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052610689908490610ca0565b5f828152602081815260408083206001600160a01b038516845290915290205460ff16610c9c5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044015b60405180910390fd5b5050565b5f610cb46001600160a01b03841683610d01565b905080515f14158015610cd8575080806020019051810190610cd6919061117d565b155b1561068957604051635274afe760e01b81526001600160a01b0384166004820152602401610c93565b6060610d0e83835f610d15565b9392505050565b606081471015610d3a5760405163cd78605960e01b8152306004820152602401610c93565b5f80856001600160a01b03168486604051610d55919061119c565b5f6040518083038185875af1925050503d805f8114610d8f576040519150601f19603f3d011682016040523d82523d5f602084013e610d94565b606091505b5091509150610da4868383610dae565b9695505050505050565b606082610dc357610dbe82610e0a565b610d0e565b8151158015610dda57506001600160a01b0384163b155b15610e0357604051639996b31560e01b81526001600160a01b0385166004820152602401610c93565b5080610d0e565b805115610e1a5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f60208284031215610e43575f80fd5b81356001600160e01b031981168114610d0e575f80fd5b5f60208284031215610e6a575f80fd5b5035919050565b6001600160a01b0381168114610ab3575f80fd5b5f8060408385031215610e96575f80fd5b823591506020830135610ea881610e71565b809150509250929050565b5f60208284031215610ec3575f80fd5b8135610d0e81610e71565b62ffffff81168114610ab3575f80fd5b5f8060408385031215610eef575f80fd5b8235610efa81610ece565b946020939093013593505050565b5f60a0828403128015610f19575f80fd5b509092915050565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761054c5761054c610f21565b5f82610f6657634e487b7160e01b5f52601260045260245ffd5b500490565b8082018082111561054c5761054c610f21565b86815285602082015284151560408201526001600160a01b0384541660608201525f60018501546001600160a01b038116608084015262ffffff8160a01c1660a08401528060b81c60020b60c084015250610fe360028601546001600160a01b031690565b6001600160a01b031660e083015261016061010083018190525f9083015261018082016001600160a01b0394909416610120830152506101400152949350505050565b5f60208284031215611036575f80fd5b5051919050565b5f813561054c81610e71565b813561105481610e71565b81546001600160a01b0319166001600160a01b0382161782555060018101602083013561108081610e71565b81546001600160a01b0319166001600160a01b0382161782555060408301356110a881610ece565b815476ffffff00000000000000000000000000000000000000008260a01b167fffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffff8216178355505060608301358060020b8114611102575f80fd5b81548160b81b79ffffff0000000000000000000000000000000000000000000000167fffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffff8216178355505050610c9c61115c6080840161103d565b600283016001600160a01b0382166001600160a01b03198254161781555050565b5f6020828403121561118d575f80fd5b81518015158114610d0e575f80fd5b5f82518060208501845e5f92019182525091905056fea26469706673582212209302a5722ef3eb0dc62d90945a2080b2555d0f4ca9194f5df96e478e10ddc67264736f6c634300081a0033a264697066735822122084d98bfef1745646b71d2c39f5178168cd1e35d83c61cc5c7bc91c6fb9f718d864736f6c634300081a0033000000000000000000000000e911f518449ba0011d84b047b4cde50daa081ec1
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061004a575f3560e01c80630852f9f31461004e5780632625dbae1461007c578063d9181cd314610091578063f851a440146100a4575b5f80fd5b5f54610060906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61008f61008a366004610231565b6100cb565b005b61006061009f366004610251565b610176565b6100607f000000000000000000000000e911f518449ba0011d84b047b4cde50daa081ec181565b336001600160a01b037f000000000000000000000000e911f518449ba0011d84b047b4cde50daa081ec1161461011457604051635c427cd960e01b815260040160405180910390fd5b5f546001600160a01b03161561013d57604051635c427cd960e01b815260040160405180910390fd5b5f80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b5f80546001600160a01b031633146101a157604051635c427cd960e01b815260040160405180910390fd5b5f546040518591859185916001600160a01b0316906101bf90610209565b6001600160a01b039485168152928416602084015290831660408301529091166060820152608001604051809103905ff080158015610200573d5f803e3d5ffd5b50949350505050565b6114148061029283390190565b80356001600160a01b038116811461022c575f80fd5b919050565b5f60208284031215610241575f80fd5b61024a82610216565b9392505050565b5f805f60608486031215610263575f80fd5b61026c84610216565b925061027a60208501610216565b915061028860408501610216565b9050925092509256fe60c060405234801561000f575f80fd5b5060405161141438038061141483398101604081905261002e916101a5565b6001600160a01b038416158061004b57506001600160a01b038316155b8061005d57506001600160a01b038216155b1561007b5760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03838116608052600280546001600160a01b031916848316179055811660a0526100ac5f856100e1565b506100d77f2428c18a3329b64725bb2335478a6d7d04d4165bd1ef6929879fae9b7ae51e70856100e1565b50505050506101f6565b5f828152602081815260408083206001600160a01b038516845290915281205460ff16610181575f838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556101393390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610184565b505f5b92915050565b80516001600160a01b03811681146101a0575f80fd5b919050565b5f805f80608085870312156101b8575f80fd5b6101c18561018a565b93506101cf6020860161018a565b92506101dd6040860161018a565b91506101eb6060860161018a565b905092959194509250565b60805160a0516111e861022c5f395f81816101c0015261058701525f81816104e50152818161082801526108c801526111e85ff3fe608060405260043610610170575f3560e01c806391d14854116100c6578063d547741f1161007c578063f887ea4011610057578063f887ea40146104b5578063fc0c546a146104d4578063fccc281314610507575f80fd5b8063d547741f14610444578063db684c0b14610463578063f0ec98d714610496575f80fd5b8063a8c62e76116100ac578063a8c62e76146103ed578063ab0abb4a1461040c578063c0d7865514610425575f80fd5b806391d1485414610398578063a217fddf146103da575f80fd5b80632f2ff15d1161012657806354d25faf1161010157806354d25faf1461034457806375dbec12146103595780637ee383be14610378575f80fd5b80632f2ff15d146102e557806333a100ca1461030657806336568abe14610325575f80fd5b8063182148ef11610156578063182148ef146101fa5780632221466c14610294578063248a9ca3146102b7575f80fd5b806301ffc9a71461017b57806313074d76146101af575f80fd5b3661017757005b5f80fd5b348015610186575f80fd5b5061019a610195366004610e33565b61051c565b60405190151581526020015b60405180910390f35b3480156101ba575f80fd5b506101e27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101a6565b348015610205575f80fd5b50600354600454600554610254926001600160a01b03908116928082169262ffffff600160a01b830416927701000000000000000000000000000000000000000000000090920460020b911685565b604080516001600160a01b039687168152948616602086015262ffffff9093169284019290925260020b606083015291909116608082015260a0016101a6565b34801561029f575f80fd5b506102a960085481565b6040519081526020016101a6565b3480156102c2575f80fd5b506102a96102d1366004610e5a565b5f9081526020819052604090206001015490565b3480156102f0575f80fd5b506103046102ff366004610e85565b610552565b005b348015610311575f80fd5b50610304610320366004610eb3565b61057c565b348015610330575f80fd5b5061030461033f366004610e85565b610656565b34801561034f575f80fd5b506102a960075481565b348015610364575f80fd5b50610304610373366004610ede565b61068e565b348015610383575f80fd5b5060015461019a90600160a01b900460ff1681565b3480156103a3575f80fd5b5061019a6103b2366004610e85565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156103e5575f80fd5b506102a95f81565b3480156103f8575f80fd5b506001546101e2906001600160a01b031681565b348015610417575f80fd5b5060065461019a9060ff1681565b348015610430575f80fd5b5061030461043f366004610eb3565b610974565b34801561044f575f80fd5b5061030461045e366004610e85565b6109ef565b34801561046e575f80fd5b506102a97f2428c18a3329b64725bb2335478a6d7d04d4165bd1ef6929879fae9b7ae51e7081565b3480156104a1575f80fd5b506103046104b0366004610f08565b610a13565b3480156104c0575f80fd5b506002546101e2906001600160a01b031681565b3480156104df575f80fd5b506101e27f000000000000000000000000000000000000000000000000000000000000000081565b348015610512575f80fd5b506101e261dead81565b5f6001600160e01b03198216637965db0b60e01b148061054c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f8281526020819052604090206001015461056c81610aa9565b6105768383610ab6565b50505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105c55760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b0381166105ec5760405163e6c4247b60e01b815260040160405180910390fd5b600154600160a01b900460ff16156106175760405163e6c4247b60e01b815260040160405180910390fd5b600180547fffffffffffffffffffffff000000000000000000000000000000000000000000166001600160a01b0390921691909117600160a01b179055565b6001600160a01b038116331461067f5760405163334bd91960e11b815260040160405180910390fd5b6106898282610b5d565b505050565b7f2428c18a3329b64725bb2335478a6d7d04d4165bd1ef6929879fae9b7ae51e706106b881610aa9565b60065460ff166106db57604051633382f3a560e01b815260040160405180910390fd5b62ffffff831615806106f357506127108362ffffff16115b1561071157604051631f3b85d360e01b815260040160405180910390fd5b475f81900361073357604051631e9acf1760e31b815260040160405180910390fd5b5f61271061074662ffffff871684610f35565b6107509190610f4c565b9050805f0361077257604051631e9acf1760e31b815260040160405180910390fd5b6002546001600160a01b031663b1a0d5718280876001600330610797426103e8610f6b565b6040518863ffffffff1660e01b81526004016107b896959493929190610f7e565b60206040518083038185885af1935050505080156107f3575060408051601f3d908101601f191682019092526107f091810190611026565b60015b6108105760405163081ceff360e41b815260040160405180910390fd5b506040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610875573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108999190611026565b9050805f036108bb5760405163081ceff360e41b815260040160405180910390fd5b6108f16001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661dead83610bde565b8160075f8282546109029190610f6b565b925050819055508060085f82825461091a9190610f6b565b909155505060075460085460408051858152602081018590529081019290925260608201527f42659a4aa613c1e350c764f0ff2be36a175ac2a1e4b77b8e1467d1fed32becc89060800160405180910390a1505050505050565b5f61097e81610aa9565b6001600160a01b0382166109a55760405163e6c4247b60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0384169081179091556040517f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc80905f90a25050565b5f82815260208190526040902060010154610a0981610aa9565b6105768383610b5d565b6001546001600160a01b03163314610a3e5760405163e6c4247b60e01b815260040160405180910390fd5b60065460ff1615610a6257604051635a4ef2d360e01b815260040160405180910390fd5b806003610a6f8282611049565b50506006805460ff191660011790556040517f124339d9fade6161abb9b8aa74ff4ab3c07a643fdaa2eac599ec96985268f47b905f90a150565b610ab38133610c45565b50565b5f828152602081815260408083206001600160a01b038516845290915281205460ff16610b56575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055610b0e3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161054c565b505f61054c565b5f828152602081815260408083206001600160a01b038516845290915281205460ff1615610b56575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161054c565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052610689908490610ca0565b5f828152602081815260408083206001600160a01b038516845290915290205460ff16610c9c5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044015b60405180910390fd5b5050565b5f610cb46001600160a01b03841683610d01565b905080515f14158015610cd8575080806020019051810190610cd6919061117d565b155b1561068957604051635274afe760e01b81526001600160a01b0384166004820152602401610c93565b6060610d0e83835f610d15565b9392505050565b606081471015610d3a5760405163cd78605960e01b8152306004820152602401610c93565b5f80856001600160a01b03168486604051610d55919061119c565b5f6040518083038185875af1925050503d805f8114610d8f576040519150601f19603f3d011682016040523d82523d5f602084013e610d94565b606091505b5091509150610da4868383610dae565b9695505050505050565b606082610dc357610dbe82610e0a565b610d0e565b8151158015610dda57506001600160a01b0384163b155b15610e0357604051639996b31560e01b81526001600160a01b0385166004820152602401610c93565b5080610d0e565b805115610e1a5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f60208284031215610e43575f80fd5b81356001600160e01b031981168114610d0e575f80fd5b5f60208284031215610e6a575f80fd5b5035919050565b6001600160a01b0381168114610ab3575f80fd5b5f8060408385031215610e96575f80fd5b823591506020830135610ea881610e71565b809150509250929050565b5f60208284031215610ec3575f80fd5b8135610d0e81610e71565b62ffffff81168114610ab3575f80fd5b5f8060408385031215610eef575f80fd5b8235610efa81610ece565b946020939093013593505050565b5f60a0828403128015610f19575f80fd5b509092915050565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761054c5761054c610f21565b5f82610f6657634e487b7160e01b5f52601260045260245ffd5b500490565b8082018082111561054c5761054c610f21565b86815285602082015284151560408201526001600160a01b0384541660608201525f60018501546001600160a01b038116608084015262ffffff8160a01c1660a08401528060b81c60020b60c084015250610fe360028601546001600160a01b031690565b6001600160a01b031660e083015261016061010083018190525f9083015261018082016001600160a01b0394909416610120830152506101400152949350505050565b5f60208284031215611036575f80fd5b5051919050565b5f813561054c81610e71565b813561105481610e71565b81546001600160a01b0319166001600160a01b0382161782555060018101602083013561108081610e71565b81546001600160a01b0319166001600160a01b0382161782555060408301356110a881610ece565b815476ffffff00000000000000000000000000000000000000008260a01b167fffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffff8216178355505060608301358060020b8114611102575f80fd5b81548160b81b79ffffff0000000000000000000000000000000000000000000000167fffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffff8216178355505050610c9c61115c6080840161103d565b600283016001600160a01b0382166001600160a01b03198254161781555050565b5f6020828403121561118d575f80fd5b81518015158114610d0e575f80fd5b5f82518060208501845e5f92019182525091905056fea26469706673582212209302a5722ef3eb0dc62d90945a2080b2555d0f4ca9194f5df96e478e10ddc67264736f6c634300081a0033a264697066735822122084d98bfef1745646b71d2c39f5178168cd1e35d83c61cc5c7bc91c6fb9f718d864736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e911f518449ba0011d84b047b4cde50daa081ec1
-----Decoded View---------------
Arg [0] : _admin (address): 0xe911f518449ba0011D84b047B4cde50dAA081eC1
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000e911f518449ba0011d84b047b4cde50daa081ec1
Net Worth in USD
Net Worth in ETH
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.