Function: payBills(Payment[] payments)

This function can be used to initiate one or more payments. The function supports both native Ethereum as well as ERC-20 tokens.

Inputs

  • payments

    • Control: Arbitrary.

    • Constraints: None directly enforced by the contract — user must have sufficient balance and must have granted sufficient allowance for ERC-20 assets.

    • Impact: List of payments to be made.

Each entry in the payments array is an instance of the Payment struct:

struct Payment { address token; // Use address(0) for native currency (ETH, MATIC, etc.) address recipient; uint256 amount; }

Branches and code coverage

Intended branches

  • Allows to initiate a native ETH payment.

  • Allows to initiate an ERC-20 payment.

  • Returns any excess ETH sent in the transaction.

Negative behavior

  • Reverts if an ERC-20 transfer is unsuccessful.

  • Reverts if the ETH payment's total is greater than the incoming message value.

  • Reverts if the call made to refund excess ETH has reverted.

Zellic © 2024Back to top ↑