Architecture

Deposit flow

  1. User initiates a deposit by interacting with the Pike protocol on a Spoke chain.

  2. Spoke chain contract creates the required data to send to Hub chain. In parallel mint pToken accordingly to the user’s wallet.

  3. The Gateway contract on the Spoke chain receives the deposit request and forwards it to the HubState contract on the Hub chain via the Wormhole relayer.

  4. HubState verifies the deposit request, ensuring that the user meets the required criteria and that the deposited assets are supported.

  5. Once the deposit is approved, HubState updates the user's collateral balance and reserves the deposited assets for borrowing purposes.

  6. The user's collateral can now be utilized for borrowing on the Spoke chain.

Borrow flow

  1. User submits a borrowing request through the contract on the relevant Spoke chain.

  2. Spoke chain contract creates the required data to send to Hub chain.

  3. The Gateway contract on the Spoke chain receives the borrow request and forwards it to the Hub chain via the Wormhole relayer.

  4. HubState validates the request, checking the user's collateral, borrowing limit, and other parameters.

  5. If the request is valid, the Hub chain sends back a message to Spoke chain via the Wormhole relayer to confirm the borrow.

  6. Spoke chain receives the message to confirm the borrow and sends the asset to the user’s wallet.

  7. The user can now access and utilize the borrowed assets for their intended purposes.

Repay flow

  1. User initiates a loan repayment by interacting with the contract on the Spoke chain.

  2. Spoke chain contract creates the required data to send to Hub chain.

  3. The Gateway contract on the Spoke chain receives the repayment request data and forwards it to the Hub chain via the Wormhole relayer.

  4. The HubState verifies the repayment request, ensuring that the user has sufficient funds and the repayment amount is valid.

  5. Once the repayment is confirmed, the HubState updates the user's borrowing balance, adjusting interest accruals and calculating any remaining outstanding loan amounts.

  6. The user's repayment reduces their borrowing balance and improves their overall loan status.

Withdraw flow

  1. User submits a withdrawal request through the contract on the relevant Spoke chain.

  2. Spoke chain contract creates the required data to send to Hub chain.

  3. The Gateway contract on the Spoke chain receives the withdraw request data and forwards it to the Hub chain via the Wormhole relayer.

  4. HubState validates the request, checking the user's collateral, borrowing limit, and other parameters.

  5. If the request is valid, the Hub chain sends back a message to Spoke chain via the Wormhole relayer to confirm the withdrawal.

  6. Spoke chain receives the message to confirm the withdrawal, sends the asset to the user’s wallet, and burns pToken accordingly.

  7. The user can now access and utilize the assets for their intended purposes.

Liquidation flow

  1. In the case of a borrower's default or failure to meet loan obligations, the liquidation bot can trigger the liquidation from the contract on the relevant Spoke chain.

  2. Spoke contract creates and encodes the message payload for sending to Hub chain.

  3. Gateway contract on the Spoke chain receives the liquidation request and forwards it to the Hub chain via the Wormhole relayer.

  4. Hub contract validates the request, performs needed checks, calculates the reward amount for a liquidator and updates the global state.

  5. Hub contract creates, encodes and sends back the confirmation message to Spoke chain.

  6. Spoke chain receives the message, performs needed checks and sends the liquidation reward to the wallet address which had initiated the liquidation.

Last updated