Javascript is required

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

Ethereum
0x00000ED5a4B586a67F405eEf1Cb2D0cB9368B506
Blast
0x00000d4Ce915f65F2F47B73a0C9032b2EF5A38A6
Base
0x00000ED5a4B586a67F405eEf1Cb2D0cB9368B506
Arbitrum
0x00000ED5a4B586a67F405eEf1Cb2D0cB9368B506

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

⚠️ To preserve the integrity of the poll, you cannot change these options after the poll is created.

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

⚠️ To preserve the integrity of the poll, you cannot delete an option after you have added it. You can only add new options.

Description: Add new options to an existing poll.

Type: function

State Mutability: nonpayable

Inputs:

  • _pollId (uint256)
  • _names (string[])

setPollAllowList

⚠️ To preserve the integrity of the poll, you cannot change the allow list after the poll has started.

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

⚠️ To preserve the integrity of the poll, you cannot change the allow list after the poll has started.

Description: Add addresses to the allow list for a poll.

Type: function

State Mutability: nonpayable

Inputs:

  • _pollId (uint256)
  • _address (address)

removeFromPollAllowList

⚠️ To preserve the integrity of the poll, you cannot change the allow list after the poll has started.

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

⚠️ The poll must be ended before you can withdraw funds.

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