Skip to content

Commit e9efffb

Browse files
Refactor Marketplace contract to use string for contenthash, update event signatures, and enhance listing management. Remove unused SimpleListings references and improve EAS configuration handling. Update Next.js app metadata and styles for Ethereum Bazaar branding.
1 parent 13e2227 commit e9efffb

37 files changed

+829
-1181
lines changed

packages/hardhat/contracts/Marketplace.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ contract Marketplace {
1111
struct ListingPointer {
1212
address creator;
1313
address listingType;
14-
bytes32 contenthash;
14+
string contenthash;
1515
bool active;
1616
}
1717

1818
uint256 public listingCount;
1919
mapping(uint256 => ListingPointer) public listings;
2020

21-
event ListingCreated(uint256 indexed id, address indexed creator, address indexed listingType, uint256 listingId, bytes32 contenthash);
21+
event ListingCreated(uint256 indexed id, address indexed creator, address indexed listingType, uint256 listingId, string contenthash);
2222
event ListingAction(uint256 indexed id, address indexed caller, bytes32 action);
2323
event ListingActivationChanged(uint256 indexed listingId, bool active);
2424

2525
function createListing(
2626
address listingType,
27-
bytes32 contenthash,
27+
string calldata contenthash,
2828
bytes calldata data
2929
) external returns (uint256 id) {
3030
id = ++listingCount;
@@ -55,7 +55,7 @@ contract Marketplace {
5555
function getListing(uint256 id) external view returns (
5656
address creator,
5757
address listingType,
58-
bytes32 contenthash,
58+
string memory contenthash,
5959
bool active,
6060
bytes memory listingData
6161
) {

packages/hardhat/test/YourContract.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

packages/indexer/ponder.config.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { createConfig } from "ponder";
2-
import { MarketplaceAbi } from "./abis/MarketplaceAbi";
3-
import { SimpleListingsAbi } from "./abis/SimpleListingsAbi";
2+
// Use deployed ABIs to avoid drift with contracts
43
import { easGetAttestationAbi } from "./abis/EASAbi";
54
import easDeployment from "../hardhat/deployments/localhost/EAS.json" assert { type: "json" };
65
import MarketplaceDeployment from "../hardhat/deployments/localhost/Marketplace.json" assert { type: "json" };
7-
import SimpleListingsDeployment from "../hardhat/deployments/localhost/SimpleListings.json" assert { type: "json" };
86

97
export default createConfig({
108
chains: {
@@ -16,16 +14,11 @@ export default createConfig({
1614
contracts: {
1715
Marketplace: {
1816
chain: "localhost",
19-
abi: MarketplaceAbi,
17+
// Cast ABI to const to preserve literal event names for type inference
18+
abi: MarketplaceDeployment.abi as const,
2019
address: MarketplaceDeployment.address as `0x${string}`,
2120
startBlock: 0,
2221
},
23-
SimpleListings: {
24-
chain: "localhost",
25-
abi: SimpleListingsAbi,
26-
address: SimpleListingsDeployment.address as `0x${string}`,
27-
startBlock: 0,
28-
},
2922
// Index EAS core contract using the deployed ABI to match emitted events
3023
EAS: {
3124
chain: "localhost",

packages/indexer/ponder.schema.ts

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,42 @@
11
import { onchainTable } from "ponder";
22

3+
// Listings table (Marketplace-only)
34
export const listings = onchainTable("listings", (t) => ({
45
id: t.text().primaryKey(), // Marketplace listing id (uint256 as string)
56
creator: t.text(),
67
listingType: t.text(),
7-
listingInnerId: t.text(),
8-
// Sale details
9-
buyer: t.text(),
10-
// SimpleListings enrichment
8+
cid: t.text(),
9+
// Token/payment fields parsed from listingData
1110
paymentToken: t.text(),
1211
priceWei: t.text(),
13-
ipfsCid: t.text(),
14-
active: t.boolean(),
15-
// Review status flags
16-
buyerReviewed: t.boolean(),
17-
sellerReviewed: t.boolean(),
18-
// Token metadata enrichment (for ERC-20s; null for native ETH)
1912
tokenName: t.text(),
2013
tokenSymbol: t.text(),
2114
tokenDecimals: t.integer(),
22-
// IPFS metadata
15+
// Denormalized from metadata
2316
title: t.text(),
2417
description: t.text(),
2518
category: t.text(),
2619
image: t.text(),
20+
contact: t.json(),
21+
tags: t.json(),
22+
price: t.text(),
23+
currency: t.text(),
2724
locationId: t.text(),
28-
createdBlockNumber: t.text(),
29-
createdBlockTimestamp: t.text(),
30-
createdTxHash: t.text(),
31-
}));
32-
33-
// Buffer table to handle ordering between SimpleListings and Marketplace events
34-
export const simple_buffer = onchainTable("simple_buffer", (t) => ({
35-
id: t.text().primaryKey(), // `${listingType}:${listingInnerId}`
36-
listingType: t.text(),
37-
listingInnerId: t.text(),
38-
paymentToken: t.text(),
39-
priceWei: t.text(),
40-
ipfsCid: t.text(),
41-
// Token metadata enrichment (buffered until Marketplace row exists)
42-
tokenName: t.text(),
43-
tokenSymbol: t.text(),
44-
tokenDecimals: t.integer(),
45-
}));
46-
47-
export const listing_created = onchainTable("listing_created", (t) => ({
48-
id: t.text().primaryKey(), // txHash-logIndex
49-
listingId: t.text(),
50-
creator: t.text(),
51-
listingType: t.text(),
52-
listingInnerId: t.text(),
53-
blockNumber: t.text(),
54-
txHash: t.text(),
55-
}));
56-
57-
export const listing_prebuy = onchainTable("listing_prebuy", (t) => ({
58-
id: t.text().primaryKey(), // txHash-logIndex
59-
listingId: t.text(),
60-
buyer: t.text(),
61-
blockNumber: t.text(),
62-
txHash: t.text(),
63-
}));
64-
65-
export const listing_sold = onchainTable("listing_sold", (t) => ({
66-
id: t.text().primaryKey(), // txHash-logIndex
67-
listingId: t.text(),
6825
buyer: t.text(),
26+
active: t.boolean(),
6927
buyerReviewed: t.boolean(),
7028
sellerReviewed: t.boolean(),
71-
blockNumber: t.text(),
72-
txHash: t.text(),
29+
createdBlockNumber: t.text(),
30+
createdBlockTimestamp: t.text(),
31+
createdTxHash: t.text(),
7332
}));
7433

75-
export const listing_closed = onchainTable("listing_closed", (t) => ({
34+
// Recorded actions from Marketplace
35+
export const listing_actions = onchainTable("listing_actions", (t) => ({
7636
id: t.text().primaryKey(), // txHash-logIndex
7737
listingId: t.text(),
38+
selectorHex: t.text(),
39+
actionName: t.text(),
7840
caller: t.text(),
7941
blockNumber: t.text(),
8042
txHash: t.text(),
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"chainId": "31337",
3-
"schemaRegistry": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
4-
"eas": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
5-
"reviewSchemaUid": "0xacde809080fd143534906c94758ae51f26ef9047f769b4c4d033ad9b7305856b"
2+
"31337": {
3+
"schemaRegistry": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
4+
"eas": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
5+
"reviewSchemaUid": "0xacde809080fd143534906c94758ae51f26ef9047f769b4c4d033ad9b7305856b"
6+
}
67
}

0 commit comments

Comments
 (0)