Payment Terminal Architecture
In practice, terminal functionality is implemented across several interfaces, abstract contracts, and implementation contracts. This modular architecture allows for greater flexibility when extending the protocol.1
The basic interfaces are:
IJBPaymentTerminal- exposes the capacity to take inbound payments.
IJBPayoutTerminal3_1- exposes the capacity to distribute payouts.
IJBAllowanceTerminal3_1- exposes the capacity for discretionary allocation of funds.
IJBRedemptionTerminal- exposes the capacity to redeem tokens.
Which are extended by:
IJBPaymentTerminal) - an extension interface that constrains inbound payments to only one token type.
IJBRedemptionTerminal) - an extension interface that has the capacity to take inbound payments, distribute payouts, allocate discretionary funds, and redeem tokens.
Abstract implementation contracts
These interfaces are implemented in the abstract contracts:
IJBSingleTokenPaymentTerminal) - an implementation of a payment terminal that only accepts one token type.
IJBPayoutRedemptionPaymentTerminal3_1_1) - an implementation of a payment terminal that has the capacity to take inbound payments of a particular token, distribute payouts of the same particular token, allocate discretionary funds of the same particular token, and make redemptions for the same particular token.
Finally, these contracts implement the abstract contracts above:
JBPayoutRedemptionPaymentTerminal3_1_1) - an implementation of a fully capable ETH terminal.
JBPayoutRedemptionPaymentTerminal3_1_1) - an implementation of a fully capable ERC-20 terminal.
- To register a terminal with
JBDirectory, that terminal only needs to adhere to
IJBPaymentTerminal, a basic interface which requires a consistent way of sending funds to the terminal (via
addToBalance). Protocol extensions can ensure their unique requirements are met by utilizing a different interface or abstract contract – for example, an extension which depends on standard redemption functionality can ensure adherence to
IJBRedemptionTerminal. This allows for easier extension interoperability.↩