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 commandsourceChain
: Name of the originating spoke chainsourceAddress
: Address of the spoke contract that sent the messagepayload
: Encoded data containing (user
,pTokenAddress
,borrowAmount
)
Process:
Validates the message comes from an authorized spoke contract
Calls
borrowFor()
on the specified pToken contractSends 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 commandsourceChain
: Name of the originating spoke chainsourceAddress
: Address of the spoke contract that sent the messagepayload
: Encoded user addresstokenSymbol
: Symbol of the token being supplied (e.g., "USDC")amount
: Amount of tokens being supplied
Process:
Validates the message comes from an authorized spoke contract
Maps token symbol to local pToken contract
Calls
mintFor()
on the pToken contract to mint pTokens for the user
Last updated