Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NorVirae committed Nov 9, 2022
0 parents commit 9589655
Show file tree
Hide file tree
Showing 9 changed files with 1,535 additions and 0 deletions.
862 changes: 862 additions & 0 deletions abis/PodShipAuction.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions networks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"mumbai": {
"PodShipAuction": {
"address": "0xFdc217E2867717ca21A5Edc13Fb8feA73192292D"
}
}
}
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "podship",
"license": "UNLICENSED",
"scripts": {
"codegen": "graph codegen",
"build": "graph build",
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ norvirae/podship",
"create-local": "graph create --node http://localhost:8020/ norvirae/podship",
"remove-local": "graph remove --node http://localhost:8020/ norvirae/podship",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 norvirae/podship",
"test": "graph test"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.35.0",
"@graphprotocol/graph-ts": "0.28.1"
},
"devDependencies": { "matchstick-as": "0.5.0" }
}
6 changes: 6 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type ExampleEntity @entity {
id: ID!
count: BigInt!
owner: Bytes! # address
approved: Bytes! # address
}
124 changes: 124 additions & 0 deletions src/pod-ship-auction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import { BigInt } from "@graphprotocol/graph-ts"
import {
PodShipAuction,
Approval,
ApprovalForAll,
AuctionCancelled,
AuctionCreated,
AuctionResulted,
BidPlaced,
BidRefunded,
OwnershipTransferred,
PlatformFeeChanged,
PlatformFeeRecipientChanged,
PodShipContractDeployed,
ProdcastCreated,
RecentWinner,
RequestedWinner,
Tipping,
Transfer
} from "../generated/PodShipAuction/PodShipAuction"
import { ExampleEntity } from "../generated/schema"

export function handleApproval(event: Approval): void {
// Entities can be loaded from the store using a string ID; this ID
// needs to be unique across all entities of the same type
let entity = ExampleEntity.load(event.transaction.from.toHex())

// Entities only exist after they have been saved to the store;
// `null` checks allow to create entities on demand
if (!entity) {
entity = new ExampleEntity(event.transaction.from.toHex())

// Entity fields can be set using simple assignments
entity.count = BigInt.fromI32(0)
}

// BigInt and BigDecimal math are supported
entity.count = entity.count + BigInt.fromI32(1)

// Entity fields can be set based on event parameters
entity.owner = event.params.owner
entity.approved = event.params.approved

// Entities can be written to the store with `.save()`
entity.save()

// Note: If a handler doesn't require existing field values, it is faster
// _not_ to load the entity from the store. Instead, create it fresh with
// `new Entity(...)`, set the fields that should be updated and save the
// entity back to the store. Fields that were not set or unset remain
// unchanged, allowing for partial updates to be applied.

// It is also possible to access smart contracts from mappings. For
// example, the contract that has emitted the event can be connected to
// with:
//
// let contract = Contract.bind(event.address)
//
// The following functions can then be called on this contract to access
// state variables and other data:
//
// - contract.auctions(...)
// - contract.balanceOf(...)
// - contract.bidders(...)
// - contract.bids(...)
// - contract.checkUpkeep(...)
// - contract.getApproved(...)
// - contract.getCurrentToken(...)
// - contract.getInterval(...)
// - contract.getLastTimestamp(...)
// - contract.getNftCreator(...)
// - contract.getNftOwner(...)
// - contract.getNftTokenId(...)
// - contract.getPlatformFee(...)
// - contract.getPlatformFeeRecipient(...)
// - contract.isApprovedForAll(...)
// - contract.minimumTip(...)
// - contract.mintNFT(...)
// - contract.name(...)
// - contract.owner(...)
// - contract.ownerOf(...)
// - contract.podcastId(...)
// - contract.podshipNft(...)
// - contract.royaltyInfo(...)
// - contract.startAuction(...)
// - contract.supportsInterface(...)
// - contract.symbol(...)
// - contract.tippers(...)
// - contract.tokenURI(...)
}

export function handleApprovalForAll(event: ApprovalForAll): void {}

export function handleAuctionCancelled(event: AuctionCancelled): void {}

export function handleAuctionCreated(event: AuctionCreated): void {}

export function handleAuctionResulted(event: AuctionResulted): void {}

export function handleBidPlaced(event: BidPlaced): void {}

export function handleBidRefunded(event: BidRefunded): void {}

export function handleOwnershipTransferred(event: OwnershipTransferred): void {}

export function handlePlatformFeeChanged(event: PlatformFeeChanged): void {}

export function handlePlatformFeeRecipientChanged(
event: PlatformFeeRecipientChanged
): void {}

export function handlePodShipContractDeployed(
event: PodShipContractDeployed
): void {}

export function handleProdcastCreated(event: ProdcastCreated): void {}

export function handleRecentWinner(event: RecentWinner): void {}

export function handleRequestedWinner(event: RequestedWinner): void {}

export function handleTipping(event: Tipping): void {}

export function handleTransfer(event: Transfer): void {}
68 changes: 68 additions & 0 deletions subgraph.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
specVersion: 0.0.1
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum
name: PodShipAuction
network: mumbai
source:
address: "0xFdc217E2867717ca21A5Edc13Fb8feA73192292D"
abi: PodShipAuction
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
entities:
- Approval
- ApprovalForAll
- AuctionCancelled
- AuctionCreated
- AuctionResulted
- BidPlaced
- BidRefunded
- OwnershipTransferred
- PlatformFeeChanged
- PlatformFeeRecipientChanged
- PodShipContractDeployed
- ProdcastCreated
- RecentWinner
- RequestedWinner
- Tipping
- Transfer
abis:
- name: PodShipAuction
file: ./abis/PodShipAuction.json
eventHandlers:
- event: Approval(indexed address,indexed address,indexed uint256)
handler: handleApproval
- event: ApprovalForAll(indexed address,indexed address,bool)
handler: handleApprovalForAll
- event: AuctionCancelled(indexed uint256)
handler: handleAuctionCancelled
- event: AuctionCreated(indexed uint256,indexed uint256,indexed uint96,uint256,uint256)
handler: handleAuctionCreated
- event: AuctionResulted(indexed uint256,indexed address,uint256)
handler: handleAuctionResulted
- event: BidPlaced(indexed uint256,indexed address,indexed uint256)
handler: handleBidPlaced
- event: BidRefunded(indexed uint256,indexed address,uint256)
handler: handleBidRefunded
- event: OwnershipTransferred(indexed address,indexed address)
handler: handleOwnershipTransferred
- event: PlatformFeeChanged(indexed uint256)
handler: handlePlatformFeeChanged
- event: PlatformFeeRecipientChanged(indexed address)
handler: handlePlatformFeeRecipientChanged
- event: PodShipContractDeployed()
handler: handlePodShipContractDeployed
- event: ProdcastCreated(indexed string,indexed address,indexed uint256)
handler: handleProdcastCreated
- event: RecentWinner(indexed address)
handler: handleRecentWinner
- event: RequestedWinner(indexed uint256)
handler: handleRequestedWinner
- event: Tipping(indexed uint256,indexed uint256,indexed address)
handler: handleTipping
- event: Transfer(indexed address,indexed address,indexed uint256)
handler: handleTransfer
file: ./src/pod-ship-auction.ts
Loading

0 comments on commit 9589655

Please sign in to comment.