Skip to content
LogoLogo

earn.createErc4626Engine

Deploys a deterministic engine for an ERC-4626 venue. This API is experimental.

Usage

import { ,  } from 'viem/utils'
import {  } from './viem.config'
 
const  = await ..({
  : .(.('acme-usd-v1')),
  : '0x0000000000000000000000000000000000000001',
  : '0x0000000000000000000000000000000000000002',
})
{ deploymentId: '0x...', engine: '0x...', receipt: { ... } }

The client account deploys and owns the engine by default. Use owner to set a different final owner. The action derives engine metadata from the venue unless name or symbol is provided.

Asynchronous Usage

earn.createErc4626EngineSync waits for inclusion and returns the decoded deployment event. Use earn.createErc4626Engine to return the transaction hash immediately.

import { ,  } from 'viem/utils'
import {  } from 'viem/tempo'
import {  } from './viem.config'
 
const  = '0x0000000000000000000000000000000000000001'
const  = await ..({
  : .(.('acme-usd-v1')),
  ,
  : '0x0000000000000000000000000000000000000002',
})
const  = await ..({  }).
const {  } = ...(., {
  ,
})

Return Value

type ReturnValue = {
  /** Venue asset address. */
  asset: Address
  /** Deployment identifier. */
  deploymentId: Hex
  /** Deployed ERC-4626 engine address. */
  engine: Address
  /** Deterministic engine salt. */
  engineSalt: Hex
  /** Final engine owner. */
  owner: Address
  /** Transaction receipt. */
  receipt: TransactionReceipt
  /** ERC-4626 venue address. */
  vault: Address
}

The asynchronous action returns the transaction hash instead.

Parameters

deploymentId

  • Type: Hex

A required, nonzero 32-byte identifier. Reuse it only when resuming the same deployment.

factory

  • Type: Address

Reviewed ERC4626EngineFactory address.

venue

  • Type: Address

ERC-4626 venue address.

owner (optional)

  • Type: Account | Address
  • Default: account.address

Final engine owner. This account must later bind the engine to its EarnVault.

name (optional)

  • Type: string

Engine name override. An omitted value derives metadata from the venue.

symbol (optional)

  • Type: string

Engine symbol override. An omitted value derives metadata from the venue.

account (optional)

  • Type: Account | Address

Account that will be used to send the transaction.

feePayer (optional)

  • Type: Account | boolean

Fee payer for the transaction (TIP-1 gas sponsorship).

Pass true to defer the fee token to an external fee payer (e.g. a relay), or a local Account to co-sign the transaction as the fee payer.

feeToken (optional)

  • Type: Address | bigint

Fee token for the transaction.

Can be an unpaused USD-denominated TIP-20 token address or ID.

gas (optional)

  • Type: bigint

Gas limit for the transaction.

keyAuthorization (optional)

  • Type: KeyAuthorization

Signed key authorization to include with the transaction, authorizing an access key to act for the sending account.

maxFeePerGas (optional)

  • Type: bigint

Max fee per gas for the transaction.

maxPriorityFeePerGas (optional)

  • Type: bigint

Max priority fee per gas for the transaction.

nonce (optional)

  • Type: number

Nonce for the transaction.

nonceKey (optional)

  • Type: 'expiring' | 'random' | bigint

Nonce key for the transaction (TIP-1009 2D nonces).

Use 'expiring' to select an expiring nonce, which enables concurrent transaction submission without nonce ordering. Use 'random' to select a random key.

throwOnReceiptRevert (optional)

  • Type: boolean
  • Default: true

Whether a Sync action throws when the receipt reports a revert.

validAfter (optional)

  • Type: number

Unix timestamp after which the transaction can be included.

validBefore (optional)

  • Type: number

Unix timestamp before which the transaction must be included.