Class

VotingContract

VotingContract(options)

Constructor

# new VotingContract(options)

Voting Contract Object

Parameters:
Name Type Description
options VotingContract~Options

View Source models/Voting/VotingContract.js, line 14

Methods

# async __assert()

View Source models/Voting/VotingContract.js, line 290

Contract is not deployed, first deploy it and provide a contract address

Error

# castVote() → {Promise.<TransactionObject>}

Cast Vote

Parameters:
Name Type Description
params.poolId Integer

Pool Id

params.voteId Integer

Vote Position on Length

View Source models/Voting/VotingContract.js, line 81

Promise.<TransactionObject>

# createPool() → {Promise.<TransactionObject>}

Creates a Pool

Parameters:
Name Type Description
params.description String
params.expirationTime Integer
params.poolOptions Array | Integer

View Source models/Voting/VotingContract.js, line 42

Promise.<TransactionObject>

# deploy(Objectopt, options) → {Promise.<*>}

Deploy the Staking Contract

Parameters:
Name Type Attributes Description
Object <optional>

params

params.erc20Contract Address
options IContract~TxOptions

View Source models/Voting/VotingContract.js, line 321

Promise.<*>

# endPool() → {Promise.<TransactionObject>}

Creates a Pool

Parameters:
Name Type Description
params.poolId Integer

View Source models/Voting/VotingContract.js, line 63

Promise.<TransactionObject>

# erc20() → {Promise.<Address>}

Get ERC20 Address of the Contract

View Source models/Voting/VotingContract.js, line 28

Promise.<Address>

# getERC20Contract()

View Source models/Voting/VotingContract.js, line 334

ERC20Contract|undefined

# getLockedAmount(params) → {Integer}

Get Locked Amount

Parameters:
Name Type Description
params Object
voter Address

View Source models/Voting/VotingContract.js, line 252

Locked Amount

Integer

# getPollHistory(params) → {Array|Integer}

Get Pool History for Address

Parameters:
Name Type Description
params Object
address Address

View Source models/Voting/VotingContract.js, line 193

Pool Ids

Array | Integer

# getPollInfoForVoter(params) → {Integer|Integer}

Get Pool Info for Voter

Parameters:
Name Type Description
params Object
poolId Integer
voter Address

View Source models/Voting/VotingContract.js, line 213

Vote

Integer

Weigth (Token Value)

Integer

# getPollOptionById(params) → {Integer}

Get Pool Winner

Parameters:
Name Type Description
params Object
poolId Integer

Pool Id

optionIndex Integer

Option Id for Pool

View Source models/Voting/VotingContract.js, line 177

Option Id

Integer

# getPoolInformation(params) → {Promise.<VotingContract~Pool>}

Get Pool Information

Parameters:
Name Type Description
params Object
poolId Integer

View Source models/Voting/VotingContract.js, line 132

Promise.<VotingContract~Pool>

# getPoolWinner(params) → {Integer|Integer}

Get Pool Winner

Parameters:
Name Type Description
params Object
poolId Integer

View Source models/Voting/VotingContract.js, line 157

Winner Id

Integer

Winner Id Index

Integer

# stakeVotingTokens() → {Promise.<TransactionObject>}

Stake Voting Tokens

Parameters:
Name Type Description
params.tokens Integer

Tokens

View Source models/Voting/VotingContract.js, line 100

Promise.<TransactionObject>

# userHasVoted(params) → {Bool}

Check if a User has voted

Parameters:
Name Type Description
params Object
poolId Integer
voter Address

View Source models/Voting/VotingContract.js, line 236

HasVoted

Bool

# withdrawTokens() → {Promise.<TransactionObject>}

Withdraw Tokens from Voting

Parameters:
Name Type Description
params.tokens Integer

Tokens

View Source models/Voting/VotingContract.js, line 269

Promise.<TransactionObject>

Type Definitions

Object

# Options

Properties:
Name Type Attributes Default Description
test Boolean
localtest Boolean

ganache local blockchain

web3Connection Web3Connection <optional>
Web3Connection

created from params: 'test', 'localtest' and optional 'web3Connection' string and 'privateKey'

contractAddress string <optional>

View Source models/Voting/VotingContract.js, line 6

Object

# Pool

Properties:
Name Type Description
creator Address
status Bool
optionsSize Integer
description String
voters Array | Address
expirationTime Date

View Source models/Voting/VotingContract.js, line 115