S Price: $0.718264 (+6.73%)

Contract

0x955198C750A160b1f8C5976A0AF7cE6C6013682D

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
IchiConnector

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 4 : IchiConnector.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { IICHIVault } from "contracts/interfaces/external/swapx/IIchiVault.sol";
import {
    ILiquidityConnector,
    AddLiquidityParams,
    RemoveLiquidityParams,
    SwapParams,
    GetAmountOutParams
} from "contracts/interfaces/ILiquidityConnector.sol";

contract IchiConnector is ILiquidityConnector {
    error NotSupported();
    error PoolTokensNotAllowed();

    function addLiquidity(
        AddLiquidityParams memory addLiquidityParams
    ) external payable override {
        if (
            IICHIVault(addLiquidityParams.lpToken).allowToken0()
                && !IICHIVault(addLiquidityParams.lpToken).allowToken1()
        ) {
            IICHIVault(addLiquidityParams.lpToken).deposit(
                addLiquidityParams.desiredAmounts[0], 0, address(this)
            );
        } else if (
            !IICHIVault(addLiquidityParams.lpToken).allowToken0()
                && IICHIVault(addLiquidityParams.lpToken).allowToken1()
        ) {
            IICHIVault(addLiquidityParams.lpToken).deposit(
                0, addLiquidityParams.desiredAmounts[1], address(this)
            );
        } else if (
            IICHIVault(addLiquidityParams.lpToken).allowToken0()
                && IICHIVault(addLiquidityParams.lpToken).allowToken1()
        ) {
            IICHIVault(addLiquidityParams.lpToken).deposit(
                addLiquidityParams.desiredAmounts[0],
                addLiquidityParams.desiredAmounts[1],
                address(this)
            );
        } else {
            revert PoolTokensNotAllowed();
        }
    }

    function removeLiquidity(
        RemoveLiquidityParams memory removeLiquidityParams
    ) external override {
        IICHIVault(removeLiquidityParams.lpToken).withdraw(
            removeLiquidityParams.lpAmountIn, address(this)
        );
    }

    function swapExactTokensForTokens(
        SwapParams memory
    ) external payable override {
        revert NotSupported();
    }

    function getAmountOut(
        GetAmountOutParams memory
    ) external pure returns (uint256) {
        revert NotSupported();
    }
}

File 2 of 4 : IIchiVault.sol
// SPDX-License-Identifier: Unlicense

pragma solidity >=0.8.4;

interface IICHIVault {
    function ichiVaultFactory() external view returns (address);

    function balanceOf(
        address
    ) external view returns (uint256);

    function pool() external view returns (address);

    function owner() 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);

    /// @notice NFT ID of the base position. If 0, the base position is not
    /// initialized.
    function basePositionId() external view returns (uint256);

    /// @notice NFT ID of the limit position. If 0, the limit position is not
    /// initialized.
    function limitPositionId() external view returns (uint256);

    function deposit0Max() external view returns (uint256);

    function deposit1Max() external view returns (uint256);

    function hysteresis() external view returns (uint256);

    function twapPeriod() external view returns (uint32);

    function auxTwapPeriod() external view returns (uint32);

    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 resetAllowances() external;

    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 setTwapPeriod(
        uint32 newTwapPeriod
    ) external;

    function setAuxTwapPeriod(
        uint32 newAuxTwapPeriod
    ) external;
}

File 3 of 4 : ILiquidityConnector.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {
    AddLiquidityParams,
    RemoveLiquidityParams,
    SwapParams,
    GetAmountOutParams
} from "contracts/structs/LiquidityStructs.sol";

interface ILiquidityConnector {
    function addLiquidity(
        AddLiquidityParams memory addLiquidityParams
    ) external payable;

    function removeLiquidity(
        RemoveLiquidityParams memory removeLiquidityParams
    ) external;

    function swapExactTokensForTokens(
        SwapParams memory swap
    ) external payable;

