Skip to content

Repository files navigation

AdvertisementManager Subgraph

This subgraph indexes events from the AdvertisementManager contract on the Base network. It provides a comprehensive view of advertisements, user activities, and system statistics.

Queries

Here are some example queries you can use to interact with the subgraph:

Global Statistics

{
globalStats(id: "1") {
totalAdvertisementstotalEngagementstotalUserstotalRewardsMinted
}
}

User Information

Get user details:

{
user(id: "0x1234...") {
addresslevelreputationachievementsCountengagementsCounttotalRewardsEarnedreferrals {
id
}
referrer {
id
}
}
}

List top users by reputation:

{
users(first: 10, orderBy: reputation, orderDirection: desc) {
idaddressreputationlevel
}
}

Advertisements

Get advertisement details:

{
advertisement(id: "0x5678...") {
linkimageUrlpriceadvertiser {
idaddress
}
referrer {
idaddress
}
engagementsCountactive
}
}

List recent active advertisements:

{
advertisements(
first: 20,
orderBy: blockTimestamp,
orderDirection: desc,
where: { active: true }
) {
idlinkimageUrlpriceadvertiser {
address
}
engagementsCount
}
}

Engagements

Get recent engagements:

{
engagementRecordeds(first: 100, orderBy: blockTimestamp, orderDirection: desc) {
adIndexusertimestamp
}
}

Achievements

List recent achievements:

{
achievementUnlockeds(first: 50, orderBy: blockTimestamp, orderDirection: desc) {
userachievementIdname
}
}

Special Events

Get details of recent special events:

{
specialEventStarteds(first: 10, orderBy: startTime, orderDirection: desc) {
namestartTimeendTimerewardMultiplier
}
}

Complex Queries

Get user with their advertisements and engagements:

{
user(id: "0x1234...") {
addresslevelreputationadvertisements {
idlinkengagementsCount
}
engagementRecordeds {
adIndextimestamp
}
}
}

Get top advertisers by engagement count:

{
advertisements(first: 10, orderBy: engagementsCount, orderDirection: desc) {
advertiser {
addresslevelreputation
}
linkengagementsCount
}
}

Notes

  • Replace "0x1234..." and "0x5678..." with actual entity IDs when querying.
  • The first parameter in list queries can be adjusted to retrieve more or fewer results.
  • Use skip parameter for pagination, e.g., (first: 20, skip: 20) for the second page.
  • Combine where conditions for more specific queries, e.g., where: { active: true, price_gt: "1000000000000000000" }.

For more information on how to build queries, refer to The Graph's query API documentation.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages