Skip to main content

GroupBase

View Source: contracts/protocol/bases/GroupBase.sol

↗ Extends: ProtocolBase, IBosonGroupEvents ↘ Derived Contracts: GroupHandlerFacet, OrchestrationHandlerFacet

GroupBase

Provides methods for group creation that can be shared across facets

Functions

createGroupInternal

Creates a group.
Emits a GroupCreated event if successful.
Reverts if:
- Caller is not an operator
- Any of offers belongs to different seller
- Any of offers does not exist
- Offer exists in a different group
- Number of offers exceeds maximum allowed number per group

function createGroupInternal(struct BosonTypes.Group _group,
struct BosonTypes.Condition _condition)
internal

Arguments

NameTypeDescription
_groupBosonTypes.Groupthe fully populated struct with group id set to 0x0
_conditionBosonTypes.Conditionthe fully populated condition struct

storeCondition

Store a condition struct associated with a given group id.

function storeCondition(uint256 _groupId,
struct BosonTypes.Condition _condition)
internal

Arguments

NameTypeDescription
_groupIduint256the group id
_conditionBosonTypes.Conditionthe condition

validateCondition

Validates that condition parameters make sense.
Reverts if:
- EvaluationMethod.None and has fields different from 0
- EvaluationMethod.Threshold and token address or maxCommits is zero
- EvaluationMethod.SpecificToken and token address or maxCommits is zero

function validateCondition(struct BosonTypes.Condition _condition) 
internal
pure
returns(bool valid)

Arguments

NameTypeDescription
_conditionBosonTypes.Conditionfully populated condition struct

Returns

NameTypeDescription
validboolvalidity of condition

addOffersToGroupInternal

Adds offers to an existing group.
Emits a GroupUpdated event if successful.
Reverts if:
- Caller is not the seller
- Offer ids param is an empty list
- Current number of offers plus number of offers added exceeds maximum allowed number per group
- Group does not exist
- Any of offers belongs to different seller
- Any of offers does not exist
- Offer exists in a different group
- Offer ids param contains duplicated offers

function addOffersToGroupInternal(uint256 _groupId,
uint256[] _offerIds)
internal

Arguments

NameTypeDescription
_groupIduint256the id of the group to be updated
_offerIdsuint256[]array of offer ids to be added to the group

preUpdateChecks

Checks that update can be done before performing an update
and returns seller id and group storage pointer for further use.
Reverts if:
- Caller is not the seller
- Offer ids param is an empty list
- Number of offers exceeds maximum allowed number per group
- Group does not exist

function preUpdateChecks(uint256 _groupId,
uint256[] _offerIds)
internal
view
returns(uint256 sellerId, Group storage group)

Arguments

NameTypeDescription
_groupIduint256the id of the group to be updated
_offerIdsuint256[]array of offer ids to be added to or removed from the group

Returns

NameTypeDescription
sellerIduint256the seller id
groupBosonTypes.Groupthe group details