PeridotHubHandler

The PeridotHubHandler is the central cross-chain message receiver on the hub chain, responsible for processing all supply and borrow requests from spoke chains and coordinating with pToken contracts.


🛠️ Key Functions & Parameters

_execute(bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, bytes calldata payload)

Processes cross-chain borrow requests (messages without tokens).

Parameters:

  • commandId: Unique identifier for the cross-chain command

  • sourceChain: Name of the originating spoke chain

  • sourceAddress: Address of the spoke contract that sent the message

  • payload: Encoded data containing (user, pTokenAddress, borrowAmount)

Process:

  1. Validates the message comes from an authorized spoke contract

  2. Calls borrowFor() on the specified pToken contract

  3. Sends borrowed tokens back to user on the spoke chain via Axelar


_executeWithToken(bytes32 commandId, string calldata sourceChain, string calldata sourceAddress, bytes calldata payload, string calldata tokenSymbol, uint256 amount)

Processes cross-chain supply requests (messages with tokens).

Parameters:

  • commandId: Unique identifier for the cross-chain command

  • sourceChain: Name of the originating spoke chain

  • sourceAddress: Address of the spoke contract that sent the message

  • payload: Encoded user address

  • tokenSymbol: Symbol of the token being supplied (e.g., "USDC")

  • amount: Amount of tokens being supplied

Process:

  1. Validates the message comes from an authorized spoke contract

  2. Maps token symbol to local pToken contract

  3. Calls mintFor() on the pToken contract to mint pTokens for the user

Last updated