Skip to content

Instantly share code, notes, and snippets.

@corydickson
Last active April 27, 2019 12:00
Show Gist options
  • Save corydickson/7bd7cb0700d81b474ed0b79d81f5b30d to your computer and use it in GitHub Desktop.
Save corydickson/7bd7cb0700d81b474ed0b79d81f5b30d to your computer and use it in GitHub Desktop.
DAORegistry Scheme Spec

The DAO Registry

This scheme contract interacts with the DAORegisty inside of the arc-hive repo. It leverages the generic call contract scheme to interact with a registry contract that the DAOAvatar owns.

Specification

The user interface for this scheme will take the address of the registry contract, the address of the DAO to be added/removed, and the associated name to be registered. On the client-side of Alchemy it should generate the callData field to be set inside of the proposal storage by encoding the parameters supplied by the user.

For example, if the user is trying to register another DAO avatar, they will supply its address, and the name as type string, as well as the registry address they are trying to access. The scheme will call the registry contracts' register function.

When trying to remove an avatar from the registry it simply take the address to be removed as well as the address of the registry, and call the function unregister. Regardless of the type of proposal (add/remove), when it passes with an affirmative vote, executeProposal will be triggered and use the GenericScheme to call the functions with the correct data supplied in the proposal memory.

API

function proposeToAddDAO(Avatar _avatar, string memory _registryName, Avatar _proposedAvatar, bytes memory _callData, uint256 _value) public returns(bytes32)
function proposeToRemoveDAO(Avatar _avatar, string memory _registryName, Avatar _proposedAvatar, bytes memory _callData, uint256 _value) public returns(bytes32)
function executeProposal(bytes32 _proposalId, int256 _param) external onlyVotingMachine(_proposalId) returns(bool)

A possible improvement to this contract that would increase it's gas price would be to encode the parameters inside of each of the proposal functions. Furthermore the registry contract emits events to acknowledge changes made, the contract storage itself is never updated. Due to this feature, a suggested improvement to the scheme is to limit the amount of times one can initate a call on a particular address it is trying to register/unregister.

How to initialize

First the registry contract to be called must be deployed and initialized as the DAOAvatar as the owner. Once this is completed the user will supply that address to the scheme when making a proposal. This allows the DAO to have multiple registries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment