Ichi Vaults
Hydrex integrates with Ichi single-sided liquidity vaults that automatically rebalance positions. All user transactions go through the Deposit Guard contract, not the vault directly.
Reading Vault State
Use IchiVault.getVaultInfo to read all vault state in a single batched call. Estimation helpers compute minimum proceeds without on-chain simulation.
typescript
import { IchiVault, IchiVaultInfo } from '@hydrexfi/hydrex-sdk';
// Read all vault state in one batched call
const info: IchiVaultInfo = await IchiVault.getVaultInfo(readContracts);
// info.token0, token1, allowToken0, allowToken1,
// deposit0Max, deposit1Max, totalSupply, total0, total1, fee
// Check whether deposits are paused
const paused: boolean = IchiVault.isDepositsPaused(info);
// Estimate minimum LP shares (fallback, no simulation)
const minShares: bigint = IchiVault.estimateDepositShares(
depositAmountUSD, // deposit value in USD
vaultTVLUSD, // total vault TVL in USD
info.totalSupply,
50, // slippage in bps (floored at 500 bps)
);
// Estimate minimum token amounts for withdrawal
const { amount0, amount1 } = IchiVault.estimateWithdrawAmounts(
sharesToBurn,
info.total0,
info.total1,
info.totalSupply,
50,
);Depositing
All deposit transactions target ICHI_VAULT_DEPOSIT_GUARD_ADDRESSES[chainId].
typescript
import {
IchiVaultDepositGuard,
ICHI_VAULT_DEPOSIT_GUARD_ADDRESSES,
ICHI_VAULT_DEPLOYER_ADDRESSES,
ChainId,
} from '@hydrexfi/hydrex-sdk';
// ERC20 deposit — approve Deposit Guard first
const { calldata, value } = IchiVaultDepositGuard.buildDepositCallParameters({
vault: '0xVaultAddress',
vaultDeployer: ICHI_VAULT_DEPLOYER_ADDRESSES[ChainId.Base],
token: '0xDepositToken',
amount: '1000000000000000000',
minimumProceeds: minShares,
recipient: '0xYourWallet',
});
// Native ETH deposit — no approval needed; include value as tx.value
const { calldata: ethCalldata, value: ethValue } =
IchiVaultDepositGuard.buildNativeDepositCallParameters({
vault: '0xVaultAddress',
vaultDeployer: ICHI_VAULT_DEPLOYER_ADDRESSES[ChainId.Base],
amount: '1000000000000000000',
minimumProceeds: minShares,
recipient: '0xYourWallet',
});ℹ
Deposit Guard address on Base
0x9A0EBEc47c85fD30F1fdc90F57d2b178e84DC8d8Withdrawing
typescript
// ERC20 withdrawal — approve Deposit Guard for vault share token first
const { calldata } = IchiVaultDepositGuard.buildWithdrawCallParameters({
vault: '0xVaultAddress',
vaultDeployer: ICHI_VAULT_DEPLOYER_ADDRESSES[ChainId.Base],
shares: '500000000000000000',
recipient: '0xYourWallet',
minAmount0: amount0, // from estimateWithdrawAmounts
minAmount1: amount1,
});
// Native ETH withdrawal — WETH auto-unwrapped to ETH
const { calldata: nativeCalldata } =
IchiVaultDepositGuard.buildNativeWithdrawCallParameters({
vault: '0xVaultAddress',
vaultDeployer: ICHI_VAULT_DEPLOYER_ADDRESSES[ChainId.Base],
shares: '500000000000000000',
recipient: '0xYourWallet',
minAmount0: amount0,
minAmount1: amount1,
});