Inverter Documentation
GithubDiscordTwitterLinks
  • Getting Started
  • Concepts
    • What is Inverter Network
    • The Inverter Protocol
    • Protocol Concepts
      • Workflow Model
        • Factories
        • Orchestrator
        • Authorizer
        • Funding Manager
        • Payment Processor
        • Logic Module
      • Module Library
        • Authorizers
          • Role Authorizer
          • Single Vote Governance Module
          • Token Gated Role Authorizer
        • Funding Managers
          • PIMs
            • Bancor Based PIM: Virtual Supply
            • Bancor Based PIM: Virtual Supply Buy Restriction
          • Deposit Vault Funding Manager
        • Payment Processors
          • Streaming Payment Processor
          • Simple Payment Processor
        • Logic Modules
          • Bounty Manager
          • Recurring Payment Manager
          • KPI Rewarder
          • Staking Manager
      • Primary Issuance Markets (PIMs)
      • Governance
      • Security
        • Upgradeability
        • Emergency Protocol
        • Audits
        • Bug Bounties
      • Fees
  • SDK's
    • TypeScript SDK
      • Deploy a Workflow
      • Operate a Workflow
      • Deploy a Contract
    • React SDK
      • Deploy a Workflow
      • Operate a Workflow
      • Deploy a Contract
      • Query the Indexer
      • Subscribe to the Indexer
    • Graphql SDK
    • Workflow Guides
      • Grant/Revoke Roles
      • Bounty Manager
      • Bonding Curve
      • Deposit Vault
    • API
      • Inverter
      • getDeployWorkflowOptions
      • deployWorkflow
      • getModule
      • getWorkflow
      • deploy
  • Contracts
    • Technical Specification
    • Security Guidelines
    • Deployment Addresses
    • Technical Reference
      • Factories
        • Interfaces
          • IModuleFactory_v1.sol
          • IOrchestratorFactory_v1.sol
        • ModuleFactory_v1.sol
        • OrchestratorFactory_v1.sol
      • Orchestrator
        • Abstracts
          • ModuleManagerBase_v1.sol
        • Interfaces
          • IModuleManagerBase_v1.sol
          • IOrchestrator_v1.sol
        • Orchestrator_v1.sol
      • Modules
        • Authorizer
          • Role
            • Interfaces
              • IAUT_EXT_VotingRoles_v1.sol
              • IAUT_TokenGated_Roles_v1.sol
            • AUT_EXT_VotingRoles_v1.sol
            • AUT_Roles_v1.sol
            • AUT_TokenGated_Roles_v1.sol
          • IAuthorizer_v1.sol
        • Base
          • IModule_v1.sol
          • Module_v1.sol
        • Funding Manager
          • Deposit Vault
            • FM_DepositVault_v1
            • Interfaces
              • IFM_DepositVault_v1
          • Bonding Curve
            • Abstracts
              • BondingCurveBase_v1.sol
              • RedeemingBondingCurveBase_v1.sol
              • VirtualCollateralSupplyBase_v1.sol
              • VirtualIssuanceSupplyBase_v1.sol
            • Formulas
              • BancorFormula.sol
              • Utils.sol
            • Interfaces
              • IBancorFormula.sol
              • IBondingCurveBase_v1.sol
              • IFM_BC_Bancor_Redeeming_VirtualSupply_v1.sol
              • IRedeemingBondingCurveBase_v1.sol
              • IVirtualCollateralSupplyBase_v1.sol
              • IVirtualIssuanceSupplyBase_v1.sol
            • FM_BC_Bancor_Redeeming_VirtualSupply_v1.sol
            • FM_BC_Restricted_Bancor_Redeeming_VirtualSupply_v1.sol
            • FM_BC_Tools
          • IFundingManager_v1.sol
        • Logic Module
          • Abstracts
            • ERC20PaymentClientBase_v1.sol
            • Oracle Integrations
              • UMA Optimistic Oracle V3
                • Optimistic Oracle V3
                  • Interfaces
                    • OptimisticOracleV3CallbackRecipientInterface.sol
                    • OptimisticOracleV3Interface.sol
                  • AncillaryData.sol
                  • ClaimData.sol
                • IOptimisticOracleIntegrator.sol
                • OptimisticOracleIntegrator.sol
          • Interfaces
            • IERC20PaymentClientBase_v1.sol
            • ILM_PC_Bounties_v1.sol
            • ILM_PC_KPIRewarder_v1.sol
            • ILM_PC_PaymentRouter_v1.sol
            • ILM_PC_RecurringPayments_v1.sol
            • ILM_PC_Staking_v1.sol
          • LM_PC_Bounties_v1.sol
          • LM_PC_KPIRewarder_v1.sol
          • LM_PC_PaymentRouter_v1.sol
          • LM_PC_RecurringPayments_v1.sol
          • LM_PC_Staking_v1.sol
        • Payment Processor
          • Interfaces
            • IPP_Streaming_v1.sol
          • IPaymentProcessor_v1.sol
          • PP_Simple_v1.sol
          • PP_Streaming_v1.sol
        • Lib
          • LibMetadata.sol
          • LinkedIdList.sol
          • SafeMath.sol
      • External
        • Fees
          • Interfaces
            • IFeeManager_v1.sol
          • FeeManager_v1.sol
        • Forwarder
          • Interfaces
            • ITransactionForwarder_v1.sol
          • TransactionForwarder_v1
        • Governance
          • Interfaces
            • IGovernor_v1.sol
          • Governor_v1.sol
        • Reverter
          • InverterReverter_v1.sol
        • ERC20Issuance
          • Interfaces
            • IERC20Issuance_v1.sol
          • ERC20Issuance_v1.sol
        • Interfaces
          • IERC2771Context.sol
      • Proxies
        • Interfaces
          • IInverterBeacon_v1.sol
          • IInverterProxyAdmin_v1.sol
          • IInverterTransparentUpgradeableProxy_v1.sol
        • InverterBeacon_v1.sol
        • InverterBeaconProxy_v1.sol
        • InverterProxyAdmin_v1.sol
        • InverterTransparentUpgradeableProxy_v1.sol
  • Apps
  • Support
