Contract Overview
Last updated
Last updated
Pike is a cross-chain lending protocol that enables seamless borrowing and lending of digital assets across multiple blockchain networks. It employs a hub and spoke architecture with the integration of the Wormhole protocol for generic message passing.
The Hub chain (Base L2) controls the universal liquidity in the Pike protocol. It performs global accounting, maintains information from the Spokes, and approves or declines users' actions. The HubState contract serves as the central point of the Pike protocol, maintaining the aggregated state from all Spokes and validating key user actions.
The Spoke chains are where users interact with the protocol (excluding liquidations). Actions taken on Spokes are forwarded to the Hub for approval. Each Spoke has its own Gateway contract, which acts as a communication bridge between the Pike contracts and the Wormhole message-passing solution.
Pike utilizes the Wormhole protocol for generic message passing. The Wormhole triggers actions with payloads on the Gateway contract, which delegates these actions to their relevant destinations.
Pike consists of various contracts that handle different aspects of the lending protocol. Here are the key contracts involved:
The HubContract is the central contract of the Pike protocol. It maintains the aggregated state from all Spokes and performs necessary calculations to validate user actions such as depositing, borrowing, repaying, and withdrawing. HubState inherits from multiple auxiliary contracts related to the Hub state and exposes functions for liquidations.
The SpokeContract is deployed on each supported chain in the Pike protocol. It acts as the local interface for users to interact with the protocol on their respective chains. The SpokeContract handles the execution of user actions such as deposits, withdrawals, borrows, and repayments. It also communicates with the HubContract through the GatewayContract to maintain a synchronized state across all chains. The SpokeContract is responsible for managing the local reserves of assets and ensuring the enforcement of protocol rules on the local chain.
The Gateway contract is deployed on each Spoke and acts as a communication interface between the Pike contracts and the Wormhole message-passing solution. It receives actions with payloads from Wormhole and delegates them to their relevant destinations. The Gateway contract maintains a mapping of authorized contracts and supported chains, allowing only these contracts to call functions that forward messages to relevant chains.
The CollateralEngine contract calculates the borrowing capacity against a user's deposits. It determines the amount a user can borrow based on their collateral holdings.
The InterestRateEngine contract is responsible for algorithmically adjusting interest rates for various supported assets. It considers multiple internal and external factors when determining interest rate changes.
The OracleEngine contract retrieves actual price feeds from various sources. It ensures the availability of accurate and up-to-date price information for asset valuations within the Pike protocol.