Governance

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.

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.

Solidity API

Proposals

propose() / Contract: GovernorBravo

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

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

Parameter description:

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

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

function queue(uint proposalId) public

Parameter description:

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

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

function execute(uint proposalId) public payable

Parameter description:

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

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

function cancel(uint proposalId) public

Parameter description:

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

Calling this method gets the actions of an exact proposal.

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

Parameter description:

ParameterTypeDescription

proposalId

uint

ID of the proposal

Return Values:

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

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

getReceipt() / Contract: GovernorBravo

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

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

Parameter description:

ParameterTypeDescription

proposalId

uint

ID of the specified proposal

voter

address

Address of the specified account

Return Values:

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

Calling this method returns the state of a specified proposal.

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

Parameter description:

ParameterTypeDescription

proposalId

uint

ID of the specified proposal

Return Values:

ReturnsTypeDescription

ProposalState

enum

Pending Active Canceled Defeated Succeeded Queued Expired Executed

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

Poll & Vote

deposit() / Contract: WJST

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

function deposit(uint256 sad) public

Parameter description:

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

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

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

Parameter description:

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

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

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

Parameter description:

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

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

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

Parameter description:

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