ETH Price: $2,347.70 (-2.44%)
Gas: 3.37 Gwei

Contract

0x812eD17AfdbB3431Bd17E7d3799a5A2Fad832a1a
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit ETH171454992023-04-28 15:25:11496 days ago1682695511IN
0x812eD17A...Fad832a1a
0.01 ETH0.0052624435.46238231
0x60e06040170950512023-04-21 13:25:47503 days ago1682083547IN
 Create: ETHVaultWithSlippage
0 ETH0.0132214935

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
171454992023-04-28 15:25:11496 days ago1682695511
0x812eD17A...Fad832a1a
0.01 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ETHVaultWithSlippage

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 6 : ETHVaultWithSlippage.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import {IWETH} from '../interfaces/IWETH.sol';
import {IETHVaultWithSlippage} from "../interfaces/IETHVaultWithSlippage.sol";
import {IICHIVault} from "../interfaces/IICHIVault.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 @notice wrapper contract around ICHI vault with wETH being a base token. Allows users to deposit ETH instead of wETH
 */
contract ETHVaultWithSlippage is ReentrancyGuard, IETHVaultWithSlippage {

    // WETH address
    address public immutable override wETH;

    // Vault address
    address public immutable override vault;

    // Flag that indicates whether the vault is inverted or not
    bool private immutable isInverted;

    address constant NULL_ADDRESS = address(0);

    /**
     @notice creates an instance of ETHVault (wrapped around an existing ICHI vault)
     @param _wETH wETH address
     @param _vault underlying vault
     */
    constructor(
        address _wETH,
        address _vault
    ) {
        require(_wETH != NULL_ADDRESS && _vault != NULL_ADDRESS, "EV.constructor: zero address");

        wETH = _wETH;
        vault = _vault;

        bool _isInverted = _wETH == IICHIVault(_vault).token0();

        require(_isInverted || _wETH == IICHIVault(_vault).token1(), "EV.constructor: one of the tokens must be wETH");
        isInverted = _isInverted;
        IERC20(_wETH).approve(_vault, uint256(-1));

        emit DeployETHVault(
            msg.sender,
            _vault,
            _wETH,
            _isInverted
        );
    }

    /**
     @notice Distributes shares to depositor equal to the ETH value of his deposit multiplied by the ratio of total liquidity shares issued divided by the pool's AUM measured in ETH value. 
     @param minimumProceeds Min amount of LPs the end user should receive.
     @param to Address to which liquidity tokens are minted
     @param shares Quantity of liquidity tokens minted as a result of deposit
     */
    function depositETH(
        uint256 minimumProceeds,
        address to
    ) external payable override nonReentrant returns (uint256 shares) {
        require(msg.value > 0, "EV.depositETH: can't deposit 0");

        IWETH(wETH).deposit{ value: msg.value }();
        shares = isInverted ? IICHIVault(vault).deposit(msg.value, 0, to) : IICHIVault(vault).deposit(0, msg.value, to);

        require(shares >= minimumProceeds, "EV.depositETH: slippage too great. Try again.");

        emit DepositForwarded(msg.sender, msg.value, shares, to);
    }

}

File 2 of 6 : IWETH.sol
// SPDX-License-Identifier: Unlicense

pragma solidity 0.7.6;

interface IWETH {
  function deposit() external payable;

  function withdraw(uint256) external;

  function approve(address guy, uint256 wad) external returns (bool);

  function transferFrom(
    address src,
    address dst,
    uint256 wad
  ) external returns (bool);
}

File 3 of 6 : IETHVaultWithSlippage.sol
// SPDX-License-Identifier: Unlicense

pragma solidity 0.7.6;

import "./IICHIVault.sol";

interface IETHVaultWithSlippage {

    // WETH address
    function wETH() external view returns(address);

    // Vault address
    function vault() external view returns(address);
    
    function depositETH(
        uint256 minimumProceeds,
        address to
    ) external payable returns (uint256 shares);

    event DeployETHVault(
        address indexed sender, 
        address indexed vault, 
        address wETH,
        bool isInverted);