    function getAmountOut(
        GetAmountOutParams memory getAmountOutParams
    ) external view returns (uint256);
}

File 4 of 4 : LiquidityStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct AddLiquidityParams {
    address router;
    address lpToken;
    address[] tokens;
    uint256[] desiredAmounts;
    uint256[] minAmounts;
    bytes extraData;
}

struct RemoveLiquidityParams {
    address router;
    address lpToken;
    address[] tokens;
    uint256 lpAmountIn;
    uint256[] minAmountsOut;
    bytes extraData;
}

struct SwapParams {
    address router;
    uint256 amountIn;
    uint256 minAmountOut;
    address tokenIn;
    bytes extraData;
}

struct GetAmountOutParams {
    address router;
    address lpToken;
    address tokenIn;
    address tokenOut;
    uint256 amountIn;
}

Settings
{
  "remappings": [
    "solmate/=lib/solmate/src/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@uniswap/v3-periphery/=lib/v3-periphery/",
    "@uniswap/v3-core/=lib/v3-core/",
    "@morpho-blue/=lib/morpho-blue/src/",
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "morpho-blue/=lib/morpho-blue/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"NotSupported","type":"error"},{"inputs":[],"name":"PoolTokensNotAllowed","type":"error"},{"inputs":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"desiredAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmounts","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct AddLiquidityParams","name":"addLiquidityParams","type":"tuple"}],"name":"addLiquidity","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"internalType":"struct GetAmountOutParams","name":"","type":"tuple"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256","name":"lpAmountIn","type":"uint256"},{"internalType":"uint256[]","name":"minAmountsOut","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct RemoveLiquidityParams","name":"removeLiquidityParams","type":"tuple"}],"name":"removeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams","name":"","type":"tuple"}],"name":"swapExactTokensForTokens","outputs":[],"stateMutability":"payable","type":"function"}]

608060405234801561001057600080fd5b50610adb806100206000396000f3fe60806040526004361061003f5760003560e01c80630fdc253c1461004457806341d07dc014610076578063fb986deb14610098578063ff781feb146100ab575b600080fd5b34801561005057600080fd5b5061006461005f36600461061c565b6100be565b60405190815260200160405180910390f35b34801561008257600080fd5b506100966100913660046107e9565b6100d9565b005b6100966100a63660046108ca565b610158565b6100966100b9366004610986565b610554565b6000604051630280e1e560e61b815260040160405180910390fd5b60208101516060820151604051627b8a6760e11b815260048101919091523060248201526001600160a01b039091169062f714ce9060440160408051808303816000875af115801561012f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101539190610a29565b505050565b80602001516001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561019a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101be9190610a4d565b801561022d575080602001516001600160a01b03166337e41b406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022b9190610a4d565b155b156102db5780602001516001600160a01b0316638dbdbe6d826060015160008151811061025c5761025c610a76565b60209081029190910101516040516001600160e01b031960e084901b1681526004810191909152600060248201523060448201526064015b6020604051808303816000875af11580156102b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d79190610a8c565b5050565b80602001516001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561031d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103419190610a4d565b1580156103af575080602001516001600160a01b03166337e41b406040518163ffffffff1660e01b8152600401602060405180830381865afa15801561038b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103af9190610a4d565b1561041a5780602001516001600160a01b0316638dbdbe6d600083606001516001815181106103e0576103e0610a76565b60209081029190910101516040516001600160e01b031960e085901b16815260048101929092526024820152306044820152606401610294565b80602001516001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561045c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104809190610a4d565b80156104ed575080602001516001600160a01b03166337e41b406040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed9190610a4d565b1561053b5780602001516001600160a01b0316638dbdbe6d826060015160008151811061051c5761051c610a76565b602002602001015183606001516001815181106103e0576103e0610a76565b60405163589cb43160e11b815260040160405180910390fd5b604051630280e1e560e61b815260040160405180910390fd5b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff811182821017156105a6576105a661056d565b60405290565b60405160c0810167ffffffffffffffff811182821017156105a6576105a661056d565b604051601f8201601f1916810167ffffffffffffffff811182821017156105f8576105f861056d565b604052919050565b80356001600160a01b038116811461061757600080fd5b919050565b600060a0828403121561062e57600080fd5b610636610583565b61063f83610600565b815261064d60208401610600565b602082015261065e60408401610600565b604082015261066f60608401610600565b6060820152608083013560808201528091505092915050565b600067ffffffffffffffff8211156106a2576106a261056d565b5060051b60200190565b600082601f8301126106bd57600080fd5b813560206106d26106cd83610688565b6105cf565b82815260059290921b840181019181810190868411156106f157600080fd5b8286015b848110156107135761070681610600565b83529183019183016106f5565b509695505050505050565b600082601f83011261072f57600080fd5b8135602061073f6106cd83610688565b82815260059290921b8401810191818101908684111561075e57600080fd5b8286015b848110156107135780358352918301918301610762565b600082601f83011261078a57600080fd5b813567ffffffffffffffff8111156107a4576107a461056d565b6107b7601f8201601f19166020016105cf565b8181528460208386010111156107cc57600080fd5b816020850160208301376000918101602001919091529392505050565b6000602082840312156107fb57600080fd5b813567ffffffffffffffff8082111561081357600080fd5b9083019060c0828603121561082757600080fd5b61082f6105ac565b61083883610600565b815261084660208401610600565b602082015260408301358281111561085d57600080fd5b610869878286016106ac565b6040830152506060830135606082015260808301358281111561088b57600080fd5b6108978782860161071e565b60808301525060a0830135828111156108af57600080fd5b6108bb87828601610779565b60a08301525095945050505050565b6000602082840312156108dc57600080fd5b813567ffffffffffffffff808211156108f457600080fd5b9083019060c0828603121561090857600080fd5b6109106105ac565b61091983610600565b815261092760208401610600565b602082015260408301358281111561093e57600080fd5b61094a878286016106ac565b60408301525060608301358281111561096257600080fd5b61096e8782860161071e565b60608301525060808301358281111561088b57600080fd5b60006020828403121561099857600080fd5b813567ffffffffffffffff808211156109b057600080fd5b9083019060a082860312156109c457600080fd5b6109cc610583565b6109d583610600565b815260208301356020820152604083013560408201526109f760608401610600565b6060820152608083013582811115610a0e57600080fd5b610a1a87828601610779565b60808301525095945050505050565b60008060408385031215610a3c57600080fd5b505080516020909101519092909150565b600060208284031215610a5f57600080fd5b81518015158114610a6f57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a9e57600080fd5b505191905056fea26469706673582212200563a9630468d63673ef2c788d77411158cf3721116b21f87f5200eab0b8f5d164736f6c63430008130033

Deployed Bytecode

0x60806040526004361061003f5760003560e01c80630fdc253c1461004457806341d07dc014610076578063fb986deb14610098578063ff781feb146100ab575b600080fd5b34801561005057600080fd5b5061006461005f36600461061c565b6100be565b60405190815260200160405180910390f35b34801561008257600080fd5b506100966100913660046107e9565b6100d9565b005b6100966100a63660046108ca565b610158565b6100966100b9366004610986565b610554565b6000604051630280e1e560e61b815260040160405180910390fd5b60208101516060820151604051627b8a6760e11b815260048101919091523060248201526001600160a01b039091169062f714ce9060440160408051808303816000875af115801561012f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101539190610a29565b505050565b80602001516001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561019a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101be9190610a4d565b801561022d575080602001516001600160a01b03166337e41b406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022b9190610a4d565b155b156102db5780602001516001600160a01b0316638dbdbe6d826060015160008151811061025c5761025c610a76565b60209081029190910101516040516001600160e01b031960e084901b1681526004810191909152600060248201523060448201526064015b6020604051808303816000875af11580156102b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d79190610a8c565b5050565b80602001516001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561031d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103419190610a4d565b1580156103af575080602001516001600160a01b03166337e41b406040518163ffffffff1660e01b8152600401602060405180830381865afa15801561038b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103af9190610a4d565b1561041a5780602001516001600160a01b0316638dbdbe6d600083606001516001815181106103e0576103e0610a76565b60209081029190910101516040516001600160e01b031960e085901b16815260048101929092526024820152306044820152606401610294565b80602001516001600160a01b0316637f7a1eec6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561045c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104809190610a4d565b80156104ed575080602001516001600160a01b03166337e41b406040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ed9190610a4d565b1561053b5780602001516001600160a01b0316638dbdbe6d826060015160008151811061051c5761051c610a76565b602002602001015183606001516001815181106103e0576103e0610a76565b60405163589cb43160e11b815260040160405180910390fd5b604051630280e1e560e61b815260040160405180910390fd5b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff811182821017156105a6576105a661056d565b60405290565b60405160c0810167ffffffffffffffff811182821017156105a6576105a661056d565b604051601f8201601f1916810167ffffffffffffffff811182821017156105f8576105f861056d565b604052919050565b80356001600160a01b038116811461061757600080fd5b919050565b600060a0828403121561062e57600080fd5b610636610583565b61063f83610600565b815261064d60208401610600565b602082015261065e60408401610600565b604082015261066f60608401610600565b6060820152608083013560808201528091505092915050565b600067ffffffffffffffff8211156106a2576106a261056d565b5060051b60200190565b600082601f8301126106bd57600080fd5b813560206106d26106cd83610688565b6105cf565b82815260059290921b840181019181810190868411156106f157600080fd5b8286015b848110156107135761070681610600565b83529183019183016106f5565b509695505050505050565b600082601f83011261072f57600080fd5b8135602061073f6106cd83610688565b82815260059290921b8401810191818101908684111561075e57600080fd5b8286015b848110156107135780358352918301918301610762565b600082601f83011261078a57600080fd5b813567ffffffffffffffff8111156107a4576107a461056d565b6107b7601f8201601f19166020016105cf565b8181528460208386010111156107cc57600080fd5b816020850160208301376000918101602001919091529392505050565b6000602082840312156107fb57600080fd5b813567ffffffffffffffff8082111561081357600080fd5b9083019060c0828603121561082757600080fd5b61082f6105ac565b61083883610600565b815261084660208401610600565b602082015260408301358281111561085d57600080fd5b610869878286016106ac565b6040830152506060830135606082015260808301358281111561088b57600080fd5b6108978782860161071e565b60808301525060a0830135828111156108af57600080fd5b6108bb87828601610779565b60a08301525095945050505050565b6000602082840312156108dc57600080fd5b813567ffffffffffffffff808211156108f457600080fd5b9083019060c0828603121561090857600080fd5b6109106105ac565b61091983610600565b815261092760208401610600565b602082015260408301358281111561093e57600080fd5b61094a878286016106ac565b60408301525060608301358281111561096257600080fd5b61096e8782860161071e565b60608301525060808301358281111561088b57600080fd5b60006020828403121561099857600080fd5b813567ffffffffffffffff808211156109b057600080fd5b9083019060a082860312156109c457600080fd5b6109cc610583565b6109d583610600565b815260208301356020820152604083013560408201526109f760608401610600565b6060820152608083013582811115610a0e57600080fd5b610a1a87828601610779565b60808301525095945050505050565b60008060408385031215610a3c57600080fd5b505080516020909101519092909150565b600060208284031215610a5f57600080fd5b81518015158114610a6f57600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a9e57600080fd5b505191905056fea26469706673582212200563a9630468d63673ef2c788d77411158cf3721116b21f87f5200eab0b8f5d164736f6c63430008130033

Block Transaction 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

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.