Adrena
  • About Adrena
    • 👁️Vision
    • 💉What is Adrena?
      • ✨No Liquidation Fees
      • 🫗Peer-to-Pool Perp Model (and the risks as a Liquidity Provider)
      • 🏋️Trading Competitions
        • 0️⃣Pre-Season: Awakening
        • 1️⃣Season 1: Expanse
      • 💽RPC and Trade Execution
    • 🧀Fees
      • 💰Revenue Sharing
      • 🍯Ways to Earn Overview
      • 💱Buybacks
    • 👾Trader Profile
    • 📖Achievements
    • 🧪Mutagen (Points System)
    • 🤝Referral System
    • Audits
    • Bug Bounty Program
    • 🔗Useful Links
  • Tokenomics
    • 🫦Tokenomics Overview
    • 🪙ADX
      • 🤑Distribution
      • 💸Emissions
      • 👥Forms of ADX
      • 🦺Vesting
      • 🚰Staked ADX - Rewards Emissions Schedule
      • 🔐Staking and Duration Locked Parameters for ADX
      • 🗳️Voting
    • 💎ALP
      • 🌊Genesis Liquidity [terminated]
        • 💦Genesis Liquidity Program [Terminated]
      • 🚰Staked ALP - Rewards Emissions Schedule [Terminated]
      • 🔐Staking and Locked Stake Parameters for ALP
  • Technical Documentation
    • 👤Governance Shadow Token
    • 🤖MrSablier & MrSablierStaking (Open Source Keepers)
    • 🔮Oracles and Price Feeds
    • ☢️"Toxic Flow" Countermeasures
    • 🪖Position Parameters
    • ⌚Sablier Automation Threads (deprecated)
    • 🏦Staking Implementation Details
    • Terms and Conditions
    • Token Terms and Conditions
  • Guides
    • 💻How to Change to Devnet in Phantom Wallet
    • 💧How to get Devnet SOL
    • 💰How to Get Tokens to Trade
    • 📈How to Open and Close a Trade
  • Reports
    • 21/11/2024 - BE - Increase Position, position.price miscalculations
    • 22/10/2024 - Upgrade staking accounting issue causing extra reward distribution
    • 12/10/2024 - BE - Borrow fees reset on position increase
    • 01/10/2024 - BE - Custody internal state for `Assets` reports too much locked collateral
    • 27/09/2024 - BE - Missing accounts reload during fee distribution
Powered by GitBook
On this page
  • Keepers, position opening and liquidations
  • First, what do we call a keeper?
  • Keeper usage related to user facing endpoints (IX)
  • Keeper usage related to liquidation engine
  • Keeper usage related to automated orders
  • Keeper usage related to staking
  1. Technical Documentation

MrSablier & MrSablierStaking (Open Source Keepers)

Adrena switched from its initial Clockwork fork "Sablier" that was too heavy to maintain and not reliable to a new set of gRPC Triton Yellowstone clients.

PreviousGovernance Shadow TokenNextOracles and Price Feeds

Last updated 6 months ago

The code of the open source MrSablier gRPC rust client is available on github at

Keepers, position opening and liquidations

First, what do we call a keeper?

To explain this, we can use the Push/Pull analogy for on-chain programs. Each on-chain program has a specific API, and all actions are PULL-based, meaning that someone needs to call an endpoint to trigger the associated logic, which can be either read-only or read-write.

Most of the endpoints (instructions, IX) of an on-chain program are designed to be called by users on demand, with some restricted to specific subgroups of users if permissioned.

However, there are actions that are more related to upkeep than actual user actions. For example, updating the funding rate, cranking the stake epoch, or performing side effects actions after another IX has been called. (Liquidation, SL, TP...)

This requires periodic or programmed program invocations, where off-chain services run and periodically call specific endpoints at a given interval or depending on specific conditions.

Keeper usage related to user facing endpoints (IX)

use keepers to process user requests. Users submit a request to open a position, the intent is then picked up by the keeper who process any incoming request, and bundle the necessary tx interacting with swap then perps. This introduces a slight latency that is used as protection against arbitrages.

In the case of Adrena, we don’t rely on keepers for all users actions, the user interacts directly with the contract without additional middleman, giving that #OPOS speed. The protection against oracle arbitrage is done through using worse price for collateral valuation (not trade prices).

We do not use Keeper for user-facing endpoint operations, such as position opening/closing, for instance. Atomic instructions™️

Keeper usage related to liquidation engine

Liquidation occurs when the posted collateral becomes insufficient due to a decrease in its price, or if the borrow (funding) slowly erodes it.

A platform that allows leveraging of user positions must consistently monitor these parameters for each position, as well as track all positions. This is necessary to promptly liquidate positions based on the aforementioned conditions. Time is crucial in order to avoid accumulating bad debt for the platform, which would then need to be paid by all participants.

Keeper usage related to automated orders

Stop loss, take profits (and future other types of limit order and such) are handled by our open source keeper MrSablier.

Keeper usage related to staking

At the end of each staking round, where rewards are distributed, a permissionless instruction is called by MrSablierStaking.

Another example is the locked staking accounts of users, or periodical auto-claim on behalf of users every ~7 days.

🤖
https://github.com/AdrenaFoundation/MrSablier/tree/main
Jup.ag
Jup.ag