CFABasePCOFacet
Documentation for the CFABasePCOFacet contract.
The
CFABasePCOFacet
implements the functions required for the current licensor of a parcel to manage their For Sale Price,
corresponding network fee stream, and required buffer deposit according to the PCO market and Superfluid requirements.Handles basic PCO functionality using Constant Flow Agreement (CFA)
event PayerContributionRateUpdated(address _payer, int96 contributionRate)
Emitted when an owner bid is updated
function initializeBid(contract ICFABeneficiary beneficiary, contract IPCOLicenseParamsStore paramsStore, contract IERC721 initLicense, uint256 initLicenseId, address bidder, int96 newContributionRate, uint256 newForSalePrice) external
Initialize bid. - Must be the contract owner - Must have payment token buffer deposited - Must have permissions to create flow for bidder
Parameters
Name | Type | Description |
---|---|---|
beneficiary | contract ICFABeneficiary | |
paramsStore | contract IPCOLicenseParamsStore | Global store for parameters |
initLicense | contract IERC721 | Underlying ERC721 license |
initLicenseId | uint256 | Token ID of license |
bidder | address | Initial bidder |
newContributionRate | int96 | New contribution rate for bid |
newForSalePrice | uint256 | Intented new for sale price. Must be within rounding bounds of newContributionRate |
function payer() external view returns (address)
Current payer of license
function contributionRate() external view returns (int96)
Current contribution rate of payer
function forSalePrice() external view returns (uint256)
Current price needed to purchase license
function licenseId() external view returns (uint256)
License Id
function license() external view returns (contract IERC721)
License
function isPayerBidActive() external view returns (bool)
Is current bid actively being paid
function currentBid() external pure returns (struct LibCFABasePCO.Bid)
Get current bid
bytes32 STORAGE_POSITION
bytes32 STORAGE_POSITION_CUR_BID
bytes32 STORAGE_POSITION_CFA
struct Bid {
uint256 timestamp;
address bidder;
int96 contributionRate;
uint256 perSecondFeeNumerator;
uint256 perSecondFeeDenominator;
uint256 forSalePrice;
}
struct DiamondStorage {
contract IPCOLicenseParamsStore paramsStore;
contract IERC721 license;
uint256 licenseId;
contract ICFABeneficiary beneficiary;
}
struct DiamondCFAStorage {
struct CFAv1Library.InitData cfaV1;
}
event PayerContributionRateUpdated(address _payer, int96 contributionRate)
Emitted when an owner bid is updated
event PayerForSalePriceUpdated(address _payer, uint256 forSalePrice)
Emitted when for sale price is updated
function diamondStorage() internal pure returns (struct LibCFABasePCO.DiamondStorage ds)
function _currentBid() internal pure returns (struct LibCFABasePCO.Bid bid)
Store currentBid in separate position so struct is upgradeable
function cfaStorage() internal pure returns (struct LibCFABasePCO.DiamondCFAStorage ds)
Store cfa in separate position so struct is upgradeable
function _getBeneficiary() internal view returns (address)
Get beneficiary or default if not set
function _checkForSalePrice(uint256 forSalePrice, int96 contributionRate, uint256 _perSecondFeeNumerator, uint256 _perSecondFeeDenominator) internal pure returns (bool)
function _contributionRate() internal view returns (int96)
function _isPayerBidActive() internal view returns (bool)
function _createBeneficiaryFlow(int96 newContributionRate) internal
function _editBid(int96 newContributionRate, uint256 newForSalePrice) internal
event PayerForSalePriceUpdated(address _payer, uint256 forSalePrice)
Emitted when for sale price is updated
function payer() external view returns (address)
Current payer of license
function forSalePrice() external view returns (uint256)
Current for sale price of license
function licenseId() external view returns (uint256)
License Id
function license() external view returns (contract IERC721)
License
event BidPlaced(address _bidder, int96 contributionRate, uint256 forSalePrice)
Emitted when for sale price is updated
function editBid(int96 newContributionRate, uint256 newForSalePrice) external
Edit bid
Parameters
Name | Type | Description |
---|---|---|
newContributionRate | int96 | New contribution rate for bid |
newForSalePrice | uint256 | Intented new for sale price. Must be within rounding bounds of newContributionRate |
function placeBid(int96 newContributionRate, uint256 newForSalePrice) external
Place a bid to purchase license as msg.sender
Parameters
Name | Type | Description |
---|---|---|
newContributionRate | int96 | New contribution rate for bid |
newForSalePrice | uint256 | Intented new for sale price. Must be within rounding bounds of newContributionRate |
Last modified 2mo ago