跳到主要内容

IJBRulesetDataHook

Git Source

Inherits: IERC165

Data hooks can extend a terminal's core pay/cashout functionality by overriding the weight or memo. They can also specify pay/cashout hooks for the terminal to fulfill, or allow addresses to mint a project's tokens on-demand.

If a project's ruleset has useDataHookForPay or useDataHookForCashOut enabled, its dataHook is called by the terminal upon payments/cashouts (respectively).

Functions

hasMintPermissionFor

A flag indicating whether an address has permission to mint a project's tokens on-demand.

A project's data hook can allow any address to mint its tokens.

function hasMintPermissionFor(uint256 projectId, address addr) external view returns (bool flag);

Parameters

NameTypeDescription
projectIduint256The ID of the project whose token can be minted.
addraddressThe address to check the token minting permission of.

Returns

NameTypeDescription
flagboolA flag indicating whether the address has permission to mint the project's tokens on-demand.

beforePayRecordedWith

The data calculated before a payment is recorded in the terminal store. This data is provided to the terminal's pay(...) transaction.

function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
external
view
returns (uint256 weight, JBPayHookSpecification[] memory hookSpecifications);

Parameters

NameTypeDescription
contextJBBeforePayRecordedContextThe context passed to this data hook by the pay(...) function as a JBBeforePayRecordedContext struct.

Returns

NameTypeDescription
weightuint256The new weight to use, overriding the ruleset's weight.
hookSpecificationsJBPayHookSpecification[]The amount and data to send to pay hooks instead of adding to the terminal's balance.

beforeCashOutRecordedWith

The data calculated before a cash out is recorded in the terminal store. This data is provided to the terminal's cashOutTokensOf(...) transaction.

function beforeCashOutRecordedWith(JBBeforeCashOutRecordedContext calldata context)
external
view
returns (
uint256 cashOutTaxRate,
uint256 cashOutCount,
uint256 totalSupply,
JBCashOutHookSpecification[] memory hookSpecifications
);

Parameters

NameTypeDescription
contextJBBeforeCashOutRecordedContextThe context passed to this data hook by the cashOutTokensOf(...) function as a JBBeforeCashOutRecordedContext struct.

Returns

NameTypeDescription
cashOutTaxRateuint256The rate determining the amount that should be reclaimable for a given surplus and token supply.
cashOutCountuint256The amount of tokens that should be considered cashed out.
totalSupplyuint256The total amount of tokens that are considered to be existing.
hookSpecificationsJBCashOutHookSpecification[]The amount and data to send to cash out hooks instead of returning to the beneficiary.