-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ca20d4
commit 255b789
Showing
14 changed files
with
1,094 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
libsFolder: ../../node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"sepolia": { | ||
"Registry": { | ||
"address": "0x62996E7041C0A434B8d0268EF7F6BBCf2d668dA7", | ||
"startBlock": 5281759 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "chamberj", | ||
"license": "MIT", | ||
"scripts": { | ||
"codegen": "graph codegen", | ||
"build": "graph build", | ||
"deploy": "graph deploy --node https://api.studio.thegraph.com/deploy/ chamberj", | ||
"create-local": "graph create --node http://localhost:8020/ chamberj", | ||
"remove-local": "graph remove --node http://localhost:8020/ chamberj", | ||
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 chamberj", | ||
"test": "graph test" | ||
}, | ||
"dependencies": { | ||
"@graphprotocol/graph-cli": "0.67.4", | ||
"@graphprotocol/graph-ts": "0.32.0" | ||
}, | ||
"devDependencies": { "matchstick-as": "0.5.0" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
type ChamberDeployed @entity(immutable: true) { | ||
id: ID! | ||
chamber: Bytes! # address | ||
serial: BigInt! # uint256 | ||
deployer: Bytes! # address | ||
memberToken: Bytes! # address | ||
govToken: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type OwnershipTransferred @entity(immutable: true) { | ||
id: ID! | ||
previousOwner: Bytes! # address | ||
newOwner: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
|
||
type ChangedGuard @entity(immutable: true) { | ||
id: ID! | ||
guard: Bytes! # address | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type Demoted @entity(immutable: true) { | ||
id: ID! | ||
demoter: Bytes! # address | ||
amt: BigInt! # uint256 | ||
tokenId: BigInt! # uint256 | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type Initialized @entity(immutable: true) { | ||
id: ID! | ||
version: Int! # uint8 | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type Promoted @entity(immutable: true) { | ||
id: ID! | ||
promoter: Bytes! # address | ||
amt: BigInt! # uint256 | ||
tokenId: BigInt! # uint256 | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type ProposalApproved @entity(immutable: true) { | ||
id: ID! | ||
proposalId: BigInt! # uint256 | ||
tokenId: BigInt! # uint256 | ||
approvals: BigInt! # uint256 | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type ProposalCreated @entity(immutable: true) { | ||
id: ID! | ||
proposalId: BigInt! # uint256 | ||
target: [Bytes!]! # address[] | ||
value: [BigInt!]! # uint256[] | ||
data: [Bytes!]! # bytes[] | ||
voters: [BigInt!]! # uint256[5] | ||
nonce: BigInt! # uint256 | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type ProposalExecuted @entity(immutable: true) { | ||
id: ID! | ||
proposalId: BigInt! # uint256 | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type ReceivedEther @entity(immutable: true) { | ||
id: ID! | ||
sender: Bytes! # address | ||
value: BigInt! # uint256 | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} | ||
|
||
type ReceivedFallback @entity(immutable: true) { | ||
id: ID! | ||
sender: Bytes! # address | ||
value: BigInt! # uint256 | ||
contractAddress: Bytes! # address | ||
blockNumber: BigInt! | ||
blockTimestamp: BigInt! | ||
transactionHash: Bytes! | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
import { createId } from "../../../helpers/utils" | ||
import { Bytes } from "@graphprotocol/graph-ts" | ||
|
||
import { | ||
ChangedGuard as ChangedGuardEvent, | ||
Demoted as DemotedEvent, | ||
Initialized as InitializedEvent, | ||
Promoted as PromotedEvent, | ||
ProposalApproved as ProposalApprovedEvent, | ||
ProposalCreated as ProposalCreatedEvent, | ||
ProposalExecuted as ProposalExecutedEvent, | ||
ReceivedEther as ReceivedEtherEvent, | ||
ReceivedFallback as ReceivedFallbackEvent | ||
} from "../generated/templates/Chamber/Chamber" | ||
|
||
import { | ||
ChangedGuard, | ||
Demoted, | ||
Initialized, | ||
Promoted, | ||
ProposalApproved, | ||
ProposalCreated, | ||
ProposalExecuted, | ||
ReceivedEther, | ||
ReceivedFallback | ||
} from "../generated/schema" | ||
|
||
export function handleChangedGuard(event: ChangedGuardEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const changedGuardTx = new ChangedGuard(id); | ||
changedGuardTx.guard = event.params.guard | ||
changedGuardTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
changedGuardTx.blockNumber = event.block.number | ||
changedGuardTx.blockTimestamp = event.block.timestamp | ||
changedGuardTx.transactionHash = event.transaction.hash | ||
|
||
changedGuardTx.save() | ||
} | ||
|
||
export function handleDemoted(event: DemotedEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const demotedTx = new Demoted(id); | ||
demotedTx.demoter = event.params.demoter | ||
demotedTx.amt = event.params.amt | ||
demotedTx.tokenId = event.params.tokenId | ||
demotedTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
demotedTx.blockNumber = event.block.number | ||
demotedTx.blockTimestamp = event.block.timestamp | ||
demotedTx.transactionHash = event.transaction.hash | ||
|
||
demotedTx.save() | ||
} | ||
|
||
export function handleInitialized(event: InitializedEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const initializedTx = new Initialized(id); | ||
initializedTx.version = event.params.version | ||
initializedTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
initializedTx.blockNumber = event.block.number | ||
initializedTx.blockTimestamp = event.block.timestamp | ||
initializedTx.transactionHash = event.transaction.hash | ||
|
||
initializedTx.save() | ||
} | ||
|
||
export function handlePromoted(event: PromotedEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const promotedTx = new Promoted(id) | ||
promotedTx.promoter = event.params.promoter | ||
promotedTx.amt = event.params.amt | ||
promotedTx.tokenId = event.params.tokenId | ||
promotedTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
promotedTx.blockNumber = event.block.number | ||
promotedTx.blockTimestamp = event.block.timestamp | ||
promotedTx.transactionHash = event.transaction.hash | ||
|
||
promotedTx.save() | ||
} | ||
|
||
export function handleProposalApproved(event: ProposalApprovedEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const proposalApprovedTx = new ProposalApproved(id) | ||
proposalApprovedTx.proposalId = event.params.proposalId | ||
proposalApprovedTx.tokenId = event.params.tokenId | ||
proposalApprovedTx.approvals = event.params.approvals | ||
proposalApprovedTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
proposalApprovedTx.blockNumber = event.block.number | ||
proposalApprovedTx.blockTimestamp = event.block.timestamp | ||
proposalApprovedTx.transactionHash = event.transaction.hash | ||
|
||
proposalApprovedTx.save() | ||
} | ||
|
||
export function handleProposalCreated(event: ProposalCreatedEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const proposalCreatedTx = new ProposalCreated(id) | ||
proposalCreatedTx.proposalId = event.params.proposalId | ||
proposalCreatedTx.target = changetype<Bytes[]>(event.params.target) | ||
proposalCreatedTx.value = event.params.value | ||
proposalCreatedTx.data = event.params.data | ||
proposalCreatedTx.voters = event.params.voters | ||
proposalCreatedTx.nonce = event.params.nonce | ||
proposalCreatedTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
proposalCreatedTx.blockNumber = event.block.number | ||
proposalCreatedTx.blockTimestamp = event.block.timestamp | ||
proposalCreatedTx.transactionHash = event.transaction.hash | ||
|
||
proposalCreatedTx.save() | ||
} | ||
|
||
export function handleProposalExecuted(event: ProposalExecutedEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const proposalExecutedTx = new ProposalExecuted(id) | ||
proposalExecutedTx.proposalId = event.params.proposalId | ||
proposalExecutedTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
proposalExecutedTx.blockNumber = event.block.number | ||
proposalExecutedTx.blockTimestamp = event.block.timestamp | ||
proposalExecutedTx.transactionHash = event.transaction.hash | ||
|
||
proposalExecutedTx.save() | ||
} | ||
|
||
export function handleReceivedEther(event: ReceivedEtherEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const receivedEtherTx = new ReceivedEther(id) | ||
receivedEtherTx.sender = event.params.sender | ||
receivedEtherTx.value = event.params.value | ||
receivedEtherTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
receivedEtherTx.blockNumber = event.block.number | ||
receivedEtherTx.blockTimestamp = event.block.timestamp | ||
receivedEtherTx.transactionHash = event.transaction.hash | ||
|
||
receivedEtherTx.save() | ||
} | ||
|
||
export function handleReceivedFallback(event: ReceivedFallbackEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const receivedFallbackTx = new ReceivedFallback(id) | ||
receivedFallbackTx.sender = event.params.sender | ||
receivedFallbackTx.value = event.params.value | ||
receivedFallbackTx.contractAddress = changetype<Bytes>(event.transaction.to) | ||
|
||
receivedFallbackTx.blockNumber = event.block.number | ||
receivedFallbackTx.blockTimestamp = event.block.timestamp | ||
receivedFallbackTx.transactionHash = event.transaction.hash | ||
|
||
receivedFallbackTx.save() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { createId } from "../../../helpers/utils" | ||
import { | ||
ChamberDeployed as ChamberDeployedEvent, | ||
OwnershipTransferred as OwnershipTransferredEvent | ||
} from "../generated/Registry/Registry" | ||
import { | ||
ChamberDeployed, | ||
OwnershipTransferred | ||
} from "../generated/schema" | ||
|
||
import { Chamber } from "../generated/templates" | ||
|
||
export function handleChamberDeployed(event: ChamberDeployedEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const chamberDeployedTx = new ChamberDeployed(id); | ||
chamberDeployedTx.chamber = event.params.chamber | ||
chamberDeployedTx.serial = event.params.serial | ||
chamberDeployedTx.deployer = event.params.deployer | ||
chamberDeployedTx.memberToken = event.params.memberToken | ||
chamberDeployedTx.govToken = event.params.govToken | ||
|
||
chamberDeployedTx.blockNumber = event.block.number | ||
chamberDeployedTx.blockTimestamp = event.block.timestamp | ||
chamberDeployedTx.transactionHash = event.transaction.hash | ||
|
||
chamberDeployedTx.save() | ||
|
||
Chamber.create(event.params.chamber) | ||
} | ||
|
||
export function handleOwnershipTransferred(event: OwnershipTransferredEvent): void { | ||
const id = createId(event.transaction.hash, event.logIndex); | ||
const ownershipTransferredTx = new OwnershipTransferred(id); | ||
ownershipTransferredTx.previousOwner = event.params.previousOwner | ||
ownershipTransferredTx.newOwner = event.params.newOwner | ||
|
||
ownershipTransferredTx.blockNumber = event.block.number | ||
ownershipTransferredTx.blockTimestamp = event.block.timestamp | ||
ownershipTransferredTx.transactionHash = event.transaction.hash | ||
|
||
ownershipTransferredTx.save() | ||
} | ||
|
Oops, something went wrong.