Fraction ProtocolgenericFacetspriceFacetsdynamicSignedPriceFacets

DynamicSignedPriceFacetStorage

DynamicSignedPriceFacetStorage

No nonce is used as the same signature can be used for many users calls. The price is considered stable within some time windows (until expiration timestamp).

InvalidPriceZero

error InvalidPriceZero()

Thrown when attempting to set price as zero.

InvalidZeroAddressSigner

error InvalidZeroAddressSigner()

Thrown when attempting to set signer as the zero address.

InvalidSignature

error InvalidSignature()

Thrown when attempting to pass invalid signature.

MessageExpired

error MessageExpired()

Thrown when attempting to pass an expired message.

STORAGE_SLOT

bytes32 STORAGE_SLOT

================================================== STORAGE =================================================

Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula. STORAGE_SLOT: TO-DO

Layout

struct Layout {
  mapping(uint256 => struct DynamicSignedPriceFacetStorage.CampaignInfo) campaignsInfo;
}

CampaignInfo

struct CampaignInfo {
  uint256 initialPrice;
  address signer;
  uint256 lastPriceUsed;
}

layout

function layout() internal pure returns (struct DynamicSignedPriceFacetStorage.Layout l)

Retrieves a reference to the Layout struct stored at a specified storage slot

setAndCheckPriceFacet

function setAndCheckPriceFacet(struct DynamicSignedPriceFacetStorage.Layout l, bytes postFractionPriceData) internal returns (uint256, uint256)

Sets the price of a fraction, in terms of input packets, for a campaign.

Parameters

NameTypeDescription
lstruct DynamicSignedPriceFacetStorage.LayoutA reference to the Layout struct in storage.
postFractionPriceDatabytesThe ABI-encoded data containing the following: - initialPrice: The price (in terms of input packets) required to purchase a single fraction initially. - signer: The party that is the signer of the price messages.

getPurchasePrice

function getPurchasePrice(struct DynamicSignedPriceFacetStorage.Layout l, uint256 campaignId, bytes extraData) internal returns (uint256)

getCurrentPrice

function getCurrentPrice(struct DynamicSignedPriceFacetStorage.Layout l, uint256 campaignId) internal view returns (uint256)

On this page