CityCoins
  • Introduction
  • About CityCoins
    • What are CityCoins?
    • How do I get started?
  • CityCoins Resources
    • General
    • MineCityCoins.com
  • Core Protocol
    • Registration and Activation
    • Mining CityCoins
    • Stacking CityCoins
    • Token Configuration
  • Developer Resources
    • General
    • API
    • Code Examples
      • Get Account Transactions
      • Activation
      • Mining
      • Mining Claims
      • Stacking
    • Contracts
    • Integrations
      • Supporting Stacks
      • Supporting CityCoins
      • Stacks Transactions
      • Additional Info
  • Contract Functions
    • Activation
    • Mining
    • Mining Claims
    • Stacking
    • Stacking Claims
    • Token
Powered by GitBook
On this page
  • Overview
  • Details
  • Contract Functions
  • API Ref: Stacking Claims
  • claim-stacking-reward
  • get-stacking-reward

Was this helpful?

  1. Contract Functions

Stacking Claims

CityCoin contract functions related to stacking claims.

PreviousStackingNextToken

Last updated 3 years ago

Was this helpful?

Overview

After CityCoins are Stacked in the contract, Stackers are required to claim their rewards and unlocked CityCoins after a cycle ends.

Claiming rewards from Stacking CityCoins happens by calling the contract function .

Details

The payouts are based on the amount Stacked by the user R, the total STX reward that cycle S, and the total of all StackersTusing the formula: STX Rewards = (R * S) / T

Contract Functions

claim-stacking-reward

Type: Public Function

Input: targetCycle as uint

Success: (ok true)

Errors:

  • ERR_USER_ID_NOT_FOUND u1003

  • ERR_STACKING_NOT_AVAILABLE u1015

  • ERR_REWARD_CYCLE_NOT_COMPLETED u1017

  • ERR_NOTHING_TO_REDEEM u1018

Claiming Stacking rewards happens through calling the claim-stacking-reward function in the contract, which accepts a reward cycle and checks both the entitled STX reward from miners and the amount of CityCoins to return, then transfers them to the user.

get-stacking-reward

Type: Read-only Function

Input: userId as uint and targetCycle as uint

Returns: entitledStackingReward as uint, or default (u0)

Returns the amount of STX a user can claim in a given reward cycle in uSTX. This method will only return a positive value if:

  • the current block height is in a subsequent reward cycle

  • the Stacker locked up CityCoins in the target reward cycle

  • the Stacker locked up enough CityCoins to receive at least one uSTX

API Ref: Stacking Claims
claim-stacking-rewards