Giter VIP home page Giter VIP logo

dss-gov's Introduction

DSSGov

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.

Description

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.

Authorization schema

Authorization schema

Public functions

rely(address usr)

It is an auth function. Authorizes usr to execute auth functions.

deny(address usr)

It is an auth function. Removes authorization of usr to execute auth functions.

file(bytes32 what, uint256 data)

It is an auth function. Changes a governance setting.

addProposer(address usr)

It is an auth function. Adds usr to the whitelist of regular proposers (which do not need to stake MKR to make a proposal).

removeProposer(address usr)

It is an auth function. Removes usr from the whitelist of regular proposers.

delegate(address owner, address newDelegated)

Delegates the MKR deposited by owner to newDelegated.

Requires:

  • msg.sender == owner OR
  • msg.sender == oldDelegated AND newDelegated == address(0) OR
  • msg.sender == ANYONE AND newDelegated == address(0) AND owner is inactive

lock(uint256 wad)

Deposits wad amount of MKR

free(uint256 wad)

Withdraws wad amount of MKR

clear(address usr)

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.

ping()

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.

launch()

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.

propose(address exec, address action)

Makes a new proposal.

Requires:

  • msg.sender is a whitelisted proposer and hasn't reached the daily maximum OR
  • msg.sender has enough MKR deposited and is not a current locked account (due a previous proposal created)

vote(uint256 id, uint256 snapshotIndex, uint256 wad)

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).

plot(uint256 id)

Schedules proposal number id

Requires it has enough votes supporting it.

exec(uint256 id)

Executes proposal number id.

Requires that the proposal has already been scheduled and the delay has passed.

drop(uint256 id)

It is an auth function. Cancels proposal number id.

Some user flows

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()

dss-gov's People

Contributors

gbalabasquer avatar hexonaut avatar brianmcmichael avatar godsflaw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.