Skip to content

Commit

Permalink
feat(token): add bit token to mnt supagraph
Browse files Browse the repository at this point in the history
  • Loading branch information
grezle committed Jul 4, 2023
1 parent f45b16b commit 370664e
Show file tree
Hide file tree
Showing 4 changed files with 292 additions and 127 deletions.
47 changes: 41 additions & 6 deletions apps/token/src/app/graphql/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BigNumber } from "ethers";
// export the complete supagraph configuration (sync & graph)
export const config = {
// Name your supagraph (this will inform mongo table name etc...)
name: "supagraph--token--0-0-6",
name: "supagraph--token--0-0-8",
// Configure providers
providers: {
5: {
Expand All @@ -22,10 +22,26 @@ export const config = {
// Configure available Contracts and their block details
contracts: {
mantle: {
chainId: 5,
address: "0xc1dC2d65A2243c22344E725677A3E3BEBD26E604",
startBlock: 9127688,
endBlock: "latest",
// Establish all event signatures available on this contract (we could also accept a .sol or .json file here)
events: [
"event Transfer(address indexed from, address indexed to, uint256 value)",
"event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance)",
"event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate)",
],
},
bitdao: {
// chainId: 1,
// address: "0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5",
// startBlock: 12605730,
// endBlock: "latest",
chainId: 5,
address: "0xB17B140eddCC575DaD4256959b8A35d0E7E1Ae17", // we should make sure these are always checksummed going in
startBlock: 7728490,
endBlock: "latest",
// Establish all event signatures available on this contract (we could also accept a .sol or .json file here)
events: [
"event Transfer(address indexed from, address indexed to, uint256 value)",
Expand All @@ -38,11 +54,19 @@ export const config = {
schema: `
type Delegate @entity {
id: ID!
to: String!
bitTo: String!
mntTo: String!
balance: BigInt!
mntBalance: BigInt!
bitBalance: BigInt!
votes: BigInt!
delegators: [Delegate!]! @derivedFrom(field: "to")
bitVotes: BigInt!
mntVotes: BigInt!
bitDelegators: [Delegate!]! @derivedFrom(field: "bitTo")
mntDelegators: [Delegate!]! @derivedFrom(field: "mntTo")
delegatorsCount: BigInt!
mntDelegatorsCount: BigInt!
bitDelegatorsCount: BigInt!
blockNumber: BigInt!
transactionHash: String!
}
Expand All @@ -57,11 +81,15 @@ export const config = {
where: {votes_gt: "0"}
) {
id
to
mntTo
bitTo
votes
balance
delegatorsCount
delegators {
bitDelegators {
id
}
mntDelegators {
id
}
}
Expand Down Expand Up @@ -130,10 +158,17 @@ export type TransferEvent = {
// Delegate entity definition
export type DelegateEntity = {
id: string;
to: string;
bitTo: string;
mntTo: string;
balance: BigNumber;
mntBalance: BigNumber;
bitBalance: BigNumber;
votes: BigNumber;
mntVotes: BigNumber;
bitVotes: BigNumber;
delegatorsCount: BigNumber;
mntDelegatorsCount: BigNumber;
bitDelegatorsCount: BigNumber;
blockNumber: number;
transactionHash: string;
};
Loading

0 comments on commit 370664e

Please sign in to comment.