Royco
  • Overview
    • Introduction to Royco
    • Key Concepts
    • Applications
  • FOR USERS
    • FAQs
    • How to Use Royco
  • FOR INCENTIVE PROVIDERS
    • Developer Overview
      • Fees on Royco
    • Recipes vs. Vaults IAMs
    • Create an IAM
    • Incentivize IAMs
      • Types of Incentives
      • Place an Incentive Offer
      • Place an Incentive Offer: For Developers
      • Setup a Points Campaign
      • Native Yield
    • Verify a Market
    • Audits
    • Contract Addresses
  • How to fetch incentive data from Royco
  • MORE
    • Bug Bounty Program
    • Cross-Chain Deposit Module (CCDM)
      • CCDM Recipe IAMs
      • Deposit Locker
      • Deposit Executor
      • Token Support
      • Audits
      • IP Guide
    • Royco V2
      • Incentive Locker
      • Action Verifiers
      • Multiplier Market Hub
      • Audit
    • Royco SDK
    • Contributing to the Protocol
    • Brand Kit
  • Royco Vaults
    • Royco Vaults: Overview
  • Royco Vaults: Risks
Powered by GitBook
On this page

How to fetch incentive data from Royco

If you're running an incentive campaign on Royco, you'll likely want users to be able to see how many rewards they've earned on your native application as well.

PreviousContract AddressesNextBug Bounty Program

Last updated 1 month ago

Step 1:

Go to the API URL:i

Step 2:

Select "Authorize" and paste in your API Key you received from the Royco contributor team in the x-api-key (apiKey) field. (8efbdc2513f31866c6f5e6aa7d1ae3506843e2a874eb9284dcb3dbb8969c77de)

Step 3:

Scroll down to "Position" and the tab that matches your market type (Vault or Recipe)

If your market is a Recipe: Go to “/api/v1/position/recipe”

Else if your market is a Vault: Got to “/api/v1/position/vault”

Step 4:

Select "Try it Out"

Step 5:

Paste in the following json inside “Request Body” and under "value" key below “rawMarketRefId”, update to your specific global market id which is composed of chain Id, Market Type and Market Id (found at the end of your URL of your market on Royco). For Example:

The values are: Chain Id = 1, Market Type = 0, Market Id = 0x83c459782b2ff36629401b1a592354fc085f29ae00cf97b803f73cac464d389b The global market ID which you need to pass in “value” becomes: 1_0_0x83c459782b2ff36629401b1a592354fc085f29ae00cf97b803f73cac464d389b

{

"page": {

"index": 1,

"size": 500

},

"filters": [

{

"id": "rawMarketRefId",

"value": "146_0_0x7d1f2a66eabf9142dd30d1355efcbfd4cfbefd2872d24ca9855641434816a525"

}

]

}

Step 6:

Click Execute

Step 7:

Download the json file and pull data. You will get each individual position where user’s deposited assets are denoted by “inputToken” and user’s received incentives are denoted by “incentiveTokens”. The general conventions for amount notations are: 1. rawAmount: amount in wei 2. tokenAmount: amount normalized by token decimals

3. tokenAmountUsd: amount value in USD

Step 8:

In the response object, there will be a page object like below:

“page”: {

“index”: 1,

“size”: 500,

“total”: 3

}

This means that you have fetched the 1st page, where each page is of max size 500 and there are 3 pages in total. You will also receive one more property called “count” inside response object like below:

“count”: 1500 This means that there are 1500 positions in total. In one request, you can only fetch 500 positions. So, you will need to fetch the next pages in order to get all the positions, just in case that the value of “total” of your “page” object in response is not 1. In order to fetch the next page, you need to update the value of “index” in the request body. Note: Pagination is 1-based so, the first page will have an index of 1, the second page will have an index of 2 and so on…

For this Royco Market:

https://api.royco.org/ap
https://app.royco.org/market/1/0/0x83c459782b2ff36629401b1a592354fc085f29ae00cf97b803f73cac464d389b