Powered by GitBook
On this page
  • State Variables
  • Functions
  • Public Functions
  • Internal Functions
  1. Contracts
  2. Technical Reference
  3. Modules
  4. Payment Processor

PP_Simple_v1.sol

PreviousIPaymentProcessor_v1.solNextPP_Streaming_v1.sol

Last updated 5 months ago

Inherits: Module_v1, IPaymentProcessor_v1

Author: Inverter Network

Manages ERC20 payment processing for modules within the Inverter Network that are compliant with the {IERC20PaymentClientBase_v1} interface.

Inherits {Module_v1} and implements {IPaymentProcessor_v1} to handle payment orders from registered modules, ensuring only eligible modules can initiate payments. Utilizes {SafeERC20} for secure token transfers.

State Variables

unclaimableAmountsForRecipient

Tracks all payments that could not be made to the paymentReceiver due to any reason.

paymentClient => token address => paymentReceiver => unclaimable Amount.

mapping(address => mapping(address => mapping(address => uint))) internal
    unclaimableAmountsForRecipient;

__gap

Gap for possible future upgrades.

uint[50] private __gap;

Functions

supportsInterface

See {IERC165-supportsInterface}.

function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(Module_v1)
    returns (bool);

onlyModule

Checks that the caller is an active module.

modifier onlyModule();

validClient

Checks that the client is calling for itself.

modifier validClient(IERC20PaymentClientBase_v1 client);

Public Functions

init

function init(
    IOrchestrator_v1 orchestrator_,
    Metadata memory metadata,
    bytes memory
) external override(Module_v1) initializer;

processPayments

Processes all payments from an {IERC20PaymentClientBase_v1} instance. Please note: this function does not support callbacks on transfer of tokens.

It's up to the the implementation to keep up with what has been paid out or not.

function processPayments(IERC20PaymentClientBase_v1 client)
    external
    onlyModule
    validClient(client);

Parameters

Name
Type
Description

client

IERC20PaymentClientBase_v1

The {IERC20PaymentClientBase_v1} instance to process its to payments.

cancelRunningPayments

Cancels all unfinished payments from an {IERC20PaymentClientBase_v1} instance.

It's up to the the implementation to keep up with what has been paid out or not.

function cancelRunningPayments(IERC20PaymentClientBase_v1 client)
    external
    view
    onlyModule
    validClient(client);

Parameters

Name
Type
Description

client

IERC20PaymentClientBase_v1

The {IERC20PaymentClientBase_v1} instance to process its to payments.

unclaimable

Getter for the amount of tokens that could not be claimed.

function unclaimable(address client, address token, address paymentReceiver)
    public
    view
    returns (uint amount);

Parameters

Name
Type
Description

client

address

address of the payment client.

token

address

address of the payment token.

paymentReceiver

address

PaymentReceiver's address.

Returns

Name
Type
Description

amount

uint256

Amount of tokens that could not be claimed.

claimPreviouslyUnclaimable

claim every unclaimable amount that the paymentClient owes to the _msgSender and send it to a specified receiver.

This function should be callable if the _msgSender has unclaimedAmounts.

function claimPreviouslyUnclaimable(
    address client,
    address token,
    address receiver
) external;

Parameters

Name
Type
Description

client

address

The IERC20PaymentClientBase_v1 instance address that processes all claims from _msgSender.

token

address

address of the payment token.

receiver

address

The address that will receive the previously unclaimable amount.

validPaymentOrder

Function that checks if the given PaymentOrder was valid.

function validPaymentOrder(IERC20PaymentClientBase_v1.PaymentOrder memory order)
    external
    returns (bool);

Parameters

Name
Type
Description

order

IERC20PaymentClientBase_v1.PaymentOrder

The IERC20PaymentClientBase_v1 Order that needs to be checked.

Returns

Name
Type
Description

<none>

bool

valid Bool if the Payment Order is valid.

Internal Functions

_claimPreviouslyUnclaimable

used to claim the unclaimable amount of a particular paymentReceiver for a given payment client.

function _claimPreviouslyUnclaimable(
    address client,
    address token,
    address paymentReceiver
) internal;

Parameters

Name
Type
Description

client

address

address of the payment client.

token

address

address of the payment token.

paymentReceiver

address

address of the paymentReceiver for which the unclaimable amount will be claimed.

_validPaymentReceiver

Validate address input.

function _validPaymentReceiver(address addr) internal view returns (bool);

Parameters

Name
Type
Description

addr

address

Address to validate.

Returns

Name
Type
Description

<none>

bool

True if address is valid.

_validTotal

Validate uint total amount input.

function _validTotal(uint _total) internal pure returns (bool);

Parameters

Name
Type
Description

_total

uint256

uint to validate.

Returns

Name
Type
Description

<none>

bool

True if uint is valid.

_validPaymentToken

Validate payment token input.

function _validPaymentToken(address _token) internal returns (bool);

Parameters

Name
Type
Description

_token

address

Address of the token to validate.

Returns

Name
Type
Description

<none>

bool

True if address is valid.

_validOriginAndTargetChain

function _validOriginAndTargetChain(uint originChainId_, uint targetChainId_)
    internal
    view
    returns (bool);
Git Source