Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Supporting Initiatives

supportInitiative()

function supportInitiative(
    uint256 initiativeId,
    uint256 amount,
    uint256 lockDuration
) external returns (uint256 tokenId)
ParameterTypeDescription
initiativeIduint256Initiative to support. Must be in Proposed state.
amountuint256Tokens to lock (wei). Requires prior ERC20 approval.
lockDurationuint256Lock duration in intervals. Must be ≤ maxLockIntervals

Returns: tokenId (ERC721 lock NFT).

Data structures

struct TokenLock {
    uint256 initiativeId;
    address supporter;
    uint256 tokenAmount;
    uint256 lockDuration;
    uint256 created;
    bool withdrawn;
}

Events

event InitiativeSupported(uint256 indexed initiativeId, address indexed supporter, uint256 tokenAmount, uint256 lockDuration, uint256 tokenId)

Errors

ErrorCondition
Signals_IncorrectBoardStateBoard not open
Signals_InvalidIDInitiative doesn't exist
Signals_IncorrectInitiativeStateInitiative not in Proposed state
Signals_InvalidArgumentsDuration is 0 or > maxLockIntervals
Signals_InsufficientTokensBalance < minBalance
Signals_InsufficientLockAmountAmount < minLockAmount
Signals_InsufficientTokenDurationHistorical balance < minBalance
Signals_TokenHasNoCheckpointSupportToken doesn't implement IVotes
Signals_TokenTransferFailedERC20 transfer reverted