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

Adding Bounties

Distribution and refunds are not yet triggered on-chain. Balances are tracked but cannot be claimed.

addBounty()

function addBounty(
    uint256 _initiativeId,
    address _token,
    uint256 _amount,
    uint256 _expiresAt,
    Conditions _terms
) external
ParameterTypeDescription
_initiativeIduint256Initiative to attach bounty to
_tokenaddressERC20 token (must be whitelisted in TokenRegistry)
_amountuint256Tokens to contribute. Requires prior approval on Bounties contract.
_expiresAtuint256Expiration timestamp. 0 = never expires.
_termsConditionsDistribution conditions (stored, not enforced yet)

Tokens are transferred immediately on call.

Distribution formula

protocolAmount = (totalAmount * protocolAllocation) / 100
voterAmount    = (totalAmount * voterAllocation) / 100
treasuryAmount = (totalAmount * treasuryAllocation) / 100
 
// Per supporter
supporterShare = (lockedAmount / totalLocked) * voterAmount

Allocations are configured via updateSplits() and must sum to 100. Versioned to prevent retroactive changes.

Data structures

struct Bounty {
    uint256 initiativeId;
    IERC20 token;
    uint256 amount;
    uint256 paid;
    uint256 refunded;
    uint256 expiresAt;
    address contributor;
    Conditions terms;
}

Query functions

// Aggregated bounties by token, excluding expired
function getBounties(uint256 _initiativeId) external view
    returns (address[] memory tokens, uint256[] memory amounts, uint256 expiredCount)
 
// Returns 0 (not implemented)
function previewRewards(uint256 _initiativeId, uint256 _tokenId) external view returns (uint256)

Events

event BountyAdded(uint256 indexed bountyId, uint256 indexed initiativeId, address indexed token, uint256 amount, uint256 expiresAt, Conditions terms)
event BountiesUpdated(uint256 version)

Errors

ErrorCondition
Bounties_TokenNotRegisteredToken not in whitelist
Bounties_InvalidInitiativeInitiative doesn't exist
Bounties_InsufficientBalanceInsufficient token balance
Bounties_InsufficientAllowanceBounties contract not approved
Bounties_InvalidAllocationSplits don't sum to 100
Bounties_NotAuthorizedCaller not authorized