Source Code
Overview
MON Balance
MON Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
StrategyVaultGuard
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IICHIVaultDepositGuard.sol";
import "./interfaces/IICHIVault.sol";
import "./libraries/TransferHelper.sol";
import "./StrategyStorage.sol";
import "./StrategyEvent.sol";
import "../utils/SwapDataParser.sol";
contract StrategyVaultGuard is
Initializable,
StrategyStorage,
StrategyEvent,
OwnableUpgradeable,
ReentrancyGuardUpgradeable
{
using SafeERC20 for IERC20;
function initialize(
IICHIVaultDepositGuard _ichiVaultDepositGuard,
address _wrappedNative
) external initializer {
__Ownable_init();
__ReentrancyGuard_init();
ichiVaultDepositGuard = _ichiVaultDepositGuard;
WRAPPED_NATIVE = _wrappedNative;
}
receive() external payable {}
modifier onlyWhitelisted(address _to) {
require(whitelistsZeroSwap[_to], "Not whitelisted");
_;
}
function deposit(
address vault,
address vaultDeployer,
address token,
uint256 amount,
uint256 minimumProceeds
) external nonReentrant returns (uint256 vaultTokens) {
require(amount > 0, "Amount must be greater than 0");
IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
IERC20(token).safeApprove(address(ichiVaultDepositGuard), amount);
vaultTokens = ichiVaultDepositGuard.forwardDepositToICHIVault(
vault,
vaultDeployer,
token,
amount,
minimumProceeds,
address(this)
);
IERC20(token).safeApprove(address(ichiVaultDepositGuard), 0);
_depositStorage(vault, token, vaultTokens, amount);
}
function deposit(
address vault,
address vaultDeployer,
uint256 minimumProceeds
) external payable nonReentrant returns (uint256 vaultTokens) {
uint256 nativeAmount = msg.value;
require(nativeAmount > 0, "Amount must be greater than 0");
vaultTokens = ichiVaultDepositGuard.forwardNativeDepositToICHIVault{
value: nativeAmount
}(vault, vaultDeployer, minimumProceeds, address(this));
_depositStorage(vault, WRAPPED_NATIVE, vaultTokens, nativeAmount);
}
function _depositStorage(
address vault,
address token,
uint256 vaultTokens,
uint256 amount
) internal {
vaultBalances[msg.sender][vault] += vaultTokens;
Deposit storage _deposit = _deposits[msg.sender][vault];
_deposit.token = token;
_deposit.lastChange = block.timestamp;
emit StrategyDeposit(msg.sender, vault, token, amount);
}
function withdraw(
address vault,
address vaultDeployer,
uint256 shares,
uint256 minAmount0,
uint256 minAmount1,
bool isNative,
bool isSwapIncluded,
SwapRequest calldata swapData
)
external
nonReentrant
onlyWhitelisted(swapData.to)
returns (uint256 amount0, uint256 amount1)
{
require(shares > 0, "Amount must be greater than 0");
require(
vaultBalances[msg.sender][vault] >= shares,
"Insufficient balance"
);
require(swapData.to != address(0), "Invalid swap data");
require(swapData.swapCallData.length >= 4, "Invalid swap data");
require(
IERC20(vault).approve(address(ichiVaultDepositGuard), shares),
"Approve failed"
);
WithdrawData memory vars;
if (isNative) {
(vars.amount0, vars.amount1) = ichiVaultDepositGuard
.forwardNativeWithdrawFromICHIVault(
vault,
vaultDeployer,
shares,
address(this),
minAmount0,
minAmount1
);
} else {
(vars.amount0, vars.amount1) = ichiVaultDepositGuard
.forwardWithdrawFromICHIVault(
vault,
vaultDeployer,
shares,
address(this),
minAmount0,
minAmount1
);
}
amount0 = vars.amount0;
amount1 = vars.amount1;
vaultBalances[msg.sender][vault] -= shares;
vars.isAllowToken0 = IICHIVault(vault).allowToken0();
vars.isAllowToken1 = IICHIVault(vault).allowToken1();
vars.token0 = IICHIVault(vault).token0();
vars.token1 = IICHIVault(vault).token1();
vars.sellToken = IERC20(vars.token1);
vars.buyToken = IERC20(vars.token0);
vars.sellAmount = vars.amount1;
if (vars.isAllowToken1) {
vars.sellToken = IERC20(vars.token0);
vars.buyToken = IERC20(vars.token1);
vars.sellAmount = vars.amount0;
}
if (isSwapIncluded) {
vars.nativeAmount = 0;
if (
address(vars.sellToken) == WRAPPED_NATIVE && vars.isAllowToken1
) {
vars.nativeAmount = vars.amount0;
}
if (
address(vars.sellToken) == WRAPPED_NATIVE && vars.isAllowToken0
) {
vars.nativeAmount = vars.amount1;
}
SwapDataParser.ExecData memory execData = SwapDataParser
.parseExecCallData(swapData.swapCallData);
//require(execData.operator != address(0), "Invalid operator");
if (
address(vars.sellToken) != WRAPPED_NATIVE &&
execData.token != address(0)
) {
require(
execData.token == address(vars.sellToken),
"Invalid token"
);
}
if (vars.sellAmount > 0) {
uint256 sellAmount = address(vars.sellToken) != WRAPPED_NATIVE
? vars.sellAmount
: vars.nativeAmount;
uint256 lowerBound = (execData.amount * 90) / 100;
uint256 upperBound = (execData.amount * 110) / 100;
require(
execData.amount > 0 &&
sellAmount >= lowerBound &&
sellAmount <= upperBound,
"Invalid amount"
);
if (address(vars.sellToken) != WRAPPED_NATIVE) {
require(vars.sellToken.approve(swapData.to, upperBound));
}
(bool success, bytes memory returndata) = swapData.to.call{
value: vars.nativeAmount
}(swapData.swapCallData);
if (!success) {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert("Swap failed");
}
}
if (address(vars.sellToken) != WRAPPED_NATIVE) {
require(vars.sellToken.approve(swapData.to, 0));
}
}
}
vars.boughtAmount = 0;
if (vars.isAllowToken1) {
vars.boughtAmount += vars.amount1;
}
if (vars.isAllowToken0) {
vars.boughtAmount += vars.amount0;
}
if (address(vars.buyToken) != WRAPPED_NATIVE) {
vars.buyToken.safeTransfer(msg.sender, vars.boughtAmount);
} else {
TransferHelper.safeTransferNative(msg.sender, vars.boughtAmount);
}
if (!isSwapIncluded) {
if (address(vars.sellToken) != WRAPPED_NATIVE) {
vars.sellToken.safeTransfer(msg.sender, vars.sellAmount);
} else {
TransferHelper.safeTransferNative(msg.sender, vars.sellAmount);
}
}
Deposit storage _deposit = _deposits[msg.sender][vault];
_deposit.lastChange = block.timestamp;
emit StrategyWithdraw(
msg.sender,
vault,
address(vars.buyToken),
shares
);
}
function getDeposit(
address user,
address vault
) external view returns (Deposit memory) {
return _deposits[user][vault];
}
function getUserAmounts(
address _user,
address _vault
) external view returns (uint256 amount0, uint256 amount1) {
return _getUserAmounts(_user, _vault);
}
function _getUserAmounts(
address _user,
address _vault
) private view returns (uint256 amount0, uint256 amount1) {
uint256 userBalance = vaultBalances[_user][_vault];
(uint256 total0, uint256 total1) = IICHIVault(_vault).getTotalAmounts();
uint256 totalSupply = IICHIVault(_vault).totalSupply();
if (totalSupply > 0) {
amount0 = (userBalance * total0) / totalSupply;
amount1 = (userBalance * total1) / totalSupply;
}
}
function toWithdraw(
address _user,
address _vault
) external view returns (uint256 amount, address token) {
(uint256 amount0, uint256 amount1) = _getUserAmounts(_user, _vault);
address token0 = IICHIVault(_vault).token0();
address token1 = IICHIVault(_vault).token1();
bool isAllowToken0 = IICHIVault(_vault).allowToken0();
amount = amount0;
token = token0;
if (isAllowToken0) {
amount = amount1;
token = token1;
}
}
function withdrawAnyToken(
address _tokenAddr,
address _to,
uint256 _amount
) external onlyOwner {
TransferHelper.safeTransfer(_tokenAddr, _to, _amount);
}
function withdrawNativeToken(
address _to,
uint256 _amount
) external onlyOwner {
TransferHelper.safeTransferNative(_to, _amount);
}
function updateWhitelist(
address _address,
bool _status
) external onlyOwner {
whitelistsZeroSwap[_address] = _status;
}
function updateIchiVaultDepositGuard(
IICHIVaultDepositGuard _ichiVaultDepositGuard
) external onlyOwner {
ichiVaultDepositGuard = _ichiVaultDepositGuard;
}
function version() public pure returns (string memory) {
return "v15";
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../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) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @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) (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 v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../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;
}
/**
* @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 v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @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 amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` 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 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// 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 Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* 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: Unlicense
pragma solidity >=0.8.4;
interface IICHIVault {
function ichiVaultFactory() external view returns (address);
function pool() external view returns (address);
function token0() external view returns (address);
function allowToken0() external view returns (bool);
function token1() external view returns (address);
function allowToken1() external view returns (bool);
function fee() external view returns (uint24);
function tickSpacing() external view returns (int24);
function ammFeeRecipient() external view returns (address);
function affiliate() external view returns (address);
function baseLower() external view returns (int24);
function baseUpper() external view returns (int24);
function limitLower() external view returns (int24);
function limitUpper() external view returns (int24);
function deposit0Max() external view returns (uint256);
function deposit1Max() external view returns (uint256);
function hysteresis() external view returns (uint256);
function getTotalAmounts() external view returns (uint256, uint256);
function getBasePosition()
external
view
returns (uint128, uint256, uint256);
function getLimitPosition()
external
view
returns (uint128, uint256, uint256);
function deposit(uint256, uint256, address) external returns (uint256);
function withdraw(uint256, address) external returns (uint256, uint256);
function currentTick() external view returns (int24);
function rebalance(
int24 _baseLower,
int24 _baseUpper,
int24 _limitLower,
int24 _limitUpper,
int256 swapQuantity
) external;
function collectFees() external returns (uint256 fees0, uint256 fees1);
function setDepositMax(uint256 _deposit0Max, uint256 _deposit1Max) external;
function setHysteresis(uint256 _hysteresis) external;
function setAmmFeeRecipient(address _ammFeeRecipient) external;
function setAffiliate(address _affiliate) external;
function totalSupply() external view returns (uint256);
event DeployICHIVault(
address indexed sender,
address indexed pool,
bool allowToken0,
bool allowToken1,
address owner,
uint256 twapPeriod
);
event SetTwapPeriod(address sender, uint32 newTwapPeriod);
event Deposit(
address indexed sender,
address indexed to,
uint256 shares,
uint256 amount0,
uint256 amount1
);
event Withdraw(
address indexed sender,
address indexed to,
uint256 shares,
uint256 amount0,
uint256 amount1
);
event Rebalance(
int24 tick,
uint256 totalAmount0,
uint256 totalAmount1,
uint256 feeAmount0,
uint256 feeAmount1,
uint256 totalSupply
);
event CollectFees(
address indexed sender,
uint256 feeAmount0,
uint256 feeAmount1
);
event Hysteresis(address indexed sender, uint256 hysteresis);
event DepositMax(
address indexed sender,
uint256 deposit0Max,
uint256 deposit1Max
);
event AmmFeeRecipient(address indexed sender, address ammFeeRecipient);
event Affiliate(address indexed sender, address affiliate);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.4;
interface IICHIVaultDepositGuard {
/// @notice Emitted when the contract is deployed.
/// @param _ICHIVaultFactory Address of the ICHIVaultFactory.
/// @param _WETH Address of the Wrapped ETH token.
event Deployed(address _ICHIVaultFactory, address _WETH);
/// @notice Emitted when a deposit is forwarded to an ICHIVault.
/// @param sender The address initiating the deposit.
/// @param vault The ICHIVault receiving the deposit.
/// @param token The token being deposited.
/// @param amount The amount of the token being deposited.
/// @param shares The amount of shares issued in the vault as a result of the deposit.
/// @param to The address receiving the vault shares.
event DepositForwarded(
address indexed sender,
address indexed vault,
address indexed token,
uint256 amount,
uint256 shares,
address to
);
/// @notice Retrieves the address of the ICHIVaultFactory.
/// @return Address of the ICHIVaultFactory.
function ICHIVaultFactory() external view returns (address);
/// @notice Retrieves the address of the Wrapped Native Token (e.g., WETH).
/// @return Address of the Wrapped Native Token.
function WRAPPED_NATIVE() external view returns (address);
/// @notice Forwards a deposit to the specified ICHIVault after input validation.
/// @dev Emits a DepositForwarded event upon success.
/// @param vault The address of the ICHIVault to deposit into.
/// @param vaultDeployer The address of the vault deployer.
/// @param token The address of the token being deposited.
/// @param amount The amount of the token being deposited.
/// @param minimumProceeds The minimum amount of vault tokens to be received.
/// @param to The address to receive the vault tokens.
/// @return vaultTokens The number of vault tokens received.
function forwardDepositToICHIVault(
address vault,
address vaultDeployer,
address token,
uint256 amount,
uint256 minimumProceeds,
address to
) external returns (uint256 vaultTokens);
/// @notice Forwards a native currency (e.g., ETH) deposit to an ICHIVault.
/// @dev Converts the native currency to Wrapped Native Token before deposit.
/// @param vault The address of the ICHIVault to deposit into.
/// @param vaultDeployer The address of the vault deployer.
/// @param minimumProceeds The minimum amount of vault tokens to be received.
/// @param to The address to receive the vault tokens.
/// @return vaultTokens The number of vault tokens received.
function forwardNativeDepositToICHIVault(
address vault,
address vaultDeployer,
uint256 minimumProceeds,
address to
) external payable returns (uint256 vaultTokens);
/// @notice Forwards a request to withdraw from an ICHIVault.
/// @param vault The address of the ICHIVault to withdraw from.
/// @param vaultDeployer The address of the vault deployer.
/// @param shares The amount of shares to withdraw.
/// @param to The address to receive the withdrawn tokens.
/// @param minAmount0 The minimum amount of token0 expected to receive.
/// @param minAmount1 The minimum amount of token1 expected to receive.
/// @return amount0 The amount of token0 received.
/// @return amount1 The amount of token1 received.
function forwardWithdrawFromICHIVault(
address vault,
address vaultDeployer,
uint256 shares,
address to,
uint256 minAmount0,
uint256 minAmount1
) external returns (uint256 amount0, uint256 amount1);
/// @notice Forwards a request to withdraw native currency from an ICHIVault.
/// @dev Converts the Wrapped Native Tokens back to native currency on withdrawal.
/// @param vault The address of the ICHIVault to withdraw from.
/// @param vaultDeployer The address of the vault deployer.
/// @param shares The amount of shares to withdraw.
/// @param to The address to receive the withdrawn native currency.
/// @param minAmount0 The minimum amount of token0 expected to receive.
/// @param minAmount1 The minimum amount of token1 expected to receive.
/// @return amount0 The amount of token0 received.
/// @return amount1 The amount of token1 received.
function forwardNativeWithdrawFromICHIVault(
address vault,
address vaultDeployer,
uint256 shares,
address to,
uint256 minAmount0,
uint256 minAmount1
) external returns (uint256 amount0, uint256 amount1);
/// @notice Computes the unique key for a vault based on given parameters.
/// @param vaultDeployer The address of the vault deployer.
/// @param token0 The address of the first token in the vault.
/// @param token1 The address of the second token in the vault.
/// @param allowToken0 Boolean indicating if token0 is allowed in the vault.
/// @param allowToken1 Boolean indicating if token1 is allowed in the vault.
/// @return key The computed unique key for the vault.
function vaultKey(
address vaultDeployer,
address token0,
address token1,
bool allowToken0,
bool allowToken1
) external view returns (bytes32 key);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
library TransferHelper {
function safeTransfer(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0xa9059cbb, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: TRANSFER_FAILED"
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(
abi.encodeWithSelector(0x23b872dd, from, to, value)
);
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: TRANSFER_FROM_FAILED"
);
}
function safeTransferNative(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, "TransferHelper: NATIVE_TRANSFER_FAILED");
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "./interfaces/IICHIVaultDepositGuard.sol";
contract StrategyEvent {
event StrategyDeposit(
address indexed user,
address indexed vault,
address indexed token,
uint256 amount
);
event StrategyWithdraw(
address indexed user,
address indexed vault,
address receivedToken,
uint256 vaultTokens
);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "./interfaces/IICHIVaultDepositGuard.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract StrategyStorage {
IICHIVaultDepositGuard public ichiVaultDepositGuard;
address public WRAPPED_NATIVE;
struct Deposit {
address token;
uint256 amount;
uint256 lastChange;
}
struct SwapRequest {
address to;
bytes swapCallData;
}
struct WithdrawData {
uint256 amount0;
uint256 amount1;
bool isAllowToken0;
bool isAllowToken1;
address token0;
address token1;
IERC20 sellToken;
IERC20 buyToken;
uint256 boughtAmount;
uint256 nativeAmount;
uint256 sellAmount;
}
mapping(address => mapping(address => Deposit)) internal _deposits;
mapping(address => mapping(address => uint256)) public vaultBalances;
mapping(address => bool) public whitelistsZeroSwap;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
/**
* @title SwapDataParser
* @dev Library for parsing swapData.swapCallData
* Parses exec method call: exec(address operator, address token, uint256 amount, address payable target, bytes calldata data)
*/
library SwapDataParser {
// Exec method selector: 0x2213bc0b
bytes4 constant EXEC_SELECTOR = 0x2213bc0b;
// Structure for storing parsed data
struct ExecData {
address operator;
address token;
uint256 amount;
address target;
}
/**
* @dev Parses swapCallData and extracts exec method parameters
* @param swapCallData - encoded exec method call data
* @return execData - structure with parsed parameters
*/
function parseExecCallData(bytes calldata swapCallData)
internal
pure
returns (ExecData memory execData)
{
require(swapCallData.length >= 4, "SwapDataParser: Invalid data length");
// Check selector
bytes4 selector = bytes4(swapCallData[:4]);
require(selector == EXEC_SELECTOR, "SwapDataParser: Invalid selector");
assembly {
// Skip selector (4 bytes)
let dataPtr := add(swapCallData.offset, 4)
// Read operator (address - 32 bytes)
mstore(add(execData, 0), shr(0, calldataload(dataPtr)))
dataPtr := add(dataPtr, 32)
// Read token (address - 32 bytes)
mstore(add(execData, 32), shr(0, calldataload(dataPtr)))
dataPtr := add(dataPtr, 32)
// Read amount (uint256 - 32 bytes)
mstore(add(execData, 64), calldataload(dataPtr))
dataPtr := add(dataPtr, 32)
// Read target (address - 32 bytes)
mstore(add(execData, 96), shr(0, calldataload(dataPtr)))
dataPtr := add(dataPtr, 32)
}
}
/**
* @dev Checks if swapCallData contains exec method call
* @param swapCallData - encoded call data
* @return bool - true if it's an exec method call
*/
function isExecCall(bytes calldata swapCallData) internal pure returns (bool) {
if (swapCallData.length < 4) return false;
return bytes4(swapCallData[:4]) == EXEC_SELECTOR;
}
/**
* @dev Extracts only operator from swapCallData
* @param swapCallData - encoded call data
* @return operator - operator address
*/
function getOperator(bytes calldata swapCallData) internal pure returns (address operator) {
require(isExecCall(swapCallData), "SwapDataParser: Not an exec call");
assembly {
// Skip selector and read operator
operator := shr(96, calldataload(add(swapCallData.offset, 4)))
}
}
/**
* @dev Extracts only token from swapCallData
* @param swapCallData - encoded call data
* @return token - token address
*/
function getToken(bytes calldata swapCallData) internal pure returns (address token) {
require(isExecCall(swapCallData), "SwapDataParser: Not an exec call");
assembly {
// Skip selector + operator and read token
token := shr(96, calldataload(add(swapCallData.offset, 36)))
}
}
/**
* @dev Extracts only amount from swapCallData
* @param swapCallData - encoded call data
* @return amount - token amount
*/
function getAmount(bytes calldata swapCallData) internal pure returns (uint256 amount) {
require(isExecCall(swapCallData), "SwapDataParser: Not an exec call");
assembly {
// Skip selector + operator + token and read amount
amount := calldataload(add(swapCallData.offset, 68))
}
}
/**
* @dev Extracts only target from swapCallData
* @param swapCallData - encoded call data
* @return target - target address
*/
function getTarget(bytes calldata swapCallData) internal pure returns (address target) {
require(isExecCall(swapCallData), "SwapDataParser: Not an exec call");
assembly {
// Skip selector + operator + token + amount and read target
target := shr(96, calldataload(add(swapCallData.offset, 100)))
}
}
/**
* @dev Extracts only data from swapCallData
* @param swapCallData - encoded call data
* @return data - additional data
*/
function getData(bytes calldata swapCallData) internal pure returns (bytes memory data) {
require(isExecCall(swapCallData), "SwapDataParser: Not an exec call");
assembly {
// Skip selector + operator + token + amount + target and read data offset
let dataOffset := calldataload(add(swapCallData.offset, 132))
let dataPtr := add(swapCallData.offset, dataOffset)
// Read data length
let dataLength := calldataload(dataPtr)
dataPtr := add(dataPtr, 32)
// Copy data to memory
data := mload(0x40)
mstore(data, dataLength)
calldatacopy(add(data, 32), dataPtr, dataLength)
mstore(0x40, add(add(data, 32), add(dataLength, 31)))
}
}
/**
* @dev Validates SwapRequest structure
* @param to - contract address to call
* @param swapCallData - encoded call data
* @return bool - true if valid
*/
function validateSwapRequest(address to, bytes calldata swapCallData) internal pure returns (bool) {
if (to == address(0)) return false;
if (swapCallData.length < 4) return false;
if (!isExecCall(swapCallData)) return false;
return true;
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"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":"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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StrategyDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"address","name":"receivedToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"vaultTokens","type":"uint256"}],"name":"StrategyWithdraw","type":"event"},{"inputs":[],"name":"WRAPPED_NATIVE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"vaultDeployer","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minimumProceeds","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"vaultTokens","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"vaultDeployer","type":"address"},{"internalType":"uint256","name":"minimumProceeds","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"vaultTokens","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"vault","type":"address"}],"name":"getDeposit","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"lastChange","type":"uint256"}],"internalType":"struct StrategyStorage.Deposit","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_vault","type":"address"}],"name":"getUserAmounts","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ichiVaultDepositGuard","outputs":[{"internalType":"contract IICHIVaultDepositGuard","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IICHIVaultDepositGuard","name":"_ichiVaultDepositGuard","type":"address"},{"internalType":"address","name":"_wrappedNative","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","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":"_user","type":"address"},{"internalType":"address","name":"_vault","type":"address"}],"name":"toWithdraw","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IICHIVaultDepositGuard","name":"_ichiVaultDepositGuard","type":"address"}],"name":"updateIchiVaultDepositGuard","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"updateWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"vaultBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistsZeroSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"vaultDeployer","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"minAmount0","type":"uint256"},{"internalType":"uint256","name":"minAmount1","type":"uint256"},{"internalType":"bool","name":"isNative","type":"bool"},{"internalType":"bool","name":"isSwapIncluded","type":"bool"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"swapCallData","type":"bytes"}],"internalType":"struct StrategyStorage.SwapRequest","name":"swapData","type":"tuple"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddr","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawAnyToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawNativeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052348015600f57600080fd5b5061275e8061001f6000396000f3fe6080604052600436106101185760003560e01c80638340f549116100a0578063d2571ec111610064578063d2571ec11461036e578063d999984d146103ab578063db53a5b1146103cb578063f2fde38b14610400578063fb099af21461042057600080fd5b80638340f549146102805780638da5cb5b14610293578063af160910146102c5578063c35082a9146102eb578063ce5100181461033657600080fd5b8063485cc955116100e7578063485cc955146101d9578063536c6bfa146101f957806354fd4d50146102195780635e1d68041461024b578063715018a61461026b57600080fd5b806302b9446c146101245780630d392cd914610157578063275a6c90146101795780633b029b011461019957600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5061014461013f36600461224e565b610440565b6040519081526020015b60405180910390f35b34801561016357600080fd5b506101776101723660046122b7565b610587565b005b34801561018557600080fd5b506101776101943660046122f0565b6105ba565b3480156101a557600080fd5b506101c96101b43660046122f0565b60046020526000908152604090205460ff1681565b604051901515815260200161014e565b3480156101e557600080fd5b506101776101f436600461230d565b6105ec565b34801561020557600080fd5b5061017761021436600461233b565b610748565b34801561022557600080fd5b50604080518082018252600381526276313560e81b6020820152905161014e919061238b565b34801561025757600080fd5b506101776102663660046123be565b61075e565b34801561027757600080fd5b50610177610771565b61014461028e3660046123be565b610785565b34801561029f57600080fd5b506037546001600160a01b03165b6040516001600160a01b03909116815260200161014e565b3480156102d157600080fd5b506000546102ad906201000090046001600160a01b031681565b3480156102f757600080fd5b5061030b61030636600461230d565b610869565b6040805182516001600160a01b0316815260208084015190820152918101519082015260600161014e565b34801561034257600080fd5b5061014461035136600461230d565b600360209081526000928352604080842090915290825290205481565b34801561037a57600080fd5b5061038e61038936600461230d565b6108e6565b604080519283526001600160a01b0390911660208301520161014e565b3480156103b757600080fd5b506001546102ad906001600160a01b031681565b3480156103d757600080fd5b506103eb6103e63660046123ff565b610a4b565b6040805192835260208301919091520161014e565b34801561040c57600080fd5b5061017761041b3660046122f0565b6116cf565b34801561042c57600080fd5b506103eb61043b36600461230d565b611748565b600061044a611761565b600083116104735760405162461bcd60e51b815260040161046a906124ab565b60405180910390fd5b6104886001600160a01b0385163330866117ba565b6000546104a8906001600160a01b0386811691620100009004168561182b565b600054604051635d123e3f60e01b81526001600160a01b0388811660048301528781166024830152868116604483015260648201869052608482018590523060a48301526201000090920490911690635d123e3f9060c4016020604051808303816000875af115801561051f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054391906124e2565b60008054919250610568916001600160a01b038781169262010000909204169061182b565b61057486858386611940565b61057e6001606955565b95945050505050565b61058f6119ff565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6105c26119ff565b600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b600054610100900460ff161580801561060c5750600054600160ff909116105b806106265750303b158015610626575060005460ff166001145b6106895760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161046a565b6000805460ff1916600117905580156106ac576000805461ff0019166101001790555b6106b4611a59565b6106bc611a88565b6000805462010000600160b01b031916620100006001600160a01b038681169190910291909117909155600180546001600160a01b0319169184169190911790558015610743576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6107506119ff565b61075a8282611ab7565b5050565b6107666119ff565b610743838383611b83565b6107796119ff565b6107836000611c9e565b565b600061078f611761565b34806107ad5760405162461bcd60e51b815260040161046a906124ab565b600054604051639b6470e360e01b81526001600160a01b0387811660048301528681166024830152604482018690523060648301526201000090920490911690639b6470e390839060840160206040518083038185885af1158015610816573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061083b91906124e2565b6001549092506108579086906001600160a01b03168484611940565b506108626001606955565b9392505050565b610896604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b506001600160a01b03808316600090815260026020818152604080842086861685528252928390208351606081018552815490951685526001810154918501919091520154908201525b92915050565b6000806000806108f68686611cf0565b915091506000856001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561093a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095e91906124fb565b90506000866001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c491906124fb565b90506000876001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2a9190612518565b90508496508295508015610a3f578396508195505b50505050509250929050565b600080610a56611761565b610a6360208401846122f0565b6001600160a01b03811660009081526004602052604090205460ff16610abd5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081dda1a5d195b1a5cdd1959608a1b604482015260640161046a565b60008911610add5760405162461bcd60e51b815260040161046a906124ab565b3360009081526003602090815260408083206001600160a01b038f168452909152902054891115610b475760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015260640161046a565b6000610b5660208601866122f0565b6001600160a01b031603610ba05760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642073776170206461746160781b604482015260640161046a565b6004610baf6020860186612535565b90501015610bf35760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642073776170206461746160781b604482015260640161046a565b60005460405163095ea7b360e01b8152620100009091046001600160a01b039081166004830152602482018b90528c169063095ea7b3906044016020604051808303816000875af1158015610c4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c709190612518565b610cad5760405162461bcd60e51b815260206004820152600e60248201526d105c1c1c9bdd994819985a5b195960921b604482015260640161046a565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101919091528615610da557600060029054906101000a90046001600160a01b03166001600160a01b0316638f44f0ee8d8d8d308e8e6040518763ffffffff1660e01b8152600401610d579695949392919061257c565b60408051808303816000875af1158015610d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9991906125b6565b60208301528152610e3a565b600060029054906101000a90046001600160a01b03166001600160a01b0316631a0e8cdf8d8d8d308e8e6040518763ffffffff1660e01b8152600401610df09695949392919061257c565b60408051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3291906125b6565b602083015281525b80600001519350806020015192508960036000336001600160a01b03166001600160a01b0316815260200190815260200160002060008e6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ea091906125f0565b925050819055508b6001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ee5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f099190612518565b8160400190151590811515815250508b6001600160a01b03166337e41b406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7a9190612518565b1515606082015260408051630dfe168160e01b815290516001600160a01b038e1691630dfe16819160048083019260209291908290030181865afa158015610fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fea91906124fb565b81608001906001600160a01b031690816001600160a01b0316815250508b6001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611045573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106991906124fb565b6001600160a01b0390811660a0830181905260c083015260808201511660e082015260208101516101408201526060810151156110c95760808101516001600160a01b0390811660c083015260a08201511660e082015280516101408201525b85156114fd57600061012082015260015460c08201516001600160a01b0390811691161480156110fa575080606001515b156111085780516101208201525b60015460c08201516001600160a01b03908116911614801561112b575080604001515b1561113c5760208101516101208201525b600061115361114e6020880188612535565b611e27565b60015460c08401519192506001600160a01b03918216911614801590611185575060208101516001600160a01b031615155b156111e3578160c001516001600160a01b031681602001516001600160a01b0316146111e35760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b604482015260640161046a565b610140820151156114fb5760015460c08301516000916001600160a01b039081169116036112165782610120015161121d565b8261014001515b9050600060648360400151605a6112349190612603565b61123e919061261a565b9050600060648460400151606e6112559190612603565b61125f919061261a565b9050600084604001511180156112755750818310155b80156112815750808311155b6112be5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b604482015260640161046a565b60015460c08601516001600160a01b039081169116146113725760c08501516001600160a01b031663095ea7b36112f860208c018c6122f0565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611345573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113699190612518565b61137257600080fd5b60008061138260208c018c6122f0565b6001600160a01b03168761012001518c80602001906113a19190612535565b6040516113af92919061263c565b60006040518083038185875af1925050503d80600081146113ec576040519150601f19603f3d011682016040523d82523d6000602084013e6113f1565b606091505b5091509150816114415780511561140b5780518082602001fd5b60405162461bcd60e51b815260206004820152600b60248201526a14ddd85c0819985a5b195960aa1b604482015260640161046a565b60015460c08801516001600160a01b039081169116146114f55760c08701516001600160a01b031663095ea7b361147b60208e018e6122f0565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152600060248201526044016020604051808303816000875af11580156114c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ec9190612518565b6114f557600080fd5b50505050505b505b600061010082015260608101511561152a5780602001518161010001818151611526919061264c565b9052505b80604001511561154c5780516101008201805161154890839061264c565b9052505b60015460e08201516001600160a01b039081169116146115925761158d338261010001518360e001516001600160a01b0316611f4d9092919063ffffffff16565b6115a1565b6115a133826101000151611ab7565b856115fb5760015460c08201516001600160a01b039081169116146115ec576115e7338261014001518360c001516001600160a01b0316611f4d9092919063ffffffff16565b6115fb565b6115fb33826101400151611ab7565b600060026000336001600160a01b03166001600160a01b0316815260200190815260200160002060008e6001600160a01b03166001600160a01b0316815260200190815260200160002090504281600201819055508c6001600160a01b0316336001600160a01b03167f8459175f26e01b7db52d253b45996240e8e6507df50dcc0fe55b4dd54074ab228460e001518e6040516116ad9291906001600160a01b03929092168252602082015260400190565b60405180910390a35050506116c26001606955565b9850989650505050505050565b6116d76119ff565b6001600160a01b03811661173c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161046a565b61174581611c9e565b50565b6000806117558484611cf0565b915091505b9250929050565b6002606954036117b35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161046a565b6002606955565b6040516001600160a01b03808516602483015283166044820152606481018290526118259085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f7d565b50505050565b8015806118a55750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561187f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a391906124e2565b155b6119105760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161046a565b6040516001600160a01b03831660248201526044810182905261074390849063095ea7b360e01b906064016117ee565b3360009081526003602090815260408083206001600160a01b03881684529091528120805484929061197390849061264c565b90915550503360008181526002602081815260408084206001600160a01b038a81168087529184529482902080546001600160a01b031916958a169586178155429481019490945590518681529294909290917fcc3d99ef3608eafdfce86498089694111f40a0dd5b2841cba24bf2dfde1cc16c910160405180910390a45050505050565b6001606955565b6037546001600160a01b031633146107835760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046a565b600054610100900460ff16611a805760405162461bcd60e51b815260040161046a9061265f565b610783612052565b600054610100900460ff16611aaf5760405162461bcd60e51b815260040161046a9061265f565b610783612082565b604080516000808252602082019092526001600160a01b038416908390604051611ae191906126aa565b60006040518083038185875af1925050503d8060008114611b1e576040519150601f19603f3d011682016040523d82523d6000602084013e611b23565b606091505b50509050806107435760405162461bcd60e51b815260206004820152602660248201527f5472616e7366657248656c7065723a204e41544956455f5452414e534645525f60448201526511905253115160d21b606482015260840161046a565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611bdf91906126aa565b6000604051808303816000865af19150503d8060008114611c1c576040519150601f19603f3d011682016040523d82523d6000602084013e611c21565b606091505b5091509150818015611c4b575080511580611c4b575080806020019051810190611c4b9190612518565b611c975760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015260640161046a565b5050505050565b603780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03808316600090815260036020908152604080832093851680845293909152808220548151636253bb0f60e11b815282519394859492938593849363c4a7761e9260048083019391928290030181865afa158015611d59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7d91906125b6565b915091506000866001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de591906124e2565b90508015611e1c5780611df88486612603565b611e02919061261a565b955080611e0f8386612603565b611e19919061261a565b94505b505050509250929050565b6040805160808101825260008082526020820181905291810182905260608101919091526004821015611ea85760405162461bcd60e51b815260206004820152602360248201527f53776170446174615061727365723a20496e76616c69642064617461206c656e6044820152620cee8d60eb1b606482015260840161046a565b6000611eb760048285876126c6565b611ec0916126f0565b90506001600160e01b03198116632213bc0b60e01b14611f225760405162461bcd60e51b815260206004820181905260248201527f53776170446174615061727365723a20496e76616c69642073656c6563746f72604482015260640161046a565b5060048301358152602483013560208201526044830135604082015260649092013560608301525090565b6040516001600160a01b03831660248201526044810182905261074390849063a9059cbb60e01b906064016117ee565b6000611fd2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120a99092919063ffffffff16565b9050805160001480611ff3575080806020019051810190611ff39190612518565b6107435760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161046a565b600054610100900460ff166120795760405162461bcd60e51b815260040161046a9061265f565b61078333611c9e565b600054610100900460ff166119f85760405162461bcd60e51b815260040161046a9061265f565b60606120b884846000856120c0565b949350505050565b6060824710156121215760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161046a565b600080866001600160a01b0316858760405161213d91906126aa565b60006040518083038185875af1925050503d806000811461217a576040519150601f19603f3d011682016040523d82523d6000602084013e61217f565b606091505b50915091506121908783838761219b565b979650505050505050565b6060831561220a578251600003612203576001600160a01b0385163b6122035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161046a565b50816120b8565b6120b8838381511561221f5781518083602001fd5b8060405162461bcd60e51b815260040161046a919061238b565b6001600160a01b038116811461174557600080fd5b600080600080600060a0868803121561226657600080fd5b853561227181612239565b9450602086013561228181612239565b9350604086013561229181612239565b94979396509394606081013594506080013592915050565b801515811461174557600080fd5b600080604083850312156122ca57600080fd5b82356122d581612239565b915060208301356122e5816122a9565b809150509250929050565b60006020828403121561230257600080fd5b813561086281612239565b6000806040838503121561232057600080fd5b823561232b81612239565b915060208301356122e581612239565b6000806040838503121561234e57600080fd5b823561235981612239565b946020939093013593505050565b60005b8381101561238257818101518382015260200161236a565b50506000910152565b60208152600082518060208401526123aa816040850160208701612367565b601f01601f19169190910160400192915050565b6000806000606084860312156123d357600080fd5b83356123de81612239565b925060208401356123ee81612239565b929592945050506040919091013590565b600080600080600080600080610100898b03121561241c57600080fd5b883561242781612239565b9750602089013561243781612239565b965060408901359550606089013594506080890135935060a089013561245c816122a9565b925060c089013561246c816122a9565b915060e089013567ffffffffffffffff81111561248857600080fd5b89016040818c03121561249a57600080fd5b809150509295985092959890939650565b6020808252601d908201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604082015260600190565b6000602082840312156124f457600080fd5b5051919050565b60006020828403121561250d57600080fd5b815161086281612239565b60006020828403121561252a57600080fd5b8151610862816122a9565b6000808335601e1984360301811261254c57600080fd5b83018035915067ffffffffffffffff82111561256757600080fd5b60200191503681900382131561175a57600080fd5b6001600160a01b0396871681529486166020860152604085019390935293166060830152608082019290925260a081019190915260c00190565b600080604083850312156125c957600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601160045260246000fd5b818103818111156108e0576108e06125da565b80820281158282048414176108e0576108e06125da565b60008261263757634e487b7160e01b600052601260045260246000fd5b500490565b8183823760009101908152919050565b808201808211156108e0576108e06125da565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082516126bc818460208701612367565b9190910192915050565b600080858511156126d657600080fd5b838611156126e357600080fd5b5050820193919092039150565b80356001600160e01b03198116906004841015612721576001600160e01b0319600485900360031b81901b82161691505b509291505056fea264697066735822122030f230d471778f6f55e7dd4d2841be4d0b4d9e48c66e6f008e5ef485b1b8fe7064736f6c634300081a0033
Deployed Bytecode
0x6080604052600436106101185760003560e01c80638340f549116100a0578063d2571ec111610064578063d2571ec11461036e578063d999984d146103ab578063db53a5b1146103cb578063f2fde38b14610400578063fb099af21461042057600080fd5b80638340f549146102805780638da5cb5b14610293578063af160910146102c5578063c35082a9146102eb578063ce5100181461033657600080fd5b8063485cc955116100e7578063485cc955146101d9578063536c6bfa146101f957806354fd4d50146102195780635e1d68041461024b578063715018a61461026b57600080fd5b806302b9446c146101245780630d392cd914610157578063275a6c90146101795780633b029b011461019957600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5061014461013f36600461224e565b610440565b6040519081526020015b60405180910390f35b34801561016357600080fd5b506101776101723660046122b7565b610587565b005b34801561018557600080fd5b506101776101943660046122f0565b6105ba565b3480156101a557600080fd5b506101c96101b43660046122f0565b60046020526000908152604090205460ff1681565b604051901515815260200161014e565b3480156101e557600080fd5b506101776101f436600461230d565b6105ec565b34801561020557600080fd5b5061017761021436600461233b565b610748565b34801561022557600080fd5b50604080518082018252600381526276313560e81b6020820152905161014e919061238b565b34801561025757600080fd5b506101776102663660046123be565b61075e565b34801561027757600080fd5b50610177610771565b61014461028e3660046123be565b610785565b34801561029f57600080fd5b506037546001600160a01b03165b6040516001600160a01b03909116815260200161014e565b3480156102d157600080fd5b506000546102ad906201000090046001600160a01b031681565b3480156102f757600080fd5b5061030b61030636600461230d565b610869565b6040805182516001600160a01b0316815260208084015190820152918101519082015260600161014e565b34801561034257600080fd5b5061014461035136600461230d565b600360209081526000928352604080842090915290825290205481565b34801561037a57600080fd5b5061038e61038936600461230d565b6108e6565b604080519283526001600160a01b0390911660208301520161014e565b3480156103b757600080fd5b506001546102ad906001600160a01b031681565b3480156103d757600080fd5b506103eb6103e63660046123ff565b610a4b565b6040805192835260208301919091520161014e565b34801561040c57600080fd5b5061017761041b3660046122f0565b6116cf565b34801561042c57600080fd5b506103eb61043b36600461230d565b611748565b600061044a611761565b600083116104735760405162461bcd60e51b815260040161046a906124ab565b60405180910390fd5b6104886001600160a01b0385163330866117ba565b6000546104a8906001600160a01b0386811691620100009004168561182b565b600054604051635d123e3f60e01b81526001600160a01b0388811660048301528781166024830152868116604483015260648201869052608482018590523060a48301526201000090920490911690635d123e3f9060c4016020604051808303816000875af115801561051f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054391906124e2565b60008054919250610568916001600160a01b038781169262010000909204169061182b565b61057486858386611940565b61057e6001606955565b95945050505050565b61058f6119ff565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6105c26119ff565b600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b600054610100900460ff161580801561060c5750600054600160ff909116105b806106265750303b158015610626575060005460ff166001145b6106895760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161046a565b6000805460ff1916600117905580156106ac576000805461ff0019166101001790555b6106b4611a59565b6106bc611a88565b6000805462010000600160b01b031916620100006001600160a01b038681169190910291909117909155600180546001600160a01b0319169184169190911790558015610743576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6107506119ff565b61075a8282611ab7565b5050565b6107666119ff565b610743838383611b83565b6107796119ff565b6107836000611c9e565b565b600061078f611761565b34806107ad5760405162461bcd60e51b815260040161046a906124ab565b600054604051639b6470e360e01b81526001600160a01b0387811660048301528681166024830152604482018690523060648301526201000090920490911690639b6470e390839060840160206040518083038185885af1158015610816573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061083b91906124e2565b6001549092506108579086906001600160a01b03168484611940565b506108626001606955565b9392505050565b610896604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b506001600160a01b03808316600090815260026020818152604080842086861685528252928390208351606081018552815490951685526001810154918501919091520154908201525b92915050565b6000806000806108f68686611cf0565b915091506000856001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561093a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095e91906124fb565b90506000866001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c491906124fb565b90506000876001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2a9190612518565b90508496508295508015610a3f578396508195505b50505050509250929050565b600080610a56611761565b610a6360208401846122f0565b6001600160a01b03811660009081526004602052604090205460ff16610abd5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081dda1a5d195b1a5cdd1959608a1b604482015260640161046a565b60008911610add5760405162461bcd60e51b815260040161046a906124ab565b3360009081526003602090815260408083206001600160a01b038f168452909152902054891115610b475760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015260640161046a565b6000610b5660208601866122f0565b6001600160a01b031603610ba05760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642073776170206461746160781b604482015260640161046a565b6004610baf6020860186612535565b90501015610bf35760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642073776170206461746160781b604482015260640161046a565b60005460405163095ea7b360e01b8152620100009091046001600160a01b039081166004830152602482018b90528c169063095ea7b3906044016020604051808303816000875af1158015610c4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c709190612518565b610cad5760405162461bcd60e51b815260206004820152600e60248201526d105c1c1c9bdd994819985a5b195960921b604482015260640161046a565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101919091528615610da557600060029054906101000a90046001600160a01b03166001600160a01b0316638f44f0ee8d8d8d308e8e6040518763ffffffff1660e01b8152600401610d579695949392919061257c565b60408051808303816000875af1158015610d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9991906125b6565b60208301528152610e3a565b600060029054906101000a90046001600160a01b03166001600160a01b0316631a0e8cdf8d8d8d308e8e6040518763ffffffff1660e01b8152600401610df09695949392919061257c565b60408051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3291906125b6565b602083015281525b80600001519350806020015192508960036000336001600160a01b03166001600160a01b0316815260200190815260200160002060008e6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610ea091906125f0565b925050819055508b6001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ee5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f099190612518565b8160400190151590811515815250508b6001600160a01b03166337e41b406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7a9190612518565b1515606082015260408051630dfe168160e01b815290516001600160a01b038e1691630dfe16819160048083019260209291908290030181865afa158015610fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fea91906124fb565b81608001906001600160a01b031690816001600160a01b0316815250508b6001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611045573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106991906124fb565b6001600160a01b0390811660a0830181905260c083015260808201511660e082015260208101516101408201526060810151156110c95760808101516001600160a01b0390811660c083015260a08201511660e082015280516101408201525b85156114fd57600061012082015260015460c08201516001600160a01b0390811691161480156110fa575080606001515b156111085780516101208201525b60015460c08201516001600160a01b03908116911614801561112b575080604001515b1561113c5760208101516101208201525b600061115361114e6020880188612535565b611e27565b60015460c08401519192506001600160a01b03918216911614801590611185575060208101516001600160a01b031615155b156111e3578160c001516001600160a01b031681602001516001600160a01b0316146111e35760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b604482015260640161046a565b610140820151156114fb5760015460c08301516000916001600160a01b039081169116036112165782610120015161121d565b8261014001515b9050600060648360400151605a6112349190612603565b61123e919061261a565b9050600060648460400151606e6112559190612603565b61125f919061261a565b9050600084604001511180156112755750818310155b80156112815750808311155b6112be5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b604482015260640161046a565b60015460c08601516001600160a01b039081169116146113725760c08501516001600160a01b031663095ea7b36112f860208c018c6122f0565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611345573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113699190612518565b61137257600080fd5b60008061138260208c018c6122f0565b6001600160a01b03168761012001518c80602001906113a19190612535565b6040516113af92919061263c565b60006040518083038185875af1925050503d80600081146113ec576040519150601f19603f3d011682016040523d82523d6000602084013e6113f1565b606091505b5091509150816114415780511561140b5780518082602001fd5b60405162461bcd60e51b815260206004820152600b60248201526a14ddd85c0819985a5b195960aa1b604482015260640161046a565b60015460c08801516001600160a01b039081169116146114f55760c08701516001600160a01b031663095ea7b361147b60208e018e6122f0565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152600060248201526044016020604051808303816000875af11580156114c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ec9190612518565b6114f557600080fd5b50505050505b505b600061010082015260608101511561152a5780602001518161010001818151611526919061264c565b9052505b80604001511561154c5780516101008201805161154890839061264c565b9052505b60015460e08201516001600160a01b039081169116146115925761158d338261010001518360e001516001600160a01b0316611f4d9092919063ffffffff16565b6115a1565b6115a133826101000151611ab7565b856115fb5760015460c08201516001600160a01b039081169116146115ec576115e7338261014001518360c001516001600160a01b0316611f4d9092919063ffffffff16565b6115fb565b6115fb33826101400151611ab7565b600060026000336001600160a01b03166001600160a01b0316815260200190815260200160002060008e6001600160a01b03166001600160a01b0316815260200190815260200160002090504281600201819055508c6001600160a01b0316336001600160a01b03167f8459175f26e01b7db52d253b45996240e8e6507df50dcc0fe55b4dd54074ab228460e001518e6040516116ad9291906001600160a01b03929092168252602082015260400190565b60405180910390a35050506116c26001606955565b9850989650505050505050565b6116d76119ff565b6001600160a01b03811661173c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161046a565b61174581611c9e565b50565b6000806117558484611cf0565b915091505b9250929050565b6002606954036117b35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161046a565b6002606955565b6040516001600160a01b03808516602483015283166044820152606481018290526118259085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f7d565b50505050565b8015806118a55750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561187f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a391906124e2565b155b6119105760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161046a565b6040516001600160a01b03831660248201526044810182905261074390849063095ea7b360e01b906064016117ee565b3360009081526003602090815260408083206001600160a01b03881684529091528120805484929061197390849061264c565b90915550503360008181526002602081815260408084206001600160a01b038a81168087529184529482902080546001600160a01b031916958a169586178155429481019490945590518681529294909290917fcc3d99ef3608eafdfce86498089694111f40a0dd5b2841cba24bf2dfde1cc16c910160405180910390a45050505050565b6001606955565b6037546001600160a01b031633146107835760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046a565b600054610100900460ff16611a805760405162461bcd60e51b815260040161046a9061265f565b610783612052565b600054610100900460ff16611aaf5760405162461bcd60e51b815260040161046a9061265f565b610783612082565b604080516000808252602082019092526001600160a01b038416908390604051611ae191906126aa565b60006040518083038185875af1925050503d8060008114611b1e576040519150601f19603f3d011682016040523d82523d6000602084013e611b23565b606091505b50509050806107435760405162461bcd60e51b815260206004820152602660248201527f5472616e7366657248656c7065723a204e41544956455f5452414e534645525f60448201526511905253115160d21b606482015260840161046a565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611bdf91906126aa565b6000604051808303816000865af19150503d8060008114611c1c576040519150601f19603f3d011682016040523d82523d6000602084013e611c21565b606091505b5091509150818015611c4b575080511580611c4b575080806020019051810190611c4b9190612518565b611c975760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015260640161046a565b5050505050565b603780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03808316600090815260036020908152604080832093851680845293909152808220548151636253bb0f60e11b815282519394859492938593849363c4a7761e9260048083019391928290030181865afa158015611d59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7d91906125b6565b915091506000866001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de591906124e2565b90508015611e1c5780611df88486612603565b611e02919061261a565b955080611e0f8386612603565b611e19919061261a565b94505b505050509250929050565b6040805160808101825260008082526020820181905291810182905260608101919091526004821015611ea85760405162461bcd60e51b815260206004820152602360248201527f53776170446174615061727365723a20496e76616c69642064617461206c656e6044820152620cee8d60eb1b606482015260840161046a565b6000611eb760048285876126c6565b611ec0916126f0565b90506001600160e01b03198116632213bc0b60e01b14611f225760405162461bcd60e51b815260206004820181905260248201527f53776170446174615061727365723a20496e76616c69642073656c6563746f72604482015260640161046a565b5060048301358152602483013560208201526044830135604082015260649092013560608301525090565b6040516001600160a01b03831660248201526044810182905261074390849063a9059cbb60e01b906064016117ee565b6000611fd2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120a99092919063ffffffff16565b9050805160001480611ff3575080806020019051810190611ff39190612518565b6107435760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161046a565b600054610100900460ff166120795760405162461bcd60e51b815260040161046a9061265f565b61078333611c9e565b600054610100900460ff166119f85760405162461bcd60e51b815260040161046a9061265f565b60606120b884846000856120c0565b949350505050565b6060824710156121215760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161046a565b600080866001600160a01b0316858760405161213d91906126aa565b60006040518083038185875af1925050503d806000811461217a576040519150601f19603f3d011682016040523d82523d6000602084013e61217f565b606091505b50915091506121908783838761219b565b979650505050505050565b6060831561220a578251600003612203576001600160a01b0385163b6122035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161046a565b50816120b8565b6120b8838381511561221f5781518083602001fd5b8060405162461bcd60e51b815260040161046a919061238b565b6001600160a01b038116811461174557600080fd5b600080600080600060a0868803121561226657600080fd5b853561227181612239565b9450602086013561228181612239565b9350604086013561229181612239565b94979396509394606081013594506080013592915050565b801515811461174557600080fd5b600080604083850312156122ca57600080fd5b82356122d581612239565b915060208301356122e5816122a9565b809150509250929050565b60006020828403121561230257600080fd5b813561086281612239565b6000806040838503121561232057600080fd5b823561232b81612239565b915060208301356122e581612239565b6000806040838503121561234e57600080fd5b823561235981612239565b946020939093013593505050565b60005b8381101561238257818101518382015260200161236a565b50506000910152565b60208152600082518060208401526123aa816040850160208701612367565b601f01601f19169190910160400192915050565b6000806000606084860312156123d357600080fd5b83356123de81612239565b925060208401356123ee81612239565b929592945050506040919091013590565b600080600080600080600080610100898b03121561241c57600080fd5b883561242781612239565b9750602089013561243781612239565b965060408901359550606089013594506080890135935060a089013561245c816122a9565b925060c089013561246c816122a9565b915060e089013567ffffffffffffffff81111561248857600080fd5b89016040818c03121561249a57600080fd5b809150509295985092959890939650565b6020808252601d908201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604082015260600190565b6000602082840312156124f457600080fd5b5051919050565b60006020828403121561250d57600080fd5b815161086281612239565b60006020828403121561252a57600080fd5b8151610862816122a9565b6000808335601e1984360301811261254c57600080fd5b83018035915067ffffffffffffffff82111561256757600080fd5b60200191503681900382131561175a57600080fd5b6001600160a01b0396871681529486166020860152604085019390935293166060830152608082019290925260a081019190915260c00190565b600080604083850312156125c957600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601160045260246000fd5b818103818111156108e0576108e06125da565b80820281158282048414176108e0576108e06125da565b60008261263757634e487b7160e01b600052601260045260246000fd5b500490565b8183823760009101908152919050565b808201808211156108e0576108e06125da565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082516126bc818460208701612367565b9190910192915050565b600080858511156126d657600080fd5b838611156126e357600080fd5b5050820193919092039150565b80356001600160e01b03198116906004841015612721576001600160e01b0319600485900360031b81901b82161691505b509291505056fea264697066735822122030f230d471778f6f55e7dd4d2841be4d0b4d9e48c66e6f008e5ef485b1b8fe7064736f6c634300081a0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MON
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.