Spell
Last updated
Last updated
Contract Name: spell.sol
Type/Category: Governance Module
Contract Source: Etherscan
A DSSpell
is an un-owned object that performs one action or series of atomic actions (multiple transactions) one time only. This can be thought of as a one-off DSProxy with no owner (no DSAuth mix-in, it is not a DSThing).
This primitive is useful to express objects that do actions which shouldn't depend on "sender", like an upgrade to a contract system that needs to be given root permission. By convention, it is usually what is used to change system parameters (where it is given auth via voting in ds-chief).
The spell.sol
contract contains two main contracts: DSSPELL and DSSpellBook. DSSPELL is the core contract that, with call instructions set in the constructor, can actually perform the one-time action. DSSpellBook is a factory contract designed to make the creation of DSSPELLs easier.
Glossary (Spell)
whom
- is the address the spell is targeting,
mana
- is the amount of ETH you are sending, which in spells it is usually 0.
data
- bytes memory calldata.
done
- indicates that the spell has been called successfully.
hat
- A spell comes into effect as the hat when someone calls the lift function. This is only possible when the spell in question has more BTU voted towards it than the current hat.
cast
- Once a spell has become the hat, it can be cast and its new variables will go into effect as part of the live HelloBTU system. It is worth noting that a spell can only be cast once.
lift
- The process whereby a new spell replaces the old proposal.
Note: the hat
and lift
have more to do with ds-chief
than ds-spell
but are important to mention here for context.
Immutable Actions
whom
, mana
, and data
are set in the constructor, so the action a spell is to perform cannot be changed after the contract has been deployed.
Note that the spell is only marked as "done" if the CALL it makes succeeds, meaning it did not end in an exceptional condition and it did not revert. Conversely, contracts that use return values instead of exceptions to signal errors could be successfully called without having the effect you might desire. "Approving" spells to take action on a system after the spell is deployed generally requires the system to use exception-based error handling to avoid griefing.
spell
- A spell may remain uncast if it did not reach the required amount of BTU in order to pass. If this occurs, the spell may remain available as a later target if enough GOV is voted towards it.
lift
- Although spells cannot be cast a second time, they can be lifted to become the hat more than once if enough BTU votes remain on that proposal. The proposals parameters will not go into effect, however any additional spell will need to have more than that amount of GOV voted towards it in order to become the new hat. See forum post for a description of this having once occurred.
cast
- If, when cast
is called, the spell's one-time action fails, done
does not get flipped and the spell remains castable.