Skip to content
LogoLogo

Validate Earn Exit-Safe Policy

earn.validateExitSafePolicy

Verifies that an Earn share token uses an expected exit-safe TIP-403 policy and that every required member can receive transfers and mints.

The action throws when the token policy, compound components, whitelist administrator, or member authorization does not match the expected configuration.

Usage

import {  } from './viem.config'
 
await ..({
  : '0x0000000000000000000000000000000000000002',
  : {
    : 3n,
    : 1n,
    : 2n,
    : 2n,
  },
  : [
    '0x0000000000000000000000000000000000000003',
    '0x0000000000000000000000000000000000000004',
  ],
  : '0x20c0000000000000000000000000000000000001',
})

Recipes

Screen a Vault Before Listing It

Validate a third-party vault against its published policy record before showing it to users. Resolve the live share token with earn.getVault.

import {  } from './viem.config'
 
const  = '0x0000000000000000000000000000000000000001'
 
const {  } = await ..({  })
const  = await .
  .({
    : '0x8ba1f109551bD432803012645Ac136ddd64DBA72',
    : {
      : 3n,
      : 1n,
      : 2n,
      : 2n,
    },
    : [],
    ,
  })
  .(() => true)
  .(() => false)
true

Revalidate After Membership Changes

Rerun validation after every policy.modifyWhitelist update to catch accidental removal of a protocol recipient, such as the vault itself.

import {  } from './viem.config'
 
const  = '0x0000000000000000000000000000000000000001'
const  = '0x20c0000000000000000000000000000000000001'
const  = 2n
 
await ..({
  : '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  : false,
  : ,
})
 
await ..({
  : ..,
  : {
    : 3n,
    : 1n,
    ,
    : ,
  },
  : [],
  ,
})

Return Value

void

Parameters

accessAdministrator

  • Type: Address

Expected whitelist administrator.

policy

  • Type: ExitSafePolicy

Expected compound and component policy IDs. The sender policy must be the always-allow policy, and the recipient and mint-recipient policy IDs must match.

requiredMembers

  • Type: readonly Address[]

Addresses that must be authorized as recipients and mint recipients.

shareToken

  • Type: Address

Earn share token expected to use the compound transfer policy.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.