Documentation Index
Fetch the complete documentation index at: https://docs.cultura.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Solidity API
ExceedsMaxVotePerUser
error ExceedsMaxVotePerUser()
Custom errors for the POP contract
InsufficientVotedAmount
error InsufficientVotedAmount()
TokensStillLocked
error TokensStillLocked()
NoTokensToWithdraw
error NoTokensToWithdraw()
InvalidAddress
Contract: POP
voteOnAttestation
function voteOnAttestationfunction voteOnAttestation(bytes32 attestationUID, uint256 amount) external
Allows users to vote on an attestation to increase its popularity
Parameters
| Name | Description |
|---|
attestationUID | The unique identifier of the attestation |
amount | The amount of tokens to vote with |
requestVoteWithdrawal
function requestVoteWithdrawalfunction requestVoteWithdrawal(bytes32 attestationUID, uint256 amount) external
Allows users to request withdrawal of their votes
Parameters
| Name | Description |
|---|
attestationUID | The unique identifier of the attestation |
amount | The amount of tokens to withdraw |
withdrawVotes
function withdrawVotesfunction withdrawVotes(bytes32 attestationUID) external
Allows users to withdraw their tokens after timelock period
Parameters
| Name | Description |
|---|
attestationUID | The unique identifier of the attestation |
getPopularityScore
function getPopularityScorefunction getPopularityScore(bytes32 attestationUID) external view returns (uint256)
Returns the popularity score of an attestation
Parameters
| Name | Description |
|---|
attestationUID | The unique identifier of the attestation |
Return Values
| Description |
|---|
| The popularity score |
getUserVotedAmount
function getUserVotedAmountfunction getUserVotedAmount(bytes32 attestationUID, address user) external view returns (uint256)
Returns the amount of tokens voted by a user for an attestation
Parameters
| Name | Description |
|---|
attestationUID | The unique identifier of the attestation |
user | The address of the user |
Return Values
| Description |
|---|
| The amount of tokens voted |
getTotalVotedAmount
function getTotalVotedAmountfunction getTotalVotedAmount(bytes32 attestationUID) external view returns (uint256)
Returns the total amount of tokens voted for an attestation
Parameters
| Name | Description |
|---|
attestationUID | The unique identifier of the attestation |
Return Values
| Description |
|---|
| The total amount of tokens voted |
getUnlockTime
function getUnlockTimefunction getUnlockTime(bytes32 attestationUID, address user) external view returns (uint256)
Returns the unlock time for a user’s voted tokens
Parameters
| Name | Description |
|---|
attestationUID | The unique identifier of the attestation |
user | The address of the user |
Return Values
| Description |
|---|
| The unlock time as a Unix timestamp |
setMaxVotePerUser
function setMaxVotePerUserfunction setMaxVotePerUser(uint256 _maxVotePerUser) external
Updates the maximum vote per user
Parameters
| Name | Description |
|---|
_maxVotePerUser | The new maximum vote per user |
Dev: Only callable by the contract owner
setCASAddress
function setCASAddressfunction setCASAddress(address _casAddress) external
Updates the CAS contract address
Parameters
| Name | Description |
|---|
_casAddress | The new CAS contract address |
Dev: Only callable by the contract owner
getTopAttestations
function getTopAttestationsfunction getTopAttestations(uint256 count) external view returns (bytes32[])
Get top N most popular attestations
Parameters
| Name | Description |
|---|
count | The number of attestations to return |
Return Values
| Description |
|---|
| An array of attestation UIDs sorted by popularity |
getTopAttestationsWithScores
function getTopAttestationsWithScoresfunction getTopAttestationsWithScores() external view returns (bytes32[3] attestations, uint256[3] scores)
Get the top 3 attestations and their scores
Return Values
| Description |
|---|
| Array of the top 3 attestation UIDs |
| Array of the scores for the top 3 attestations |
withdrawVoteToken
function withdrawVoteTokenfunction withdrawVoteToken(uint256 amount) external
Withdraws specified amount of vote tokens from the contract
Parameters
| Name | Description |
|---|
amount | The amount of vote tokens to withdraw |
Dev: Only callable by the contract owner
Public Functions
constructor
function constructorconstructor() public
initialize
function initializefunction initialize(address initialOwner, address voteToken, address _casAddress, uint256 _maxVotePerUser) public
Initializes the POP contract with required parameters
Parameters
| Name | Description |
|---|
initialOwner | The address that will own the contract |
voteToken | The address of the ERC20 token used for voting (same as CAS bond token) |
_casAddress | The address of the CAS contract |
_maxVotePerUser | Maximum vote amount per user per attestation |
Events
TokensVoted
event TokensVotedevent TokensVoted(bytes32 attestationUID, address user, uint256 amount)
WithdrawalRequested
event WithdrawalRequestedevent WithdrawalRequested(bytes32 attestationUID, address user, uint256 amount, uint256 unlockTime)
TokensWithdrawn
event TokensWithdrawnevent TokensWithdrawn(bytes32 attestationUID, address user, uint256 amount)
TopAttestationsUpdated
event TopAttestationsUpdatedevent TopAttestationsUpdated(bytes32[3] topAttestations, uint256[3] topScores)