Wormhole Integration: Token Transfer with Payload
Wormhole powers the cross-chain communication layer of Peridot Protocol. We use the Token Bridge with Payload feature to move assets and messages together in a single operation.
How It Works
A user interacts with a Spoke Contract (e.g., on Solana).
The contract calls Wormhole’s
transferTokensWithPayload()
method:Locks the asset on the source chain
Emits a message (VAA) with the user action: deposit, borrow, repay, etc.
The Hub Contract receives and verifies the VAA using
completeTransferWithPayload()
.Logic is executed on the Hub: balances are updated, collateral is verified, loans are issued.
Payload Structure
The payload includes:
Action type (deposit, borrow, repay, etc.)
Asset and amount
Source chain and user address
Optional metadata
Why It Matters
Combines token movement and cross-chain logic in one step
Eliminates the need for separate messaging or relayers
Guarantees atomicity of user intents and token transfers
Last updated