-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OS-754 : re-organize entity relations & add testing (#15)
* re organize entity relations * add testing for OSx & Plugin * remove extra files * Update Satsuma deploy node url * Clean up * fix lint * fix subgraph scripts * fix subgraph test flow * ci: fixed linting work flow * add comment * OSx: Remove redundant code * flow: build contracts for subgraph testing * flow: build root for subgraph testing * flow: remove comments * subgraph: update test constants and comments * subgraph: refactor & add comments * ci: skip js-client linting * docs: fix typo --------- Co-authored-by: Michael Heuer <[email protected]>
- Loading branch information
1 parent
fa55216
commit a4a768b
Showing
20 changed files
with
381 additions
and
724 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
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 was deleted.
Oops, something went wrong.
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,84 @@ | ||
// TODO: Remove this file and import from OSx-commons-subgraph, | ||
// once the OSx-commons-subgraph npm package is published | ||
import { | ||
InstallationPrepared, | ||
InstallationPreparedPreparedSetupDataStruct, | ||
} from '../generated/PluginSetupProcessor/PluginSetupProcessor'; | ||
import {Address, Bytes, ethereum} from '@graphprotocol/graph-ts'; | ||
import {newMockEvent} from 'matchstick-as'; | ||
|
||
export function createInstallationPreparedEvent( | ||
sender: string, | ||
dao: string, | ||
plugin: string, | ||
preparedSetupId: Bytes, | ||
pluginSetupRepo: string, | ||
versionTag: ethereum.Tuple, | ||
data: Bytes, | ||
helpers: string[], | ||
requestedPermissions: ethereum.Value[][] | ||
): InstallationPrepared { | ||
const newEvent = changetype<InstallationPrepared>(newMockEvent()); | ||
newEvent.parameters = []; | ||
|
||
const permissions: ethereum.Tuple[] = []; | ||
for (let i = 0; i < requestedPermissions.length; i++) { | ||
const permissionTuple = new ethereum.Tuple(); | ||
for (let a = 0; a < requestedPermissions[i].length; a++) { | ||
permissionTuple.push(requestedPermissions[i][a]); | ||
} | ||
permissions.push(permissionTuple); | ||
} | ||
|
||
const helpersArray: Address[] = []; | ||
for (let i = 0; i < helpers.length; i++) { | ||
helpersArray.push(Address.fromString(helpers[i])); | ||
} | ||
|
||
const preparedSetupData = new InstallationPreparedPreparedSetupDataStruct(); | ||
preparedSetupData.push(ethereum.Value.fromAddressArray(helpersArray)); | ||
preparedSetupData.push(ethereum.Value.fromTupleArray(permissions)); | ||
|
||
const senderParam = new ethereum.EventParam( | ||
'sender', | ||
ethereum.Value.fromAddress(Address.fromString(sender)) | ||
); | ||
const daoParam = new ethereum.EventParam( | ||
'dao', | ||
ethereum.Value.fromAddress(Address.fromString(dao)) | ||
); | ||
const preparedSetupIdParam = new ethereum.EventParam( | ||
'preparedSetupId', | ||
ethereum.Value.fromBytes(preparedSetupId) | ||
); | ||
const pluginSetupRepoParam = new ethereum.EventParam( | ||
'pluginSetupRepo', | ||
ethereum.Value.fromAddress(Address.fromString(pluginSetupRepo)) | ||
); | ||
const versionTagParam = new ethereum.EventParam( | ||
'versionTag', | ||
ethereum.Value.fromTuple(versionTag) | ||
); | ||
const dataParam = new ethereum.EventParam( | ||
'data', | ||
ethereum.Value.fromBytes(data) | ||
); | ||
const pluginParam = new ethereum.EventParam( | ||
'plugin', | ||
ethereum.Value.fromAddress(Address.fromString(plugin)) | ||
); | ||
const preparedSetupDataParam = new ethereum.EventParam( | ||
'preparedSetupData', | ||
ethereum.Value.fromTuple(preparedSetupData) | ||
); | ||
|
||
newEvent.parameters.push(senderParam); | ||
newEvent.parameters.push(daoParam); | ||
newEvent.parameters.push(preparedSetupIdParam); | ||
newEvent.parameters.push(pluginSetupRepoParam); | ||
newEvent.parameters.push(versionTagParam); | ||
newEvent.parameters.push(dataParam); | ||
newEvent.parameters.push(pluginParam); | ||
newEvent.parameters.push(preparedSetupDataParam); | ||
return newEvent; | ||
} |
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,13 @@ | ||
{ | ||
"info": "# Do not edit subgraph.yaml,this is a generated file. \n# Instead, edit subgraph.placeholder.yaml and run: yarn manifest", | ||
"network": "sepolia", | ||
"dataSources": { | ||
"PluginSetupProcessors": [ | ||
{ | ||
"name": "PluginSetupProcessor", | ||
"address": "0xC24188a73dc09aA7C721f96Ad8857B469C01dC9f", | ||
"startBlock": 4415294 | ||
} | ||
] | ||
} | ||
} |
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 |
---|---|---|
@@ -1,108 +1,10 @@ | ||
# Types | ||
|
||
# Executions | ||
|
||
type Action @entity { | ||
id: ID! | ||
to: Bytes! | ||
value: BigInt! | ||
data: Bytes! | ||
dao: Dao! | ||
proposal: IProposal! | ||
execResult: Bytes | ||
} | ||
|
||
# Dao | ||
|
||
type Dao @entity { | ||
id: ID! # use address as id | ||
actions: [Action!]! @derivedFrom(field: "dao") | ||
proposals: [IProposal!]! @derivedFrom(field: "dao") | ||
plugins: [Plugin!]! @derivedFrom(field: "dao") | ||
} | ||
|
||
# Plugins | ||
|
||
type PluginPreparation @entity(immutable: true) { | ||
# OSX related data | ||
id: ID! # psp setupId + installationId | ||
|
||
# Set plugin specific related data below: | ||
} | ||
|
||
interface PluginInstallation @entity { | ||
# OSX related data | ||
id: ID! # psp installationId | ||
dao: Dao! | ||
|
||
# Set plugin specific related data below: | ||
} | ||
|
||
# Plugin | ||
|
||
type Plugin implements PluginInstallation @entity { | ||
type DaoPlugin @entity { | ||
"OSX related data" | ||
id: ID! # psp installationId | ||
dao: Dao! | ||
dao: Bytes! | ||
pluginAddress: Bytes! | ||
|
||
"Set plugin specific related data below:" | ||
number: BigInt! | ||
proposals: [PluginProposal!]! @derivedFrom(field: "plugin") | ||
members: [PluginMember!]! @derivedFrom(field: "plugin") | ||
} | ||
|
||
type PluginMember @entity { | ||
id: ID! # plugin_address + member_address | ||
address: String # address as string to facilitate filtering by address on the UI | ||
proposals: [PluginProposalMember!]! @derivedFrom(field: "approver") | ||
plugin: Plugin! | ||
} | ||
|
||
type PluginProposalMember @entity(immutable: true) { | ||
"MemberProposal for Many-to-Many" | ||
id: ID! # approver + proposal | ||
approver: PluginMember! | ||
proposal: PluginProposal! | ||
createdAt: BigInt! | ||
} | ||
|
||
# Proposal | ||
interface IProposal { | ||
id: ID! # package + proposalId | ||
dao: Dao! | ||
creator: Bytes! | ||
metadata: String | ||
actions: [Action!]! @derivedFrom(field: "proposal") | ||
allowFailureMap: BigInt! | ||
failureMap: BigInt | ||
executed: Boolean! | ||
createdAt: BigInt! | ||
startDate: BigInt! | ||
endDate: BigInt! | ||
executionTxHash: Bytes | ||
} | ||
|
||
type PluginProposal implements IProposal @entity { | ||
id: ID! # plugin + proposalId | ||
dao: Dao! | ||
actions: [Action!]! @derivedFrom(field: "proposal") | ||
allowFailureMap: BigInt! | ||
failureMap: BigInt | ||
plugin: Plugin! | ||
pluginProposalId: BigInt! | ||
creator: Bytes! | ||
metadata: String | ||
createdAt: BigInt! | ||
startDate: BigInt! | ||
endDate: BigInt! | ||
creationBlockNumber: BigInt! | ||
snapshotBlock: BigInt! | ||
minApprovals: Int! | ||
approvals: Int | ||
potentiallyExecutable: Boolean! | ||
executed: Boolean! | ||
executionDate: BigInt | ||
executionBlockNumber: BigInt | ||
executionTxHash: Bytes | ||
approvers: [PluginProposalMember!]! @derivedFrom(field: "proposal") | ||
number: BigInt | ||
} |
Oops, something went wrong.