跳到主要内容

Data Hook

What everyone needs to know

  • A data hook contract provides extensions to a treasury that either override or augment the default JBMultiTerminal functionality.
  • A data hook can provide custom data to the JBMultiTerminal.pay(...) transaction and/or the JBMultiTerminal.cashOutTokensOf(...) transaction.
  • The data hook is passed contextual information from the transactions, which it uses to derive custom data for the protocol to affect subsequent behaviors in the pay and cash out transactions. Contextual information from the pay transaction is passed in the form of JBBeforePayRecordedContext, and contextual information from the cash out transaction is passed in the form of JBBeforeCashOutRecordedContext.
  • Data hooks can revert under custom circumstances, enabling functionality such as gated treasuries, max token supplies, or minimum contribution amounts.
  • A data hook is responsible for specifying any pay hook that should be triggered after the core functionality of a pay(...) or cashOutTokensOf(...) transaction executes successfully.
  • Each IJBTerminal fork can leverage data hooks in unique ways.

What you'll want to know if you're building