Skip to content

Commit

Permalink
Merge pull request #253 from Azuro-protocol/devrel1
Browse files Browse the repository at this point in the history
query descr
  • Loading branch information
Avvrik authored Oct 9, 2024
2 parents feeb509 + 5e471db commit d3889a3
Show file tree
Hide file tree
Showing 28 changed files with 627 additions and 1 deletion.
9 changes: 9 additions & 0 deletions pages/community/hackathon.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ This page contains helpful materials to succeed in the tasks. For all informatio

### Tutorials

[GraphQL query descriptions](https://gem.azuro.org/subgraph/queries/sports/sporthub)

<Callout type="info">
The most helpful entities for this hack’s tasks are Game, Condition, Sport, League, and Country.
- The `Game` entity provides details about game status, participants, and the associated betting conditions. It’s useful for organizing games into categories like live, upcoming, or resolved, and showing detailed game-level data (e.g., participants, turnover).
- `Condition` entity is helful for building markets around individual game conditions and fetching the latest odds. You can use this entity to show bettors the markets available within a game.
- `Country, League, Sport` entities help in organizing betting markets and displaying relevant statistics by region, league, or sport. Great for creating custom market views, where users can explore betting opportunities by region or sport. You can also organize games by league or tournament.
</Callout>

[How to build an app on Azuro](https://gem.azuro.org/hub/apps/guides/tutorial)

[How to fetch and filter games](https://gem.azuro.org/hub/apps/guides/advanced/prematch/get-games)
Expand Down
5 changes: 4 additions & 1 deletion pages/subgraph/queries/_meta.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"bettor-data": "Bettor Data"
"contracts": "Smart Contract Entities",
"sports": "Sports, Leagues, Countries Entities",
"games-conditions": "Games & Conditions Entities",
"bets-events": "Bets (pre-match, live, freebets) & Events"
}
9 changes: 9 additions & 0 deletions pages/subgraph/queries/bets-events/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bet": "Bet Entity",
"live-bet": "LiveBet Entity",
"selection": "Selection Entity",
"live-selection": "LiveSelection Entity",
"bettor-data": "Bettor",
"event": "Event Entity",
"freebet": "FreeBet Entity"
}
48 changes: 48 additions & 0 deletions pages/subgraph/queries/bets-events/bet.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Bet Entity

## Description

Represents a user bet in Azuro. It stores details about the bet, such as conditions, odds, amount, and results, and is linked to the core contract for settlement.

## Usage

Use this entity to track and manage individual bets placed by users. It can be used to display betting histories, manage user-specific bets, or track bet results and payouts in your interface.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the bet (Core contract address + Bet ID). |
| `core` | `CoreContract!` | Reference to the core contract associated with the bet. |
| `type` | `BetType!` | Type of bet: either `Ordinar` (single bet) or `Express` (multiple bets). |
| `betId` | `BigInt!` | Numeric identifier for the bet. |
| `bettor` | `String!` | Address of the person who placed the bet. |
| `owner` | `String!` | Address of the owner of the bet. |
| `actor` | `String!` | Address of the actor (the account that executed the bet). |
| `affiliate` | `String` | Affiliate linked to the bet. |
| `rawAmount` | `BigInt!` | Raw amount staked in the bet. |
| `amount` | `BigDecimal!` | Formatted value of the amount staked. |
| `rawPotentialPayout` | `BigInt!` | Raw value of the potential payout. |
| `potentialPayout` | `BigDecimal!` | Formatted value of the potential payout. |
| `rawPayout` | `BigInt` | Raw value of the actual payout. |
| `payout` | `BigDecimal` | Formatted value of the actual payout. |
| `rawOdds` | `BigInt!` | Raw odds of the bet. |
| `odds` | `BigDecimal!` | Formatted odds of the bet. |
| `rawSettledOdds` | `BigInt` | Raw odds after settlement of the bet. |
| `settledOdds` | `BigDecimal` | Formatted odds after settlement. |
| `approxSettledAt` | `BigInt!` | Approximate time when the bet is expected to be settled. |
| `selections` | `[Selection!]! @derivedFrom` | List of selections tied to this bet. |
| `createdBlockNumber` | `BigInt!` | Block number when the bet was created. |
| `createdBlockTimestamp` | `BigInt!` | Timestamp of the block when the bet was created. |
| `createdTxHash` | `String!` | Transaction hash of the bet creation. |
| `resolvedBlockNumber` | `BigInt` | Block number when the bet was resolved (if applicable). |
| `resolvedBlockTimestamp` | `BigInt` | Timestamp of the block when the bet was resolved. |
| `resolvedTxHash` | `String` | Transaction hash for the resolution of the bet. |
| `status` | `BetStatus!` | Status of the bet: `Accepted`, `Canceled`, or `Resolved`. |
| `result` | `BetResult` | Result of the bet: `Won` or `Lost`. |
| `isRedeemable` | `Boolean!` | Indicates if the bet is redeemable. |
| `isRedeemed` | `Boolean!` | Indicates if the bet has been redeemed. |
| `redeemedBlockNumber` | `BigInt` | Block number when the bet was redeemed. |
| `redeemedBlockTimestamp` | `BigInt` | Timestamp of the block when the bet was redeemed. |
| `redeemedTxHash` | `String` | Transaction hash for the redemption of the bet. |
| `freebet` | `Freebet` | Reference to the freebet details (if applicable). |
File renamed without changes.
54 changes: 54 additions & 0 deletions pages/subgraph/queries/bets-events/event.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Event Entity

## Description

Represents a specific event within the Azuro system, such as new games, bets, or liquidity actions. It stores transaction details, timestamps, and references to related entities like bets and conditions.

**List of event names:**

- **NewGame**: A new game has been created.
- **GameShifted**: The game’s start time or conditions have been altered.
- **BettorWin**: A bettor has won their bet.
- **ConditionCreated**: A new betting condition has been created.
- **ConditionResolved**: A betting condition has been resolved.
- **ConditionShifted**: The condition has been changed, such as an odds adjustment.
- **ConditionStopped**: A condition has been halted or paused.
- **NewBet**: A new bet has been placed.
- **NewLiveBet**: A new live bet has been placed.
- **BetSettled**: A bet has been settled.
- **FreeBetMinted**: A freebet has been created and issued.
- **FreeBetReissued**: A freebet has been reissued.
- **FreeBetRedeemed**: A freebet has been redeemed.
- **FreeBetBettorWin**: A freebet has resulted in a win.
- **FreeBetTransfer**: A freebet has been transferred.
- **LiquidityAdded**: Liquidity has been added to a liquidity pool.
- **LiquidityRemoved**: Liquidity has been removed from a liquidity pool.
- **LiquidityTransfer**: Liquidity has been transferred between pools or users.
- **AzuroBetTransfer**: An Azuro bet has been transferred.
- **MarginChanged**: The margin on a bet or condition has been altered.
- **ReinforcementChanged**: The reinforcement (backing amount) for a condition has been adjusted.

## Usage

This entity is essential for tracking specific events like new game creations, bets being placed, or conditions being resolved. Use it to build real-time updates or historical event logs in your interface.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the event. |
| `contractAddress` | `String!` | Address of the contract where the event was generated. |
| `name` | `EventName!` | Name of the event (e.g., `NewGame`, `BetSettled`, `LiquidityAdded`, etc.). |
| `blockNumber` | `BigInt!` | Block number where the event occurred. |
| `blockTimestamp` | `BigInt!` | Timestamp of the block when the event occurred. |
| `txHash` | `String!` | Transaction hash associated with the event. |
| `transactionIndex` | `BigInt!` | Transaction index within the block. |
| `logIndex` | `BigInt!` | Log index for the event. |
| `sortOrder` | `BigInt!` | Sort order for the event. |
| `betId` | `String` | ID of the bet related to the event (if applicable). |
| `conditionId` | `String` | ID of the condition related to the event (if applicable). |
| `gameId` | `String` | ID of the game related to the event (if applicable). |
| `freebetId` | `String` | ID of the freebet related to the event (if applicable). |
| `depositId` | `String` | ID of the deposit related to the event (if applicable). |
| `gasPrice` | `BigInt!` | Gas price for the transaction where the event occurred. |
| `gasUsed` | `BigInt` | Amount of gas used during the event. |
30 changes: 30 additions & 0 deletions pages/subgraph/queries/bets-events/freebet.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Freebet Entity

## Description

Represents a specific event within the Azuro system, such as new games, bets, or liquidity actions. It stores transaction details, timestamps, and references to related entities like bets and conditions.

## Usage

This entity is essential for tracking specific events like new game creations, bets being placed, or conditions being resolved. Use it to build real-time updates or historical event logs in your interface.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the event. |
| `contractAddress` | `String!` | Address of the contract where the event was generated. |
| `name` | `EventName!` | Name of the event (e.g., `NewGame`, `BetSettled`, `LiquidityAdded`, etc.). |
| `blockNumber` | `BigInt!` | Block number where the event occurred. |
| `blockTimestamp` | `BigInt!` | Timestamp of the block when the event occurred. |
| `txHash` | `String!` | Transaction hash associated with the event. |
| `transactionIndex` | `BigInt!` | Transaction index within the block. |
| `logIndex` | `BigInt!` | Log index for the event. |
| `sortOrder` | `BigInt!` | Sort order for the event. |
| `betId` | `String` | ID of the bet related to the event (if applicable). |
| `conditionId` | `String` | ID of the condition related to the event (if applicable). |
| `gameId` | `String` | ID of the game related to the event (if applicable). |
| `freebetId` | `String` | ID of the freebet related to the event (if applicable). |
| `depositId` | `String` | ID of the deposit related to the event (if applicable). |
| `gasPrice` | `BigInt!` | Gas price for the transaction where the event occurred. |
| `gasUsed` | `BigInt` | Amount of gas used during the event. |
47 changes: 47 additions & 0 deletions pages/subgraph/queries/bets-events/live-bet.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# LiveBet Entity

## Description

Represents a live bet placed by a user. It stores real-time betting data such as odds, payout potential, and results, and is linked to live conditions and selections.

## Usage

This entity is useful for managing and displaying live bet details, such as odds changes or potential payouts for ongoing games.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the live bet (Core contract address + Bet ID). |
| `core` | `CoreContract!` | Reference to the core contract associated with the bet. |
| `betId` | `BigInt!` | Numeric identifier for the bet. |
| `bettor` | `String!` | Address of the bettor who placed the live bet. |
| `owner` | `String!` | Address of the owner of the live bet. |
| `actor` | `String!` | Address of the actor (the account that executed the live bet). |
| `affiliate` | `String` | Affiliate information associated with the live bet. |
| `rawAmount` | `BigInt!` | Raw amount staked in the live bet. |
| `amount` | `BigDecimal!` | Formatted value of the amount staked. |
| `rawPotentialPayout` | `BigInt!` | Raw value of the potential payout. |
| `potentialPayout` | `BigDecimal!` | Formatted value of the potential payout. |
| `rawPayout` | `BigInt` | Raw value of the actual payout. |
| `payout` | `BigDecimal` | Formatted value of the actual payout. |
| `rawPayoutLimit` | `BigInt!` | Raw value of the payout limit for the bet. |
| `payoutLimit` | `BigDecimal!` | Formatted payout limit. |
| `rawOdds` | `BigInt!` | Raw odds of the live bet. |
| `odds` | `BigDecimal!` | Formatted odds of the live bet. |
| `rawSettledOdds` | `BigInt` | Raw odds after settlement. |
| `settledOdds` | `BigDecimal` | Formatted odds after settlement. |
| `selections` | `[LiveSelection!]! @derivedFrom` | List of selections tied to this live bet. |
| `createdBlockNumber` | `BigInt!` | Block number when the live bet was created. |
| `createdBlockTimestamp` | `BigInt!` | Timestamp when the live bet was created. |
| `createdTxHash` | `String!` | Transaction hash for the creation of the live bet. |
| `resolvedBlockNumber` | `BigInt` | Block number when the live bet was resolved. |
| `resolvedBlockTimestamp` | `BigInt` | Timestamp for the resolution of the live bet. |
| `resolvedTxHash` | `String!` | Transaction hash for the resolution of the live bet. |
| `status` | `BetStatus!` | Status of the live bet (`Accepted`, `Canceled`, or `Resolved`). |
| `result` | `BetResult` | Result of the live bet (`Won` or `Lost`). |
| `isRedeemable` | `Boolean!` | Indicates if the live bet is redeemable. |
| `isRedeemed` | `Boolean!` | Indicates if the live bet has been redeemed. |
| `redeemedBlockNumber` | `BigInt` | Block number when the bet was redeemed. |
| `redeemedBlockTimestamp` | `BigInt` | Timestamp when the bet was redeemed. |
| `redeemedTxHash` | `String!` | Transaction hash for the redemption of the bet. |
20 changes: 20 additions & 0 deletions pages/subgraph/queries/bets-events/live-selection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# LiveSelection Entity

## Description

Represents a selection within a live bet. It is linked to a live outcome and stores odds, results, and other metadata relevant to live betting.

## Usage

Allows you to display real-time data for specific user selections.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the live selection. |
| `bet` | `LiveBet!` | Reference to the live bet associated with this selection. |
| `rawOdds` | `BigInt!` | Raw odds for the live selection. |
| `odds` | `BigDecimal!` | Formatted odds for the live selection. |
| `result` | `SelectionResult` | Result of the selection (`Won` or `Lost`). |
| `outcome` | `LiveOutcome!` | Reference to the live outcome associated with the selection. |
20 changes: 20 additions & 0 deletions pages/subgraph/queries/bets-events/selection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Selection Entity

## Description

Represents an individual selection in a bet. It is linked to a specific outcome and tracks the odds, result, and other metadata for the selection.

## Usage

This entity helps when you need to track specific selections within a bet, such as individual outcomes within a parlay. Use it to display detailed bet information to users.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the selection. |
| `bet` | `Bet!` | Reference to the associated bet. |
| `rawOdds` | `BigInt!` | Raw odds for the selection. |
| `odds` | `BigDecimal!` | Formatted odds for the selection. |
| `result` | `SelectionResult` | Result of the selection: `Won` or `Lost`. |
| `outcome` | `Outcome!` | Reference to the outcome related to the selection. |
20 changes: 20 additions & 0 deletions pages/subgraph/queries/contracts/AzuroBetContract.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# AzuroBetContract Entity

## Description

Represents a contract related to an Azuro betting market. This contract facilitates user bets and interacts with the core contract that handles betting logic.

## Usage

This entity helps manage bets linked to specific Azuro contracts. It can be used when building applications to track and display individual bet contracts and their statuses.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the freebet contract. |
| `liquidityPool` | `LiquidityPoolContract!` | Reference to the associated liquidity pool. |
| `address` | `String!` | On-chain address of the freebet contract. |
| `name` | `String` | Name of the freebet contract. |
| `affiliate` | `String` | Affiliate information linked to the freebet contract. |
| `manager` | `String` | Address of the freebet contract manager. |
18 changes: 18 additions & 0 deletions pages/subgraph/queries/contracts/CoreContract.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# CoreContract Entity

## Description

Represents a core contract in Azuro, linked to a specific liquidity pool. It manages the logic related to betting and outcomes and is a key component in the betting ecosystem.

## Usage

This entity is essential when working with the core logic of betting systems. If you're developing features that involve interacting with the underlying smart contracts that handle bet placement and settlement, use this to access relevant contract data linked to the liquidity pool.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the core contract. |
| `liquidityPool` | `LiquidityPoolContract!` | Reference to the associated liquidity pool. |
| `address` | `String!` | On-chain address of the core contract. |
| `type` | `String!` | Type of core contract, indicating its function in the protocol. |
16 changes: 16 additions & 0 deletions pages/subgraph/queries/contracts/ExpressPrematchRelation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ExpressPrematchRelation Entity

## Description

Stores the relationship between combo bets and prematch contracts. It links express core contract addresses to the respective prematch contracts.

## Usage

Use this entity when you need to create or manage connections between combo bets and prematch contracts. It's useful for developers building applications that allow users to switch between express and prematch betting modes.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Express core contract address. |
| `prematchAddress` | `String!` | Address of the prematch contract related to the express bet. |
16 changes: 16 additions & 0 deletions pages/subgraph/queries/contracts/FreebetContract.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# FreebetContract Entity

## Description

Created by Azuro ad hoc for the active frontends/affiliates. It manages the details of freebets, including any affiliate programs, and allows end users to place freebets within the system.

## Attributes

| **Attribute** | **Type** | **Description** |
| --- | --- | --- |
| `id` | `ID!` | Unique identifier for the freebet contract. |
| `liquidityPool` | `LiquidityPoolContract!` | Reference to the associated liquidity pool. |
| `address` | `String!` | On-chain address of the freebet contract. |
| `name` | `String` | Name of the freebet contract. |
| `affiliate` | `String` | Affiliate information linked to the freebet contract. |
| `manager` | `String` | Address of the freebet contract manager. |
Loading

0 comments on commit d3889a3

Please sign in to comment.