โšกEVM Actions

Execute transactions on EVM vaults including deposits, withdrawals, and approvals. All write operations are available via `sdk.evm.*` methods.

Overview

EVM write operations require a connected wallet with a signer. The SDK supports all vault versions (evm-0, evm-1, evm-2) and automatically selects the correct contract ABI and function signatures.

Setup

import { ethers } from 'ethers';
import { AugustSDK } from '@augustdigital/sdk';

// Initialize SDK
const sdk = new AugustSDK({
  providers: {
    1: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
  },
});

// Connect wallet and set signer
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
sdk.evm.setSigner(signer);

const userAddress = await signer.getAddress();

Vault Deposit

Deposit tokens into a vault. The SDK automatically handles different vault versions (evm-0, evm-1, evm-2) and adapter deposits.

Vault Version Detection

The SDK automatically detects the vault version and uses the correct deposit method:

Version
Deposit Function
Parameters
Use Case

evm-0

deposit(uint256, address)

2 params

Legacy vaults

evm-1

deposit(uint256, address)

2 params

Standard vaults

evm-2

deposit(address, uint256, address)

3 params

Multi-asset vaults

Adapter

Various

Depends on adapter type

Alternative token deposits

You don't need to specify the version - the SDK detects it automatically from the vault's version field.

Parameters

Parameter
Type
Required
Description

target

string

Yes

Vault contract address

wallet

string

Yes

User wallet address

amount

string | bigint | number

Yes

Amount to deposit

wait

boolean

No

Wait for confirmation (default: false)

depositAsset

string

No

Token to deposit (defaults to underlying)

chainId

number

No

Chain ID for adapter routing

poolName

string

No

Pool name for adapter routing

Returns

Transaction hash as string

Example: Standard Deposit

How It Works for Each Version

EVM-0 & EVM-1 Vaults (Standard)

Contract Function: deposit(uint256 assets, address receiver)

Behavior:

  • Deposits the vault's underlying token only

  • 2 parameters: amount and receiver

  • Automatic approval of underlying token to vault

Example:

EVM-2 Vaults (Multi-Asset)

Contract Function: deposit(address assetIn, uint256 amount, address receiver)

Behavior:

  • Accepts multiple whitelisted tokens (listed in vault.depositAssets)

  • 3 parameters: asset address, amount, and receiver

  • Automatic approval of selected token to vault

Example:

Note: For EVM-2 vaults, you can optionally specify depositAsset. If omitted, SDK uses the first asset in depositAssets array (usually the primary/underlying token).

Adapter Vaults (Alternative Tokens)

Contract Functions: Various depending on adapter type

Behavior:

  • Enables deposits with tokens beyond the vault's standard accepted tokens

  • Uses wrapper contracts or swap protocols

  • Requires depositAsset, chainId, and sometimes poolName parameters

Adapter Types:

  1. Native Token Adapter (e.g., ETH โ†’ wstETH)

    • Wraps native tokens before depositing

    • Uses WrapperAdapter contract

    • Example: Treehouse Growth

  2. Token Wrapper Adapter (e.g., WETH โ†’ wstETH)

    • Wraps ERC20 tokens before depositing

    • Uses WrapperAdapter contract

    • Example: Treehouse Growth

  3. Swap Adapter (e.g., USDC โ†’ WBTC)

    • Swaps tokens via Paraswap before depositing

    • Uses PoolAdapter contract

    • Example: BTC Multi-Token

Example: Native ETH Deposit

Example: WETH Deposit (via adapter)

Example: Swap Adapter Deposit

Automatic Detection Flow

When to Use Each Parameter

Parameter
Required
Use When

target

โœ… Always

Vault address

wallet

โœ… Always

User's address

amount

โœ… Always

Deposit amount

wait

โŒ Optional

Want to wait for confirmation

depositAsset

โš ๏ธ Sometimes

Using adapter OR EVM-2 with non-primary token

chainId

โš ๏ธ Sometimes

Using adapter

poolName

โš ๏ธ Sometimes

Using adapter (helps with routing)

Quick Reference: Vault Versions

How to check which version a vault uses:

Common Vaults by Version:

Vault Name
Version
Deposit Tokens
Notes

Upshift USDC

evm-1

USDC only

Standard deposit

Upshift USDT

evm-1

USDT only

Standard deposit

Treehouse Growth

evm-1

wstETH, WETH, ETH

Has adapters

Kelp TAC rsETH

evm-1

rsETH, stETH, ETHx, WETH, ETH

Has adapters

Wild USD

evm-2

USDC, USDT, DAI

Multi-asset

BTC Multi-Token

evm-1

WBTC, USDC (via swap)

Has swap adapter

Decision Tree

Adapter Deposits

Deposit with alternative tokens beyond the vault's underlying asset.

Check Available Tokens

Deposit with Alternative Token

Deposit Native ETH

Supported Adapter Vaults

Vault
Supported Tokens
Type

Treehouse Growth

wstETH, WETH, ETH

Native deposits

Kelp TAC rsETH

stETH, ETHx, WETH, ETH

Native deposits

BTC Multi-Token

WBTC, cbBTC, tBTC

Swap adapter (Paraswap)

AVAX Strategy

WAVAX, AVAX

Native deposits

Request Withdrawal

Request to withdraw tokens from a vault. Subject to lag period before claiming.

Parameters

Parameter
Type
Required
Description

target

string

Yes

Vault contract address

wallet

string

Yes

User wallet address

amount

string | bigint | number

Yes

Amount of shares to redeem

wait

boolean

No

Wait for confirmation

Returns

Transaction hash as string

Example

Behavior

The SDK automatically:

  1. Detects vault version

  2. Uses correct function signature:

    • EVM-0/1: requestRedeem(uint256, address, address) (3 params)

    • EVM-2: requestRedeem(uint256, address) (2 params)

  3. Converts amount to proper decimals

  4. Submits transaction

Claim Redemption

Claim tokens from a completed redemption request.

Parameters

Parameter
Type
Required
Description

target

string

Yes

Vault contract address

wallet

string

Yes

User wallet address

year

string

Yes

Year from redemption request

month

string

Yes

Month from redemption request

day

string

Yes

Day from redemption request

receiverIndex

string

Yes

Receiver index

wait

boolean

No

Wait for confirmation

Returns

Transaction hash as string

Example

Token Approval

Approve vault to spend tokens. Usually called automatically by vaultDeposit.

Returns

  • Transaction hash if approval was needed

  • undefined if allowance already sufficient

Example

Check Allowance

Check current token allowance for a vault.

Example

Examples

Complete Deposit Flow

Complete Withdrawal Flow

Multi-Asset Vault Deposit

Error Handling

Best Practices

1. Always Check Vault Status

2. Verify Deposit Cap

3. Show User Expected Output

Last updated