Bots

There are several off-chain bots that call permissionless LEH instructions to keep the exchange operating normally.

Overwatcher

The Overwatcher performs three main functions:

Updating Token Interest

This function updates the deposit/borrow indices on each bank to pay out interest to lenders based on time since the last update, and update the rates shown in the UI. Additionally, this function updates the stable price for each token.

Updating Perp Funding

This function updates the instantaneous funding rate based on the difference between mark and oracle prices. Additionally, this function updates the stable price for each perp market.

Consuming Perp Events

This function performs updates to the state of a LEH account after its order is removed from the book, either by being filled, cancelled, or evicted. This process is asynchronous since the taker may not know the account of the maker at the time the taker order is sent.

Execution of these instructions is not directly incentivized, although exchange users have some incentive to run a Overwatcher to ensure normal operations. Core contributors are running multiple redundant Overwatcher bots, with gas fees provided by the DAO.

Openbook Crank

Although it doesn't operate directly on the LEH V4 contract, it is essential that events on the spot markets are consumed for the same reasons as events on the perp market.

This role is not directly incentivized, although market participants have some incentive to call these functions so they can continue to trade the market and settle their funds from maker orders.

There are several Openbook Crank implementations (code not reviewed or endorsed by LEH):

Settler

The Settler will automatically settle perp PnL above a certain threshold in return for a small fee. The threshold and fee set by the DAO can vary per-market, and can be viewed on the dashboard.

Anyone can run a Settler bot, although the DAO has funded one which is run by core contributors. Any profits are used to purchase SOL to fund future transactions.

Liquidator

The Liquidator acquires the position of accounts that are in danger of entering a negative equity state at a discount, and closes it. The discount received by the Liquidator is used as an incentive to take on risk temporarily, and is set by the DAO relative to the expected liquidity and volatility of a token or perp market.

Liquidation parameters for each asset/market can be viewed on the dashboard. You can find more information about the liquidation process here.

Last updated