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

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:

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:

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:

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:

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:

Return Values:

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:

Return Values:

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:

Return Values:

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:

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:

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:

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:

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