Skip to content

Stichting-AllianceBlock-Foundation/ALB-TheGraph-LMCv1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ALB-TheGraph-LMCv1

The repository contains TheGraph based service for AllianceBlock Liquidity Mining Campaings Version 1.

Overview

This TheGraph based service listens for creation of new contracts from Staking Factory Contract and then tracks each of the deployed LMC contracts.

The Subgraph Manifest

Subgraph Manifest is in the subgraph.yaml file. It tracks few important configurations:

Network

  network: mainnet

Factory contract address

  source:
    address: "0x422A4057f8B8a41474Cf767cd32f0c781C8075cF"

ABIs

  source:
    abi: StakingRewardsFactory

NOTE: ABIs for both StakingRewardsFactory and StakingRewards are generated by solc tool and stored in /abi folder.

Start Block

  startBlock: 11206038

NOTE: In subgraph.yaml always keep the same version for apiVersion inside dataSources and templates!

Defined Entities

Defined enitites can be found schema.graphql. All queries will be made against the data model defined in the subgraph schema and the entities indexed by the subgraph.

  • LMC entitity tracks data for each LMC contract

    • id
    • blockNumber (of deployment)
    • timestamp (of deployment)
    • address
    • stakingToken (Liquidity pool token)
    • rewardsTokens (tokens in which users will incentivized for participating in campaign)
    • rewardsAmounts
    • rewardsDuration
  • Stake

    • id
    • blockNumber (of transaction)
    • timestamp (of transaction)
    • gasUsed (IMPORTANT: this is gas limit of transaction)
    • gasPrice
    • position (index to some user LMC position)
    • token (address of staking token)
    • amount (of tokens staked)
  • Withdraw

    • id
    • blockNumber (of transaction)
    • timestamp (of transaction)
    • gasUsed (IMPORTANT: this is gas limit of transaction)
    • gasPrice
    • position (index to some user LMC position)
    • token (address of staking token)
    • amount (of tokens withdrawn)
  • RewardPaid

    • id
    • blockNumber (of transaction)
    • timestamp (of transaction)
    • gasUsed (IMPORTANT: this is gas limit of transaction)
    • gasPrice
    • position (index to some user LMC position)
    • token (address of staking token)
    • amount (of tokens withdrawn)
  • User

    • id
    • positions (array of positions)
  • UserLMCPosition

    • id
    • lastUpdatedInBlock (last block user position got updated)
    • lastUpdatedAtTimestamp (last time user position got updated)
    • user (address)
    • lmc (address)
    • active (if user has active/non withdrawn stakes for this particular LMC)
    • activeStakes
    • totalStaked
    • totalRewards (total reward cliamed by user)
    • stakes (array of user's stakes)
    • withdraws (array of user's withdraws)
    • rewardsPaid (array of user's rewardsPaid)

Handlers:

All handlers can be found in /src/mappings.ts. They convert ethereum network data (transaction data and contract events) to queriable data. List of handlers:

  • handleDeploy
  • handleRewardPaid
  • handleStaked
  • handleWithdrawn

Use

For graphql querries: https://api.thegraph.com/subgraphs/name/skeremidchiev/alb-lmcv1

Useful Links

Documentation For TheGraph AllianceBlock LMCs v1

Known Issues

For some strange reason gasUsed variable in the transaction is actually gasLimit. This is a known bug in TheGraph!

About

The Graph project for AllianceBlock's Liquidity Mining Campaigns

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published