IERC20PaymentClientBase_v1.sol
Author: Inverter Network
Enables modules within the Inverter Network to create and manage payment orders that can be processed by authorized payment processors, ensuring efficient and secure transactions. Refer to the implementations contract for more details.
STRUCTURING OF THE FLAGS AND DATA FIELDS The PaymentOrder struct implements a flag system to manage the information payloads received by the payment processor. It is comprised of a bytes32 value that indicates the number of flags that are active, and a bytes32[] value that stores the corresponding values. For example: If the value of 'flags' is '0000 [...] 0000 1011', then that order stores values for the paramters 0, 1 and 3 of the master list. The byte code for simple flag setups might also be represented by hexadecimal values like 0xB, which has the same value as the bit combination above. If a module wants to set flags, it can use bit shifts, in this case 1 << 0, 1 << 1 and 1 << 3. Afterwards, to be correct, the following data variable should contain 3 elements of the type specified in the master list, each stored as bytes32 value.
Functions
paymentOrders
Returns the list of outstanding payment orders.
Returns
<none>
PaymentOrder[]
list of payment orders.
outstandingTokenAmount
Returns the total outstanding token payment amount.
Parameters
token_
address
The token in which to pay.
Returns
total_
uint256
amount of token to pay.
collectPaymentOrders
Collects outstanding payment orders.
Marks the orders as completed for the client.
Returns
paymentOrders_
PaymentOrder[]
list of payment orders.
tokens_
address[]
list of token addresses.
totalAmounts_
uint256[]
list of amounts.
amountPaid
Notifies the PaymentClient, that tokens have been paid out accordingly.
Payment Client will reduce the total amount of tokens it will stock up by the given amount.
This has to be called by a paymentProcessor.
Parameters
token_
address
The token in which the payment was made.
amount_
uint256
amount of tokens that have been paid out.
getFlags
Returns the flags used when creating payment orders in this client.
Returns
flags_
bytes32
The flags this client will use.
getFlagCount
Returns the number of flags this client uses for PaymentOrders.
Returns
flagCount_
uint8
The number of flags.
Events
PaymentOrderAdded
Added a payment order.
Parameters
recipient
address
The address that will receive the payment.
token
address
The token in which to pay.
amount
uint256
The amount of tokens the payment consists of.
originChainId
uint256
The id of the origin chain.
targetChainId
uint256
The id of the target chain.
flags
bytes32
Flags that indicate additional data used by the payment order.
data
bytes32[]
Array of additional data regarding the payment order.
FlagsSet
Emitted when the flags are set.
Parameters
flagCount
uint8
The number of flags set.
newFlags
bytes32
The newly set flags.
Errors
Module__ERC20PaymentClientBase__CallerNotAuthorized
Function is only callable by authorized address.
Module__ERC20PaymentClientBase__TokenTransferFailed
ERC20 token transfer failed.
Module__ERC20PaymentClientBase__InsufficientFunds
Insufficient funds to fulfill the payment.
Parameters
token
address
The token in which the payment was made.
Module__ERC20PaymentClientBase__InvalidRecipient
Given recipient invalid.
Module__ERC20PaymentClientBase__InvalidToken
Given token invalid.
Module__ERC20PaymentClientBase__InvalidAmount
Given amount invalid.
Module__ERC20PaymentClientBase__InvalidPaymentOrder
Given paymentOrder is invalid.
Module__ERC20PaymentClientBase__MismatchBetweenFlagCountAndArrayLength
Given mismatch between flag count and supplied array length.
Module__ERC20PaymentClientBase_v1__FlagAmountTooHigh
Given number of flags exceeds the limit.
Structs
PaymentOrder
Struct used to store information about a payment order.
Properties
recipient
address
The recipient of the payment.
paymentToken
address
The token in which to pay. Assumed to always be on the local chain.
amount
uint256
The amount of tokens to pay.
originChainId
uint256
The id of the origin chain.
targetChainId
uint256
The id of the target chain.
flags
bytes32
Flags that indicate which information the data array contains.
data
bytes32[]
Array of additional data regarding the payment order.
Last updated