Write a Shaman
Alright, first things first. Shamans are not just spiritual healers; in our context, they're special admin scripts designed for automating DAO features. If you're curious where to find them, you'd want to head on over to the HausDAO (opens in a new tab) organization on Github.
Think of shamans as special roles within the DAO. There are several levels of permissions to be aware of:
- Admin: Has the mighty power to pause or unpause tokens.
- Governor: Is in charge of adjusting governance configurations and can even cancel proposals.
- Manager: Plays the role of minting and burning tokens.
First is the baal-tokens (opens in a new tab) repository. Think of this as your playground; it's primarily used for creating shamans and experimentation. If you're looking to set up a new DAO with multiple shamans, this repo will be especially helpful. It supports custom tokens using a factory pattern.
Next up, we have the baal-shamans (opens in a new tab) repository. This has a treasure trove of examples and is essentially the precursor to 'Baal Tokens'.
Now, if you're feeling adventurous, go ahead and fork the 'Baal Tokens' repo to experiment.
git clone https://github.com/HausDAO/baal-tokens.git
While you're there, familiarize yourself with its layout and purpose. Here you'll find configurations for summoners, tokens, and shamans, and also get introduced to higher-order summoners or factories. We are using indexed factories for seamless SDK integration.
Okay, it's time to get our hands a bit dirty. Fork and clone the 'Baal Shamans' repo locally.
git clone https://github.com/HausDAO/baal-shamans.git
For initialization, we'll use
pnpm, which operates similarly to
yarn. Check out the 'ETH Onboarder' (EthOnboarder.sol (opens in a new tab)) shaman. Spend some time understanding it's functions, especially how it mints shares or loot.
Ready for customization? Start with the iBaal interface from the @daohaus/baal-contracts (opens in a new tab) NPM package. Feel free to integrate functionalities from OpenZeppelin, give your shaman a unique name for frontend and SDK recognition, and set those public variables for frontend and SDK interactions.
Now, before sending our creation into the wild, we must test it. Familiarize yourself with the test framework by importing it from the @daohaus/baal-contracts (opens in a new tab) NPM package. Dive deep into its behavior file, fixture file, and base test file.
Once ready, compile and run tests. But, a quick heads up, ensure your
.env file is primed with your Infura key and mnemonic private key.
For deployment, there are available scripts to make your life easier. Also, consider the clone pattern -- it's a real game-changer when thinking about gas savings and initialization.
And there you have it! From here, the world is your oyster. You can choose what to focus on next. Want to learn more about our tools?