Skip to content
LogoLogo

earn.bindEngine

Permanently binds an engine to its EarnVault and optionally transfers ownership. This API is experimental.

Usage

import {  } from './viem.config'
 
const  = await ..({
  : '0x0000000000000000000000000000000000000001',
  : '0x0000000000000000000000000000000000000003',
  : '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.bindEngineSync waits for inclusion and returns the decoded binding event. Use earn.bindEngine to return the transaction hash immediately.

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

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 sends the transaction. For a coordinated transaction, pass the configurable account.

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.

Owner (Optional)

  • Type: Account

Local owner that signs one coordinated approval.

finalOwner (Optional)

  • Type: Address

Final engine owner. Omit to preserve the current owner.