LM_PC_Bounties_v1.sol

Git Source

Inherits: ILM_PC_Bounties_v1, ERC20PaymentClientBase_v1

Author: Inverter Network

Provides functionality to manage bounties and process claims, allowing participants to propose, update, and claim bounties securely and transparently.

Extends {ERC20PaymentClientBase_v1} to integrate payment processing with bounty management, supporting dynamic additions, updates, and the locking of bounties. Utilizes roles for managing permissions and maintaining robust control over bounty operations.

State Variables

_SENTINEL

Marks the beginning of the list.

uint internal constant _SENTINEL = type(uint).max;

BOUNTY_ISSUER_ROLE

Role for the bounty issuer.

bytes32 public constant BOUNTY_ISSUER_ROLE = "BOUNTY_ISSUER";

CLAIMANT_ROLE

Role for the claimant.

bytes32 public constant CLAIMANT_ROLE = "CLAIMANT";

VERIFIER_ROLE

Role for the verifier.

_nextId

Value for what the next id will be.

_bountyRegistry

Registry mapping ids to Bounty structs id => Bounty.

_bountyList

List of Bounty id's.

_claimRegistry

Registry mapping ids to Claim struct id => Claim.

_claimList

List of Claim id's.

contributorAddressToClaimIds

Connects contributor addresses to claim Ids contributor address => claim ids.

__gap

Storage gap for future upgrades.

Modifiers

supportsInterface

See {IERC165-supportsInterface}.

onlyClaimContributor

Checks if the sender is a contributor of the given claimId.

Parameters

Name
Type
Description

claimId

uint256

The id of the claim to check.

validPayoutAmounts

Checks if the payout amounts are valid.

Parameters

Name
Type
Description

minimumPayoutAmount

uint256

The minimum payout amount.

maximumPayoutAmount

uint256

The maximum payout amount.

validArrayLengths

Checks if the array lengths are valid

Parameters

Name
Type
Description

minimumPayoutAmountLength

uint256

The minimum payout amount length

maximumPayoutAmountLength

uint256

The maximum payout amount length

detailArrayLength

uint256

The detail array length

validBountyId

Checks if the bountyId is valid.

Parameters

Name
Type
Description

bountyId

uint256

The id of the bounty to check.

validClaimId

Checks if the claimId is valid.

Parameters

Name
Type
Description

claimId

uint256

The id of the claim to check.

notLocked

Checks if the bounty is not locked.

Parameters

Name
Type
Description

bountyId

uint256

The id of the bounty to check.

notClaimed

Checks if the claim is not claimed.

Parameters

Name
Type
Description

claimId

uint256

The id of the claim to check.

_contributorsNotChanged

Checks if the contributors have not changed.

Parameters

Name
Type
Description

claimId

uint256

The id of the claim to check.

contributors

Contributor[]

The new contributors to check.

Public Functions

init

getBountyInformation

Returns the Bounty instance with id id.

Parameters

Name
Type
Description

bountyId

uint256

The id of the Bounty to return.

Returns

Name
Type
Description

<none>

Bounty

Bounty with id id.

listBountyIds

Returns total list of Bounty ids.

List is in ascending order.

Returns

Name
Type
Description

<none>

uint256[]

List of Bounty ids.

isExistingBountyId

Returns whether Bounty with id id exists.

Parameters

Name
Type
Description

bountyId

uint256

The id of the Bounty to test.

Returns

Name
Type
Description

<none>

bool

True if Claim with id id exists, false otherwise.

getClaimInformation

Returns the Claim instance with id id.

Parameters

Name
Type
Description

claimId

uint256

The id of the Claim to return.

Returns

Name
Type
Description

<none>

Claim

Claim with id id.

listClaimIds

Returns total list of Claim ids.

List is in ascending order.

Returns

Name
Type
Description

<none>

uint256[]

List of Claim ids.

isExistingClaimId

Returns whether Claim with id id exists.

Parameters

Name
Type
Description

claimId

uint256

The id of the Bounty to test.

Returns

Name
Type
Description

<none>

bool

True if Claim with id id exists, false otherwise.

listClaimIdsForContributorAddress

Returns a list of Claim ids in which contributor Address is used.

List is in ascending order.

Parameters

Name
Type
Description

contributorAddrs

address

claim ids are filtered by the contributor address.

Returns

Name
Type
Description

<none>

uint256[]

List of Claim ids.

addBounty

Adds a new Bounty.

Reverts if an argument invalid.

Parameters

Name
Type
Description

minimumPayoutAmount

uint256

The minimum amount of tokens the Bounty will pay out upon being claimed.

maximumPayoutAmount

uint256

The maximum amount of tokens the Bounty will pay out upon being claimed.

details

bytes

The Bounty's details.

Returns

Name
Type
Description

id

uint256

The newly added Bounty id.

addBountyBatch

Adds a new array of Bounties.

Reverts if an argument invalid.

Parameters

Name
Type
Description

minimumPayoutAmounts

uint256[]

The array of minimum amount of tokens the Bounty will pay out upon being claimed

maximumPayoutAmounts

uint256[]

The array of maximum amount of tokens the Bounty will pay out upon being claimed

detailArray

bytes[]

The array of Bounty's details.

Returns

Name
Type
Description

ids

uint256[]

The newly added array of Bounty ids.

updateBounty

Updates a Bounty's informations.

Reverts if an argument invalid.

Parameters

Name
Type
Description

bountyId

uint256

The id of the Bounty that will be updated.

details

bytes

The Bounty's details.

lockBounty

Locks the Bounty so it cant be claimed.

Only callable by authorized addresses.

Parameters

Name
Type
Description

bountyId

uint256

The id of the Bounty that will be locked.

addClaim

Adds a new Claim.

Reverts if an argument invalid.

Parameters

Name
Type
Description

bountyId

uint256

The id of the bounty this claim belongs to.

contributors

Contributor[]

The contributor information for the Claim.

details

bytes

The Claim's details.

Returns

Name
Type
Description

id

uint256

The newly added Claim's id.

updateClaimContributors

Updates a Claim's contributor informations.

Reverts if an argument invalid.

Parameters

Name
Type
Description

claimId

uint256

The id of the Claim that will be updated.

contributors

Contributor[]

The contributor information for the Claim.

updateClaimDetails

Updates a Claim Details.

Parameters

Name
Type
Description

claimId

uint256

The id of the Claim that will be updated.

details

bytes

The Claim's details.

verifyClaim

Completes a Bounty by verifying a claim.

Only callable by authorized addresses.

Parameters

Name
Type
Description

claimId

uint256

The id of the Claim that wants to claim the Bounty.

contributors

Contributor[]

The contributor information for the Claim.

Internal Functions

_validPayoutAmounts

Internal function to check if the payout amounts are valid

Parameters

Name
Type
Description

minimumPayoutAmount

uint256

The minimum payout amount

maximumPayoutAmount

uint256

The maximum payout amount

_validContributorsForBounty

Checks if the contributors are valid for the given bounty.

Parameters

Name
Type
Description

contributors

Contributor[]

The contributors to check.

bounty

Bounty

The bounty to check.

_addBounty

Internal function to add a bounty

Parameters

Name
Type
Description

minimumPayoutAmount

uint256

The minimum payout amount

maximumPayoutAmount

uint256

The maximum payout amount

details

bytes

The details of the bounty

Returns

Name
Type
Description

bountyId

uint256

The id of the bounty

Last updated