Source Code
Overview
MNT Balance
MNT Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
AgniDEXProxyV2
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// contracts/Box.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./interfaces/ISwapRouter.sol";
import "./interfaces/IZiSwap.sol";
import "./interfaces/IWMNT.sol";
import "./libraries/TransferHelper.sol";
import "./libraries/FullMath.sol";
import "./libraries/Path.sol";
contract AgniDEXProxyV2 is Initializable, OwnableUpgradeable {
using Path for bytes;
address public WMNT;
address public _router;
uint256 public _fee;
address public _IZISwap;
function initialize(
address wmnt,
address router,
uint256 fee,
address izumiswap
) public initializer {
__Ownable_init();
WMNT = wmnt;
_router = router;
_fee = fee;
_IZISwap = izumiswap;
}
// Emitted when swap
event AgniSwap(
address tokenIn,
address tokenOut,
uint256 fee,
address sender,
address recipient,
uint256 amountIn,
uint256 amountOut
);
event AgniSwapRouter(
bytes path,
address tokenIn,
address tokenOut,
uint256 fee,
address sender,
address recipient,
uint256 amountIn,
uint256 amountOut
);
event FeeChanged(uint256 oldFee, uint256 newFee);
event IZiSwap(
address tokenIn,
address tokenOut,
uint256 fee,
address sender,
address recipient,
uint256 amountIn,
uint256 amountOut
);
event IZiSwapRouter(
bytes path,
address tokenIn,
address tokenOut,
uint256 fee,
address sender,
address recipient,
uint256 amountIn,
uint256 amountOut
);
function setIZumSwap(address _swap) external onlyOwner {
_IZISwap = _swap;
}
function changeFee(uint256 fee) external onlyOwner {
emit FeeChanged(_fee, fee);
require(fee >= 0 && fee < 1e4, "invalid fee");
_fee = fee;
}
function withdrawToken(address token, uint256 amount) external onlyOwner {
if (token == WMNT) {
IWMNT(WMNT).withdraw(amount);
TransferHelper.safeTransferMNT(owner(), amount);
} else {
IERC20(token).transfer(owner(), amount);
}
}
function withdraw(uint256 amount) external onlyOwner {
require(address(this).balance >= amount, "no sufficient ether");
payable(owner()).transfer(amount);
}
function agniSwap(
ISwapRouter.ExactInputSingleParams calldata params
) external payable returns (uint256 amountOut) {
address payer = msg.sender;
address proxyAddress = address(this);
pay(params.tokenIn, payer, proxyAddress, params.amountIn);
uint256 newamountIn = FullMath.mulDiv(params.amountIn, 1e4 - _fee, 1e4);
TransferHelper.safeApprove(params.tokenIn, _router, newamountIn);
amountOut = ISwapRouter(_router).exactInputSingle(
ISwapRouter.ExactInputSingleParams(
params.tokenIn,
params.tokenOut,
params.fee,
proxyAddress,
params.deadline,
newamountIn,
params.amountOutMinimum,
params.sqrtPriceLimitX96
)
);
require(amountOut > 0, "no out");
address tokenout = params.tokenOut;
if (tokenout == WMNT) {
IWMNT(WMNT).withdraw(amountOut);
TransferHelper.safeTransferMNT(payer, amountOut);
} else {
require(
IERC20(tokenout).balanceOf(proxyAddress) >= amountOut,
"no second balance"
);
TransferHelper.safeTransfer(tokenout, payer, amountOut);
}
emit AgniSwap(
params.tokenIn,
params.tokenOut,
params.fee,
payer,
params.recipient,
params.amountIn,
amountOut
);
}
struct AgniInputParams {
address[] tokenIns;
uint24[] fees;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
}
function agniSwapRouter(
AgniInputParams calldata params
) external payable returns (uint256 amountOut) {
require(
params.tokenIns.length == params.fees.length + 1,
"length is invalid"
);
require(params.fees.length >= 1, "length must be more than one");
address payer = msg.sender;
address proxyAddress = address(this);
address tokenIn = params.tokenIns[0];
uint24 fee = params.fees[0];
address tokenOut = params.tokenIns[params.tokenIns.length - 1];
bytes memory path;
{
for (uint256 i = 0; i < params.fees.length; i++) {
path = abi.encodePacked(
path,
params.tokenIns[i],
params.fees[i]
);
}
// Append the last address
path = abi.encodePacked(path, tokenOut);
pay(tokenIn, payer, proxyAddress, params.amountIn);
uint256 newamountIn = FullMath.mulDiv(
params.amountIn,
1e4 - _fee,
1e4
);
TransferHelper.safeApprove(tokenIn, _router, newamountIn);
amountOut = ISwapRouter(_router).exactInput(
ISwapRouter.ExactInputParams(
path,
proxyAddress,
params.deadline,
newamountIn,
params.amountOutMinimum
)
);
require(amountOut > 0, "no out amount");
}
if (tokenOut == WMNT) {
IWMNT(WMNT).withdraw(amountOut);
TransferHelper.safeTransferMNT(payer, amountOut);
} else {
require(
IERC20(tokenOut).balanceOf(proxyAddress) >= amountOut,
"no out balance"
);
TransferHelper.safeTransfer(tokenOut, payer, amountOut);
}
emit AgniSwapRouter(
path,
tokenIn,
tokenOut,
fee,
payer,
params.recipient,
params.amountIn,
amountOut
);
}
struct IZuSwapAmountParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 amount;
uint256 minAcquired;
uint256 deadline;
}
function izumiSwap(
IZuSwapAmountParams calldata params
) external payable returns (uint256 amountOut) {
address payer = msg.sender;
address proxyAddress = address(this);
pay(params.tokenIn, payer, proxyAddress, params.amount);
uint256 newamountIn = FullMath.mulDiv(params.amount, 1e4 - _fee, 1e4);
require(
newamountIn <= type(uint128).max,
"new amount exceeds uint128 range"
);
TransferHelper.safeApprove(params.tokenIn, _IZISwap, newamountIn);
bytes memory path = abi.encodePacked(
params.tokenIn,
params.fee,
params.tokenOut
);
(, uint256 acquire) = ISwap(_IZISwap).swapAmount(
ISwap.SwapAmountParams(
path,
proxyAddress,
uint128(newamountIn),
params.minAcquired,
params.deadline
)
);
amountOut = acquire;
require(amountOut > 0, "no out");
address tokenOut = params.tokenOut;
if (tokenOut == WMNT) {
IWMNT(WMNT).withdraw(amountOut);
TransferHelper.safeTransferMNT(payer, amountOut);
} else {
require(
IERC20(tokenOut).balanceOf(proxyAddress) >= amountOut,
"no second balance"
);
TransferHelper.safeTransfer(tokenOut, payer, amountOut);
}
emit IZiSwap(
params.tokenIn,
tokenOut,
params.fee,
payer,
params.recipient,
params.amount,
amountOut
);
}
struct IzumiInputParams {
address[] tokenIns;
uint24[] fees;
address recipient;
uint128 amount;
uint256 minAcquired;
uint256 deadline;
}
function izumiSwapRouter(
IzumiInputParams calldata params
) external payable returns (uint256 amountOut) {
require(
params.tokenIns.length == params.fees.length + 1,
"length is invalid"
);
require(params.fees.length >= 1, "length must be more than one");
address payer = msg.sender;
address proxyAddress = address(this);
uint256 amountIn = uint256(params.amount);
address tokenIn = params.tokenIns[0];
uint24 fee = params.fees[0];
address tokenOut = params.tokenIns[params.tokenIns.length - 1];
bytes memory path;
{
for (uint256 i = 0; i < params.fees.length; i++) {
path = abi.encodePacked(
path,
params.tokenIns[i],
params.fees[i]
);
}
// Append the last address
path = abi.encodePacked(path, tokenOut);
pay(tokenIn, payer, proxyAddress, amountIn);
uint256 newamountIn = FullMath.mulDiv(amountIn, 1e4 - _fee, 1e4);
require(
newamountIn <= type(uint128).max,
"new amount exceeds uint128 range"
);
TransferHelper.safeApprove(tokenIn, _IZISwap, newamountIn);
(, uint256 acquire) = ISwap(_IZISwap).swapAmount(
ISwap.SwapAmountParams(
path,
proxyAddress,
uint128(newamountIn),
params.minAcquired,
params.deadline
)
);
amountOut = acquire;
require(amountOut > 0, "no out amount");
}
if (tokenOut == WMNT) {
IWMNT(WMNT).withdraw(amountOut);
TransferHelper.safeTransferMNT(payer, amountOut);
} else {
require(
IERC20(tokenOut).balanceOf(proxyAddress) >= amountOut,
"no out balance"
);
TransferHelper.safeTransfer(tokenOut, payer, amountOut);
}
emit IZiSwapRouter(
path,
tokenIn,
tokenOut,
fee,
payer,
params.recipient,
amountIn,
amountOut
);
}
/// @param token The token to pay
/// @param payer The entity that must pay
/// @param recipient The entity that will receive payment
/// @param value The amount to pay
function pay(
address token,
address payer,
address recipient,
uint256 value
) internal {
if (token == WMNT && address(this).balance >= value) {
// pay with WMNT
IWMNT(WMNT).deposit{value: value}(); // wrap only what is needed to pay
IWMNT(WMNT).transfer(recipient, value);
} else if (payer == address(this)) {
// pay with tokens already in the contract (for the exact input multihop case)
TransferHelper.safeTransfer(token, recipient, value);
} else {
// pull payment
TransferHelper.safeTransferFrom(token, payer, recipient, value);
}
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @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, it is bubbled up by this
* function (like regular Solidity function calls).
*
* 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.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @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`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
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;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// 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: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Callback for IAgniPoolActions#swap
/// @notice Any contract that calls IAgniPoolActions#swap must implement this interface
interface IAgniSwapCallback {
/// @notice Called to `msg.sender` after executing a swap via IAgniPool#swap.
/// @dev In the implementation you must pay the pool tokens owed for the swap.
/// The caller of this method must be checked to be a AgniPool deployed by the canonical AgniFactory.
/// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
/// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
/// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
/// @param data Any data passed through by the caller via the IAgniPoolActions#swap call
function agniSwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;
import "./IAgniSwapCallback.sol";
/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Agni
interface ISwapRouter is IAgniSwapCallback {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another token
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
/// @return amountOut The amount of the received token
function exactInputSingle(
ExactInputSingleParams calldata params
) external payable returns (uint256 amountOut);
struct ExactInputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(
ExactInputParams calldata params
) external payable returns (uint256 amountOut);
struct ExactOutputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another token
/// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
/// @return amountIn The amount of the input token
function exactOutputSingle(
ExactOutputSingleParams calldata params
) external payable returns (uint256 amountIn);
struct ExactOutputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
/// @return amountIn The amount of the input token
function exactOutput(
ExactOutputParams calldata params
) external payable returns (uint256 amountIn);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title Interface for WMNT
interface IWMNT is IERC20 {
/// @notice Deposit ether to get wrapped ether
function deposit() external payable;
/// @notice Withdraw wrapped ether to get ether
function withdraw(uint256) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @title Interface for LiquidityManager
interface ISwap {
struct SwapAmountParams {
bytes path;
address recipient;
uint128 amount;
uint256 minAcquired;
uint256 deadline;
}
/// @notice Swap given amount of input token, usually used in multi-hop case.
function swapAmount(
SwapAmountParams calldata params
) external payable returns (uint256 cost, uint256 acquire);
}// SPDX-License-Identifier: GPL-2.0-or-later /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity ^0.8.4; library BytesLib { function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_start + _length >= _start, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add( add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)) ) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add( add( add(_bytes, lengthmod), mul(0x20, iszero(lengthmod)) ), _start ) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress( bytes memory _bytes, uint256 _start ) internal pure returns (address) { require(_start + 20 >= _start, "toAddress_overflow"); require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div( mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000 ) } return tempAddress; } function toUint24( bytes memory _bytes, uint256 _start ) internal pure returns (uint24) { require(_start + 3 >= _start, "toUint24_overflow"); require(_bytes.length >= _start + 3, "toUint24_outOfBounds"); uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } }
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0 <0.9.0;
/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
/// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
/// @param a The multiplicand
/// @param b The multiplier
/// @param denominator The divisor
/// @return result The 256-bit result
/// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
function mulDiv(
uint256 a,
uint256 b,
uint256 denominator
) internal pure returns (uint256 result) {
// 512-bit multiply [prod1 prod0] = a * b
// Compute the product mod 2**256 and mod 2**256 - 1
// then use the Chinese Remainder Theorem to reconstruct
// the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2**256 + prod0
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(a, b, not(0))
prod0 := mul(a, b)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division
if (prod1 == 0) {
require(denominator > 0);
assembly {
result := div(prod0, denominator)
}
return result;
}
// Make sure the result is less than 2**256.
// Also prevents denominator == 0
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0]
// Compute remainder using mulmod
uint256 remainder;
assembly {
remainder := mulmod(a, b, denominator)
}
// Subtract 256 bit number from 512 bit number
assembly {
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator
// Compute largest power of two divisor of denominator.
// Always >= 1.
uint256 twos = (~denominator + 1) & denominator;
// Divide denominator by power of two
assembly {
denominator := div(denominator, twos)
}
// Divide [prod1 prod0] by the factors of two
assembly {
prod0 := div(prod0, twos)
}
// Shift in bits from prod1 into prod0. For this we need
// to flip `twos` such that it is 2**256 / twos.
// If twos is zero, then it becomes one
assembly {
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
// Invert denominator mod 2**256
// Now that denominator is an odd number, it has an inverse
// modulo 2**256 such that denominator * inv = 1 mod 2**256.
// Compute the inverse by starting with a seed that is correct
// correct for four bits. That is, denominator * inv = 1 mod 2**4
uint256 inv = (3 * denominator) ^ 2;
// Now use Newton-Raphson iteration to improve the precision.
// Thanks to Hensel's lifting lemma, this also works in modular
// arithmetic, doubling the correct bits in each step.
inv *= 2 - denominator * inv; // inverse mod 2**8
inv *= 2 - denominator * inv; // inverse mod 2**16
inv *= 2 - denominator * inv; // inverse mod 2**32
inv *= 2 - denominator * inv; // inverse mod 2**64
inv *= 2 - denominator * inv; // inverse mod 2**128
inv *= 2 - denominator * inv; // inverse mod 2**256
// Because the division is now exact we can divide by multiplying
// with the modular inverse of denominator. This will give us the
// correct result modulo 2**256. Since the precoditions guarantee
// that the outcome is less than 2**256, this is the final result.
// We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inv;
return result;
}
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.4;
import "./BytesLib.sol";
/// @title Functions for manipulating path data for multihop swaps
library Path {
using BytesLib for bytes;
/// @dev The length of the bytes encoded address
uint256 private constant ADDR_SIZE = 20;
/// @dev The length of the bytes encoded fee
uint256 private constant FEE_SIZE = 3;
/// @dev The offset of a single token address and pool fee
uint256 private constant NEXT_OFFSET = ADDR_SIZE + FEE_SIZE;
/// @dev The offset of an encoded pool key
uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE;
/// @dev The minimum length of an encoding that contains 2 or more pools
uint256 private constant MULTIPLE_POOLS_MIN_LENGTH =
POP_OFFSET + NEXT_OFFSET;
/// @notice Returns true iff the path contains two or more pools
/// @param path The encoded swap path
/// @return True if path contains two or more pools, otherwise false
function hasMultiplePools(bytes memory path) internal pure returns (bool) {
return path.length >= MULTIPLE_POOLS_MIN_LENGTH;
}
/// @notice Returns the number of pools in the path
/// @param path The encoded swap path
/// @return The number of pools in the path
function numPools(bytes memory path) internal pure returns (uint256) {
// Ignore the first token address. From then on every fee and token offset indicates a pool.
return ((path.length - ADDR_SIZE) / NEXT_OFFSET);
}
/// @notice Decodes the first pool in path
/// @param path The bytes encoded swap path
/// @return tokenA The first token of the given pool
/// @return tokenB The second token of the given pool
/// @return fee The fee level of the pool
function decodeFirstPool(
bytes memory path
) internal pure returns (address tokenA, address tokenB, uint24 fee) {
tokenA = path.toAddress(0);
fee = path.toUint24(ADDR_SIZE);
tokenB = path.toAddress(NEXT_OFFSET);
}
/// @notice Gets the segment corresponding to the first pool in the path
/// @param path The bytes encoded swap path
/// @return The segment containing all data necessary to target the first pool in the path
function getFirstPool(
bytes memory path
) internal pure returns (bytes memory) {
return path.slice(0, POP_OFFSET);
}
/// @notice Skips a token + fee element from the buffer and returns the remainder
/// @param path The swap path
/// @return The remaining token + fee elements in the path
function skipToken(bytes memory path) internal pure returns (bytes memory) {
return path.slice(NEXT_OFFSET, path.length - NEXT_OFFSET);
}
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
library TransferHelper {
/// @notice Transfers tokens from the targeted address to the given destination
/// @notice Errors with 'STF' if transfer fails
/// @param token The contract address of the token to be transferred
/// @param from The originating address from which the tokens will be transferred
/// @param to The destination address of the transfer
/// @param value The amount to be transferred
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(
IERC20.transferFrom.selector,
from,
to,
value
)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"NSTF"
);
}
/// @notice Transfers tokens from msg.sender to a recipient
/// @dev Errors with ST if transfer fails
/// @param token The contract address of the token which will be transferred
/// @param to The recipient of the transfer
/// @param value The value of the transfer
function safeTransfer(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(IERC20.transfer.selector, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"NST"
);
}
/// @notice Approves the stipulated contract to spend the given allowance in the given token
/// @dev Errors with 'SA' if transfer fails
/// @param token The contract address of the token to be approved
/// @param to The target of the approval
/// @param value The amount of the given token the target will be allowed to spend
function safeApprove(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(IERC20.approve.selector, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"NSA"
);
}
/// @notice Transfers MNT to the recipient address
/// @dev Fails with `STE`
/// @param to The destination of the transfer
/// @param value The value to be transferred
function safeTransferMNT(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, "NSTE");
}
}{
"evmVersion": "paris",
"libraries": {},
"optimizer": {
"enabled": true,
"runs": 1000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"AgniSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"path","type":"bytes"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"AgniSwapRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"FeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"IZiSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"path","type":"bytes"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"IZiSwapRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"WMNT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_IZISwap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct ISwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"agniSwap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"tokenIns","type":"address[]"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct AgniDEXProxyV2.AgniInputParams","name":"params","type":"tuple"}],"name":"agniSwapRouter","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"changeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wmnt","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"address","name":"izumiswap","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAcquired","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct AgniDEXProxyV2.IZuSwapAmountParams","name":"params","type":"tuple"}],"name":"izumiSwap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"tokenIns","type":"address[]"},{"internalType":"uint24[]","name":"fees","type":"uint24[]"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"minAcquired","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct AgniDEXProxyV2.IzumiInputParams","name":"params","type":"tuple"}],"name":"izumiSwapRouter","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_swap","type":"address"}],"name":"setIZumSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405234801561001057600080fd5b506128d7806100206000396000f3fe6080604052600436106100f75760003560e01c80639e281a981161008a578063dd263f9411610059578063dd263f9414610272578063e8c4719614610285578063edae876f146102a5578063f2fde38b146102c557600080fd5b80639e281a98146101fc578063be2030941461021c578063c5b37c221461023c578063d295afc11461025257600080fd5b80636a1db1bf116100c65780636a1db1bf14610196578063715018a6146101b65780638da5cb5b146101cb57806390dcb009146101e957600080fd5b80632e1a7d4d1461010357806335adbab6146101255780633dbb12ae1461014b578063597a2f871461015e57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5061012361011e3660046123d0565b6102e5565b005b6101386101333660046123e9565b610380565b6040519081526020015b60405180910390f35b610138610159366004612401565b6107de565b34801561016a57600080fd5b5060685461017e906001600160a01b031681565b6040516001600160a01b039091168152602001610142565b3480156101a257600080fd5b506101236101b13660046123d0565b610c19565b3480156101c257600080fd5b50610123610cb3565b3480156101d757600080fd5b506033546001600160a01b031661017e565b6101386101f7366004612426565b610cc7565b34801561020857600080fd5b50610123610217366004612478565b6111fb565b34801561022857600080fd5b506101236102373660046124a4565b611341565b34801561024857600080fd5b5061013860675481565b34801561025e57600080fd5b5061012361026d3660046124f7565b6114b4565b610138610280366004612426565b6114eb565b34801561029157600080fd5b5060655461017e906001600160a01b031681565b3480156102b157600080fd5b5060665461017e906001600160a01b031681565b3480156102d157600080fd5b506101236102e03660046124f7565b611aab565b6102ed611b3b565b804710156103425760405162461bcd60e51b815260206004820152601360248201527f6e6f2073756666696369656e742065746865720000000000000000000000000060448201526064015b60405180910390fd5b6033546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561037c573d6000803e3d6000fd5b5050565b600033306103a061039460208601866124f7565b83838760800135611b95565b60006103c285608001356067546127106103ba919061252a565b612710611cd0565b90506001600160801b0381111561041b5760405162461bcd60e51b815260206004820181905260248201527f6e657720616d6f756e7420657863656564732075696e743132382072616e67656044820152606401610339565b61043d61042b60208701876124f7565b6068546001600160a01b031683611e4b565b600061044c60208701876124f7565b61045c6060880160408901612543565b61046c6040890160208a016124f7565b604051606093841b6bffffffffffffffffffffffff19908116602083015260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166034820152921b166037820152604b0160408051601f1981840301815260685460a080850184528285526001600160a01b0388811660208701526001600160801b03881686860152908b0135606086015260c08b0135608086015292517f75ceafe60000000000000000000000000000000000000000000000000000000081529194506000939216916375ceafe69161054e91906004016125b8565b60408051808303816000875af115801561056c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610590919061261a565b915050809550600086116105cf5760405162461bcd60e51b81526020600482015260066024820152651b9bc81bdd5d60d21b6044820152606401610339565b60006105e16040890160208a016124f7565b6065549091506001600160a01b039081169082160361066757606554604051632e1a7d4d60e01b8152600481018990526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561064057600080fd5b505af1158015610654573d6000803e3d6000fd5b505050506106628688611f78565b61072d565b6040516370a0823160e01b81526001600160a01b0386811660048301528891908316906370a0823190602401602060405180830381865afa1580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d4919061263e565b10156107225760405162461bcd60e51b815260206004820152601160248201527f6e6f207365636f6e642062616c616e63650000000000000000000000000000006044820152606401610339565b61072d818789612037565b7f5a69f26ff92c092b75b6b70b0699276706fb9bff9334d0c9ae632a7121e1064d61075b60208a018a6124f7565b8261076c60608c0160408d01612543565b8961077d60808e0160608f016124f7565b604080516001600160a01b039687168152948616602086015262ffffff9093169284019290925283166060830152919091166080828101919091528a013560a082015260c0810189905260e0015b60405180910390a1505050505050919050565b600033306107fe6107f260208601866124f7565b83838760a00135611b95565b60006108188560a001356067546127106103ba919061252a565b905061083c61082a60208701876124f7565b6066546001600160a01b031683611e4b565b6066546040805161010081019091526001600160a01b039091169063414bf389908061086b60208a018a6124f7565b6001600160a01b0316815260200188602001602081019061088c91906124f7565b6001600160a01b031681526020016108aa60608a0160408b01612543565b62ffffff1681526001600160a01b03861660208201526080808a013560408301526060820186905260c08a01359082015260a0016108ef6101008a0160e08b016124f7565b6001600160a01b039081169091526040805160e085811b7fffffffff000000000000000000000000000000000000000000000000000000001682528451841660048301526020850151841660248301529184015162ffffff1660448201526060840151831660648201526080840151608482015260a084015160a482015260c084015160c48201529201511660e4820152610104016020604051808303816000875af11580156109a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c7919061263e565b935060008411610a025760405162461bcd60e51b81526020600482015260066024820152651b9bc81bdd5d60d21b6044820152606401610339565b6000610a1460408701602088016124f7565b6065549091506001600160a01b0390811690821603610a9a57606554604051632e1a7d4d60e01b8152600481018790526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015610a7357600080fd5b505af1158015610a87573d6000803e3d6000fd5b50505050610a958486611f78565b610b60565b6040516370a0823160e01b81526001600160a01b0384811660048301528691908316906370a0823190602401602060405180830381865afa158015610ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b07919061263e565b1015610b555760405162461bcd60e51b815260206004820152601160248201527f6e6f207365636f6e642062616c616e63650000000000000000000000000000006044820152606401610339565b610b60818587612037565b7fe8fb50e51c409ba8b2a2ccf51f42c865d4a3d6e3c37f202c6be508e9abcbb545610b8e60208801886124f7565b610b9e6040890160208a016124f7565b610bae60608a0160408b01612543565b87610bbf60808c0160608d016124f7565b604080516001600160a01b039687168152948616602086015262ffffff93909316848401529084166060840152909216608082015260a0898101359082015260c0810188905290519081900360e00190a150505050919050565b610c21611b3b565b60675460408051918252602082018390527f5fc463da23c1b063e66f9e352006a7fbe8db7223c455dc429e881a2dfe2f94f1910160405180910390a16127108110610cae5760405162461bcd60e51b815260206004820152600b60248201527f696e76616c6964206665650000000000000000000000000000000000000000006044820152606401610339565b606755565b610cbb611b3b565b610cc5600061214b565b565b6000610cd66020830183612657565b610ce2915060016126a8565b610cec8380612657565b905014610d3b5760405162461bcd60e51b815260206004820152601160248201527f6c656e67746820697320696e76616c69640000000000000000000000000000006044820152606401610339565b6001610d4a6020840184612657565b90501015610d9a5760405162461bcd60e51b815260206004820152601c60248201527f6c656e677468206d757374206265206d6f7265207468616e206f6e65000000006044820152606401610339565b33306000610da88580612657565b6000818110610db957610db96126bb565b9050602002016020810190610dce91906124f7565b90506000610ddf6020870187612657565b6000818110610df057610df06126bb565b9050602002016020810190610e059190612543565b90506000610e138780612657565b6001610e1f8a80612657565b610e2a92915061252a565b818110610e3957610e396126bb565b9050602002016020810190610e4e91906124f7565b9050606060005b610e6260208a018a612657565b9050811015610ef95781610e768a80612657565b83818110610e8657610e866126bb565b9050602002016020810190610e9b91906124f7565b610ea860208c018c612657565b84818110610eb857610eb86126bb565b9050602002016020810190610ecd9190612543565b604051602001610edf939291906126d1565b60408051601f198184030181529190529150600101610e55565b508082604051602001610f0d929190612735565b6040516020818303038152906040529050610f2e8487878b60800135611b95565b6000610f4889608001356067546127106103ba919061252a565b606654909150610f639086906001600160a01b031683611e4b565b6066546040805160a080820183528582526001600160a01b038a811660208401526060808f0135848601528301869052908d0135608083015291517fc04b8d59000000000000000000000000000000000000000000000000000000008152919092169163c04b8d5991610fd9919060040161276c565b6020604051808303816000875af1158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c919061263e565b97506000881161105e5760405162461bcd60e51b815260206004820152600d60248201526c1b9bc81bdd5d08185b5bdd5b9d609a1b6044820152606401610339565b506065546001600160a01b03908116908316036110e257606554604051632e1a7d4d60e01b8152600481018990526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156110bb57600080fd5b505af11580156110cf573d6000803e3d6000fd5b505050506110dd8688611f78565b6111a8565b6040516370a0823160e01b81526001600160a01b0386811660048301528891908416906370a0823190602401602060405180830381865afa15801561112b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114f919061263e565b101561119d5760405162461bcd60e51b815260206004820152600e60248201527f6e6f206f75742062616c616e63650000000000000000000000000000000000006044820152606401610339565b6111a8828789612037565b7fb5e135f011582fb424a39acd9067d32a4f3b46fda545e0080ee51ba0c554df98818584868a8d60400160208101906111e191906124f7565b8e608001358e6040516107cb9897969594939291906127c5565b611203611b3b565b6065546001600160a01b039081169083160361129257606554604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561125f57600080fd5b505af1158015611273573d6000803e3d6000fd5b5050505061037c61128c6033546001600160a01b031690565b82611f78565b816001600160a01b031663a9059cbb6112b36033546001600160a01b031690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c9190612823565b505050565b600054610100900460ff16158080156113615750600054600160ff909116105b8061137b5750303b15801561137b575060005460ff166001145b6113ed5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610339565b6000805460ff191660011790558015611410576000805461ff0019166101001790555b6114186121aa565b606580546001600160a01b0380881673ffffffffffffffffffffffffffffffffffffffff1992831617909255606680548784169083161790556067859055606880549285169290911691909117905580156114ad576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6114bc611b3b565b6068805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60006114fa6020830183612657565b611506915060016126a8565b6115108380612657565b90501461155f5760405162461bcd60e51b815260206004820152601160248201527f6c656e67746820697320696e76616c69640000000000000000000000000000006044820152606401610339565b600161156e6020840184612657565b905010156115be5760405162461bcd60e51b815260206004820152601c60248201527f6c656e677468206d757374206265206d6f7265207468616e206f6e65000000006044820152606401610339565b333060006115d26080860160608701612845565b6001600160801b0316905060006115e98680612657565b60008181106115fa576115fa6126bb565b905060200201602081019061160f91906124f7565b905060006116206020880188612657565b6000818110611631576116316126bb565b90506020020160208101906116469190612543565b905060006116548880612657565b60016116608b80612657565b61166b92915061252a565b81811061167a5761167a6126bb565b905060200201602081019061168f91906124f7565b9050606060005b6116a360208b018b612657565b905081101561173a57816116b78b80612657565b838181106116c7576116c76126bb565b90506020020160208101906116dc91906124f7565b6116e960208d018d612657565b848181106116f9576116f96126bb565b905060200201602081019061170e9190612543565b604051602001611720939291906126d1565b60408051601f198184030181529190529150600101611696565b50808260405160200161174e929190612735565b604051602081830303815290604052905061176b84888888611b95565b6000611781866067546127106103ba919061252a565b90506001600160801b038111156117da5760405162461bcd60e51b815260206004820181905260248201527f6e657720616d6f756e7420657863656564732075696e743132382072616e67656044820152606401610339565b6068546117f29086906001600160a01b031683611e4b565b6000606860009054906101000a90046001600160a01b03166001600160a01b03166375ceafe66040518060a001604052808681526020018b6001600160a01b03168152602001856001600160801b031681526020018e6080013581526020018e60a001358152506040518263ffffffff1660e01b815260040161187591906125b8565b60408051808303816000875af1158015611893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b7919061261a565b91505080995060008a116118fd5760405162461bcd60e51b815260206004820152600d60248201526c1b9bc81bdd5d08185b5bdd5b9d609a1b6044820152606401610339565b50506065546001600160a01b039081169083160361198257606554604051632e1a7d4d60e01b8152600481018a90526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561195b57600080fd5b505af115801561196f573d6000803e3d6000fd5b5050505061197d8789611f78565b611a48565b6040516370a0823160e01b81526001600160a01b0387811660048301528991908416906370a0823190602401602060405180830381865afa1580156119cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ef919061263e565b1015611a3d5760405162461bcd60e51b815260206004820152600e60248201527f6e6f206f75742062616c616e63650000000000000000000000000000000000006044820152606401610339565b611a4882888a612037565b7fd0d4efb824fe771a4f6d10739858a8a98badb041cb76f0c5ff926f61a01c7adc818584868b8e6040016020810190611a8191906124f7565b8b8f604051611a979897969594939291906127c5565b60405180910390a150505050505050919050565b611ab3611b3b565b6001600160a01b038116611b2f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610339565b611b388161214b565b50565b6033546001600160a01b03163314610cc55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610339565b6065546001600160a01b038581169116148015611bb25750804710155b15611c9e57606560009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c0757600080fd5b505af1158015611c1b573d6000803e3d6000fd5b505060655460405163a9059cbb60e01b81526001600160a01b03878116600483015260248201879052909116935063a9059cbb925060440190506020604051808303816000875af1158015611c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c989190612823565b50611cca565b306001600160a01b03841603611cbe57611cb9848383612037565b611cca565b611cca8484848461221d565b50505050565b6000808060001985870985870292508281108382030391505080600003611d095760008411611cfe57600080fd5b508290049050611e44565b808411611d1557600080fd5b600084868809808403938111909203919050600085611d36811960016126a8565b16958690049593849004936000819003046001019050611d56818461286e565b909317926000611d6787600361286e565b6002189050611d76818861286e565b611d8190600261252a565b611d8b908261286e565b9050611d97818861286e565b611da290600261252a565b611dac908261286e565b9050611db8818861286e565b611dc390600261252a565b611dcd908261286e565b9050611dd9818861286e565b611de490600261252a565b611dee908261286e565b9050611dfa818861286e565b611e0590600261252a565b611e0f908261286e565b9050611e1b818861286e565b611e2690600261252a565b611e30908261286e565b9050611e3c818661286e565b955050505050505b9392505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b03167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839290871691611ec09190612885565b6000604051808303816000865af19150503d8060008114611efd576040519150601f19603f3d011682016040523d82523d6000602084013e611f02565b606091505b5091509150818015611f2c575080511580611f2c575080806020019051810190611f2c9190612823565b6114ad5760405162461bcd60e51b815260206004820152600360248201527f4e534100000000000000000000000000000000000000000000000000000000006044820152606401610339565b604080516000808252602082019092526001600160a01b038416908390604051611fa29190612885565b60006040518083038185875af1925050503d8060008114611fdf576040519150601f19603f3d011682016040523d82523d6000602084013e611fe4565b606091505b505090508061133c5760405162461bcd60e51b81526004016103399060208082526004908201527f4e53544500000000000000000000000000000000000000000000000000000000604082015260600190565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916120939190612885565b6000604051808303816000865af19150503d80600081146120d0576040519150601f19603f3d011682016040523d82523d6000602084013e6120d5565b606091505b50915091508180156120ff5750805115806120ff5750808060200190518101906120ff9190612823565b6114ad5760405162461bcd60e51b815260206004820152600360248201527f4e535400000000000000000000000000000000000000000000000000000000006044820152606401610339565b603380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166122155760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610339565b610cc561235c565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03167f23b872dd00000000000000000000000000000000000000000000000000000000179052915160009283929088169161229a9190612885565b6000604051808303816000865af19150503d80600081146122d7576040519150601f19603f3d011682016040523d82523d6000602084013e6122dc565b606091505b50915091508180156123065750805115806123065750808060200190518101906123069190612823565b6123545760405162461bcd60e51b81526004016103399060208082526004908201527f4e53544600000000000000000000000000000000000000000000000000000000604082015260600190565b505050505050565b600054610100900460ff166123c75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610339565b610cc53361214b565b6000602082840312156123e257600080fd5b5035919050565b600060e082840312156123fb57600080fd5b50919050565b600061010082840312156123fb57600080fd5b600060c082840312156123fb57600080fd5b60006020828403121561243857600080fd5b813567ffffffffffffffff81111561244f57600080fd5b61245b84828501612414565b949350505050565b6001600160a01b0381168114611b3857600080fd5b6000806040838503121561248b57600080fd5b823561249681612463565b946020939093013593505050565b600080600080608085870312156124ba57600080fd5b84356124c581612463565b935060208501356124d581612463565b92506040850135915060608501356124ec81612463565b939692955090935050565b60006020828403121561250957600080fd5b8135611e4481612463565b634e487b7160e01b600052601160045260246000fd5b8181038181111561253d5761253d612514565b92915050565b60006020828403121561255557600080fd5b813562ffffff81168114611e4457600080fd5b60005b8381101561258357818101518382015260200161256b565b50506000910152565b600081518084526125a4816020860160208601612568565b601f01601f19169290920160200192915050565b602081526000825160a060208401526125d460c084018261258c565b90506001600160a01b0360208501511660408401526001600160801b03604085015116606084015260608401516080840152608084015160a08401528091505092915050565b6000806040838503121561262d57600080fd5b505080516020909101519092909150565b60006020828403121561265057600080fd5b5051919050565b6000808335601e1984360301811261266e57600080fd5b83018035915067ffffffffffffffff82111561268957600080fd5b6020019150600581901b36038213156126a157600080fd5b9250929050565b8082018082111561253d5761253d612514565b634e487b7160e01b600052603260045260246000fd5b600084516126e3818460208901612568565b60609490941b6bffffffffffffffffffffffff19169190930190815260e89190911b7fffffff000000000000000000000000000000000000000000000000000000000016601482015260170192915050565b60008351612747818460208801612568565b60609390931b6bffffffffffffffffffffffff19169190920190815260140192915050565b602081526000825160a0602084015261278860c084018261258c565b90506001600160a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60006101008083526127d98184018c61258c565b6001600160a01b039a8b166020850152988a166040840152505062ffffff9590951660608601529286166080850152941660a083015260c082019390935260e00191909152919050565b60006020828403121561283557600080fd5b81518015158114611e4457600080fd5b60006020828403121561285757600080fd5b81356001600160801b0381168114611e4457600080fd5b808202811582820484141761253d5761253d612514565b60008251612897818460208701612568565b919091019291505056fea26469706673582212205534aafdacad81a09535124850d3ba832b7ce0f0fefd74799bbd9c62bd495e9064736f6c63430008180033
Deployed Bytecode
0x6080604052600436106100f75760003560e01c80639e281a981161008a578063dd263f9411610059578063dd263f9414610272578063e8c4719614610285578063edae876f146102a5578063f2fde38b146102c557600080fd5b80639e281a98146101fc578063be2030941461021c578063c5b37c221461023c578063d295afc11461025257600080fd5b80636a1db1bf116100c65780636a1db1bf14610196578063715018a6146101b65780638da5cb5b146101cb57806390dcb009146101e957600080fd5b80632e1a7d4d1461010357806335adbab6146101255780633dbb12ae1461014b578063597a2f871461015e57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5061012361011e3660046123d0565b6102e5565b005b6101386101333660046123e9565b610380565b6040519081526020015b60405180910390f35b610138610159366004612401565b6107de565b34801561016a57600080fd5b5060685461017e906001600160a01b031681565b6040516001600160a01b039091168152602001610142565b3480156101a257600080fd5b506101236101b13660046123d0565b610c19565b3480156101c257600080fd5b50610123610cb3565b3480156101d757600080fd5b506033546001600160a01b031661017e565b6101386101f7366004612426565b610cc7565b34801561020857600080fd5b50610123610217366004612478565b6111fb565b34801561022857600080fd5b506101236102373660046124a4565b611341565b34801561024857600080fd5b5061013860675481565b34801561025e57600080fd5b5061012361026d3660046124f7565b6114b4565b610138610280366004612426565b6114eb565b34801561029157600080fd5b5060655461017e906001600160a01b031681565b3480156102b157600080fd5b5060665461017e906001600160a01b031681565b3480156102d157600080fd5b506101236102e03660046124f7565b611aab565b6102ed611b3b565b804710156103425760405162461bcd60e51b815260206004820152601360248201527f6e6f2073756666696369656e742065746865720000000000000000000000000060448201526064015b60405180910390fd5b6033546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561037c573d6000803e3d6000fd5b5050565b600033306103a061039460208601866124f7565b83838760800135611b95565b60006103c285608001356067546127106103ba919061252a565b612710611cd0565b90506001600160801b0381111561041b5760405162461bcd60e51b815260206004820181905260248201527f6e657720616d6f756e7420657863656564732075696e743132382072616e67656044820152606401610339565b61043d61042b60208701876124f7565b6068546001600160a01b031683611e4b565b600061044c60208701876124f7565b61045c6060880160408901612543565b61046c6040890160208a016124f7565b604051606093841b6bffffffffffffffffffffffff19908116602083015260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166034820152921b166037820152604b0160408051601f1981840301815260685460a080850184528285526001600160a01b0388811660208701526001600160801b03881686860152908b0135606086015260c08b0135608086015292517f75ceafe60000000000000000000000000000000000000000000000000000000081529194506000939216916375ceafe69161054e91906004016125b8565b60408051808303816000875af115801561056c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610590919061261a565b915050809550600086116105cf5760405162461bcd60e51b81526020600482015260066024820152651b9bc81bdd5d60d21b6044820152606401610339565b60006105e16040890160208a016124f7565b6065549091506001600160a01b039081169082160361066757606554604051632e1a7d4d60e01b8152600481018990526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561064057600080fd5b505af1158015610654573d6000803e3d6000fd5b505050506106628688611f78565b61072d565b6040516370a0823160e01b81526001600160a01b0386811660048301528891908316906370a0823190602401602060405180830381865afa1580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d4919061263e565b10156107225760405162461bcd60e51b815260206004820152601160248201527f6e6f207365636f6e642062616c616e63650000000000000000000000000000006044820152606401610339565b61072d818789612037565b7f5a69f26ff92c092b75b6b70b0699276706fb9bff9334d0c9ae632a7121e1064d61075b60208a018a6124f7565b8261076c60608c0160408d01612543565b8961077d60808e0160608f016124f7565b604080516001600160a01b039687168152948616602086015262ffffff9093169284019290925283166060830152919091166080828101919091528a013560a082015260c0810189905260e0015b60405180910390a1505050505050919050565b600033306107fe6107f260208601866124f7565b83838760a00135611b95565b60006108188560a001356067546127106103ba919061252a565b905061083c61082a60208701876124f7565b6066546001600160a01b031683611e4b565b6066546040805161010081019091526001600160a01b039091169063414bf389908061086b60208a018a6124f7565b6001600160a01b0316815260200188602001602081019061088c91906124f7565b6001600160a01b031681526020016108aa60608a0160408b01612543565b62ffffff1681526001600160a01b03861660208201526080808a013560408301526060820186905260c08a01359082015260a0016108ef6101008a0160e08b016124f7565b6001600160a01b039081169091526040805160e085811b7fffffffff000000000000000000000000000000000000000000000000000000001682528451841660048301526020850151841660248301529184015162ffffff1660448201526060840151831660648201526080840151608482015260a084015160a482015260c084015160c48201529201511660e4820152610104016020604051808303816000875af11580156109a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c7919061263e565b935060008411610a025760405162461bcd60e51b81526020600482015260066024820152651b9bc81bdd5d60d21b6044820152606401610339565b6000610a1460408701602088016124f7565b6065549091506001600160a01b0390811690821603610a9a57606554604051632e1a7d4d60e01b8152600481018790526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015610a7357600080fd5b505af1158015610a87573d6000803e3d6000fd5b50505050610a958486611f78565b610b60565b6040516370a0823160e01b81526001600160a01b0384811660048301528691908316906370a0823190602401602060405180830381865afa158015610ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b07919061263e565b1015610b555760405162461bcd60e51b815260206004820152601160248201527f6e6f207365636f6e642062616c616e63650000000000000000000000000000006044820152606401610339565b610b60818587612037565b7fe8fb50e51c409ba8b2a2ccf51f42c865d4a3d6e3c37f202c6be508e9abcbb545610b8e60208801886124f7565b610b9e6040890160208a016124f7565b610bae60608a0160408b01612543565b87610bbf60808c0160608d016124f7565b604080516001600160a01b039687168152948616602086015262ffffff93909316848401529084166060840152909216608082015260a0898101359082015260c0810188905290519081900360e00190a150505050919050565b610c21611b3b565b60675460408051918252602082018390527f5fc463da23c1b063e66f9e352006a7fbe8db7223c455dc429e881a2dfe2f94f1910160405180910390a16127108110610cae5760405162461bcd60e51b815260206004820152600b60248201527f696e76616c6964206665650000000000000000000000000000000000000000006044820152606401610339565b606755565b610cbb611b3b565b610cc5600061214b565b565b6000610cd66020830183612657565b610ce2915060016126a8565b610cec8380612657565b905014610d3b5760405162461bcd60e51b815260206004820152601160248201527f6c656e67746820697320696e76616c69640000000000000000000000000000006044820152606401610339565b6001610d4a6020840184612657565b90501015610d9a5760405162461bcd60e51b815260206004820152601c60248201527f6c656e677468206d757374206265206d6f7265207468616e206f6e65000000006044820152606401610339565b33306000610da88580612657565b6000818110610db957610db96126bb565b9050602002016020810190610dce91906124f7565b90506000610ddf6020870187612657565b6000818110610df057610df06126bb565b9050602002016020810190610e059190612543565b90506000610e138780612657565b6001610e1f8a80612657565b610e2a92915061252a565b818110610e3957610e396126bb565b9050602002016020810190610e4e91906124f7565b9050606060005b610e6260208a018a612657565b9050811015610ef95781610e768a80612657565b83818110610e8657610e866126bb565b9050602002016020810190610e9b91906124f7565b610ea860208c018c612657565b84818110610eb857610eb86126bb565b9050602002016020810190610ecd9190612543565b604051602001610edf939291906126d1565b60408051601f198184030181529190529150600101610e55565b508082604051602001610f0d929190612735565b6040516020818303038152906040529050610f2e8487878b60800135611b95565b6000610f4889608001356067546127106103ba919061252a565b606654909150610f639086906001600160a01b031683611e4b565b6066546040805160a080820183528582526001600160a01b038a811660208401526060808f0135848601528301869052908d0135608083015291517fc04b8d59000000000000000000000000000000000000000000000000000000008152919092169163c04b8d5991610fd9919060040161276c565b6020604051808303816000875af1158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c919061263e565b97506000881161105e5760405162461bcd60e51b815260206004820152600d60248201526c1b9bc81bdd5d08185b5bdd5b9d609a1b6044820152606401610339565b506065546001600160a01b03908116908316036110e257606554604051632e1a7d4d60e01b8152600481018990526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156110bb57600080fd5b505af11580156110cf573d6000803e3d6000fd5b505050506110dd8688611f78565b6111a8565b6040516370a0823160e01b81526001600160a01b0386811660048301528891908416906370a0823190602401602060405180830381865afa15801561112b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114f919061263e565b101561119d5760405162461bcd60e51b815260206004820152600e60248201527f6e6f206f75742062616c616e63650000000000000000000000000000000000006044820152606401610339565b6111a8828789612037565b7fb5e135f011582fb424a39acd9067d32a4f3b46fda545e0080ee51ba0c554df98818584868a8d60400160208101906111e191906124f7565b8e608001358e6040516107cb9897969594939291906127c5565b611203611b3b565b6065546001600160a01b039081169083160361129257606554604051632e1a7d4d60e01b8152600481018390526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561125f57600080fd5b505af1158015611273573d6000803e3d6000fd5b5050505061037c61128c6033546001600160a01b031690565b82611f78565b816001600160a01b031663a9059cbb6112b36033546001600160a01b031690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c9190612823565b505050565b600054610100900460ff16158080156113615750600054600160ff909116105b8061137b5750303b15801561137b575060005460ff166001145b6113ed5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610339565b6000805460ff191660011790558015611410576000805461ff0019166101001790555b6114186121aa565b606580546001600160a01b0380881673ffffffffffffffffffffffffffffffffffffffff1992831617909255606680548784169083161790556067859055606880549285169290911691909117905580156114ad576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6114bc611b3b565b6068805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60006114fa6020830183612657565b611506915060016126a8565b6115108380612657565b90501461155f5760405162461bcd60e51b815260206004820152601160248201527f6c656e67746820697320696e76616c69640000000000000000000000000000006044820152606401610339565b600161156e6020840184612657565b905010156115be5760405162461bcd60e51b815260206004820152601c60248201527f6c656e677468206d757374206265206d6f7265207468616e206f6e65000000006044820152606401610339565b333060006115d26080860160608701612845565b6001600160801b0316905060006115e98680612657565b60008181106115fa576115fa6126bb565b905060200201602081019061160f91906124f7565b905060006116206020880188612657565b6000818110611631576116316126bb565b90506020020160208101906116469190612543565b905060006116548880612657565b60016116608b80612657565b61166b92915061252a565b81811061167a5761167a6126bb565b905060200201602081019061168f91906124f7565b9050606060005b6116a360208b018b612657565b905081101561173a57816116b78b80612657565b838181106116c7576116c76126bb565b90506020020160208101906116dc91906124f7565b6116e960208d018d612657565b848181106116f9576116f96126bb565b905060200201602081019061170e9190612543565b604051602001611720939291906126d1565b60408051601f198184030181529190529150600101611696565b50808260405160200161174e929190612735565b604051602081830303815290604052905061176b84888888611b95565b6000611781866067546127106103ba919061252a565b90506001600160801b038111156117da5760405162461bcd60e51b815260206004820181905260248201527f6e657720616d6f756e7420657863656564732075696e743132382072616e67656044820152606401610339565b6068546117f29086906001600160a01b031683611e4b565b6000606860009054906101000a90046001600160a01b03166001600160a01b03166375ceafe66040518060a001604052808681526020018b6001600160a01b03168152602001856001600160801b031681526020018e6080013581526020018e60a001358152506040518263ffffffff1660e01b815260040161187591906125b8565b60408051808303816000875af1158015611893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b7919061261a565b91505080995060008a116118fd5760405162461bcd60e51b815260206004820152600d60248201526c1b9bc81bdd5d08185b5bdd5b9d609a1b6044820152606401610339565b50506065546001600160a01b039081169083160361198257606554604051632e1a7d4d60e01b8152600481018a90526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b15801561195b57600080fd5b505af115801561196f573d6000803e3d6000fd5b5050505061197d8789611f78565b611a48565b6040516370a0823160e01b81526001600160a01b0387811660048301528991908416906370a0823190602401602060405180830381865afa1580156119cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ef919061263e565b1015611a3d5760405162461bcd60e51b815260206004820152600e60248201527f6e6f206f75742062616c616e63650000000000000000000000000000000000006044820152606401610339565b611a4882888a612037565b7fd0d4efb824fe771a4f6d10739858a8a98badb041cb76f0c5ff926f61a01c7adc818584868b8e6040016020810190611a8191906124f7565b8b8f604051611a979897969594939291906127c5565b60405180910390a150505050505050919050565b611ab3611b3b565b6001600160a01b038116611b2f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610339565b611b388161214b565b50565b6033546001600160a01b03163314610cc55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610339565b6065546001600160a01b038581169116148015611bb25750804710155b15611c9e57606560009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c0757600080fd5b505af1158015611c1b573d6000803e3d6000fd5b505060655460405163a9059cbb60e01b81526001600160a01b03878116600483015260248201879052909116935063a9059cbb925060440190506020604051808303816000875af1158015611c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c989190612823565b50611cca565b306001600160a01b03841603611cbe57611cb9848383612037565b611cca565b611cca8484848461221d565b50505050565b6000808060001985870985870292508281108382030391505080600003611d095760008411611cfe57600080fd5b508290049050611e44565b808411611d1557600080fd5b600084868809808403938111909203919050600085611d36811960016126a8565b16958690049593849004936000819003046001019050611d56818461286e565b909317926000611d6787600361286e565b6002189050611d76818861286e565b611d8190600261252a565b611d8b908261286e565b9050611d97818861286e565b611da290600261252a565b611dac908261286e565b9050611db8818861286e565b611dc390600261252a565b611dcd908261286e565b9050611dd9818861286e565b611de490600261252a565b611dee908261286e565b9050611dfa818861286e565b611e0590600261252a565b611e0f908261286e565b9050611e1b818861286e565b611e2690600261252a565b611e30908261286e565b9050611e3c818661286e565b955050505050505b9392505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b03167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839290871691611ec09190612885565b6000604051808303816000865af19150503d8060008114611efd576040519150601f19603f3d011682016040523d82523d6000602084013e611f02565b606091505b5091509150818015611f2c575080511580611f2c575080806020019051810190611f2c9190612823565b6114ad5760405162461bcd60e51b815260206004820152600360248201527f4e534100000000000000000000000000000000000000000000000000000000006044820152606401610339565b604080516000808252602082019092526001600160a01b038416908390604051611fa29190612885565b60006040518083038185875af1925050503d8060008114611fdf576040519150601f19603f3d011682016040523d82523d6000602084013e611fe4565b606091505b505090508061133c5760405162461bcd60e51b81526004016103399060208082526004908201527f4e53544500000000000000000000000000000000000000000000000000000000604082015260600190565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916120939190612885565b6000604051808303816000865af19150503d80600081146120d0576040519150601f19603f3d011682016040523d82523d6000602084013e6120d5565b606091505b50915091508180156120ff5750805115806120ff5750808060200190518101906120ff9190612823565b6114ad5760405162461bcd60e51b815260206004820152600360248201527f4e535400000000000000000000000000000000000000000000000000000000006044820152606401610339565b603380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166122155760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610339565b610cc561235c565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03167f23b872dd00000000000000000000000000000000000000000000000000000000179052915160009283929088169161229a9190612885565b6000604051808303816000865af19150503d80600081146122d7576040519150601f19603f3d011682016040523d82523d6000602084013e6122dc565b606091505b50915091508180156123065750805115806123065750808060200190518101906123069190612823565b6123545760405162461bcd60e51b81526004016103399060208082526004908201527f4e53544600000000000000000000000000000000000000000000000000000000604082015260600190565b505050505050565b600054610100900460ff166123c75760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610339565b610cc53361214b565b6000602082840312156123e257600080fd5b5035919050565b600060e082840312156123fb57600080fd5b50919050565b600061010082840312156123fb57600080fd5b600060c082840312156123fb57600080fd5b60006020828403121561243857600080fd5b813567ffffffffffffffff81111561244f57600080fd5b61245b84828501612414565b949350505050565b6001600160a01b0381168114611b3857600080fd5b6000806040838503121561248b57600080fd5b823561249681612463565b946020939093013593505050565b600080600080608085870312156124ba57600080fd5b84356124c581612463565b935060208501356124d581612463565b92506040850135915060608501356124ec81612463565b939692955090935050565b60006020828403121561250957600080fd5b8135611e4481612463565b634e487b7160e01b600052601160045260246000fd5b8181038181111561253d5761253d612514565b92915050565b60006020828403121561255557600080fd5b813562ffffff81168114611e4457600080fd5b60005b8381101561258357818101518382015260200161256b565b50506000910152565b600081518084526125a4816020860160208601612568565b601f01601f19169290920160200192915050565b602081526000825160a060208401526125d460c084018261258c565b90506001600160a01b0360208501511660408401526001600160801b03604085015116606084015260608401516080840152608084015160a08401528091505092915050565b6000806040838503121561262d57600080fd5b505080516020909101519092909150565b60006020828403121561265057600080fd5b5051919050565b6000808335601e1984360301811261266e57600080fd5b83018035915067ffffffffffffffff82111561268957600080fd5b6020019150600581901b36038213156126a157600080fd5b9250929050565b8082018082111561253d5761253d612514565b634e487b7160e01b600052603260045260246000fd5b600084516126e3818460208901612568565b60609490941b6bffffffffffffffffffffffff19169190930190815260e89190911b7fffffff000000000000000000000000000000000000000000000000000000000016601482015260170192915050565b60008351612747818460208801612568565b60609390931b6bffffffffffffffffffffffff19169190920190815260140192915050565b602081526000825160a0602084015261278860c084018261258c565b90506001600160a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60006101008083526127d98184018c61258c565b6001600160a01b039a8b166020850152988a166040840152505062ffffff9590951660608601529286166080850152941660a083015260c082019390935260e00191909152919050565b60006020828403121561283557600080fd5b81518015158114611e4457600080fd5b60006020828403121561285757600080fd5b81356001600160801b0381168114611e4457600080fd5b808202811582820484141761253d5761253d612514565b60008251612897818460208701612568565b919091019291505056fea26469706673582212205534aafdacad81a09535124850d3ba832b7ce0f0fefd74799bbd9c62bd495e9064736f6c63430008180033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MNT
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.