Project Registry
Integrating with the Project Registry

Integrating with the Project Registry

There are two ways to interact with the Project Registry.

  1. Through the Registry.sol contract
  2. Through the Allo subgraph

Writing to the Project Registry

Create a Profile

Creating a profile is required to create a pool. Some pools may also require recipients or allocators to have a profile. createProfile will return a profileId type bytes32. This value will be needed for future calls to the registry.

createProfile(nonce, name, metadata, signer.address, []);

Parameters

namedata typenotes
_nonceuint256nonce is used to create the profile profileId. By providing a nonce projects can ensure having the same id across chains.
_namestringThe profile name. This is used to generate the anchor.
_metadataMetadataSee the metadata section below for more details.
_owneraddressThe owner of the profile. See Roles for more details about profile owners.
_membersaddress[]Array of profile member address. Roles for more details about profile members.

Metadata

Offchain metadata can be stored in the project registry using the Metadata struct.

struct Metadata {
    uint256 protocol;
    string pointer;
}
FieldData TypeNotes
protocoluint256An id from the list of available protocols.
pointerstringThe pointer to the off chain data.

Currently, the only protocol id available is '1' for IPFS. For more details on details see MetaPtrProtocol.sol (opens in a new tab)

Updating a Profile

addMembers

Adds member addresses to the members array. Only the profile owner can add members.

addMembers(profileId, members)
FieldData TypeNotes
profileIdbytes32The id of the profile to update.
membersaddress[]Array of member address(es) to add.

removeMembers

Removes member addresses to the members array. Only the profile owner can remove members. removeMembers(profileId, members)

FieldData TypeNotes
profileIdbytes32The id of the profile to update.
membersaddress[]Array of member address(es) to remove.

updateProfileMetadata

Will overwrite the existing profile metadata. Only the owner can update profile metadata.

updateProfileMetadata(profileId, metadata)

FieldData TypeNotes
profileIdbytes32The id of the profile to update.
metadataMetadataMetadata to add to the profile.

updateProfileName

Will set a new name for the profile. Only the owner can update profile metadata. This action will create a new anchorId.

updateProfileName(profileId, name)

FieldData TypeNotes
profileIdbytes32The id of the profile to update.
namestringNew name for the profile.

updateProfilePendingOwner

Will set a new pending owner. The pending owner will need to call acceptProfileOwnership in order for the ownership transfer to be complete. Only the profile owner can set a pending owner.

updateProfilePendingOwner(profileId, pendingOwner)

FieldData TypeNotes
profileIdbytes32The id of the profile to update.
pendingOwneraddressThe address for the new profile owner.

Reading Project Registry Data Using The Graph

Project registry data is publicly available through The Graph. See the Indexers page for links to the latest graph.

Subgraph data can be accessed either manually through the subgraph Playground, or programmatically through The Graph API. For more information about how to set up these methods, please see the Querying the Graph (opens in a new tab) page in The Graph documentation.

Building Queries

To see the data currently available in the Allo V2 Subgraph, use the Graph Playground (opens in a new tab) and click on the explorer. You will also be able to build and test queries directly in the UI.

Code Examples

// This example uses js to read from the subgraph

// Allo subgraph query url
const url = `https://api.thegraph.com/subgraphs/name/allo-protocol/allo-v2-goerli`
// define the query
// This query returns the name of 10 most recently created profiles
const profileQuery = ` {
  profiles(first: 10, orderBy: createdAt) 
  {
    name
  }
}`;

//prepare the request body
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ query: profileQuery }),
};

//handle the response
fetch(url, options)
.then(response => response.json())
.then(data => {
  console.log(data);
})
.catch(error => {
  console.error(error);
});