Integrating with the Project Registry
There are two ways to interact with the Project Registry.
- Through the
Registry.sol
contract - 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
name | data type | notes |
---|---|---|
_nonce | uint256 | nonce is used to create the profile profileId. By providing a nonce projects can ensure having the same id across chains. |
_name | string | The profile name. This is used to generate the anchor. |
_metadata | Metadata | See the metadata section below for more details. |
_owner | address | The owner of the profile. See Roles for more details about profile owners. |
_members | address[] | 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;
}
Field | Data Type | Notes |
---|---|---|
protocol | uint256 | An id from the list of available protocols. |
pointer | string | The 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)
Field | Data Type | Notes |
---|---|---|
profileId | bytes32 | The id of the profile to update. |
members | address[] | 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)
Field | Data Type | Notes |
---|---|---|
profileId | bytes32 | The id of the profile to update. |
members | address[] | Array of member address(es) to remove. |
updateProfileMetadata
Will overwrite the existing profile metadata. Only the owner can update profile metadata.
updateProfileMetadata(profileId, metadata)
Field | Data Type | Notes |
---|---|---|
profileId | bytes32 | The id of the profile to update. |
metadata | Metadata | Metadata 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)
Field | Data Type | Notes |
---|---|---|
profileId | bytes32 | The id of the profile to update. |
name | string | New 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)
Field | Data Type | Notes |
---|---|---|
profileId | bytes32 | The id of the profile to update. |
pendingOwner | address | The 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);
});