TwoCapPurchaseAmountFacetStorage
TwoCapPurchaseAmountFacetStorage
AlreadyInitialized
Thrown when attempting to re-initialize.
InvalidZeroMaxHardcap
Thrown at initialization when attempting to pass max hardcap as 0.
InvalidInputAmounts
Thrown when attempting to pass invalid input amounts for softcap and hardcap.
HardcapExceedsMaxHardcap
Thrown when attempting to pass hardcap that exceeds max hardcap.
HardcapPerAccountExceedsHardcap
Thrown when attempting to pass hardcap per account that exceeds hardcap.
SoftcapPerAccountExceedsSoftcap
Thrown when attempting to pass softcap per account that exceeds softcap.
SoftcapPerAccountExceedsHardcapPerAccount
notice Thrown when attempting to pass softcap per account that exceeds hardcap per account.
InvalidZeroAmountOfFractionsToPurchase
Thrown when attempting to purchase 0 amount of fractions.
InvalidOverHardcapPurchase
Thrown when attempting to purchase more fractions than available.
InvalidOverAccountHardcapPurchase
Thrown when attempting to purchase more fractions than account hardcap allows.
InvalidUnderAccountSoftcapPurchase
Thrown when attempting to purchase less fractions than account softcap allows.
STORAGE_SLOT
================================================== STORAGE =================================================
Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula. STORAGE_SLOT: 0x80289af729f64dfcd230ded31d365fe80f029d0b25b8ca23db30fd92fc014800
Layout
layout
Retrieves a reference to the Layout struct stored at a specified storage slot
initPurchaseAmountFacet
setAndCheckPurchaseAmounts
Sets the amount-based fraction caps (both campaign-wide and per-account) for a campaign's purchase phase.
_To disable a campaign's:
softCap
: Set its value to1
(1 fraction purchased guarantees a successful campaign).hardCap
: Set its value totype(uint256).max
.softCapPerAccount
: Set its value to1
.hardCapPerAccount
: Set its value tohardCap
._
Parameters
Name | Type | Description |
---|---|---|
l | struct TwoCapPurchaseAmountFacetStorage.Layout | A reference to the Layout struct in storage. |
postFractionsAmountData | bytes | ABI-encoded data containing the following (uint256 values): - softCap : The minimum amount of fractions that must be collectively purchased for the campaign to succeed. - hardCap : The maximum amount of fractions that can be collectively purchased in the campaign. - softCapPerAccount : The minumum amount of fractions that any account can purchase in the campaign (minimum participation) - hardCapPerAccount : The maximum amount of fractions that any account can purchase in the campaign (maximum participation). |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | campaignId The ID of the targeted campaign. |
[1] | uint256 | softCap The softCap set. |
[2] | uint256 | hardCap The hardCap set. |
[3] | uint256 | softCapPerAccount The softCapPerAccount set. |
[4] | uint256 | hardCapPerAccount The hardCapPerAccount set. |
checkPurchaseAmounts
Sets the fractions purchased by account for a campaign.
Parameters
Name | Type | Description |
---|---|---|
l | struct TwoCapPurchaseAmountFacetStorage.Layout | A reference to the Layout struct in storage. |
campaignId | uint256 | The ID of the targeted campaign. |
amountOfFractions | uint256 | The amount of fractions to purchase. |
account | address | The account to purchase the fractions from. |
isTotalAmountValid
Checks if the total amount of fractions purchased is valid.
Parameters
Name | Type | Description |
---|---|---|
l | struct TwoCapPurchaseAmountFacetStorage.Layout | A reference to the Layout struct in storage. |
campaignId | uint256 | The ID of the targeted campaign. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool True if the total amount of fractions purchased is valid, false otherwise. |
getTotalFractionsPurchased
Gets the total amount of fractions purchased for a campaign.
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The ID of the targeted campaign. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The total amount of fractions purchased for the campaign. |
setMaxHardCap
Sets the max hardcap for a campaign.
Parameters
Name | Type | Description |
---|---|---|
l | struct TwoCapPurchaseAmountFacetStorage.Layout | A reference to the Layout struct in storage. |
maxHardCap | uint256 | The max hardcap to set. |