    event DepositForwarded(
        address indexed sender,
        uint256 amount,
        uint256 shares,
        address to
    );

}

File 4 of 6 : IICHIVault.sol
// SPDX-License-Identifier: Unlicense

pragma solidity 0.7.6;

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 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 maxTotalSupply() external view returns(uint256);
    function hysteresis() external view returns(uint256);

    function getTotalAmounts() external view returns (uint256, uint256);

    function deposit(
        uint256,
        uint256,
        address
    ) external returns (uint256);

    function withdraw(
        uint256,
        address
    ) external returns (uint256, uint256);

    function rebalance(
        int24 _baseLower,
        int24 _baseUpper,
        int24 _limitLower,
        int24 _limitUpper,
        int256 swapQuantity
    ) external;

    function setDepositMax(
        uint256 _deposit0Max, 
        uint256 _deposit1Max) external;

    function setAffiliate(
        address _affiliate) external;

    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 MaxTotalSupply(
        address indexed sender, 
        uint256 maxTotalSupply);

    event Hysteresis(
        address indexed sender, 
        uint256 hysteresis);

    event DepositMax(
        address indexed sender, 
        uint256 deposit0Max, 
        uint256 deposit1Max);
        
    event Affiliate(
        address indexed sender, 
        address affiliate);    
}

File 5 of 6 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @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 ReentrancyGuard {
    // 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;

    constructor () {
        _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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 6 of 6 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @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);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_wETH","type":"address"},{"internalType":"address","name":"_vault","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"address","name":"wETH","type":"address"},{"indexed":false,"internalType":"bool","name":"isInverted","type":"bool"}],"name":"DeployETHVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"DepositForwarded","type":"event"},{"inputs":[{"internalType":"uint256","name":"minimumProceeds","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"depositETH","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e060405234801561001057600080fd5b506040516107f33803806107f38339818101604052604081101561003357600080fd5b50805160209091015160016000556001600160a01b0382161580159061006157506001600160a01b03811615155b6100b2576040805162461bcd60e51b815260206004820152601c60248201527f45562e636f6e7374727563746f723a207a65726f206164647265737300000000604482015290519081900360640190fd5b6001600160601b0319606083811b821660805282901b1660a05260408051630dfe168160e01b815290516000916001600160a01b03841691630dfe168191600480820192602092909190829003018186803b15801561011057600080fd5b505afa158015610124573d6000803e3d6000fd5b505050506040513d602081101561013a57600080fd5b50516001600160a01b03848116911614905080806101c75750816001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561018c57600080fd5b505afa1580156101a0573d6000803e3d6000fd5b505050506040513d60208110156101b657600080fd5b50516001600160a01b038481169116145b6102025760405162461bcd60e51b815260040180806020018281038252602e8152602001806107c5602e913960400191505060405180910390fd5b80151560f81b60c0526040805163095ea7b360e01b81526001600160a01b038481166004830152600019602483015291519185169163095ea7b3916044808201926020929091908290030181600087803b15801561025f57600080fd5b505af1158015610273573d6000803e3d6000fd5b505050506040513d602081101561028957600080fd5b5050604080516001600160a01b038581168252831515602083015282519085169233927f064dc99035876d07b5c6aa5df2709ccd365f241c6c2583433c865fa54444b9d7929081900390910190a350505060805160601c60a05160601c60c05160f81c6104a761031e600039806101e452508061020952806102ba528061042252508061017052806103fe52506104a76000f3fe6080604052600436106100345760003560e01c806356150edf14610039578063f242862114610077578063fbfa77cf146100a8575b600080fd5b6100656004803603604081101561004f57600080fd5b50803590602001356001600160a01b03166100bd565b60408051918252519081900360200190f35b34801561008357600080fd5b5061008c6103fc565b604080516001600160a01b039092168252519081900360200190f35b3480156100b457600080fd5b5061008c610420565b600060026000541415610117576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553461016e576040805162461bcd60e51b815260206004820152601e60248201527f45562e6465706f7369744554483a2063616e2774206465706f73697420300000604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101c957600080fd5b505af11580156101dd573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006102b8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638dbdbe6d600034856040518463ffffffff1660e01b815260040180848152602001838152602001826001600160a01b031681526020019350505050602060405180830381600087803b15801561028757600080fd5b505af115801561029b573d6000803e3d6000fd5b505050506040513d60208110156102b157600080fd5b5051610365565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638dbdbe6d346000856040518463ffffffff1660e01b815260040180848152602001838152602001826001600160a01b031681526020019350505050602060405180830381600087803b15801561033857600080fd5b505af115801561034c573d6000803e3d6000fd5b505050506040513d602081101561036257600080fd5b50515b9050828110156103a65760405162461bcd60e51b815260040180806020018281038252602d815260200180610445602d913960400191505060405180910390fd5b60408051348152602081018390526001600160a01b03841681830152905133917ff9218816936b5494d6f8b9a36ddc3f373b4ddbfa954c205e8852ab703373e970919081900360600190a2600160005592915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f00000000000000000000000000000000000000000000000000000000000000008156fe45562e6465706f7369744554483a20736c69707061676520746f6f2067726561742e2054727920616761696e2ea2646970667358221220a44676eb01ce5f940d533609a2f2bd242f4f0139a10907df5664b500f9ee72ce64736f6c6343000706003345562e636f6e7374727563746f723a206f6e65206f662074686520746f6b656e73206d7573742062652077455448000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000048fbe026392e4c86b859794abb56625537c16dd0

