Depositing is the action for taking funds from the callers wallet into a particular protocol.

  1. For many cases you can directly use the route endpoint to enter into a position than directly using the deposit action. The route endpoint will determine best price and gas router for either depositing directly into the protocol, or buying the position token on a secondary market.
  2. If you are depositing into a protocol you must have the underlying token required for the deposit action. For example if you are attempting to deposit into a Yearn vault that requires WETH and you define DAI as the tokenIn then the transaction will fail. This is a perfect use case for using the route endpoint.

NOTE: Direct deposit actions doesn't have slippage protection. If you are interacting with a protocol that needs slippage protection use the route endpoint


With Enso you can simply use Deposit for all protocols resulting in quick, and easy integration with all the logic for each particular protocol deposit logic abstracted away.

You can use the deposit action inside of the bundle endpoint.

    protocol: "balancer-v2",
    args: {
        tokenIn: weth,
        tokenOut: b80bal20weth,
        amountIn: wethAmount
        primaryAddress: balancerVault
    action: "deposit",
tokenIn: 'Address of token to send' // You can define many tokens in by [inToken1, inToken2]
amountIn: 'Raw amount to send' // You can define many tokens out by [outToken1, outToken2]
  ? tokenOut
  : 'Address of token to receive' // Optional - protocols that have isolated contracts per each deposit(for example Yearn), then you do not need to define tokenOut.  For protocols that have a shared contract for all of their vaults/deposits such as balancer and univ4 then you should define tokenOut
primaryAddress: 'Address of smart contract to interact with' //  Address of smart contract to interact with e.g. Balancer Vault



Get all the protocols that have a deposit action

POST /api/v1/shortcuts/bundle (opens in a new tab)

The bundle endpoint enables bundling of many actions into one transaction, and for the examples below we will simply do one action of deposit.

Convert from WETH (opens in a new tab) to yvUSDC (opens in a new tab) assuming the user has USDC in their wallet. More more efficiency it is advised to use the route endpoint for these types of actions

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer 1e02632d-6feb-4a75-a157-documentation" \
  --data '[
    "action": "deposit",
    "args": {
      "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3d",
      "tokenOut": "0x5c6Ee304399DBdB9C8Ef030aB642B10820DB8F56",
      "amountIn": "1000000000000000000",
      "primaryAddress": "0xba12222222228d8ba445958a75a0704d566bf2c8",
      "tokenInAmountToTransfer": "1000000000000000000"
    "protocol": "balancer-v2"
  }]' \