Skip to content
LogoLogo

earn.bindErc4626Engine

Permanently binds an ERC-4626 engine to its factory-created EarnVault. This API is experimental.

Usage

import { client } from './viem.config'
 
const result = await client.earn.bindErc4626EngineSync({
  engine: '0x0000000000000000000000000000000000000001',
  vault: '0x0000000000000000000000000000000000000002',
})
{ engine: '0x...', vault: '0x...', receipt: { ... } }

The transaction must be signed by the engine's final owner. Binding remains a separate operation so deployment and final ownership can use different accounts. It cannot be changed after initialization.

Asynchronous Usage

earn.bindErc4626EngineSync waits for inclusion and returns the decoded binding event. Use earn.bindErc4626Engine to return the transaction hash immediately.

import { Actions } from 'viem/tempo'
import { client } from './viem.config'
 
const engine = '0x0000000000000000000000000000000000000001'
const hash = await client.earn.bindErc4626Engine({
  engine,
  vault: '0x0000000000000000000000000000000000000002',
})
const receipt = await client.waitForTransactionReceipt({ hash })
const { args } = Actions.earn.bindErc4626Engine.extractEvent(receipt.logs, {
  engine,
})

Return Value

type ReturnValue = {
  /** ERC-4626 engine address. */
  engine: Address
  /** Transaction receipt. */
  receipt: TransactionReceipt
  /** Bound EarnVault address. */
  vault: Address
}

The asynchronous action returns the transaction hash instead.

Parameters

engine

  • Type: Address

ERC-4626 engine address.

vault

  • Type: Address

EarnVault created for the engine.

account (optional)

  • Type: Account | Address

Account that will be used to send the transaction.

feeToken (optional)

  • Type: Address | bigint

Fee token for the transaction.

Can be an unpaused USD-denominated TIP-20 token address or ID. Use client.fee.validateToken({ token }) to validate a token before submitting a transaction or setting it as a fee preference.

feePayer (optional)

  • Type: Account | true

Fee payer for the transaction.

Can be a Viem Account, or true if a Fee Payer Service will be used.

gas (optional)

  • Type: bigint

Gas limit for the transaction.

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' | bigint

Nonce key for the transaction. Use 'expiring' to use expiring nonces (TIP-1009), which enables concurrent transaction submission without nonce ordering.

validBefore (optional)

  • Type: number

Unix timestamp before which the transaction must be included.

validAfter (optional)

  • Type: number

Unix timestamp after which the transaction can be included.

throwOnReceiptRevert (optional)

  • Type: boolean
  • Default: true

Whether to throw an error if the transaction receipt indicates a revert. Only applicable to *Sync actions.