Synthetix Docs
  • User Docs
  • Synthetix Exchange
  • Leveraged Tokens
  • For Developers
  • Orientation
  • Synthetix Overview
  • Development Progress
  • V3 FAQ
  • For Developers
    • Technical Architecture
    • Quick Start
      • Base Quickstart
    • Smart Contracts
    • Data Platform
    • Data Dictionary
    • Addresses + ABIs
    • Deployment Info
      • Mainnet
      • Sepolia
      • Sepolia Carina
      • Optimism Mainnet
      • Base Mainnet Andromeda
      • Base Sepolia Andromeda
      • Arbitrum Mainnet
      • Arbitrum Sepolia
    • Smart Contract Audits
    • Perps Market
    • Spot Market
    • Developer FAQ
  • For Perp Integrators
    • 101
    • Perps V3
    • L1 Perp (BFP)
    • Base Andromeda
    • Perps Python SDK
    • Perps V3 Keepers
  • For Liquidity Integrators
    • Creating Accounts
    • Delegating Collateral
      • Liquidity Pools
    • Liquidity Positions
      • Minting and Burning snxUSD
      • Position Liquidations
    • Base LP Guide
  • For Liquidity Pool Managers
    • Creating and Configuring Pools and Vaults
    • Collateral Vaults
      • Vault Liquidations
    • Rewards Distributors
    • Credit and Debt Distribution
  • For Derivatives Market Builders
    • Build on v3
    • Market Development Guide
    • Build on v3 FAQ
    • Operating a Market
    • Registering a Market
  • For Governance Participants
    • Synthetix Governance
    • Elections
  • For Designers
    • Design Resources
Powered by GitBook
On this page
  • Creating a Rewards Distributor
  • Rewards Distributor Example
  • Distributing Rewards
  1. For Liquidity Pool Managers

Rewards Distributors

PreviousVault LiquidationsNextCredit and Debt Distribution

Last updated 5 months ago

This is a permissioned function and only Synthetix governance can currently create or configure Reward Distributors

Pool owners may register and remove rewards distributors from the vaults in their pools. Rewards distributors are smart contracts which can distribute rewards among all of the liquidity positions in a specified vault (instantaneously or over time) and allow these rewards to be collected.

Creating a Rewards Distributor

Reward distributors must conform to the IRewardDistributor interface. This includes a payout function which should transfer amount of rewards to the sender address:

function payout(uint128 accountId, uint128 poolId, address collateralType, address sender, uint amount) external returns (bool);

For security reasons, the payout function should always revert unless msg.sender is equal to Synthetix Core address.

A pool owner can then connect a rewards distributor to a vault with the registerRewardsDistributor function. (Note that due to gas considerations, no more than 10 rewards distributors may be connected to a given vault at time.) To remove a rewards distributor, the pool owner can call the removeRewardsDistributor function.

Rewards Distributor Example

Below is an example Rewards Distributor contract that can be used to develop your own.

Below is an example transaction that:

  1. Registers a Rewards Distributor contract

  2. to poolId 69

  3. with SNX (on Optimism Goerli)

Distributing Rewards

A registered rewards distributor can call the distributeRewards function. The poolId and collateralType parameters identify the relevant vault. amount indicates the total amount of tokens to be distributed starting at the start timestamp over duration seconds. Note that duration may be set to 0, such that the rewards are distributed instantaneously based on the pro-rata distribution at start. A rewards distributor can call the distributeRewards function multiple times, adding to the rewards already distributed to those participating in the vault.

Anyone can static call the claimRewards function to see what an account ID can claim from a distributor registered to a specified vault, accounting for amounts previously claimed. Then, an address that owns (or has relevant permissions on) that account can call the claimRewards function. This, in turn, calls the payout function on the rewards distributor with the appropriate amount.

https://goerli-optimism.etherscan.io/tx/0xcbc66ab9276aa828149cabbe40c7eb88408d9963664ac37f9f69c4f228a7811egoerli-optimism.etherscan.io