LooksRare Raffles Subgraph
This Subgraph is designed to facilitate interaction with the LooksRare raffles system. It enables you to efficiently query and manipulate data related to raffles, participants, entries, prizes, pricing, currencies, winners, and transactions that occur within the LooksRare raffle smart contract.
Raffle subgraph (Mainnnet): https://thegraph.com/hosted-service/subgraph/looksrare/looksrare-raffle
Schema
The main entities in the LooksRare Raffle Subgraph are:
- Raffle
- Participant
- Entry
- Prize
- Pricing
- Currency
- Winner
- Transaction
Entities Schema
More information about each field can also be found in the Raffle Smart Contract documentation.
RaffleVersion
The RaffleVersion
is an enum. The options are V1
(0) or V2
(1).
enum RaffleVersion {
V1
V2
}
RaffleStatus
The RaffleStatus
is an enum representing all the possible statuses of a raffle.
enum RaffleStatus {
None
Created // Only on V1 raffles
Open
Drawing
RandomnessFulfilled
Drawn
Complete
Refundable
Cancelled
unknown
}
TokenType
The TokenType
is an enum representing all supported token types.
enum TokenType {
ERC721
ERC1155
ETH
ERC20
unknown
}
Raffle
A Raffle
represents a unique raffle event in the system.
- id: The unique identifier for the raffle object (
ID!
). - raffleId: The
raffleId
used in the smart contract (BigInt!
). - currency: The
Currency
entity associated with the Raffle (Currency!
). - owner: The address of the raffle owner (
Bytes!
). - status: The current status of the raffle (
RaffleStatus!
enum). - lastStatusUpdate: The timestamp of the last status update (
BigInt
). - statusLog: An array of
RaffleStatusLog
entities associated with the raffle ([RaffleStatusLog!]!
). - drawnAt: The timestamp when the winners have been determined (
BigInt
). - cutoffTime: The timestamp when the raffle is no longer accepting entries (
BigInt!
). - minimumEntries: The minimum number of entries required for the raffle to complete (
BigInt!
). - maximumEntriesPerParticipant: The maximum number of entries allowed per participant (
BigInt!
). - isMinimumEntriesFixed: Whether the raffle allows the total entries to exceed the minimum amount defined (
Boolean!
). - prizeValue: Total Prize Pool; the fair price in the Raffle’s currency value of every prize added up (
BigDecimal!
). - currentPool: The current pool value of the raffle (
BigDecimal!
). - version: The raffle contract version (
RaffleVersion!
). - pricing: A list of
Pricing
entities (pricing options) for the raffle ([Pricing!]!
). - prizes: A list of prizes associated with the raffle (
[Prize!]!
). - totalUsers: The total number of users who have entered the raffle (
BigInt!
). - totalTickets: The total number of tickets sold in the raffle (
BigInt!
). - tickets: A list of
Entry
entities for the raffle ([Entry!]!
). - totalWinners: The total number of winners in the raffle (
BigInt!
). - winners: A list of
Winner
entities in the raffle ([Winner!]
). - transactions: A list of Transaction entities associated with the raffle (
[Transaction!]!
).
Currency
A Currency
entity represents a currency used for raffle entries.
- id: The currency’s address (
ID!
). - name: The name of the currency (
String!
). - symbol: The currency's symbol (
String!
). - decimals: The number of decimal places for the currency (
BigInt!
). - isAllowed: Indicates whether the currency is allowed for raffle entries (
Boolean!
).
Pricing
A Pricing
entity represents a pricing tier in a raffle.
- id: The unique identifier for the pricing option (
ID!
). - raffle: The raffle associated with the pricing tier (
Raffle!
). - totalEntries: The number of entries granted by this pricing option (
BigInt!
). - price: The price for this pricing option (
BigDecimal!
).
Entry
An Entry
represents a participant's entry into a raffle.
- id: The unique identifier for the entry (
ID!
). - raffle: The
Raffle
entity associated with the entry (Raffle!
). - participant: The
Participant
entity who purchased the entry (Participant!
). - totalTickets: The total number of tickets purchased in this entry (
BigInt!
). - totalPrice: The total price paid for the entry (
BigDecimal!
). - refunded: Indicates whether the entry has been refunded (
Boolean!
). - winners: A list of
Winner
entities associated with this entry ([Winner!]
). - transactions: A list of
Transaction
entities associated with this entry ([Transaction!]
).
Participant
A Participant
represents a user who participates in one or more raffles.
- id: The participant’s address (
ID!
). - totalRaffles: The total number of raffles the participant has entered (
BigInt!
). - totalTickets: The total number of tickets the participant has bought across all raffles (
BigInt!
). - tickets: A list of entries associated with the participant (
[Entry!]!
). - winners: A list of winning entries associated with the participant (
[Winner!]
). - transactions: A list of transactions associated with the participant (
[Transaction!]
).
Transaction
A Transaction
entity represents a transaction associated with a raffle entry.
- id: The transaction’s hash (
ID!
). - hash: The transaction hash (
Bytes!
). - raffle: The Raffle entity associated with the transaction (
Raffle!
). - participant: The Participant entity who initiated the transaction (
Participant!
). - entry: The Entry entity associated with the transaction (
Entry!
). - entriesCount: The number of entries purchased in the transaction (
BigInt!
). - gasLimit: The gas limit for the transaction (
BigInt!
). - gasPrice: The gas price for the transaction (
BigDecimal!
). - block: The block number in which the transaction was included (
BigInt!
). - timestamp: The timestamp of the block containing the transaction (
BigInt!
).
Prize
A Prize
represents a prize in a raffle.
- id: The unique identifier for the prize (
ID!
). - prizeId: The prize's id in the smart contract (
BigInt!
). - raffle: The raffle associated with the prize (
Raffle!
). - tier: The prize tier (
BigInt!
). - type: The type of token used for the prize (
TokenType!
enum). - address: The address of the prize’s contract (
Bytes
, nullable). - tokenId: The identifier of the specific token within the given contract (
BigInt
, nullable). - amount: The amount of the prize (
BigInt
, nullable). - totalWinners: The total number of winners for this prize (
BigInt!
). - totalWinnersCumulative: The cumulative number of winners for this prize tier and all previous tiers (
BigInt!
).
Winner
A Winner
entity represents a winning entry in a raffle.
- id: The unique identifier for the winning entry (
ID!
). - raffle: The
Raffle
entity associated with the winning entry (Raffle!
). - winnerIndex: The index of the winner in the winners array (
BigInt!
). - participant: The
Participant
entity with the details of the winner (Participant!
). - entryIndex: The index of the winning entry in the entries array (
BigInt!
). - entry: The
Entry
entity associated with this win (Entry!
). - prizeIndex: The index of the prize won in the prizes array (
BigInt!
). - prize: The
Prize
entity with the details of the prize won by the winner (Prize!
). - claimed: Indicates whether the prize has been claimed (
Boolean!
). - claimedHash: The transaction's hash of the prize claim event (
Bytes
)
RaffleStatusLog
A RoundStatusLog entity represents a log of a round's status change.
- id: The log’s id (
ID!
). - raffle: The
Raffle
entity associated with the status log (Raffle!
). - status: The status of the raffle (
RaffleStatus!
). - transaction: The transaction hash that caused the status to change (
Bytes!
). - timestamp: The timestamp when the status was updated (
BigInt!
). - block: The block number when the status was updated (
BigInt!
).
Examples
These examples cover various use cases, including fetching raffle details, participant information, prizes, and more. Note that this is not an exhaustive list. You can build your own queries with the GraphQL Explorer found on the Raffle Subgraph page.
Querying Raffles
Fetch a Raffle by ID
Get raffle details by ID, including status, cutoff time, minimum entries, and maximum entries per participant.
query {
raffle(id: "1") {
id
status
cutoffTime
minimumEntries
maximumEntriesPerParticipant
}
}
List All Raffles
Retrieve a list of all raffles, including a pagination option.
query {
raffles(first: 10, skip: 0) {
id
status
cutoffTime
minimumEntries
maximumEntriesPerParticipant
}
}
Querying Participants
Fetch a Participant by ID
Get participant details by ID, including total raffles, total tickets, and associated entries.
query {
participant(id: "0x123...") {
id
totalRaffles
totalTickets
tickets {
id
raffle {
id
}
}
}
}
Querying Entries
List All Entries
Retrieve a list of all entries, including a pagination option.
query {
entries(first: 10, skip: 0) {
id
raffle {
id
}
participant {
id
}
totalTickets
totalPrice
}
}
Fetch an Entry by ID
Get entry details by ID, including the raffle, participant, total tickets, and total price.
query {
entry(id: "1-0x123...") {
id
raffle {
id
}
participant {
id
}
totalTickets
totalPrice
}
}
Querying Prizes
Fetch a Prize by ID
Get prize details by ID, including raffle, tier, type, token, and winners.
query {
prize(id: "1-0") {
id
raffle {
id
}
tier
type
tokenId
amount
totalWinners
}
}
Querying Transactions
Fetch a Transaction by ID
Get transaction details by ID, including hash, raffle, participant, entry, gas limit, gas price, block number, and block timestamp.
query {
transaction(id: "0x123...") {
id
hash
raffle {
id
}
participant {
id
}
entry {
id
}
gasLimit
gasPrice
block
timestamp
}
}