LM_PC_Bounties_v1.sol
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.
bytes32 public constant VERIFIER_ROLE = "VERIFIER";
_nextId
Value for what the next id will be.
uint private _nextId;
_bountyRegistry
Registry mapping ids to Bounty structs id => Bounty.
mapping(uint => Bounty) private _bountyRegistry;
_bountyList
List of Bounty id's.
LinkedIdList.List _bountyList;
_claimRegistry
Registry mapping ids to Claim struct id => Claim.
mapping(uint => Claim) private _claimRegistry;
_claimList
List of Claim id's.
LinkedIdList.List _claimList;
contributorAddressToClaimIds
Connects contributor addresses to claim Ids contributor address => claim ids.
mapping(address => EnumerableSet.UintSet) contributorAddressToClaimIds;
__gap
Storage gap for future upgrades.
uint[50] private __gap;
Modifiers
supportsInterface
See {IERC165-supportsInterface}.
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC20PaymentClientBase_v1)
returns (bool);
onlyClaimContributor
Checks if the sender is a contributor of the given claimId.
modifier onlyClaimContributor(uint claimId);
Parameters
claimId
uint256
The id of the claim to check.
validPayoutAmounts
Checks if the payout amounts are valid.
modifier validPayoutAmounts(uint minimumPayoutAmount, uint maximumPayoutAmount);
Parameters
minimumPayoutAmount
uint256
The minimum payout amount.
maximumPayoutAmount
uint256
The maximum payout amount.
validArrayLengths
Checks if the array lengths are valid
modifier validArrayLengths(
uint minimumPayoutAmountLength,
uint maximumPayoutAmountLength,
uint detailArrayLength
);
Parameters
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.
modifier validBountyId(uint bountyId);
Parameters
bountyId
uint256
The id of the bounty to check.
validClaimId
Checks if the claimId is valid.
modifier validClaimId(uint claimId);
Parameters
claimId
uint256
The id of the claim to check.
notLocked
Checks if the bounty is not locked.
modifier notLocked(uint bountyId);
Parameters
bountyId
uint256
The id of the bounty to check.
notClaimed
Checks if the claim is not claimed.
modifier notClaimed(uint claimId);
Parameters
claimId
uint256
The id of the claim to check.
_contributorsNotChanged
Checks if the contributors have not changed.
function _contributorsNotChanged(
uint claimId,
Contributor[] memory contributors
) internal view;
Parameters
claimId
uint256
The id of the claim to check.
contributors
Contributor[]
The new contributors to check.
Public Functions
init
function init(
IOrchestrator_v1 orchestrator_,
Metadata memory metadata,
bytes memory
) external override(Module_v1) initializer;
getBountyInformation
Returns the Bounty instance with id id
.
function getBountyInformation(uint bountyId)
external
view
validBountyId(bountyId)
returns (Bounty memory);
Parameters
bountyId
uint256
The id of the Bounty to return.
Returns
<none>
Bounty
Bounty with id id
.
listBountyIds
Returns total list of Bounty ids.
List is in ascending order.
function listBountyIds() external view returns (uint[] memory);
Returns
<none>
uint256[]
List of Bounty ids.
isExistingBountyId
Returns whether Bounty with id id
exists.
function isExistingBountyId(uint bountyId) public view returns (bool);
Parameters
bountyId
uint256
The id of the Bounty to test.
Returns
<none>
bool
True if Claim with id id
exists, false otherwise.
getClaimInformation
Returns the Claim instance with id id
.
function getClaimInformation(uint claimId)
external
view
validClaimId(claimId)
returns (Claim memory);
Parameters
claimId
uint256
The id of the Claim to return.
Returns
<none>
Claim
Claim with id id
.
listClaimIds
Returns total list of Claim ids.
List is in ascending order.
function listClaimIds() external view returns (uint[] memory);
Returns
<none>
uint256[]
List of Claim ids.
isExistingClaimId
Returns whether Claim with id id
exists.
function isExistingClaimId(uint claimId) public view returns (bool);
Parameters
claimId
uint256
The id of the Bounty to test.
Returns
<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.
function listClaimIdsForContributorAddress(address contributorAddrs)
external
view
returns (uint[] memory);
Parameters
contributorAddrs
address
claim ids are filtered by the contributor address.
Returns
<none>
uint256[]
List of Claim ids.
addBounty
Adds a new Bounty.
Reverts if an argument invalid.
function addBounty(
uint minimumPayoutAmount,
uint maximumPayoutAmount,
bytes calldata details
)
external
onlyModuleRole(BOUNTY_ISSUER_ROLE)
validPayoutAmounts(minimumPayoutAmount, maximumPayoutAmount)
returns (uint id);
Parameters
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
id
uint256
The newly added Bounty id.
addBountyBatch
Adds a new array of Bounties.
Reverts if an argument invalid.
function addBountyBatch(
uint[] calldata minimumPayoutAmounts,
uint[] calldata maximumPayoutAmounts,
bytes[] calldata detailArray
)
external
onlyModuleRole(BOUNTY_ISSUER_ROLE)
validArrayLengths(
minimumPayoutAmounts.length,
maximumPayoutAmounts.length,
detailArray.length
)
returns (uint[] memory ids);
Parameters
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
ids
uint256[]
The newly added array of Bounty ids.
updateBounty
Updates a Bounty's informations.
Reverts if an argument invalid.
function updateBounty(uint bountyId, bytes calldata details)
external
onlyModuleRole(BOUNTY_ISSUER_ROLE)
validBountyId(bountyId)
notLocked(bountyId);
Parameters
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.
function lockBounty(uint bountyId)
external
onlyModuleRole(BOUNTY_ISSUER_ROLE)
validBountyId(bountyId)
notLocked(bountyId);
Parameters
bountyId
uint256
The id of the Bounty that will be locked.
addClaim
Adds a new Claim.
Reverts if an argument invalid.
function addClaim(
uint bountyId,
Contributor[] calldata contributors,
bytes calldata details
)
external
onlyModuleRole(CLAIMANT_ROLE)
validBountyId(bountyId)
notLocked(bountyId)
returns (uint id);
Parameters
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
id
uint256
The newly added Claim's id.
updateClaimContributors
Updates a Claim's contributor informations.
Reverts if an argument invalid.
function updateClaimContributors(
uint claimId,
Contributor[] calldata contributors
)
external
validClaimId(claimId)
notClaimed(claimId)
notLocked(_claimRegistry[claimId].bountyId)
onlyModuleRole(CLAIMANT_ROLE);
Parameters
claimId
uint256
The id of the Claim that will be updated.
contributors
Contributor[]
The contributor information for the Claim.
updateClaimDetails
Updates a Claim Details.
function updateClaimDetails(uint claimId, bytes calldata details)
external
validClaimId(claimId)
notClaimed(claimId)
notLocked(_claimRegistry[claimId].bountyId)
onlyClaimContributor(claimId);
Parameters
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.
function verifyClaim(uint claimId, Contributor[] calldata contributors)
external
onlyModuleRole(VERIFIER_ROLE)
validClaimId(claimId)
notClaimed(claimId)
notLocked(_claimRegistry[claimId].bountyId);
Parameters
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
function _validPayoutAmounts(uint minimumPayoutAmount, uint maximumPayoutAmount)
internal
pure;
Parameters
minimumPayoutAmount
uint256
The minimum payout amount
maximumPayoutAmount
uint256
The maximum payout amount
_validContributorsForBounty
Checks if the contributors are valid for the given bounty.
function _validContributorsForBounty(
Contributor[] memory contributors,
Bounty memory bounty
) internal view;
Parameters
contributors
Contributor[]
The contributors to check.
bounty
Bounty
The bounty to check.
_addBounty
Internal function to add a bounty
function _addBounty(
uint minimumPayoutAmount,
uint maximumPayoutAmount,
bytes calldata details
) internal returns (uint bountyId);
Parameters
minimumPayoutAmount
uint256
The minimum payout amount
maximumPayoutAmount
uint256
The maximum payout amount
details
bytes
The details of the bounty
Returns
bountyId
uint256
The id of the bounty
Last updated