Skip to content

🚨 Pike protocol (beta)

Notifications You must be signed in to change notification settings

nutsfinance/pike-protocol

Repository files navigation

Pike protocol

The protocol allows users to deposit native assets on any supported chain and borrow native assets on any other chain, while being backed by their entire multi-chain portfolio.

Security

⚠️ Warning! ⚠️ This project is in its early and experimental stages. It is undergoing an audit and has not yet been thoroughly reviewed for security vulnerabilities. Do not use in production.

Please report any security issues you find to security@pike.finance

System overview


The Hub

Hub is the chain which controls the universal liquidity. It performs the global accounting, maintains all the information from Spokes, approves or declines users' actions.

The Spoke

Spoke is the chain where users interact with the protocol (except for liquidations). Actions taken on Spokes are forwarded to the Hub for getting approvals.

Generic messaging

Pike employs the Wormhole protocol for generic messages passing.

Contracts

HubState

HubState is the central point of the Pike protocol and maintains the aggregated state from all Spokes. Also, HubState performs all the necessary calculations to validate key users actions like depositing, borrowing, repaying and withdrawing.

Hubstate inherits from multiple auxiliary contracts related to the Hub state.

The only publicly accessible functions are designed for liquidations.

Gateway

The contract is deployed on each Spoke and serves as a communication means between the Pike contracts and Wormhole message-passing solution. Wormhole triggers actions with payload on Gateway which delegates these actions to their relevant destinations.

Gateway holds a mapping of authorized contracts and supported chains. Only these contracts can call functions that forward messages to relevant chains.

BorrowEngine

BorrowEngine contract is deployed on each Spoke and used for the management of loans taken on that Spoke. Contains logic which allows users to perform borrowings and repayments.

Treasury

Treasury contract holds pooled reserve assets and is controlled only by the Hub.

CollateralEngine

The contract calculates how much user can borrow against his deposits.

InterestRateEngine

The contract is used for algorithmically increasing or decreasing interest rates for various supported assets based on multiple internal and external factors.

OracleEngine

The contract is responsible for retrieving actual price feeds from various sources.

Setup

  1. Install Foundry by following the instructions from their repository.
  2. Copy the .env.example file to .env and fill in the variables
  3. Install the dependencies by running : yarn install && forge install

Build

yarn build

Running tests

  • Unit tests: WIP
  • E2E tests: requires Wormhole generic relayers

Deploy & verify

Setup

Configure the .env variables.

Sepolia

yarn deploy:sepolia

Base

yarn deploy:base

Releases

No releases published

Packages

No packages published

Languages