forked from greenpill-dev-guild/camp-green
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* created yaml file for configuring envio * added envio indexer for querying blockchain * updated types to bigint * uncommented out set * moved eas code to client * removed EAS references from indexer * updated contracts and scripts for new deployment
- Loading branch information
Showing
24 changed files
with
13,091 additions
and
5,223 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
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,6 @@ | ||
export const WORK_SCHEMA_UID = | ||
"0x9341009d07b8de3eb72b96ac42246c549f3e32636cb31a75961fbee6db44a0eb"; | ||
export const WORK_APPROVAL_SCHEMA_UID = | ||
"0x019249c30ec1d02ae41abb3fbbeeb56b9bbb2261cf94191fac73089308aa662a"; | ||
export const GARDEN_ASSESSMENT_SCHEMA_UID = | ||
"0x7433e24287be826b49e5eb28cd52192823e542521c94084a691e67e5cc7e8176"; |
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,85 @@ | ||
import { EAS } from "@ethereum-attestation-service/eas-sdk"; | ||
|
||
const eas = new EAS("0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458"); | ||
|
||
const getWorkAttestation = async (workUID: string): Promise<Work> => { | ||
const attestation = await eas.getAttestation(workUID); | ||
const data = JSON.parse(attestation.data); | ||
|
||
return { | ||
id: workUID, | ||
ownerAddress: attestation.attester, | ||
garden_id: attestation.recipient, | ||
action_id: data.filter((d: any) => d.name === "actionUID")[0].value.value!, | ||
title: data.filter((d: any) => d.name === "title")[0].value.value!, | ||
feedback: data.filter((d: any) => d.name === "feedback")[0].value.value!, | ||
metadata: data.filter((d: any) => d.name === "metadata")[0].value.value!, | ||
media: data.filter((d: any) => d.name === "media")[0].value.value!, | ||
createdAt: attestation.time, | ||
}; | ||
}; | ||
|
||
const getWorkApprovalAttestation = async ( | ||
workApprovalUID: string | ||
): Promise<WorkApproval> => { | ||
const attestation = await eas.getAttestation(workApprovalUID); | ||
const data = JSON.parse(attestation.data); | ||
|
||
return { | ||
id: workApprovalUID, | ||
approverAddress: attestation.attester, | ||
action_id: data.filter((d: any) => d.name === "actionUID")[0].value.value!, | ||
work_id: data.filter((d: any) => d.name === "workUID")[0].value.value!, | ||
approved: data.filter((d: any) => d.name === "approved")[0].value.value!, | ||
feedback: data.filter((d: any) => d.name === "feedback")[0].value.value!, | ||
createdAt: attestation.time, | ||
}; | ||
}; | ||
|
||
const getGardenAssessmentAttestation = async ( | ||
gardenAssessmentUID: string | ||
): Promise<GardenAssessment> => { | ||
const attestation = await eas.getAttestation(gardenAssessmentUID); | ||
const data = JSON.parse(attestation.data); | ||
|
||
return { | ||
id: gardenAssessmentUID, | ||
authorAddress: attestation.attester, | ||
garden_id: attestation.recipient, | ||
soilMoisturePercentage: data.filter( | ||
(d: any) => d.name === "soilMoisturePercentage" | ||
)[0].value.value!, | ||
carbonTonStock: data.filter((d: any) => d.name === "carbonTonStock")[0] | ||
.value.value!, | ||
carbonTonPotential: data.filter( | ||
(d: any) => d.name === "carbonTonPotential" | ||
)[0].value.value!, | ||
gardenSquareMeters: data.filter( | ||
(d: any) => d.name === "gardenSquareMeters" | ||
)[0].value.value!, | ||
biome: data.filter((d: any) => d.name === "biome")[0].value.value!, | ||
remoteReportCID: data.filter((d: any) => d.name === "remoteReportPDF")[0] | ||
.value.value!, | ||
speciesRegistryCID: data.filter( | ||
(d: any) => d.name === "speciesRegistryJSON" | ||
)[0].value.value!, | ||
polygonCoordinates: data.filter( | ||
(d: any) => d.name === "polygonCoordinates" | ||
)[0].value.value!, | ||
treeGenusesObserved: data.filter( | ||
(d: any) => d.name === "treeGenusesObserved" | ||
)[0].value.value!, | ||
weedGenusesObserved: data.filter( | ||
(d: any) => d.name === "weedGenusesObserved" | ||
)[0].value.value!, | ||
issues: data.filter((d: any) => d.name === "issues")[0].value.value!, | ||
tags: data.filter((d: any) => d.name === "tags")[0].value.value!, | ||
createdAt: attestation.time, | ||
}; | ||
}; | ||
|
||
export { | ||
getWorkAttestation, | ||
getWorkApprovalAttestation, | ||
getGardenAssessmentAttestation, | ||
}; |
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,5 @@ | ||
declare interface Garden {} | ||
declare interface GardenAssessment {} | ||
declare interface Action {} | ||
declare interface Work {} | ||
declare interface WorkApproval {} |
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 |
---|---|---|
|
@@ -91,11 +91,18 @@ contract DeployGardenToken is Script { | |
console.log("GardenToken deployed at:", token); | ||
|
||
// Mint a garden for Rio Claro, São Paulo | ||
address[] memory gardeners = new address[](1); | ||
address[] memory gardenOperators = new address[](1); | ||
address[] memory gardeners = new address[](4); | ||
address[] memory gardenOperators = new address[](4); | ||
|
||
gardeners[0] = 0x2aa64E6d80390F5C017F0313cB908051BE2FD35e; // afo-wefa.eth | ||
gardeners[1] = 0xAcD59e854adf632d2322404198624F757C868C97; // groweco.eth | ||
gardeners[2] = 0x29e6cbF2450F86006292D10A3cF791955600a457; // marcin | ||
gardeners[3] = 0x2aa64E6d80390F5C017F0313cB908051BE2FD35e; // [email protected] | ||
gardenOperators[0] = 0x2aa64E6d80390F5C017F0313cB908051BE2FD35e; // afo-wefa.eth | ||
gardenOperators[1] = 0xAcD59e854adf632d2322404198624F757C868C97; // groweco.eth | ||
gardenOperators[2] = 0x29e6cbF2450F86006292D10A3cF791955600a457; // marcin | ||
gardenOperators[3] = 0x2aa64E6d80390F5C017F0313cB908051BE2FD35e; // [email protected] | ||
|
||
gardenAccount = gardenToken.mintGarden(communityToken, "Root Planet", gardeners, gardenOperators); | ||
|
||
vm.stopBroadcast(); | ||
|
@@ -124,11 +131,11 @@ contract DeployGardenToken is Script { | |
string.concat( | ||
'src/GardenAccount.sol:GardenAccount --constructor-args $(cast abi-encode "constructor(address,address,address,address)" ', | ||
Strings.toHexString(erc4337EntryPoint), | ||
" ", | ||
", ", | ||
Strings.toHexString(multicallForwarder), | ||
" ", | ||
", ", | ||
Strings.toHexString(TOKENBOUND_REGISTRY), | ||
" ", | ||
", ", | ||
Strings.toHexString(guardian), | ||
")\n" | ||
) | ||
|
@@ -140,7 +147,7 @@ contract DeployGardenToken is Script { | |
string.concat( | ||
'src/AccountProxy.sol:AccountProxy --constructor-args $(cast abi-encode "constructor(address,address)" ', | ||
Strings.toHexString(guardian), | ||
" ", | ||
", ", | ||
Strings.toHexString(implementation), | ||
")\n" | ||
) | ||
|
@@ -151,7 +158,7 @@ contract DeployGardenToken is Script { | |
string.concat( | ||
'src/GardenToken.sol:GardenToken --constructor-args $(cast abi-encode "constructor(address)" ', | ||
Strings.toHexString(implementation), | ||
"", | ||
", ", | ||
Strings.toHexString(gardenAccount), | ||
")\n" | ||
) | ||
|
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
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
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
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
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
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,2 @@ | ||
# To create or update a token visit https://envio.dev/app/api-tokens | ||
ENVIO_API_TOKEN="<YOUR-API-TOKEN>" |
Oops, something went wrong.