BackedBy Documentation
  • OVERVIEW
    • What Is BackedBy
  • DEVELOPERS
    • Smart Contracts
      • Core
        • BBProfiles
        • BBPosts
        • BBTiers
        • BBPermissionsV01
      • Subscriptions
        • BBSubscriptions
        • BBSubscriptionsFactory
      • Gas Oracle
      • BBERC20 Wrapper
    • Integration Guide
      • JSON Schemas
    • Example Contracts
      • Access Control
      • Single Tx Profile Setup
  • RESOURCES
    • Github
    • Contact Us
Powered by GitBook
On this page
  • Functions
  • createTiers
  • editTiers
  • setSupportedCurrencies
  • getTier
  • getTierSet
  • totalTiers
  • totalTierSets
  • getCurrencyMultiplier
  • isCurrencySupported
  1. DEVELOPERS
  2. Smart Contracts
  3. Core

BBTiers

PreviousBBPostsNextBBPermissionsV01

Last updated 2 years ago

Functions

createTiers

function createTiers(
    uint256 profileId, 
    uint256[] calldata prices, 
    string[] calldata cids, 
    bool[] memory deprecated, 
    address[] calldata supportedCurrencies, 
    uint256[] calldata priceMultipliers
) external returns (uint256 tierSetId)

Creates a set of tiers

Parameters

Name
Type
Description

profileId

uint256

ID of the profile to create the tier set in

prices

uint256[]

The base prices of each tier

cids

string[]

The CID's of each tier

deprecated

bool[]

The deprecation state of each tier

supportedCurrencies

address[]

Contract address of each supported ERC20 token

priceMultipliers

uint256[]

Price multiplier of each supported ERC20 token

Return Values

Name
Type
Description

tierSetId

uint256

The ID of the created tier set

editTiers

function editTiers(
    uint256 profileId, 
    uint256 tierSetId, 
    uint256[] calldata prices, 
    string[] calldata cids, 
    bool[] memory deprecated
) external

Set the values of a set of tiers

Parameters

Name
Type
Description

profileId

uint256

ID of the profile to edit the tier set in

tierSetId

uint256

The ID of the tier set to edit

prices

uint256[]

New prices of each tier

cids

string[]

New CID's of each tier

deprecated

bool[]

New deprecated state of each tier

setSupportedCurrencies

function setSupportedCurrencies(
    uint256 profileId, 
    uint256 tierSetId, 
    address[] calldata supportedCurrencies, 
    uint256[] calldata priceMultipliers
) external

Set a tier sets supported ERC20 tokens for payment

Parameters

Name
Type
Description

profileId

uint256

ID of the profile to set the supported currencies in

tierSetId

uint256

Tier set ID to set the supported currencies in

supportedCurrencies

address[]

The ERC20 tokens to support

priceMultipliers

uint256[]

The price multiplier of each ERC20 token

getTier

function getTier(
    uint256 profileId, 
    uint256 tierSetId, 
    uint256 tierId, 
    address currency
) external view returns (string memory cid, uint256 price, bool deprecated)

Returns an existing tier

Parameters

Name
Type
Description

profileId

uint256

ID of the profile that owns the tier

tierSetId

uint256

ID of the tier set the tier is in

tierId

uint256

ID of the tier to return

currency

address

ERC20 token contract address to price the tier in

Return Values

Name
Type
Description

cid

string

Returned CID of a tier

price

uint256

Returned price of a tier

deprecated

bool

Returned deprecated state of a tier

getTierSet

function getTierSet(
    uint256 profileId, 
    uint256 tierSetId
) external view returns (uint256[] memory prices, string[] memory cids, bool[] memory deprecated)

Returns an existing set of tiers

Parameters

Name
Type
Description

profileId

uint256

ID of the profile that owns the tier set

tierSetId

uint256

ID if the tier set to return

Return Values

Name
Type
Description

prices

uint256[]

Returned base price of each tier in a tier set

cids

string[]

Returned CID of each tier in a tier set

deprecated

bool[]

Returned deprecated state of each tier in a tier set

totalTiers

function totalTiers(
    uint256 profileId, 
    uint256 tierSetId
) external view returns (uint256 total)

Returns the total number of tiers in a tier set

Parameters

Name
Type
Description

profileId

uint256

ID of the profile that owns the tier set

tierSetId

uint256

ID of the tier set to return the total number of tiers within

Return Values

Name
Type
Description

total

uint256

Number of total tiers in a tier set

totalTierSets

function totalTierSets(
    uint256 profileId
) external view returns (uint256 total)

Returns the total number of tier sets owned by a profile

Parameters

Name
Type
Description

profileId

uint256

ID of the profile to return the total number of tier sets

Return Values

Name
Type
Description

total

uint256

Number of total tier sets in a profile

getCurrencyMultiplier

function getCurrencyMultiplier(
    uint256 profileId, 
    uint256 tierSetId, 
    address currency
) external view returns (uint256 multiplier)

Returns the currency multiplier of ERC20 token in a tier set

Parameters

Name
Type
Description

profileId

uint256

ID of the profile that owns the tier set

tierSetId

uint256

ID of the tier set

currency

address

ERC20 token contract address to return the currency multiplier

Return Values

Name
Type
Description

multiplier

uint256

Price multiplier of a ERC20 token

isCurrencySupported

function isCurrencySupported(
    uint256 profileId, 
    uint256 tierSetId, 
    address currency
) external view returns (bool supported)

Returns true if a ERC20 token is supported by a tier set

Parameters

Name
Type
Description

profileId

uint256

ID of the profile that owns the tier set

tierSetId

uint256

ID of the tier set

currency

address

ERC20 token contract address to return if it is supported by a tier set

Return Values

Name
Type
Description

supported

bool

Returns true if a ERC20 is supported

v1-contracts/BBTiers.sol at main · backedby/v1-contractsGitHub
Logo