diff --git a/vue-app/src/api/projects.ts b/vue-app/src/api/projects.ts index 1438d835b..c9df4d310 100644 --- a/vue-app/src/api/projects.ts +++ b/vue-app/src/api/projects.ts @@ -5,6 +5,7 @@ import KlerosRegistry from './recipient-registry-kleros' export interface Project { id: string; // Address or another ID depending on registry implementation + address: string; name: string; description: string; imageUrl: string; diff --git a/vue-app/src/api/recipient-registry-kleros.ts b/vue-app/src/api/recipient-registry-kleros.ts index ef44cd1d0..8a2e56d5c 100644 --- a/vue-app/src/api/recipient-registry-kleros.ts +++ b/vue-app/src/api/recipient-registry-kleros.ts @@ -7,6 +7,12 @@ import { provider, ipfsGatewayUrl } from './core' import { Project } from './projects' const KLEROS_CURATE_URL = 'https://curate.kleros.io/tcr/0x2E3B10aBf091cdc53cC892A50daBDb432e220398' +// TODO: only for xDai Round 02; we should remove them later +const INVALID_PROJECTS = [ + '0xd4b514b8a245c6d6aaa5fc9b97336cfa6607f92184f1ae36e0fb26b7c90faf62', + '0xa13b920b4e1d910ac5af4a95d61af4a1272fedb39c86cdc747bbb734e990c6b6', + '0xc9cc75acbd333a72719da5446fc1752406ae0922a3c8818f769d6156af04adeb', +] export enum TcrItemStatus { Absent = 0, @@ -32,6 +38,7 @@ async function getTcrColumns(tcr: Contract): Promise { } function decodeTcrItemData(columns: TcrColumn[], data: any[]): { + address: string; name: string; description: string; imageUrl: string; @@ -44,6 +51,7 @@ function decodeTcrItemData(columns: TcrColumn[], data: any[]): { console.error = consoleError /* eslint-enable no-console */ return { + address: decodedMetadata[1] as string, name: decodedMetadata[0] as string, description: decodedMetadata[3] as string, imageUrl: `${ipfsGatewayUrl}${decodedMetadata[2]}`, @@ -70,11 +78,17 @@ export async function getProjects( const tcr = new Contract(tcrAddress, KlerosGTCR, provider) const tcrColumns = await getTcrColumns(tcr) const recipientAddedFilter = registry.filters.RecipientAdded() - const recipientAddedEvents = await registry.queryFilter(recipientAddedFilter, 0, endBlock) + const recipientAddedEvents = await registry.queryFilter(recipientAddedFilter, 0) const recipientRemovedFilter = registry.filters.RecipientRemoved() const recipientRemovedEvents = await registry.queryFilter(recipientRemovedFilter, 0) const projects: Project[] = [] for (const event of recipientAddedEvents) { + if (endBlock && event.blockNumber >= endBlock) { + // Skip recipients added after the end of round. + // We can not do this with filter because on xDai node returns + // "One of the blocks specified in filter ... cannot be found" + continue + } let project try { project = decodeRecipientAdded(event, tcrColumns) @@ -82,6 +96,9 @@ export async function getProjects( // Invalid metadata continue } + if (INVALID_PROJECTS.includes(project.id)) { + continue + } const removed = recipientRemovedEvents.find((event) => { return (event.args as any)._recipient === project.id }) diff --git a/vue-app/src/api/recipient-registry-simple.ts b/vue-app/src/api/recipient-registry-simple.ts index 53c2cc156..0b163e13e 100644 --- a/vue-app/src/api/recipient-registry-simple.ts +++ b/vue-app/src/api/recipient-registry-simple.ts @@ -10,6 +10,7 @@ function decodeRecipientAdded(event: Event): Project { const metadata = JSON.parse(args._metadata) return { id: args._recipient, + address: args._recipient, name: metadata.name, description: metadata.description, imageUrl: `${ipfsGatewayUrl}/ipfs/${metadata.imageHash}`, diff --git a/vue-app/src/views/Project.vue b/vue-app/src/views/Project.vue index 963cb45d6..675848e3d 100644 --- a/vue-app/src/views/Project.vue +++ b/vue-app/src/views/Project.vue @@ -8,7 +8,7 @@
-

+