BBSubscriptions

For each ERC20 token accepted by the protocol, there is a corresponding BBSubscriptions contract.

Functions

subscribe

function subscribe(
    uint256 profileId,
    uint256 tierId
) external payable returns (uint256 subscriptionId)

Create a subscription to a Profile at a specific Tier.

Parameters

Return Values

unsubscribe

unsubscribe(
    uint256 profileId, 
    uint256 tierId
) external

Unsubscribe from a Profile

checkUpkeep

function checkUpkeep(
    bytes calldata checkData
) external view override returns (bool, bytes memory)

Generate input for performUpkeep

Parameters

checkData Structure

abi.decode(checkData, (uint256, uint256, uint256, uint256, address))

Return Values

performData Structure

abi.encode(renewIndexes, refundReceiver)

performUpkeep

function performUpkeep(
    bytes calldata renewalData
) external

PerformUpkeep is a standard AutomationCompatibleInterface function. Input can be automatically generated by the checkUpkeep() function or manually built.

Parameters

RenewalData Structure

abi.decode(renewalData, (uint256[], address))

withdrawToTreasury

function withdrawToTreasury(
) public

Sends the ERC20 token balance the instance of BBSubscriptions handles to the treasury of the BBSubscriptionsFactory.

getSubscriptionFromProfile

function getSubscriptionFromProfile(
    uint256 profileId, 
    uint256 tierId, 
    address subscriber
) external view returns (uint256 subscriptionId, uint256 price, uint256 expiration, bool cancelled)

Get the subscription data on an account for a given profile and tier.

Parameters

Return Values

getSubscriptionFromId

function getSubscriptionFromId(
    uint256 subscriptionId
) external view returns (uint256 profileId, uint256 tierId, address subscriber, uint256 price, uint256 expiration, bool cancelled)

Get the details of a subscription based on an ID.

Parameters

Return Values

Last updated