Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badger registry 2.0 #10

Closed
wants to merge 18 commits into from
Closed

Badger registry 2.0 #10

wants to merge 18 commits into from

Conversation

AlexNi245
Copy link

@AlexNi245 AlexNi245 commented Mar 12, 2022

I'm submitting this pull request to implement the new Badger Dao registry. I've done the following steps to fulfill the task:

  • Implemented a role-based access control based on the requirements. Now there are 3 roles used within the contract:

    • Governance. This role can do anything
    • DevGovernance. This role can promote a vault to "experimental"
    • strategiestGuild. This role can do any promotion
  • To protect functions from being accessed by unauthorized users I've created two modifiers

    • "onlyGovernance",
    • "onlyDev"
    • "onlyPromoter".
  • Added Metadata to vaults. The function "add" now accepts a new parameter "metadata" of type string. Which can be used to store arbitrary strings as metadata of a certain vault.

  • Modified the return values of "getVaults" and "getFilteredProductionVaults". They are now returning an array that contains two arrays "vaultAddresses" and "vaultMetadata"

  • Modified the struct "VaultData". It has now a new field called metadata that is used to store the vaults metadata.

  • Modified the function "set" and "deleteKey" so they are now using to mappings "keys" and "addresses" to storge the needed values in both ways. Also renamed function names from "set" to "addKey" and events from "Set" to "KeyAdded".

  • Replaced "initialized" function with a constructor.

There is still an ongoing question regarding the "devote" function. I think this function can be removed since the process of devotion is now replaced by promoting to "deprecated".

If any further features could make sense to build please let me know I would love to build them!

If there are any questions left please feel free to reach me out

Discord : Alex245#0896

//@dev Anyone can add a vault to here, it will be indexed by their address
function add(string memory version, address vault) public {
function add(
string memory version,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure its covered in the spec although it would be nice to have guards here for input validation wrt version and allow some kind of management on release versions available to ensure proper usage of functionality

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes makes a lot of sense. I've added a VersionGuard modifier with requires a supported version. To ensure that checking the version has O(1) compatibility I used an Bytes32Set for storing the versions using Keccak256 hash for this.

@GalloDaSballo
Copy link
Collaborator

Closed in favour of #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants