Source Code
Overview
S Balance
S Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | ||||
|---|---|---|---|---|---|---|---|
| 61214535 | 1 hr ago | 0 S | |||||
| 61214535 | 1 hr ago | 0 S | |||||
| 61214535 | 1 hr ago | 0 S | |||||
| 61214535 | 1 hr ago | 0 S | |||||
| 61214535 | 1 hr ago | 0 S | |||||
| 61214535 | 1 hr ago | 0 S | |||||
| 61214486 | 1 hr ago | 0 S | |||||
| 61214486 | 1 hr ago | 0 S | |||||
| 61214486 | 1 hr ago | 0 S | |||||
| 61214486 | 1 hr ago | 0 S | |||||
| 61214486 | 1 hr ago | 0 S | |||||
| 61214486 | 1 hr ago | 0 S | |||||
| 61214138 | 1 hr ago | 0 S | |||||
| 61214138 | 1 hr ago | 0 S | |||||
| 61214138 | 1 hr ago | 0 S | |||||
| 61214138 | 1 hr ago | 0 S | |||||
| 61214138 | 1 hr ago | 0 S | |||||
| 61214138 | 1 hr ago | 0 S | |||||
| 61212648 | 2 hrs ago | 0 S | |||||
| 61212648 | 2 hrs ago | 0 S | |||||
| 61212648 | 2 hrs ago | 0 S | |||||
| 61212648 | 2 hrs ago | 0 S | |||||
| 61212648 | 2 hrs ago | 0 S | |||||
| 61212648 | 2 hrs ago | 0 S | |||||
| 61209114 | 3 hrs ago | 0 S |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
UniversalUniswapV3Adaptor
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
// solhint-disable
pragma solidity ^0.8.0;
import {BaseUniversalUniswapV3Adaptor} from "./BaseUniversalUniswapV3Adaptor.sol";
/**
* @title UniversalUniswapV3Adaptor
* @notice Base contract for Universal Uniswap V3 Adapter implementation
* @dev This contract serves as the foundation for adapting various Uniswap V3-like DEX protocols
*
* Supported DEX Protocols:
* 1. Uniswap V3 Family:
* - Uniswap V3
* - Sheepdex
*
* 2. Algebra Family:
* - CamelotV3
* - KimV4
* - ThenaV2
* - Quickswapv3
* - HerculesV3
* - ZyberV3
*
* 3. Other V3-like DEXs:
* - Agni
* - FusionX
* - RamsesV2 (including NileCL)
* - Xei
* - PancakeV3
* - FireflyV3
*
* @custom:security-contact [email protected]
*/
contract UniversalUniswapV3Adaptor is BaseUniversalUniswapV3Adaptor {
constructor(
address weth,
uint160 minSqrtRatio,
uint160 maxSqrtRatio
) BaseUniversalUniswapV3Adaptor(weth, minSqrtRatio, maxSqrtRatio) {}
// Uniswap V3 callback(
// Sheepdex,
// etc.)
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
_universalSwapCallback(amount0Delta, amount1Delta, data);
}
// Agni callback
function agniSwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
_universalSwapCallback(amount0Delta, amount1Delta, data);
}
// Algebra/Algebra-like callback (
// CamelotV3,
// KimV4,
// ThenaV2,
// Quickswapv3,
// HerculesV3,
// ZyberV3,
// etc.)
function algebraSwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
_universalSwapCallback(amount0Delta, amount1Delta, data);
}
// FusionX callback
function fusionXV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
_universalSwapCallback(amount0Delta, amount1Delta, data);
}
// RamsesV2 callback(
// NileCL,
// etc.)
function ramsesV2SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
_universalSwapCallback(amount0Delta, amount1Delta, data);
}
// Xei callback
function xeiV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
_universalSwapCallback(amount0Delta, amount1Delta, data);
}
// PancakeV3 callback
function pancakeV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
_universalSwapCallback(amount0Delta, amount1Delta, data);
}
// FireflyV3 callback
function fireflyV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external {
_universalSwapCallback(amount0Delta, amount1Delta, data);
}
}// SPDX-License-Identifier: MIT
// solhint-disable
pragma solidity ^0.8.0;
import {IAdapter} from "../../interfaces/IAdapter.sol";
import {IERC20} from "../../interfaces/IERC20.sol";
import {SafeERC20} from "../../libraries/SafeERC20.sol";
import {IWETH} from "../../interfaces/IWETH.sol";
import {IUniV3} from "../../interfaces/IUniV3.sol";
/// @dev specific flag for refund logic, "0x3ca20afc" is flexible and also used for commission, "ccc" mean refund
uint256 constant ORIGIN_PAYER = 0x3ca20afc2ccc0000000000000000000000000000000000000000000000000000;
uint256 constant ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
abstract contract BaseUniversalUniswapV3Adaptor is IAdapter {
address public immutable WETH;
uint160 public immutable MIN_SQRT_RATIO;
uint160 public immutable MAX_SQRT_RATIO;
/// @notice throw error when amount is not positive
error InvalidAmount();
/// @notice throw error when payer is not the contract itself or value is not required
error InvalidPay();
constructor(address weth, uint160 minSqrtRatio, uint160 maxSqrtRatio) {
WETH = weth;
MIN_SQRT_RATIO = minSqrtRatio;
MAX_SQRT_RATIO = maxSqrtRatio;
}
function sellBase(
address to,
address pool,
bytes memory moreInfo
) external override {
_sell(to, pool, moreInfo);
}
function sellQuote(
address to,
address pool,
bytes memory moreInfo
) external override {
_sell(to, pool, moreInfo);
}
function _sell(address to, address pool, bytes memory moreInfo) internal {
(uint160 sqrtX96, bytes memory data) = abi.decode(
moreInfo,
(uint160, bytes)
);
_uniswapV3Swap(to, pool, sqrtX96, data, _getPayerOrigin());
}
function _uniswapV3Swap(
address to,
address pool,
uint160 sqrtX96,
bytes memory data,
uint256 payerOrigin
) internal {
(address fromToken, address toToken) = abi.decode(
data,
(address, address)
);
uint256 sellAmount = IERC20(fromToken).balanceOf(address(this));
bool zeroForOne = fromToken < toToken;
// Call the pool's swap function
IUniV3(pool).swap(
to,
zeroForOne,
int256(sellAmount),
sqrtX96 == 0
? (zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1)
: sqrtX96,
data
);
/// @notice Refund logic: if there is leftover fromToken, refund to payerOrigin
address _payerOrigin;
if ((payerOrigin & ORIGIN_PAYER) == ORIGIN_PAYER) {
_payerOrigin = address(uint160(uint256(payerOrigin) & ADDRESS_MASK));
}
uint256 amount = IERC20(fromToken).balanceOf(address(this));
if (amount > 0 && _payerOrigin != address(0)) {
SafeERC20.safeTransfer(IERC20(fromToken), _payerOrigin, amount);
}
}
// Common internal callback logic for all V3-like protocols
function _universalSwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes memory data
) internal {
if (amount0Delta <= 0 && amount1Delta <= 0) {
revert InvalidAmount();
}
(address tokenIn, address tokenOut) = abi.decode(
data,
(address, address)
);
address tokenA = tokenIn;
address tokenB = tokenOut;
if (tokenA > tokenB) {
(tokenA, tokenB) = (tokenB, tokenA);
}
(bool isExactInput, uint256 amountToPay) = amount0Delta > 0
? (tokenIn < tokenOut, uint256(amount0Delta))
: (tokenOut < tokenIn, uint256(amount1Delta));
if (isExactInput) {
pay(tokenIn, address(this), msg.sender, amountToPay);
} else {
pay(tokenOut, address(this), msg.sender, amountToPay);
}
}
/// @notice Internal function to handle token payments during swaps
/// @dev This function handles two types of payments:
/// 1. WETH payments: If the token is WETH and contract has enough ETH balance,
/// it will wrap ETH to WETH and transfer to recipient
/// 2. ERC20 payments: If the payer is the contract itself, it will transfer
/// the ERC20 tokens directly to the recipient
/// @param token The token address to pay with (WETH or ERC20)
/// @param payer The address that should pay the tokens
/// @param recipient The address that should receive the tokens
/// @param value The amount of tokens to pay
/// @custom:error InvalidPay Thrown when payer is not the contract itself
function pay(
address token,
address payer,
address recipient,
uint256 value
) internal {
/// @notice pay with WETH
if (token == WETH && address(this).balance >= value) {
IWETH(WETH).deposit{value: value}();
IWETH(WETH).transfer(recipient, value);
/// @notice pay with ERC20
} else if (payer == address(this)) {
SafeERC20.safeTransfer(IERC20(token), recipient, value);
} else {
revert InvalidPay();
}
}
function _getPayerOrigin() internal pure returns (uint256 payerOrigin) {
assembly {
// Get the total size of the calldata
let size := calldatasize()
// Load the last 32 bytes of the calldata, which is assumed to contain the payer origin
// Assumption: The calldata is structured such that the payer origin is always at the end
payerOrigin := calldataload(sub(size, 32))
}
}
// Fallback function to handle unexpected V3-like callbacks.
// It expects calldata matching the (int256 amount0Delta, int256 amount1Delta, bytes memory data) signature
// after the 4-byte function selector.
fallback(bytes calldata _calldata) external returns (bytes memory) {
(int256 amount0Delta, int256 amount1Delta, bytes memory data) = abi.decode(_calldata[4:], (int256, int256, bytes));
_universalSwapCallback(amount0Delta, amount1Delta, data);
// Uniswap V3 callbacks typically do not return values.
// Returning empty bytes is standard for fallbacks that successfully handle a call
// but don't have a specific return value defined by an interface.
return bytes("");
}
}/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
interface IAdapter {
function sellBase(
address to,
address pool,
bytes memory data
) external;
function sellQuote(
address to,
address pool,
bytes memory data
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title Interface for DAI-style permits
interface IDaiLikePermit {
function permit(
address holder,
address spender,
uint256 nonce,
uint256 expiry,
bool allowed,
uint8 v,
bytes32 r,
bytes32 s
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @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.
*/
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].
*/
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
pragma solidity ^0.8.0;
pragma abicoder v2;
interface IUniV3 {
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
bool unlocked
);
function token0() external view returns (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);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
interface IWETH {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 wad
) external returns (bool);
function deposit() external payable;
function withdraw(uint256 wad) external;
}/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly {
codehash := extcodehash(account)
}
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account)
internal
pure
returns (address payable)
{
return payable(account);
}
/**
* @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*
* _Available since v2.4.0._
*/
function sendValue(address recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
}/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library RevertReasonForwarder {
function reRevert() internal pure {
// bubble up revert reason from latest external call
/// @solidity memory-safe-assembly
assembly { // solhint-disable-line no-inline-assembly
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
}
}/// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./SafeMath.sol"; import "./Address.sol"; import "./RevertReasonForwarder.sol"; import "../interfaces/IERC20.sol"; import "../interfaces/IERC20Permit.sol"; import "../interfaces/IDaiLikePermit.sol"; // File @1inch/solidity-utils/contracts/libraries/[email protected] library SafeERC20 { error SafeTransferFailed(); error SafeTransferFromFailed(); error ForceApproveFailed(); error SafeIncreaseAllowanceFailed(); error SafeDecreaseAllowanceFailed(); error SafePermitBadLength(); // Ensures method do not revert or return boolean `true`, admits call to non-smart-contract function safeTransferFrom(IERC20 token, address from, address to, uint256 amount) internal { bytes4 selector = token.transferFrom.selector; bool success; /// @solidity memory-safe-assembly assembly { // solhint-disable-line no-inline-assembly let data := mload(0x40) mstore(data, selector) mstore(add(data, 0x04), from) mstore(add(data, 0x24), to) mstore(add(data, 0x44), amount) success := call(gas(), token, 0, data, 100, 0x0, 0x20) if success { switch returndatasize() case 0 { success := gt(extcodesize(token), 0) } default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) } } } if (!success) revert SafeTransferFromFailed(); } // Ensures method do not revert or return boolean `true`, admits call to non-smart-contract function safeTransfer(IERC20 token, address to, uint256 value) internal { if (!_makeCall(token, token.transfer.selector, to, value)) { revert SafeTransferFailed(); } } function safeApprove(IERC20 token, address spender, uint256 value) internal { forceApprove(token, spender, value); } // If `approve(from, to, amount)` fails, try to `approve(from, to, 0)` before retry function forceApprove(IERC20 token, address spender, uint256 value) internal { if (!_makeCall(token, token.approve.selector, spender, value)) { if (!_makeCall(token, token.approve.selector, spender, 0) || !_makeCall(token, token.approve.selector, spender, value)) { revert ForceApproveFailed(); } } } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 allowance = token.allowance(address(this), spender); if (value > type(uint256).max - allowance) revert SafeIncreaseAllowanceFailed(); forceApprove(token, spender, allowance + value); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 allowance = token.allowance(address(this), spender); if (value > allowance) revert SafeDecreaseAllowanceFailed(); forceApprove(token, spender, allowance - value); } function safePermit(IERC20 token, bytes calldata permit) internal { bool success; if (permit.length == 32 * 7) { success = _makeCalldataCall(token, IERC20Permit.permit.selector, permit); } else if (permit.length == 32 * 8) { success = _makeCalldataCall(token, IDaiLikePermit.permit.selector, permit); } else { revert SafePermitBadLength(); } if (!success) RevertReasonForwarder.reRevert(); } function _makeCall(IERC20 token, bytes4 selector, address to, uint256 amount) private returns(bool success) { /// @solidity memory-safe-assembly assembly { // solhint-disable-line no-inline-assembly let data := mload(0x40) mstore(data, selector) mstore(add(data, 0x04), to) mstore(add(data, 0x24), amount) success := call(gas(), token, 0, data, 0x44, 0x0, 0x20) if success { switch returndatasize() case 0 { success := gt(extcodesize(token), 0) } default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) } } } } function _makeCalldataCall(IERC20 token, bytes4 selector, bytes calldata args) private returns(bool success) { /// @solidity memory-safe-assembly assembly { // solhint-disable-line no-inline-assembly let len := add(4, args.length) let data := mload(0x40) mstore(data, selector) calldatacopy(add(data, 0x04), args.offset, args.length) success := call(gas(), token, 0, data, len, 0x0, 0x20) if success { switch returndatasize() case 0 { success := gt(extcodesize(token), 0) } default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) } } } } }
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library SafeMath {
uint256 constant WAD = 10**18;
uint256 constant RAY = 10**27;
function wad() public pure returns (uint256) {
return WAD;
}
function ray() public pure returns (uint256) {
return RAY;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a <= b ? a : b;
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function sqrt(uint256 a) internal pure returns (uint256 b) {
if (a > 3) {
b = a;
uint256 x = a / 2 + 1;
while (x < b) {
b = x;
x = (a / x + x) / 2;
}
} else if (a != 0) {
b = 1;
}
}
function wmul(uint256 a, uint256 b) internal pure returns (uint256) {
return mul(a, b) / WAD;
}
function wmulRound(uint256 a, uint256 b) internal pure returns (uint256) {
return add(mul(a, b), WAD / 2) / WAD;
}
function rmul(uint256 a, uint256 b) internal pure returns (uint256) {
return mul(a, b) / RAY;
}
function rmulRound(uint256 a, uint256 b) internal pure returns (uint256) {
return add(mul(a, b), RAY / 2) / RAY;
}
function wdiv(uint256 a, uint256 b) internal pure returns (uint256) {
return div(mul(a, WAD), b);
}
function wdivRound(uint256 a, uint256 b) internal pure returns (uint256) {
return add(mul(a, WAD), b / 2) / b;
}
function rdiv(uint256 a, uint256 b) internal pure returns (uint256) {
return div(mul(a, RAY), b);
}
function rdivRound(uint256 a, uint256 b) internal pure returns (uint256) {
return add(mul(a, RAY), b / 2) / b;
}
function wpow(uint256 x, uint256 n) internal pure returns (uint256) {
uint256 result = WAD;
while (n > 0) {
if (n % 2 != 0) {
result = wmul(result, x);
}
x = wmul(x, x);
n /= 2;
}
return result;
}
function rpow(uint256 x, uint256 n) internal pure returns (uint256) {
uint256 result = RAY;
while (n > 0) {
if (n % 2 != 0) {
result = rmul(result, x);
}
x = rmul(x, x);
n /= 2;
}
return result;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"weth","type":"address"},{"internalType":"uint160","name":"minSqrtRatio","type":"uint160"},{"internalType":"uint160","name":"maxSqrtRatio","type":"uint160"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidPay","type":"error"},{"inputs":[],"name":"SafeTransferFailed","type":"error"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"MAX_SQRT_RATIO","outputs":[{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_SQRT_RATIO","outputs":[{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"agniSwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"algebraSwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"fireflyV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"fusionXV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"pancakeV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"ramsesV2SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes","name":"moreInfo","type":"bytes"}],"name":"sellBase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"bytes","name":"moreInfo","type":"bytes"}],"name":"sellQuote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"xeiV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e060405234801561001057600080fd5b50604051610cfc380380610cfc83398101604081905261002f91610064565b6001600160a01b0392831660805290821660a0521660c0526100b1565b6001600160a01b038116811461006157600080fd5b50565b60008060006060848603121561007957600080fd5b83516100848161004c565b60208501519093506100958161004c565b60408501519092506100a68161004c565b809150509250925092565b60805160a05160c051610bf96101036000396000818161014201526105c60152600081816101ac01526105f4015260008181610185015281816102fa0152818161034001526103d50152610bf96000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80636f7929f21161008c578063ae067e0f11610066578063ae067e0f14610115578063dcbf3bf014610115578063ee8847ff146101a7578063fa461e3314610115576100cf565b80636f7929f21461012a57806386cbcd5214610115578063ad5c464814610180576100cf565b806323a69e75146101155780632c8958f61461011557806330e6ae311461012a5780635bee97a314610115578063654b6487146101155780636d2cc3041461013d575b60003660608280806100e48560048184610795565b8101906100f19190610884565b9250925092506101028383836101ce565b5050604080516020810190915260009052005b6101286101233660046108d4565b6102a1565b005b61012861013836600461096c565b6102e8565b6101647f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6101647f000000000000000000000000000000000000000000000000000000000000000081565b6101647f000000000000000000000000000000000000000000000000000000000000000081565b600083131580156101e0575060008213155b156101fe5760405163162908e360e11b815260040160405180910390fd5b6000808280602001905181019061021591906109b8565b909250905081816001600160a01b03808216908316111561023257905b6000806000891361025857856001600160a01b0316856001600160a01b0316108861026f565b846001600160a01b0316866001600160a01b031610895b91509150811561028a57610285863033846102f8565b610296565b610296853033846102f8565b505050505050505050565b6102e2848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101ce92505050565b50505050565b6102f3838383610485565b505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b03161480156103395750804710155b1561044c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561039957600080fd5b505af11580156103ad573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038681166004830152602482018690527f000000000000000000000000000000000000000000000000000000000000000016935063a9059cbb925060440190506020604051808303816000875af1158015610422573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044691906109f2565b506102e2565b306001600160a01b0384160361046c576104678483836104bf565b6102e2565b60405163273fa35b60e01b815260040160405180910390fd5b6000808280602001905181019061049c9190610a3f565b915091506104b8858584846104b3601f1936013590565b6104ef565b5050505050565b6104d28363a9059cbb60e01b8484610741565b6102f35760405163fb7f507960e01b815260040160405180910390fd5b6000808380602001905181019061050691906109b8565b6040516370a0823160e01b815230600482015291935091506000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105769190610acc565b90506000826001600160a01b0316846001600160a01b0316109050876001600160a01b031663128acb088a83858b6001600160a01b03166000146105ba578b61061a565b856105ef576105ea60017f0000000000000000000000000000000000000000000000000000000000000000610afb565b61061a565b61061a7f00000000000000000000000000000000000000000000000000000000000000006001610b22565b8b6040518663ffffffff1660e01b815260040161063b959493929190610b42565b60408051808303816000875af1158015610659573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067d9190610b9f565b50506000650f2882bf0b3360d21b8087160361069f57506001600160a01b0385165b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a9190610acc565b905060008111801561072457506001600160a01b03821615155b15610734576107348683836104bf565b5050505050505050505050565b60006040518481528360048201528260248201526020600060448360008a5af1915050801561078d573d801561078357600160005114601f3d1116915061078b565b6000863b1191505b505b949350505050565b600080858511156107a557600080fd5b838611156107b257600080fd5b5050820193919092039150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156107fe576107fe6107bf565b604052919050565b600067ffffffffffffffff821115610820576108206107bf565b50601f01601f191660200190565b600082601f83011261083f57600080fd5b813561085261084d82610806565b6107d5565b81815284602083860101111561086757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561089957600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156108be57600080fd5b6108ca8682870161082e565b9150509250925092565b600080600080606085870312156108ea57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561091057600080fd5b818701915087601f83011261092457600080fd5b81358181111561093357600080fd5b88602082850101111561094557600080fd5b95989497505060200194505050565b6001600160a01b038116811461096957600080fd5b50565b60008060006060848603121561098157600080fd5b833561098c81610954565b9250602084013561099c81610954565b9150604084013567ffffffffffffffff8111156108be57600080fd5b600080604083850312156109cb57600080fd5b82516109d681610954565b60208401519092506109e781610954565b809150509250929050565b600060208284031215610a0457600080fd5b81518015158114610a1457600080fd5b9392505050565b60005b83811015610a36578181015183820152602001610a1e565b50506000910152565b60008060408385031215610a5257600080fd5b8251610a5d81610954565b602084015190925067ffffffffffffffff811115610a7a57600080fd5b8301601f81018513610a8b57600080fd5b8051610a9961084d82610806565b818152866020838501011115610aae57600080fd5b610abf826020830160208601610a1b565b8093505050509250929050565b600060208284031215610ade57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03828116828216039080821115610b1b57610b1b610ae5565b5092915050565b6001600160a01b03818116838216019080821115610b1b57610b1b610ae5565b600060018060a01b038088168352861515602084015285604084015280851660608401525060a0608083015282518060a0840152610b878160c0850160208701610a1b565b601f01601f19169190910160c0019695505050505050565b60008060408385031215610bb257600080fd5b50508051602090910151909290915056fea26469706673582212206e2fcb6532f4127736ce7de5d33f592bb9d0d70a09d99ce531afcb367b77273d64736f6c63430008110033000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000000000000000000000000000000000001000276a3000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d26
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80636f7929f21161008c578063ae067e0f11610066578063ae067e0f14610115578063dcbf3bf014610115578063ee8847ff146101a7578063fa461e3314610115576100cf565b80636f7929f21461012a57806386cbcd5214610115578063ad5c464814610180576100cf565b806323a69e75146101155780632c8958f61461011557806330e6ae311461012a5780635bee97a314610115578063654b6487146101155780636d2cc3041461013d575b60003660608280806100e48560048184610795565b8101906100f19190610884565b9250925092506101028383836101ce565b5050604080516020810190915260009052005b6101286101233660046108d4565b6102a1565b005b61012861013836600461096c565b6102e8565b6101647f000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d2681565b6040516001600160a01b03909116815260200160405180910390f35b6101647f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3881565b6101647f00000000000000000000000000000000000000000000000000000001000276a381565b600083131580156101e0575060008213155b156101fe5760405163162908e360e11b815260040160405180910390fd5b6000808280602001905181019061021591906109b8565b909250905081816001600160a01b03808216908316111561023257905b6000806000891361025857856001600160a01b0316856001600160a01b0316108861026f565b846001600160a01b0316866001600160a01b031610895b91509150811561028a57610285863033846102f8565b610296565b610296853033846102f8565b505050505050505050565b6102e2848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506101ce92505050565b50505050565b6102f3838383610485565b505050565b7f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b0316846001600160a01b03161480156103395750804710155b1561044c577f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561039957600080fd5b505af11580156103ad573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038681166004830152602482018690527f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3816935063a9059cbb925060440190506020604051808303816000875af1158015610422573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044691906109f2565b506102e2565b306001600160a01b0384160361046c576104678483836104bf565b6102e2565b60405163273fa35b60e01b815260040160405180910390fd5b6000808280602001905181019061049c9190610a3f565b915091506104b8858584846104b3601f1936013590565b6104ef565b5050505050565b6104d28363a9059cbb60e01b8484610741565b6102f35760405163fb7f507960e01b815260040160405180910390fd5b6000808380602001905181019061050691906109b8565b6040516370a0823160e01b815230600482015291935091506000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105769190610acc565b90506000826001600160a01b0316846001600160a01b0316109050876001600160a01b031663128acb088a83858b6001600160a01b03166000146105ba578b61061a565b856105ef576105ea60017f000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d26610afb565b61061a565b61061a7f00000000000000000000000000000000000000000000000000000001000276a36001610b22565b8b6040518663ffffffff1660e01b815260040161063b959493929190610b42565b60408051808303816000875af1158015610659573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067d9190610b9f565b50506000650f2882bf0b3360d21b8087160361069f57506001600160a01b0385165b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a9190610acc565b905060008111801561072457506001600160a01b03821615155b15610734576107348683836104bf565b5050505050505050505050565b60006040518481528360048201528260248201526020600060448360008a5af1915050801561078d573d801561078357600160005114601f3d1116915061078b565b6000863b1191505b505b949350505050565b600080858511156107a557600080fd5b838611156107b257600080fd5b5050820193919092039150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156107fe576107fe6107bf565b604052919050565b600067ffffffffffffffff821115610820576108206107bf565b50601f01601f191660200190565b600082601f83011261083f57600080fd5b813561085261084d82610806565b6107d5565b81815284602083860101111561086757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561089957600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156108be57600080fd5b6108ca8682870161082e565b9150509250925092565b600080600080606085870312156108ea57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561091057600080fd5b818701915087601f83011261092457600080fd5b81358181111561093357600080fd5b88602082850101111561094557600080fd5b95989497505060200194505050565b6001600160a01b038116811461096957600080fd5b50565b60008060006060848603121561098157600080fd5b833561098c81610954565b9250602084013561099c81610954565b9150604084013567ffffffffffffffff8111156108be57600080fd5b600080604083850312156109cb57600080fd5b82516109d681610954565b60208401519092506109e781610954565b809150509250929050565b600060208284031215610a0457600080fd5b81518015158114610a1457600080fd5b9392505050565b60005b83811015610a36578181015183820152602001610a1e565b50506000910152565b60008060408385031215610a5257600080fd5b8251610a5d81610954565b602084015190925067ffffffffffffffff811115610a7a57600080fd5b8301601f81018513610a8b57600080fd5b8051610a9961084d82610806565b818152866020838501011115610aae57600080fd5b610abf826020830160208601610a1b565b8093505050509250929050565b600060208284031215610ade57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03828116828216039080821115610b1b57610b1b610ae5565b5092915050565b6001600160a01b03818116838216019080821115610b1b57610b1b610ae5565b600060018060a01b038088168352861515602084015285604084015280851660608401525060a0608083015282518060a0840152610b878160c0850160208701610a1b565b601f01601f19169190910160c0019695505050505050565b60008060408385031215610bb257600080fd5b50508051602090910151909290915056fea26469706673582212206e2fcb6532f4127736ce7de5d33f592bb9d0d70a09d99ce531afcb367b77273d64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000000000000000000000000000000000001000276a3000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d26
-----Decoded View---------------
Arg [0] : weth (address): 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38
Arg [1] : minSqrtRatio (uint160): 4295128739
Arg [2] : maxSqrtRatio (uint160): 1461446703485210103287273052203988822378723970342
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38
Arg [1] : 00000000000000000000000000000000000000000000000000000001000276a3
Arg [2] : 000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d26
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Token Allocations
MON
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| MONAD | 100.00% | $0.018403 | 0.0000000000000001 | <$0.000001 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.