Deployed Bytecode

0x6080604052600436106100345760003560e01c806356150edf14610039578063f242862114610077578063fbfa77cf146100a8575b600080fd5b6100656004803603604081101561004f57600080fd5b50803590602001356001600160a01b03166100bd565b60408051918252519081900360200190f35b34801561008357600080fd5b5061008c6103fc565b604080516001600160a01b039092168252519081900360200190f35b3480156100b457600080fd5b5061008c610420565b600060026000541415610117576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553461016e576040805162461bcd60e51b815260206004820152601e60248201527f45562e6465706f7369744554483a2063616e2774206465706f73697420300000604482015290519081900360640190fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101c957600080fd5b505af11580156101dd573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006102b8577f00000000000000000000000048fbe026392e4c86b859794abb56625537c16dd06001600160a01b0316638dbdbe6d600034856040518463ffffffff1660e01b815260040180848152602001838152602001826001600160a01b031681526020019350505050602060405180830381600087803b15801561028757600080fd5b505af115801561029b573d6000803e3d6000fd5b505050506040513d60208110156102b157600080fd5b5051610365565b7f00000000000000000000000048fbe026392e4c86b859794abb56625537c16dd06001600160a01b0316638dbdbe6d346000856040518463ffffffff1660e01b815260040180848152602001838152602001826001600160a01b031681526020019350505050602060405180830381600087803b15801561033857600080fd5b505af115801561034c573d6000803e3d6000fd5b505050506040513d602081101561036257600080fd5b50515b9050828110156103a65760405162461bcd60e51b815260040180806020018281038252602d815260200180610445602d913960400191505060405180910390fd5b60408051348152602081018390526001600160a01b03841681830152905133917ff9218816936b5494d6f8b9a36ddc3f373b4ddbfa954c205e8852ab703373e970919081900360600190a2600160005592915050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b7f00000000000000000000000048fbe026392e4c86b859794abb56625537c16dd08156fe45562e6465706f7369744554483a20736c69707061676520746f6f2067726561742e2054727920616761696e2ea2646970667358221220a44676eb01ce5f940d533609a2f2bd242f4f0139a10907df5664b500f9ee72ce64736f6c63430007060033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000048fbe026392e4c86b859794abb56625537c16dd0

-----Decoded View---------------
Arg [0] : _wETH (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [1] : _vault (address): 0x48fBe026392E4c86b859794ABB56625537c16dd0

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 00000000000000000000000048fbe026392e4c86b859794abb56625537c16dd0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.