Skip to content

Commit

Permalink
Merge pull request #852 from papercliplabs/fix-historical-bid-links
Browse files Browse the repository at this point in the history
Added bid txn hash to subgraph + fixed webapp historical auction bid links
  • Loading branch information
solimander authored Jul 24, 2024
2 parents 4d4eec7 + b1fd9f2 commit 450230f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
10 changes: 10 additions & 0 deletions packages/nouns-subgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ yarn deploy:[network] # Supports rinkeby and mainnet
yarn deploy [organization]/[subgraph-name]
```

### Compile and deploy to The Graph studio for The Graph's decentralized network

```sh
# Auth (only the first time)
yarn graph auth [deploy-key] --product=subgraph-studio

# Deploy
yarn deploy-studio:[network] # mainnet|sepolia
```

## Running a local deployment

Make sure you have Docker installed.
Expand Down
16 changes: 8 additions & 8 deletions packages/nouns-subgraph/config/sepolia.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"network": "sepolia",
"nounsToken": {
"address": "0x03439d47983d48C0402D2e88C5F8368d6B6BaC77",
"startBlock": 5301488
"address": "0x4C4674bb72a096855496a7204962297bd7e12b85",
"startBlock": 3594846
},
"nounsAuctionHouse": {
"address": "0x09BD4d1066a2f4AD4445f60De356bfc9494b5C0d",
"startBlock": 5301519
"address": "0x488609b7113FCf3B761A05956300d605E8f6BcAf",
"startBlock": 3594847
},
"nounsDAO": {
"address": "0x442961F79C3968f908ed295a5DEbfcD9aC1712B6",
"startBlock": 5301556
"address": "0x35d2670d7C8931AACdd37C89Ddcb0638c3c44A57",
"startBlock": 3594849
},
"nounsDAOData": {
"address": "0xF82152a4322800E15F14eD85e490Fe12b815E6c3",
"startBlock": 5301568
"address": "0x9040f720AA8A693F950B9cF94764b4b06079D002",
"startBlock": 3691326
}
}
2 changes: 2 additions & 0 deletions packages/nouns-subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"deploy:goerli": "yarn clean && yarn prepare:goerli && yarn codegen && yarn graph build && goldsky subgraph deploy nouns-v3-goerli/0.1.6",
"deploy:sepolia": "yarn clean && yarn prepare:sepolia && yarn codegen && yarn graph build && goldsky subgraph deploy nouns-sepolia-client-incentives/0.1.1",
"deploy:mainnet": "yarn clean && yarn prepare:mainnet && yarn codegen && yarn graph build && goldsky subgraph deploy nouns/0.2.5",
"deploy-studio:mainnet": "yarn clean && yarn prepare:mainnet && yarn codegen && yarn graph build && graph deploy --studio nouns",
"deploy-studio:sepolia": "yarn clean && yarn prepare:sepolia && yarn codegen && yarn graph build && graph deploy --studio nouns-sepolia",
"mustache": "mustache"
},
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion packages/nouns-subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type Noun @entity {
}

type Bid @entity {
"Bid transaction hash"
"Noun.id-amount"
id: ID!

"The Noun being bid on"
Expand All @@ -91,6 +91,9 @@ type Bid @entity {
"Block number of the bid"
blockNumber: BigInt!

"Transaction has for the bid"
txHash: Bytes!

"Index of transaction within block"
txIndex: BigInt!

Expand Down
1 change: 1 addition & 0 deletions packages/nouns-subgraph/src/nouns-auction-house.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function handleAuctionBid(event: AuctionBid): void {
bid.bidder = bidder.id;
bid.amount = auction.amount;
bid.noun = auction.noun;
bid.txHash = event.transaction.hash;
bid.txIndex = event.transaction.index;
bid.blockNumber = event.block.number;
bid.blockTimestamp = event.block.timestamp;
Expand Down
2 changes: 1 addition & 1 deletion packages/nouns-webapp/src/state/slices/pastAuctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const reduxSafePastAuctions = (data: any): AuctionState[] => {
sender: bid.bidder.id,
value: BigNumber.from(bid.amount).toJSON(),
extended: false,
transactionHash: bid.id,
transactionHash: bid.txHash,
transactionIndex: Number(bid.txIndex),
timestamp: BigNumber.from(bid.blockTimestamp).toJSON(),
};
Expand Down
2 changes: 2 additions & 0 deletions packages/nouns-webapp/src/wrappers/subgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface IBid {
amount: BigNumber;
blockNumber: number;
blockTimestamp: number;
txHash: string;
txIndex?: number;
noun: {
id: number;
Expand Down Expand Up @@ -386,6 +387,7 @@ export const latestAuctionsQuery = () => gql`
amount
blockNumber
blockTimestamp
txHash
txIndex
bidder {
id
Expand Down

0 comments on commit 450230f

Please sign in to comment.