Subscriptions


allSubscriptions

To retrieve the subscriptions of a specific user, use the allSubscriptions method. It returns arrays containing addresses and encoded subscription data (cost, author’s share, project number).

function allSubscriptions(address from) external view returns(address[] memory to, uint256[] memory encodedRates)

subscriptions

To obtain encoded data for a specific subscription, use the subscriptions method. It returns two values: a flag indicating presence and encoded data if the subscription exists.

function subscriptions(address from, address to) external view returns (bool, uint256 encodedRates)
bool - success flag:
    - true subscription exists
    - false in another way
    
uint256 encodedRates - compressed data that stores:
    - uint96 incomeRate
    - uint96 outgoingRate 
    - uint96 projectId 

Note: incomeRate is a rate that incoming to the author, and outgoingRate is a rate that incoming from the subscriber


users

To get information about a user, use the users method. This returns four fields: balance, incoming stream, outgoing stream, and the last synchronization timestamp.

function users(address) public view returns (User calldata user)
struct User {
  int256 balance;
  int256 incomeRate; // changes to this field requires _syncBalance() call
  int256 outgoingRate; // changes to this field requires _syncBalance() call
  uint256 updated;
}

Note that balance synchronization occurs on request, so the balance data may be outdated.

Last updated