Smart Contract Functions Documentation
This page contains documentation for the functions available in the OpenPolls smart contract.
Each function has details about its type, state mutability, inputs, and outputs.
You can integrate the contract calls in your own project using the contract address, ABI and documentation provided here.
Official Contract Addresses
Contract ABI: Download ABI
pollPrice
Description: Get the price of creating a new poll.
Type: function
State Mutability: view
Outputs:
- uint256
assetVoteCost
Description: Get the cost of voting for a contract or an asset.
Type: function
State Mutability: view
Outputs:
- uint256
feesBps
Description: The contract operator fees. Applies only to Polls that have a non-zero price as the voteCost.
Type: function
State Mutability: view
Outputs:
- uint256
createPoll
Description: Create a new poll with the specified options.
Type: function
State Mutability: payable
Inputs:
- _startDate (uint256)
- _endDate (uint256)
- _voteCost (uint256)
- _maxEntries (uint256)
- _allowManyVotes (bool)
- _title (string)
- _description (string)
- _options (string[])
addPollOptions
Description: Add new options to an existing poll.
Type: function
State Mutability: nonpayable
Inputs:
- _pollId (uint256)
- _names (string[])
setPollAllowList
Description: Set the allow list for a poll to restrict voting to specific addresses. This replaces the existing allow list.
Type: function
State Mutability: nonpayable
Inputs:
- _pollId (uint256)
- _allowList (address[])
addToPollAllowList
Description: Add addresses to the allow list for a poll.
Type: function
State Mutability: nonpayable
Inputs:
- _pollId (uint256)
- _address (address)
removeFromPollAllowList
Description: Remove addresses from the allow list for a poll.
Type: function
State Mutability: nonpayable
Inputs:
- _pollId (uint256)
- _address (address)
vote
Description: Vote for an option in a poll.
Type: function
State Mutability: payable
Inputs:
- _pollId (uint256)
- _optionId (uint256)
upvoteContract
Description: Upvote a contract.
Type: function
State Mutability: payable
Inputs:
- _contractAddress (address)
downvoteContract
Description: Downvote a contract.
Type: function
State Mutability: payable
Inputs:
- _contractAddress (address)
upvoteAsset
Description: Upvote a contract asset.
Type: function
State Mutability: payable
Inputs:
- _contractAddress (address)
- _tokenId (string)
downvoteAsset
Description: Downvote a contract asset.
Type: function
State Mutability: payable
Inputs:
- _contractAddress (address)
- _tokenId (string)
withdrawPollFunds
Description: Withdraw funds from a poll. Only the manager of the poll can withdraw funds.
Type: function
State Mutability: nonpayable
Inputs:
- _pollId (uint256)
getPoll
Description: Get a poll by id.
Type: function
State Mutability: view
Inputs:
- _pollId (uint256)
Outputs:
- tuple
getManagersActivePolls
Description: Get the active polls managed by an address.
Type: function
State Mutability: view
Inputs:
- _manager (address)
Outputs:
- tuple[]
getManagersEndedPolls
Description: Get the ended polls managed by an address.
Type: function
State Mutability: view
Inputs:
- _manager (address)
Outputs:
- tuple[]
getContractVotes
Description: Get the votes for a contract.
Type: function
State Mutability: view
Inputs:
- _contractAddress (address)
Outputs:
- tuple
getAssetVotes
Description: Get the votes for a contract asset.
Type: function
State Mutability: view
Inputs:
- _contractAddress (address)
- _tokenId (string)
Outputs:
- tuple