-
Notifications
You must be signed in to change notification settings - Fork 15
PaymentClient
File: PaymentClient.sol
- The PaymentClient mixin enables modules to create payment orders that are processable by a proposal's
{IPaymentProcessor}
module. - Mixins are libraries that are atomic units which are composable with other mixins and encapsulate the internal state variables and associated logic of a single, concrete, concept, providing internal constants and internal or private functions, which may be (typically) be associated with some structured data storage
1. validRecipient(address recipient)
Modifier to ensure that the recipient
is valid and is neither address(0)
nor address(PaymentClientContract)
.
2. validAmount(uint amount)
Modifier to ensure that the amount
is non-zero.
3. validDueTo(uint dueTo)
Modifier to ensure that the due time is greater than block.timestamp
(i.e. lies in the future).
1. outstandingTokenAmount
function outstandingTokenAmount() external view returns (unit);
This function returns total outstanding token payment amount.
Return Data
- total outstanding token payment amount.
2. paymentOrders
function paymentOrders() external view returns (PaymentOrder[] memory);
This function returns the list of outstanding payment orders.
Return Data
- List of outstanding payment orders.
1. collectPaymentOrders
function collectPaymentOrders() external returns (PaymentOrder[] memory, unit);
This function helps collect outstanding payment orders. Callable only by the proposal's IPaymentProcessor. This function returns the list of all payment orders.
This function ensures that the IPaymentProcessor is able to fetch all tokens from the initiator/creator of the orders by ensuring sufficient token allowance.
NOTE: Collecting the payment orders means that the
IPaymentClient
will mark the orders as being fulfilled and delete them. The sole responsibility to actually fulfill the orders by transfering the tokens lies with theIPaymentProcessor
.
Return data
- list of payment orders
- total amount of token to pay