Claim Contract
Users will claim their governance rewards using this contract. Any time a claimable balance is touched, Claim will be invoked in order to keep proper track of issuance. This contract also handles updating YBX issuance amounts for each daily period. Any other contracts that manipulate claimable balances will have the Claim contract invoked to keep proper track of issued pool incentives.
Request
1
{
2
userPublicKey: string,
3
timestamp: number,
4
fee: string,
5
type: ProtocolEventTypes,
6
operation: 'UPDATE' | 'CLAIM',
7
}
Copied!
Fields:
  • operation: UPDATE or CLAIM, update sends issuance tracker payments for a period. Claim claims YBX for users.

High-Level Contract Process Flow (MAY BE OUT OF DATE)

  1. 1.
    User enters the contract through an event handler which transforms their request.
  2. 2.
    Contract prerequisite data from horizon.
    1. 1.
      Pool Account Data
    2. 2.
      User Account Data
    3. 3.
      User Position Data
  3. 3.
    Contract builds a transaction builder object.
    1. 1.
      This is the object operations will be added to throughout the rest of the contract process flow.
  4. 4.
    If the contract is performing a UPDATE operation.
    1. 1.
      Contract checks if UPDATE has been ran today. If it has been it rejects the request.
    2. 2.
      Contract calculates the YBX issuance ratio for each asset. See YBX Issuance section.
    3. 3.
      Contract send YBX issuance ratio payments to all YBX issuance trackers.
    4. 4.
      Contract adds a payment operation where the issuance account pays all YBX to be distributed this period to the distribution account.
    5. 5.
      Contract adds a payment operation where the distribution account pays all YBX allocated to YBX escrowers to the escrow pool.
  5. 5.
    If the contract is performing a CLAIM operation.
    1. 1.
      Contract identifies all user positions that have unclaimed YBX issuance accrued to them.
    2. 2.
      Contract creates claimClaimableBalance operations where the pool claims all user positions that have YBX to claim.
      1. 1.
        Contract calculates the YBX to be issued for each of these positions.
        1. 1.
          See YBX Issuance section.
      2. 2.
        Contract calculates accrued interest for all liability positions.
    3. 3.
      Contract adds createClaimableBalance operations where the pool recreates all user positions.
      1. 1.
        The user sponsors these claimable balances.
    4. 4.
      Contract adds a payment operation where the distribution account pays all earned YBX to the user.
    5. 5.
      Contract adds Utilization Tracker operations. See Average Utilization Ratios section.
  6. 6.
    Turret builds transaction builder into an XDR and returns it along with a signature.