跳到主要内容

Payment Terminal Architecture

Juicebox project can be configured to use any contract that adheres to IJBPaymentTerminal to manage inflows and outflows of tokens. To understand the basics, read the glossary.

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

Interfaces

The basic interfaces are:

Which are extended by:

  • IJBSingleTokenPaymentTerminal (is IJBPaymentTerminal) - an extension interface that constrains inbound payments to only one token type.
  • IJBPayoutRedemptionPaymentTerminal3_1_1 (is IJBPaymentTerminal, IJBPayoutTerminal3_1, IJBAllowanceTerminal3_1, 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:

  • JBSingleTokenPaymentTerminal (is IJBSingleTokenPaymentTerminal) - an implementation of a payment terminal that only accepts one token type.
  • JBPayoutRedemptionPaymentTerminal3_1_1 (is JBSingleTokenPaymentTerminal, 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.

Implementation contracts

Finally, these contracts implement the abstract contracts above:


  1. 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 pay or 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.