GovBlocks Master

Functions

getdAppInstance

gbmaster.getdAppInstance(dAppName,callback)

Get the instance of dApp

For accessing dApp specific smart contract calls user needs to create an instance of dApp modules, It is a JSON of dApp modules. Governance : Consists of decision making process and locking related function calls. MemberData : Consists of all functions related to member roles and member specific data. ProposalData : Consists of functions required to fetch Proposal and Solution data. CategoryData : Consists of all functions related to category and sub category data.

Arguments:

dAppName : Name of the dApp

Returns:

{
dAppName : Name of the dApp
governance : Govenance modules instance
memberData : Member Data Instance
proposalData : Proposal Data Instance
categoryData : Category Data Instance
}

dApp Details

getdAppMasterAddress

getdAppMasterAddress(dAppName,callback)

Get the master contract address of dApp

Arguments:

dAppName

Returns:

Master contract address

getdAppDetails

gbmaster.getdAppDetails(dAppName,callback)

Gets all dApp details in an array

Arguments:

dAppName

Returns:

dAppName
masterAddress
tokenAddress
byteCode hash
abi hash
versionLength
description hash

getdAppDetailsByAddress

gbmaster.getdAppDetailsByAddress(address,callback)

Get the dApp details by passing its master contract address or token address

Arguments:

address

Returns:

dAppName
masterAddress
tokenAddress

getdAppContractAddresses

gbmaster.getdAppContractAddresses(dAppName,callback)

Get the latest version smart contract addresses of the dApp

Arguments:

dAppName

Returns:

Array of smart contract addresses

isdAppValid

gbmaster.isdAppValid(dAppName,callback)

Checks if dApp has valid contract addresses

Arguments:

dAppName

Returns:

Whether dApp has valid contract addresses

isContractActive

gbmaster.isContractActive(dAppName,contractAddress,callback)

Checks if contract address is active

Arguments:

dAppName
contractAddress

Returns:

Whether contract address is active

activateDapp

gbmaster.activateDapp(dAppName,contractAddresses,callback)

Activate dApp master by providing an array of contract addresses

Arguments:

dAppName
contractAddresses array :[GovernanceData,MemberRoles,ProposalCategory,SimpleVoting,Governance,Pool]

Returns:

Resulting transaction hash

isMemberAuthorized

gbmaster.isMemberAuthorized(dAppName,memberAddress,callback)

Check if member belongs to any role in dApp

Arguments:

dAppName
memberAddress

Returns:

Whether member belongs to any role in dApp

getGBmemberDetails

gbmaster.getGBmemberDetails(memberAddress,dAppName,callback)

Get basic details of member in dApp

Arguments:

memberAddress
dAppName

Returns:

[
memberReputation,
totalProposal,
proposalStake,
totalOption,
optionStake,
totalVotes
]

Token Data

getdAppTokenDetails

gbmaster.getdAppTokenDetails(tokenAddress,callback)

Get basic details of a token like name,price,symbol,decimals

Arguments:

tokenAddress

Returns:

Array of Token Details

getGBTaddress

gbmaster.getGBTaddress(callback)

Method to fetch GovBlocks Standard Token

Returns:

GovBlocks Standard Token Address

getdAppTokenAddress

getdAppTokenAddress(dAppName,callback)

Get the token address of dApp

Arguments:

dAppName

Returns:

Token Address

If dApp doesn't have token address or its token doesn't supports locking, GovBlocks allows to create lockable token.

generateTokenAddress

gbmaster.generateTokenAddress(dAppName,tokenName,callback)

Generate a lockable token for dApp

Arguments:

dAppName
tokenName

Returns:

Resulting transaction hash

If dApp has token that doesn't support locking ,newly created lockable token will be added as proxy to the existing token address

generateProxyToken

gbmaster.generateProxyToken(dAppName,dAppTokenAddress,callback)

Generates a proxy for existing dApp token address

Arguments:

dAppName
dAppTokenAddress

Returns:

Resultin transaction hash

getdAppProxyToken

gbmaster.getdAppProxyToken(dAppName,callback)

Get the proxy token added for dApp

Arguments:

dAppName

Returns:

dApp Proxy token address

getLockableTokenAddress

gbmaster.getLockableTokenAddress(dAppName,callback)

Gets the address of lockable token created for the dApp

Arguments:

dAppName

Returns:

Lockable token address

getdAppTokenName

gbmaster.getdAppTokenName(dAppName,callback)

Get the name of dApp token

Arguments:

dAppName

Returns:

Token Name

getTokenName

gbmaster.getTokenName(tokenAddress,callback)

Get the name of token

Arguments:

tokenAddress

Returns:

Token Name

getGBTokenPrice

gbmaster.getGBTokenPrice(callback)

Get current price of GovBlocks Token

Returns:

GovBlocks Token Price

Balances

getGBTBalance_user

gbmaster.getGBTBalance_user(memberAddress,callback)

Get GBT balance of an address

Arguments:

memberAddress

Returns:

GBT balance

getBalance_user

gbmaster.getBalance_user(memberAddress,dAppName,callback)

Get dApp Token balance of member (assuming dApp is registered in GovBlocks)

Arguments:

memberAddress
dAppName

Returns:

dApp Token Balance of member

getBalance_pool

gbmaster.getBalance_pool(dAppName,callback)

Get amount of GBT held by dApp pool

Arguments:

Arguments

Returns:

Return parameters

buyPoolGBT

gbmaster.buyPoolGBT(dAppName,amount,callback)

Buy GBT for pool, for incentive distribution

Arguments:

dAppName
amount

Returns:

Resulting transaction hash

getBalance

gbmaster.getBalance(address,callback)

Get ETH balance if any valid ethereum address (

Arguments:

address

Returns:

ETH balance of address

getPoolBalanceinETH

gbmaster.getPoolBalanceinETH(dAppName,callback)

Get ETH balance of dApp pool

Arguments:

dAppName

Returns:

ETH balance of dApp pool

createHash

gbmaster.createHash(data,callback)

Create IPFS hash of any data in text format

Arguments:

Data

Returns:

IPFS hash

hex_to_ascii

gbmaster.hex_to_ascii(hexCode)

Basic function for converting hex code to proper ASCII value

Arguments:

HEX code

Returns:

ASCII format of input HEX data