Governance

Access all governance related methods of GovBlocks Smart Contracts through this module

Governance Module is an instance of dApp

Functions

getTotalRewardsByDapp

governance.getTotalRewardsByDapp(callback)

Get total number of rewards issued by the dApp

Rewards are incentives distributed for contributing in decision making process

Returns

Number of rewards issued by dApp

createProposal

governance.createProposal(data :<json>,callback)

Creates an uncategorized proposal in dApp

Arguments:

data json:{
proposalData:[{
title //proposal title
shortDescription //description in short form
description //complete description of proposal
}],
votingType //voting type id
}

Returns

Resulting transaction hash

createProposalwithOption

governance.createProposalwithOption(data :<json>,callback)

Create a proposal, categorize, open it for voting and submit solution at a time

Arguments:

data json : {
proposalData:[{title,shortDescription,description}],
optionData:{
paramValues // Onchain action parameter values
apiParamValues // Offchain action parameter values
},
cId //sub category id,
votingType
}

Returns

Resulting transaction hash

categorizeProposal

governance.categorizeProposal(data :<json>,callback)

Categorize a proposal

Arguments:

data json : {
proposalId //Id of the proposal to categorize
categoryId //Id of subCategory
}

Returns

Resulting transaction hash

openProposalForVoting

governance.openProposalForVoting(proposalId,callback)

Open a proposal for voting

Arguments:

proposalId

Returns

Resulting transaction hash

initiateAddSolution

governance.initiateAddSolution(data :<json>,proposalId,memberAddress,callback)

Add solution with parameters for proposal

Arguments:

data json : {
optionData:{
paramValues //Onchain parameter values
apiParamValues //Offchain parameter values
}
},
proposalId,
memberAddress

Returns

Resulting transaction hash

submitProposalWithSolution

governance.submitProposalWithSolution(data :<json>,proposalId,callback)

Open a categorized proposal for voting and submit a solution simultaneously

Arguments:

data:{
optionData:{
paramValues //Onchain parameter values
apiParamValues //Offchain parameter values
}
}
proposalId

Returns

Resulting transaction hash

checkProposalVoteClosing

governance.checkProposalVoteClosing(proposalId,callback)

Check if voting is closed for current voting layer of proposal

Arguments:

proposalId

Returns

Whether proposal voting has been closed for current voting layer

proposalVoting

governance.proposalVoting(proposalId,optionChosen,callback)

Vote for a solution of proposal

Arguments:

proposalId //Id of proposal
optionChosen //Array of options chosen to upvote

Returns

Resulting transaction hash

getTokensLockedAtTime

governance.getTokensLockedAtTime(dAppName,memberAddress,reason,time,callback)

Get number of tokens locked by the address at given time for specified reason

Arguments:

dAppName //Name of dApp
memberAddress //Ethereum address of member
reason //Reason for which tokens are locked
time //Timestamp of time at which tokens locked to be known

Returns

Number of tokens locked

checkTokensLockedForStake

governance.checkTokensLockedForStake(memberAddress,reason,time,subCategoryId,categoryId) : <callback>

Check whether address has enough tokens locked for submitting stake to a categorized proposal

Arguments:

memberAddress //Ethereum address of member
reason //Reason for which tokwns are locked
time //Timestamp of time at which tokens locked to be known
subCategoryId //Sub category id of proposal
categoryId //Category id of proposal

Returns

<boolean> Whether member has enough tokens

canCreateProposal

governance.canCreateProposal(memberAddress,subCategoryId,callback)

Check whether member can create proposal under a category

Arguments:

memberAddress //Ethereum address of member
subCategoryId //Sub category id of proposal

Returns

<boolean> Whether member can create proposal

Vote Details

getVoteEventData

governance.getVoteEventData(memberAddress,callback)

Get details of all votes cast by member

Arguments:

memberAddress //Ethereum address of member

Returns

Array of all vote details

getVoteDetailById

governance.getVoteDetailById(voteId,callback)

Get details of vote

Arguments:

voteId //Id of the vote

Returns

voteValue,
address of voter,
id of solution for which vote has been registered

getVotingTypeLength

governance.getVotingTypeLength(callback)

Get length of the voting types existing in GovBlocks

Returns

Length of voting types

getVotingTypeDetailsById

governance.getVotingTypeDetailsById(votingTypeId,callback)

Get basic details of a voting type

Arguments:

votingTypeId //Id of voting type

Returns

votingTypeid,
votingTypeName <hex>,
votingTypeAddress

getVoteArrayById

governance.getVoteArrayById(proposalId,callback)

Get id's of all votes polled for a proposal

Arguments:

proposalId //Id of the proposal

Returns

Array of vote id's

getPendingReward

governance.getPendingReward(memberAddress,callback)

Get number of rewards to be claimed by the member

Arguments:

memberAddress //Ethereum address of member

Returns

Array of pending GBT rewards and pending dApp rewards

getRewardClaimed

governance.getRewardClaimed(proposalId,memberAddress,callback)

