Skip to content
LogoLogo

reward.watchRewardDistributed

Watches for reward distributed events when rewards are distributed to token holders.

Usage

import {  } from './viem.config'
 
const  = .reward.watchRewardDistributed({
  : (, ) => {
    .('Funder:', .funder)
    .('Amount:', .amount)
  },
  : '0x20c0000000000000000000000000000000000001',
})
 
// Later, stop watching
()

Return Type

type ReturnType = () => void

Returns a function to unsubscribe from the event.

Parameters

onRewardDistributed

  • Type: function
declare function onRewardDistributed(args: Args, log: Log): void
 
type Args = {
  /** Amount distributed */
  amount: bigint
  /** Address that funded the distribution */
  funder: Address
}

Callback to invoke when rewards are distributed.

token

  • Type: Address

Address of the TIP-20 token to watch.

args (optional)

  • Type: object
type Args = {
  /** Filter by funder address */
  funder?: Address | Address[]
}

Optional filters to narrow down events by funder address.