Governance Integration

Introduction

JustLend DAO protocol is governed and upgraded by JST holders. There are three components included in the governance system: JST(WJST) token, governance module(GovernorBravo) and Timelock.

The governance of the JustLend DAO protocol is through proposals, whose process can be summarized as proposal posting-voting-taking effect. Several parameters are included in the process:

Governance Parameters

ParamValueDescription

quorumVotes

600000000

The least for-votes for a proposal to take effect

votingPeriod

86400

Voting duration(block counts), can be changed by proposals

proposalThreshold

200000000

The least votes that a proposer must possess, can be changed by proposals

votingDelay

1

The waiting duration before voting starts(block counts)

proposalMaxOperations

10

Action maximum within a proposal

proposalCount

11

Current proposal count

JST & WJST

JST can be exchanged for WJST token at a 1:1 ratio. WJST can be used to vote for proposals.

Governance Process

An account must possess at least 200,000,000 votes to create governance proposals. When a proposal is created, the voting period starts and will last for 86,400 block times(approx. 3 days). If a majority of affirmation and at least 600,000,000 votes are cast for the proposal, the proposal will wait for 2 days(according to Timelock.delay, the current value is 172,800s) to take into effect.

Relevant Methods

Proposals

propose()

Contract: GovernorBravo

function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint)

Calling this method creates a proposal to change & update the JustLend DAO protocol.

ParameterTypeDescription

targets

address[]

Target addresses for calls to be made during proposal execution

values

uint[]

Values to be passed to the calls

signatures

string[]

Function signatures

calldatas

bytes[]

Data for each function

description

string

A Readable message of what exactly the proposal changes

Returns: The ID of this proposal

const result = governorBravo.propose(targets, values, signatures, calldatas, description).send({
  feeLimit:10_000_000_000,
  callValue:0,
  shouldPollResponse:true
});

queue()

Contract: GovernorBravo

function queue(uint proposalId) public

Calling this method moves a successful proposal into the Timelock waiting period. The waiting period begins when this method is successfully called.

ParameterTypeDescription

proposalId

uint

ID of the successful proposal

Returns: None, reverts on error.

const result = governorBravo.queue(proposalId).send({
  feeLimit:10_000_000_000,
  callValue:0,
  shouldPollResponse:true
});

execute()

Contract: GovernorBravo

function execute(uint proposalId) public payable

Calling this method executes the proposal whose waiting period has already been ended. Actions in the proposal will be invoked during the execution.

ParameterTypeDescription

proposalId

uint

ID of the proposal to be executed

Returns: None, reverts on error.

const result = governorBravo.execute(proposalId).send({
  feeLimit:10_000_000_000,
  callValue:0,
  shouldPollResponse:true
});

cancel()

Contract: GovernorBravo

function cancel(uint proposalId) public

Calling this function cancels a proposal. A proposal can be cancelled at any time prior to its execution.

ParameterTypeDescription

proposalId

uint

ID of the proposal to be cancelled

Returns: None, reverts on error.

const result = governorBravo.cancel(proposalId).send({
  feeLimit:10_000_000_000,
  callValue:0,
  shouldPollResponse:true
});

getActions()

Contract: GovernorBravo

function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas)

Calling this method gets the actions of an exact proposal.

ParameterTypeDescription

proposalId

uint

ID of the proposal

ReturnsTypeDescription

targets

address[]

Target addresses for calls to be made during proposal execution

values

uint[]

Values to be passed to the calls

signatures

string[]

Function signatures

calldatas

bytes[]

Data for each function

Returns: The ID of this proposal

const {0: targets, 1: values, 2: signatures, 3: calldatas} = governorBravo.getActions(proposalId).call();

getReceipt()

Contract: GovernorBravo

function getReceipt(uint proposalId, address voter) public view returns (Receipt memory)

Calling this method gets the votes of a specified voter on a proposal.

ParameterTypeDescription

proposalId

uint

ID of the specified proposal

voter

address

Address of the specified account

ReturnsTypeDescription

Receipt

struct

bool hasVoted // voted or not bool support // for or against uint96 votes //vote count

const {hasVoted, support, votes} = governorBravo.getReceipt(proposalId, voter).call();

state()

Contract: GovernorBravo

function state(uint proposalId) public view returns (ProposalState)

Calling this method returns the state of a specified proposal.

ParameterTypeDescription

proposalId

uint

ID of the specified proposal

ReturnsTypeDescription

ProposalState

enum

Pending Active Canceled Defeated Succeeded Queued Expired Executed

const result = governorBravo.state(proposalId).call();

Poll & Vote

deposit()

Contract: WJST

function deposit(uint256 sad) public

Calling this method exchanges JST for WJST at a one-to-one ratio.

ParameterTypeDescription

sad

uint256

Number of votes(WJST) to exchange

Returns: None, reverts on error

const result = wjst.deposit(number).send({
  feeLimit:10_000_000_000,
  callValue:0,
  shouldPollResponse:true
});

castVote()

Contract: GovernorBravo

function castVote(uint proposalId, uint votes, bool support) public

Calling this method casts a vote on a proposal. The voting weight will be calculated at the time the proposal's state becomes active.

ParameterTypeDescription

proposalId

uint

ID of the proposal to vote

votes

uint

Number of the votes to be cast

support

bool

For or against

Returns: None, revers on error.

const result = governorBravo.castVote(proposalId,votes,support).send({
  feeLimit:10_000_000_000,
  callValue:0,
  shouldPollResponse:true
});

castVoteWithReason()

Contract: GovernorBravo

function castVoteWithReason(uint proposalId, uint votes, bool support, string calldata reson) public

Calling this method casts a vote on a proposal. The reason can be submitted simultaneously.

ParameterTypeDescription

proposalId

uint

ID of the proposal to vote

votes

uint

Number of the votes to be cast

support

bool

For or against

reason

string

voting reason

Returns: None, revers on error.

const result = governorBravo.castVote(proposalId,votes,support,reason).send({
  feeLimit:10_000_000_000,
  callValue:0,
  shouldPollResponse:true
});

castVoteBySig()

Contract: GovernorBravo

function castVoteBySig(uint proposalId, uint votes, bool support, uint8 v, bytes32 r, bytes32 s) public

Calling this method casts votes on a specified proposal. Comparing with castVote(), this method allows offline signature.

ParameterTypeDescription

proposalId

uint

ID of the proposal to vote

votes

uint

Number of the votes to be cast

support

bool

For or against

v

uint8

Recover byte of the signature

r

bytes32

Half of the ECDSA signature pair

s

bytes32

Half of the ECDSA signature pair

Returns: None, reverts on error.

const result = governorBravo.castVote(proposalId,votes,support,v,r,s).send({
  feeLimit:10_000_000_000,
  callValue:0,
  shouldPollResponse:true
});

Last updated