approve ​
Standard ERC-20 approval for vault shares. Use this only if you want a third party to call transferFrom, withdraw, or redeem on your shares.
WARNING
This is not the USDC approval. To deposit, you approve USDC to the vault - see Getting Started -> Approving USDC.
Signature ​
solidity
function approve(address spender, uint256 value) external returns (bool);Parameters ​
| Name | Type | Description |
|---|---|---|
spender | address | Address allowed to spend the caller's shares. |
value | uint256 | Allowance in share base units (18 decimals). Use 2^256 - 1 for unlimited. |
Returns ​
true on success. (The function reverts on failure rather than returning false.)
Events emitted ​
solidity
event Approval(address indexed owner, address indexed spender, uint256 value);Example — approve a router for unlimited share spending ​
ts
import { maxUint256 } from 'viem'
import { publicClient, walletClient } from './client'
import { liteUsdVaultAbi } from './abi'
import { VAULT } from './constants'
const ROUTER = '0x...' as const
const { request } = await publicClient.simulateContract({
account: walletClient.account!,
address: VAULT,
abi: liteUsdVaultAbi,
functionName: 'approve',
args: [ROUTER, maxUint256],
})
const hash = await walletClient.writeContract(request)
await publicClient.waitForTransactionReceipt({ hash })Notes ​
- Reapproving overwrites the existing allowance — it does not add to it.
- Some integrations recommend setting allowance to
0first before raising it from a non-zero value, to defend against the classic ERC-20 race condition. The vault uses the standard OpenZeppelin implementation, so this is optional but harmless.

