Superform v1
  • Introduction
  • Components
    • Protocol
    • Keepers
    • API
    • App
  • E2E Flows
    • Same-chain Deposit
    • Cross-chain Deposit
    • Same-chain Withdrawal
    • Cross-chain Withdrawal
  • Periphery Contracts
    • SuperformRouter
      • SuperformRouterPlus
      • SuperformRouterPlusAsync
    • PayMaster
    • PaymentHelper
    • EmergencyQueue
    • SuperformFactory
    • Forms
      • ERC4626Form
      • ERC5115Form
      • ERC7540Form
    • SuperPositions
      • ERC1155A
    • RewardsDistributor
  • Core Contracts
    • State Registries
      • CoreStateRegistry
      • AsyncStateRegistry
      • PayloadHelper
    • AMB Implementations
      • LayerzeroImplementation
      • LayerzeroV2Implementation
      • WormholeARImplementation
      • HyperlaneImplementation
      • AxelarImplementation
    • Broadcasting
      • BroadcastRegistry
      • WormholeSRImplementation
    • Bridge Validators
      • LiFiValidator
      • SocketValidator
      • SocketOneInchValidator
      • DebridgeValidator (and forwarder)
      • OneInchValidator
    • DstSwapper
    • Settings
      • SuperRBAC
      • SuperRegistry
  • SuperVaults
    • SuperVaults
  • Resources
    • Deployment Addresses
    • Subgraphs
      • Protocol Level Entities
      • Form Related Entities
      • Deposits and Withdrawals
      • SuperPosition Events
      • External Entities
    • Infrastructure Integrations
    • Security & Audits
    • Protocol License
    • Glossary
    • Protocol Multisig
    • Superform Labs Socials
Powered by GitBook
On this page
  • Introduction
  • Core Concepts
  • Users making additional payments
  • Superform managing payments
  • Retrying Messages

Was this helpful?

  1. Periphery Contracts

PayMaster

Last updated 7 months ago

Was this helpful?

Introduction

PayMaster handles payment and relayer cost management for crosschain transactions. Callers pay in native tokens on the source chain directly through entry functions (_forwardPayment) and this payment is used to fund Keepers making cross-chain transactions including retrying of messages. To rebalance funds across chains when they get low, PayMaster integrates LiquidityHandler.

Core Concepts

Users making additional payments

makePayment

function makePayment(
    address user_) external payable;
Name
Description

user_

Address of the user to make a payment for

Superform managing payments

withdrawTo

This function is utilized to withdraw native tokens from PayMaster to the appropriate contract on the same chain.

function withdrawTo(
    bytes32 superRegistryId_,
    uint256 nativeAmount_) external;
Name
Description

superRegistryId_

bytes hash of the superRegistryId

nativeAmount_

Amount of the native token to withdraw

rebalanceTo

function rebalanceTo(
    bytes32 superRegistryId_,
    LiqRequest memory req_,
    uint64 dstChainId_) external;
Name
Description

superRegistryId_

bytes id of the superRegistryId

liqRequest

dstChainId_

uint64 EVM chain ID of where the funds are going

Retrying Messages

treatAMB

This function allows PaymentAdmin to use funds in PayMaster to retry messages automatically.

function treatAMB(
    uint8 ambId_,
    uint256 nativeValue_,
    bytes memory data_) external
Name
Description

ambId_

nativeValue_

uint256 native tokens to send in the transaction

data_

While estimations try to estimate the amount paid in as accurately as possible, it is possible that transactions are underpaid, especially in custom integrations not using the Superform API. Underpaid transactions will become stuck. Users can pay more native tokens to PayMaster on any chain Superform supports through the makePayment() function by specifying which address the payments should be used for. Once completed, Superform Keepers will recognize this and attempt to retry the action.

Payments can only be withdrawn by the Superform PaymentAdmin and tokens can only be sent to core infrastructure in the Superform ecosystem, associated with a hashed .

These functions are used to withdraw and bridge native tokens from PayMaster to the appropriate contract on other chains. ensure that bridged data sends funds to the intended contract.

struct

The retrying of messages, either payloads or proofs, is specific to the and can be triggered by users directly in .

uint8 AMBid of the

bytes data specific to the required to retry the message

SuperformRouter
superRegistryId
Bridge Validators
AMB implementation
AMB Implementations
AMB Implementations.
AMB implementation
SuperformRouter
LiquidityRequest