The Governor Contract, or DssGov
for short, is a Dai Stablecoin System Contract that authorises Maker governance to make changes to the Maker protocol by supporting on-chain proposals.
This repository contains three main contracts:
DssGov
: actual governance contract
GovExec
: contract which acts as a delayer between proposals being approved and getting them executed.
GovMom
: contract that has authority to drop proposals in DssGov
. It will be used together with a GovExec
with 0 time delay.
It is an auth
function. Authorizes usr
to execute auth
functions.
It is an auth
function. Removes authorization of usr
to execute auth
functions.
It is an auth
function. Changes a governance setting.
It is an auth
function. Adds usr
to the whitelist of regular proposers (which do not need to stake MKR to make a proposal).
It is an auth
function. Removes usr
from the whitelist of regular proposers.
Delegates the MKR deposited by owner
to newDelegated
.
Requires:
msg.sender == owner
ORmsg.sender == oldDelegated
AND newDelegated == address(0)
ORmsg.sender == ANYONE
AND newDelegated == address(0)
AND owner is inactive
Deposits wad
amount of MKR
Withdraws wad
amount of MKR
Creates a new snapshot of usr
with 0 voting weight. Removes the previous weight from total active MKR.
Requires usr
has been inactive for a certain time and hasn't been already marked as inactive.
Creates a new snapshot of msg.sender
with its delegated amount. Adds this voting weight to total active MKR.
Requires msg.sender
was previously marked as inactive or it is the first time calling this function.
Launches the system. This function is meant to activate the system and just to be used once.
Requires that a minimum amount of MKR is deposited and active in the contract.
Makes a new proposal.
Requires:
msg.sender
is a whitelisted proposer and hasn't reached the daily maximum ORmsg.sender
has enough MKR deposited and is not a current locked account (due a previous proposal created)Votes proposal number id
with wad
amount of MKR.
Requires passing the correct snapshotIndex
and having wad
<= voting rights at that snapshotIndex
.
The correct snapshotIndex
of a user is the last snapshot created for that user prior to the creation of the proposal to be voted on. (snapshot.fromBlock < proposal.blockNum
).
Schedules proposal number id
Requires it has enough votes supporting it.
Executes proposal number id
.
Requires that the proposal has already been scheduled and the delay has passed.
It is an auth
function. Cancels proposal number id
.
Users that want to deposit and start voting with their own wad
amount of MKR:
MKR.approve(DssGov, wad)
DssGov.lock(wad)
DssGov.delegate(sender, sender)
DssGov.ping()
Users that want to deposit and delegate wad
amount of MKR:
MKR.approve(DssGov, wad)
DssGov.lock(wad)
DssGov.delegate(sender, userToDelegate)
Users that want to start voting with their delegated wad
amount of MKR for the first time (or after being inactive):
DssGov.ping()