BBSubscriptions
For each ERC20 token accepted by the protocol, there is a corresponding BBSubscriptions contract.
Functions
subscribe
Create a subscription to a Profile at a specific Tier.
Parameters
profileId
uint256
Profile to create a subscription to
tierId
uint256
Subscription Tier to subscribe to.
Return Values
subscriptionId
uint256
The ID of the newly created subscription
unsubscribe
Unsubscribe from a Profile
profileId
uint256
Profile to unsubscribe from
tierId
uint256
Tier to unsubscribe from
checkUpkeep
Generate input for performUpkeep
Parameters
checkData
bytes
api.encoded input
checkData Structure
lowerBound
uint256
Starting subscriptionId to check for renewal
upperBoard
uint256
Ending subscriptionId to check for renewal
minRenews
uint256
Minimum number of renewals to find
maxRenews
uint256
Maximum number of renewals to find
refundReceiver
address
Account to receive the gas refund from performUpkeep.
Return Values
upkeepNeeded
bool
Returns true if the number of subscriptions to renew is greater than minRenews.
performData
bytes
Data to pass thru to performUpkeep if upkeepNeeded is true.
performData Structure
renewIndexes
uint256[]
Subscription IDs to renew
refundReceiver
address
Account to send gas refund to
performUpkeep
PerformUpkeep is a standard AutomationCompatibleInterface
function. Input can be automatically generated by the checkUpkeep() function or manually built.
Parameters
renewalData
bytes
abi.encoded parameters
RenewalData Structure
renewIndexes
uint256[]
Subscriber IDs to renew
refundReceiver
address
Address to send gas refund to
withdrawToTreasury
Sends the ERC20 token balance the instance of BBSubscriptions handles to the treasury of the BBSubscriptionsFactory.
getSubscriptionFromProfile
Get the subscription data on an account for a given profile and tier.
Parameters
profileId
uint256
Profile to look at
tierId
uint256
Tier to look at
subscriber
address
Account to look for
Return Values
subscriptionId
uint256
Subscription ID
price
uint256
Monthly price of subscription
expiration
uint256
Unix timestamp of the when the subscription will expire
cancelled
bool
Whether or not the subscription is cancelled
getSubscriptionFromId
Get the details of a subscription based on an ID.
Parameters
subscriptionId
uint256
ID of the subscription to return
Return Values
profileId
uint256
ID of the profile
tierId
uint256
ID of the subscription tier
subscriber
address
Address of the subscriber
price
uint256
Monthly price of subscription
expiration
uint256
Unix timestamp of the when the subscription will expire
cancelled
bool
Whether or not the subscription is cancelled
Last updated