Skip to content

Commit

Permalink
update graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanjohan committed Apr 27, 2024
1 parent f374f01 commit bd05638
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This project uses Ankr RPC to deploy the game smart contracts. See the hardhat c
### Aztec

A contract written in Noir is used to verify the validity of the challenger's committed strategy. By providing a proof generated by Noir, the game smart contract can use the on-chain verifier to ensure the strategy is valid. The Noir verifier checks if the fighter exists and if the moves are valid.
[Noir circuits](https://github.com/arjanjohan/scroll-fighter/tree/main/packages/noir)
[Noir circuit](https://github.com/arjanjohan/scroll-fighter/blob/main/packages/noir/src/main.nr)
[UltraVerifier on Scroll Sepolia](https://sepolia.scrollscan.com/address/0xc15BC025d57bec9FA39e18701b4f0b3b5a067B6C#code)

### The Graph
Expand All @@ -33,7 +33,6 @@ Due to the limited time, I could not complete everything I set out to do. Additi

- Overview of current games, using The Graph to query existing games.
- Create open games (anyone can join/accept)
- Using NFT's as fighters

## Links

Expand Down
14 changes: 14 additions & 0 deletions packages/graph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,17 @@ type GameProposed @entity(immutable: true) {
blockTimestamp: BigInt!
transactionHash: Bytes!
}

type Game @entity {
id: BigInt! # uint256
wageredAmount: BigInt! # uint256
player1: Bytes! # address
player2: Bytes! # address
winner: Bytes! # address
fighterIds: [BigInt!]! # uint256
moves: [[BigInt!]!]! # uint256
state: String!
blockNumber: BigInt!
blockTimestamp: BigInt!
transactionHash: Bytes!
}
1 change: 1 addition & 0 deletions packages/graph/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ export function handleGameProposed(event: GameProposedEvent): void {
entity.transactionHash = event.transaction.hash

entity.save()

}

0 comments on commit bd05638

Please sign in to comment.