How Governance Works

Maksim Malikov
pieLABS
Published in
5 min readJun 9, 2021

Introduction

DeFiPIE governance allows the community to fully manage the protocol — change various parameters, such as: asset collateral factor, reserve factor or PIE distribution rate; call administrative functions such as adding and removing pools from PIE distribution, withdrawing reserves from pools, and much more. But in addition to the already built-in functionality, governance allows the community to change and add new functionality to the protocol by replacing the contract itself or changing the implementation of smart contracts, because most of the smart contracts in the protocol were developed according to the Upgradable Proxy Pattern.

Since the launch of governance, the DeFiPIE development team no longer has the ability to single-handedly make changes to the protocol. We have changed the admin address in the entire protocol from our own address to the governance module address. This means that the PIE holders are now the collective owner and manager of the protocol.

This both gives great opportunities (for example, PIE holders may decide to increase the distribution rate, or withdraw reserves from pools), but also imposes great responsibility, because now each bug fix must be agreed and accepted by the community, and not rely solely on the DeFiPIE development team.

Scheme of work

The governance module consists of 2 contracts — Governor and Timelock. They work in the following combination:

Timelock is the administrator of the entire protocol, and only from its address is possible to make any administrative calls to the protocol. The Governor is the admin of Timelock and only the Governor can tell the Timelock which calls to make. And the Governor sends calls to Timelock only through the voting system. Thus, it is impossible to make administrative calls to the protocol in any other way, except through voting.

How to get votes

To start participating in governance, you first need to get votes. To do this, you need to call the method in the pPIE contract:

In DeFiPIE app:

  1. Press the “Get Started” button.

2. Choose who will vote — you or someone else.

3. Press the “Setup” button and send the transaction.

4. The value “Votes received” will appear.

How to create a new proposal

The Governor smart contract is responsible for creating proposals and a voting system.

It is possible to create a new proposal only if the following conditions are met:

  1. The Proposer doesn’t have any active proposals
  2. The proposer has at least 15M votes.

1 vote = 1 pPIE (~0.02 PIE deposited in the DeFiPIE pool). Thus, to create a new proposal, you must have ~300K PIE in your deposit. But that’s not the only way to get votes. Other pPIE holders may delegate their votes to you. Voices are added together, i.e. if you have 5M pPIE on your account and 2 other participants delegate their votes to you, who also have 5M pPIE, in total you will have 15M votes and you can create a new proposal.

To create a new proposal, you need to call the method of the Governor smart contract:

In DeFiPIE app:

  1. Click the “Create Proposal” button

2. Enter the title (1), description (2), and also click on the “Add action” button (3) to select the necessary actions to be performed in the protocol.

3. Select the protocol contract to be changed.

4. Set the required value and click the “Add action” button.

5. All added actions will be displayed in the “Actions” list (1). The maximum number of actions in one proposal is 10. After adding all the necessary actions, click the “Submit proposal” button (2) and send the transaction.

After that, if the required conditions have been met, a new proposal will be created.

Voting

Approximately 3 days are given for voting, or rather 17280 blocks for Ethereum and 86,400 blocks for Bincance Smart Chain. During this time, a proposal must receive at least 150 million “For” votes before it can be submitted to Timelock and queued for execution.

An important point, each participant votes only with those votes that he had at the time of creating the proposal. Those if you receive votes after creating a proposal, they will not be counted. This is done in order to protect against repeated voting with the same tokens. Otherwise, one could vote countless times simply by sending the same tokens to and voting from other addresses.

Thus, it is important to worry about the presence of votes in advance, otherwise, when the proposal will be created, and you did not have votes, it will be too late to take part in the vote.

To vote for any proposal, you need to call a function in the Governor smart contract:

In DeFiPIE app:

  1. Open the proposal page
  2. Click on the “Vote for” button if you are voting FOR or “Vote against” if you are voting AGAINST.

If the proposal will get the required number of votes, after 3 days, it can be sent to the Timelock in the queue for execution, for this you need to call the function in the Governor smart contract:

The proposal will be in the queue from 2 days to 16 days.

During the first 2 days, a successful proposal cannot be executed and can still be canceled by the guardian (who has veto power), or by anyone if the proposer has lost 15M votes.

After 2 days, if the proposal has not been canceled, it can be executed by calling the Governor smart contract function:

After that, all proposed changes will be executed and implemented into the protocol.

--

--