Check whether member had claimed his reward

Arguments:

proposalId //Id of proposal
memberAddress //Ethereum address of member

Returns

<boolean> Whether member had claimed his reward

getVoteRewardClaimed

governance.getVoteRewardClaimed(voteId,callback)

Check if reward has been claimed for the vote

Arguments:

voteId //Id of vote

Returns

<boolean> Whether reward has been claimed for the vote

Voting Weights

getQuorumPercentage

governance.getQuorumPercentage(callback)

Get quorum percentage

Returns

Quorum percentage

getStakeWeight

governance.getStakeWeight(callback)

Get stake weight

Returns

Stake weight

getBonusReputation

governance.getBonusReputation(callback)

Get bonus reputation

Returns

Bonus reputation

getBonusStake

governance.getBonusStake(callback)

Get bonus stake

Returns

Bonus stake

Reputation Weights

getReputationWeight

governance.getReputationWeight(callback)

Get reputation weight

Returns

Reputation weight

getProposalOwnerPoints

governance.getProposalOwnerPoints(callback)

Get number of reputation points distributed to proposal owner

Returns

Reputation points

getOptionOwnerPoints

governance.getOptionOwnerPoints(callback)

Get number of reputation points distributed to solution owner

Returns

Reputation points

Locking

dAppTokenSupportsLocking

governance.dAppTokenSupportsLocking(callback)

Check whether dApp token supports locking

Returns

<boolean> Whether dApp token supports locking

getdAppTokenProxy

governance.getdAppTokenProxy(callback)

Get proxy of dApp token

Returns

Proxy token address ofdApp

getTokenAddress

governance.getTokenAddress(dAppName,callback)

Get dApp token Address

Arguments:

dAppName //Name of dApp

Returns

Token address of dApp

getTotalBalance_user

governance.getTotalBalance_user(memberAddress,dAppName,callback)

Get total dApp token balance of member inclusive of locked tokens

Arguments:

memberAddress //Ethereum address of member
dAppName //Name of dApp

Returns

total dApp token balance

getTotalGBTBalance_user

governance.getTotalGBTBalance_user(memberAddress,callback)

Get total GBT balance of member inclusive of locked tokens

Arguments:

memberAddress //Ethereum address of member

Returns

total GBT balance of user

getTokensLocked

governance.getTokensLocked(dAppName,memberAddress,reason,callback)

Get number of tokens locked by the member for specified reason

Arguments:

dAppName //Name of dApp
memberAddress //Ethereum address of member
reason //Reason for which tokens are locked

Returns

Number of tokens locked by the member

getTokensLockedValidity

governance.getTokensLockedValidity(dAppName,memberAddress,reason),callback

Get time up-to which member had locked tokens for specified reason

Arguments:

dAppName //dAppName
memberAddress //Ethereum address of member
reason //Reason for which tokens are locked

Returns

Time upto which member had locked tokens

getUnlockableTokens

governance.getUnlockableTokens(dAppName,membrAddress,reason,callback)

Get number of unlock-able tokens of specified reason available for member

Arguments:

dAppName //Name of dApp
memberAddres //Ethereum address of member
reason //Reason for which tokens are locked

Returns

Number of unlockable tokens available for member

getTotalUnlockableTokens

governance.getTotalUnlockableTokens(dAppName,memberAddress,callback)

Get total number of unlocked tokens

Arguments:

dAppName //Name of dApp
memberAddress //Ethereum address of member

Returns

Total number of unlockable tokens

transferTokens

governance.transferTokens(dAppName,recipientAddress,value,callback)

Transfer dApp tokens of member address to recipients address

Arguments:

dAppName //Name of dApp
recipientAddress //Ethereum address of recipient
value //Amount of tokens to transfer

Returns

Resulting transaction hash

lockTokens

governance.lockTokens(dAppName,reason,amount,time,callback)

Lock member tokens for specified reason and time

Arguments:

dAppName //Name of dApp
reason //Reason for which tokens to be locked
amount //Amount of tokens to lock
time //Time for which tokens to be locked

Returns

Resulting transaction hash

extendLockValidity

governance.extendLockValidity(dAppName,reason,time,callback)

Extend amount of time tokens were locked for reason

Arguments:

dAppName //Name of dApp
reason //Reason for which tokens are locked
time //Time to extend locking period

Returns

Resulting transaction hash

unlockTokens

governance.unlockTokens(dAppName,memberAddress,callback)

Release the unlock-able tokens available for member

Arguments:

dAppName //Name of dApp
memberAddress //Ethereum address of member

Returns

Resulting transaction hash

claimPendingRewards

governance.claimPendingRewards(memberAddress,callback)

Claim all the pending rewards available for member

Arguments:

memberAddress //Ethereum address of member

Returns

Resulting transaction hash

getDataFromHash

governance.getDataFromHash(hash)

Get data from the IPFS hash

Arguments:

hash //Valid IPFS hash

Returns

Data present in hash