5SuperTokenV1Library

Library for Token Centric Interface

The SuperTokenV1Library is a solidity library that allows you to interact with the Tagomi Protocol. It is a comprehensive library for Tagomi protocol. It includes all the functions that are required to interact with the Tagomi protocol. It includes functions for interacting with Money Streaming and Distributions. In order to have access to the library, you need to:

  • Import the library in your contract as such:

    import "@Tagomi-finance/bsc-contracts/contracts/apps/SuperTokenV1Library.sol";

  • Make sure that you include the using statement in your contract:

    using SuperTokenV1Library for ISuperToken;

Note 1

In the case of interacting with Native Super Tokens you should use using SuperTokenV1Library for ISETH; instead.

Note 2

It is important to "warm up" the cache and cache the host, cfa, gda before calling, this is only applicable to Foundry tests where the vm.expectRevert() will not work as expected. You must use vm.startPrank(account) instead of vm.prank when executing functions if the cache isn't "warmed up" yet. vm.prank impersonates the account only for the first call, which will be used for caching.

Fn createFlowarrow-up-right

function createFlow(
    contract ISuperToken token,
    address receiver,
    int96 flowRate
) 
    internal 
    returns (bool)

Create flow without userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

Fn createFlowarrow-up-right

Create flow with userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

userData

bytes

The userdata passed along with call

Fn updateFlowarrow-up-right

Update flow without userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

Fn updateFlow (w/userData)arrow-up-right

Update flow with userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

userData

bytes

The userdata passed along with call

Fn deleteFlowarrow-up-right

Delete flow without userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

Fn deleteFlow (w/userData)arrow-up-right

Delete flow with userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

userData

bytes

The userdata passed along with call

Fn setFlowPermissionsarrow-up-right

Update permissions for flow operator

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address given flow permissions

allowCreate

bool

creation permissions

allowUpdate

bool

allowDelete

bool

flowRateAllowance

int96

The allowance provided to flowOperator

Fn setMaxFlowPermissionsarrow-up-right

Update permissions for flow operator - give operator max permissions

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address given flow permissions

Fn revokeFlowPermissionsarrow-up-right

Update permissions for flow operator - revoke all permission

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address given flow permissions

Fn increaseFlowRateAllowancearrow-up-right

Increases the flow rate allowance for flow operator

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address whose flow rate allowance is increased

addedFlowRateAllowance

int96

amount to increase allowance by

allowing userData to be a parameter here triggered stack too deep error

Fn increaseFlowRateAllowance (w/userData)arrow-up-right

Increases the flow rate allowance for flow operator

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address whose flow rate allowance is increased

addedFlowRateAllowance

int96

amount to increase allowance by

userData

bytes

The userdata passed along with call

allowing userData to be a parameter here triggered stack too deep error

Fn decreaseFlowRateAllowancearrow-up-right

Decreases the flow rate allowance for flow operator

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address whose flow rate allowance is decreased

subtractedFlowRateAllowance

int96

amount to decrease allowance by

allowing userData to be a parameter here triggered stack too deep error

Fn decreaseFlowRateAllowance (w/userData)arrow-up-right

Decreases the flow rate allowance for flow operator

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address whose flow rate allowance is decreased

subtractedFlowRateAllowance

int96

amount to decrease allowance by

userData

bytes

The userdata passed along with call

allowing userData to be a parameter here triggered stack too deep error

Fn increaseFlowRateAllowanceWithPermissionsarrow-up-right

Increases the flow rate allowance for flow operator and adds the permissions

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address whose flow rate allowance is increased

permissionsToAdd

uint8

The permissions to add for the flow operator

addedFlowRateAllowance

int96

amount to increase allowance by

allowing userData to be a parameter here triggered stack too deep error

Fn increaseFlowRateAllowanceWithPermissions (w/userData)arrow-up-right

Increases the flow rate allowance for flow operator and adds the permissions

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address whose flow rate allowance is increased

permissionsToAdd

uint8

The permissions to add for the flow operator

addedFlowRateAllowance

int96

amount to increase allowance by

userData

bytes

The userdata passed along with call

allowing userData to be a parameter here triggered stack too deep error

Fn decreaseFlowRateAllowanceWithPermissionsarrow-up-right

Decreases the flow rate allowance for flow operator and removes the permissions

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address whose flow rate allowance is subtracted

permissionsToRemove

uint8

The permissions to remove for the flow operator

subtractedFlowRateAllowance

int96

amount to subtract allowance by

allowing userData to be a parameter here triggered stack too deep error

Fn decreaseFlowRateAllowanceWithPermissions (w/userData)arrow-up-right

Decreases the flow rate allowance for flow operator and removes the permissions

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address whose flow rate allowance is subtracted

permissionsToRemove

uint8

The permissions to remove for the flow operator

subtractedFlowRateAllowance

int96

amount to subtract allowance by

userData

bytes

The userdata passed along with call

allowing userData to be a parameter here triggered stack too deep error

Fn setFlowPermissionsWithCtxarrow-up-right

Update permissions for flow operator in callback

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address given flow permissions

allowCreate

bool

creation permissions

allowUpdate

bool

allowDelete

bool

flowRateAllowance

int96

The allowance provided to flowOperator

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

allowing userData to be a parameter here triggered stack too deep error

Fn setMaxFlowPermissionsWithCtxarrow-up-right

Update permissions for flow operator - give operator max permissions

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address given flow permissions

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn revokeFlowPermissionsWithCtxarrow-up-right

Update permissions for flow operator - revoke all permission

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowOperator

address

The address given flow permissions

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn createFlowFromarrow-up-right

Creates flow as an operator without userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

Fn createFlowFrom (w/userData)arrow-up-right

Creates flow as an operator with userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

userData

bytes

The user provided data

Fn updateFlowFromarrow-up-right

Updates flow as an operator without userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

Fn updateFlowFrom (w/userData)arrow-up-right

Updates flow as an operator with userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

userData

bytes

The user provided data

Fn deleteFlowFromarrow-up-right

Deletes flow as an operator without userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

Fn deleteFlowFrom (w/userData)arrow-up-right

Deletes flow as an operator with userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

userData

bytes

The user provided data

Fn createFlowWithCtxarrow-up-right

Create flow with context and userData

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn createFlowFromWithCtxarrow-up-right

Create flow by operator with context

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn updateFlowWithCtxarrow-up-right

Update flow with context

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn updateFlowFromWithCtxarrow-up-right

Update flow by operator with context

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The receiver of the flow

receiver

address

The receiver of the flow

flowRate

int96

The desired flowRate

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn deleteFlowWithCtxarrow-up-right

Delete flow with context

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn deleteFlowFromWithCtxarrow-up-right

Delete flow by operator with context

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token to flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn getFlowRatearrow-up-right

get flow rate between two accounts for given token

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

Return Valuesarrow-up-right

Name
Type
Description

flowRate

int96

The flow rate

Fn getFlowInfoarrow-up-right

get flow info between two accounts for given token

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

sender

address

The sender of the flow

receiver

address

The receiver of the flow

Return Valuesarrow-up-right

Name
Type
Description

lastUpdated

uint256

Timestamp of flow creation or last flowrate change

flowRate

int96

The flow rate

deposit

uint256

The amount of deposit the flow

owedDeposit

uint256

The amount of owed deposit of the flow

Fn getNetFlowRatearrow-up-right

get net flow rate for given account for given token (CFA + GDA)

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super token address

account

address

Account to query

Return Valuesarrow-up-right

Name
Type
Description

flowRate

int96

The net flow rate of the account

Fn getCFANetFlowRatearrow-up-right

get CFA net flow rate for given account for given token

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super token address

account

address

Account to query

Return Valuesarrow-up-right

Name
Type
Description

flowRate

int96

The net flow rate of the account

Fn getGDANetFlowRatearrow-up-right

get GDA net flow rate for given account for given token

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super token address

account

address

Account to query

Return Valuesarrow-up-right

Name
Type
Description

flowRate

int96

The net flow rate of the account

Fn getNetFlowInfoarrow-up-right

get the aggregated flow info of the account

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super token address

account

address

Account to query

Return Valuesarrow-up-right

Name
Type
Description

lastUpdated

uint256

Timestamp of the last change of the net flow

flowRate

int96

The net flow rate of token for account

deposit

uint256

The sum of all deposits for account's flows

owedDeposit

uint256

The sum of all owed deposits for account's flows

Fn getBufferAmountByFlowRatearrow-up-right

calculate buffer for a flow rate

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

flowRate

int96

The flowrate to calculate the needed buffer for

Return Valuesarrow-up-right

Name
Type
Description

bufferAmount

uint256

The buffer amount based on flowRate, liquidationPeriod and minimum deposit

Fn getFlowPermissionsarrow-up-right

get existing flow permissions

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The token used in flow

sender

address

sender of a flow

flowOperator

address

the address we are checking permissions of for sender & token

Return Valuesarrow-up-right

Name
Type
Description

allowCreate

bool

is true if the flowOperator can create flows

allowUpdate

bool

is true if the flowOperator can update flows

allowDelete

bool

is true if the flowOperator can delete flows

flowRateAllowance

int96

The flow rate allowance the flowOperator is granted (only goes down)

Gets an index by its ID and publisher.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

Return Valuesarrow-up-right

Name
Type
Description

exist

bool

True if the index exists.

indexValue

uint128

Total value of the index.

totalUnitsApproved

uint128

Units of the index approved by subscribers.

totalUnitsPending

uint128

Units of teh index not yet approved by subscribers.

Fn calculateDistributionarrow-up-right

Calculates the distribution amount based on the amount of tokens desired to distribute.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

amount

uint256

Amount of tokens desired to distribute.

Return Valuesarrow-up-right

Name
Type
Description

actualAmount

uint256

Amount to be distributed with correct rounding.

newIndexValue

uint128

The index value after the distribution would be called.

Fn listSubscriptionsarrow-up-right

List all subscriptions of an address

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super token used in the indexes listed.

subscriber

address

Subscriber address.

Return Valuesarrow-up-right

Name
Type
Description

publishers

address[]

Publishers of the indices.

indexIds

uint32[]

IDs of the indices.

unitsList

uint128[]

Units owned of the indices.

Fn getSubscriptionarrow-up-right

Gets subscription by publisher, index id, and subscriber.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber to the index.

Return Valuesarrow-up-right

Name
Type
Description

exist

bool

True if the subscription exists.

approved

bool

True if the subscription has been approved by the subscriber.

units

uint128

Units held by the subscriber

pendingDistribution

uint256

If not approved, the amount to be claimed on approval.

Fn getSubscriptionByIDarrow-up-right

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

agreementId

bytes32

Fn getFlowDistributionFlowRatearrow-up-right

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

from

address

to

contract ITagomiPool

GDA VIEW FUNCTIONS *************************************

Fn estimateFlowDistributionActualFlowRatearrow-up-right

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

from

address

to

contract ITagomiPool

requestedFlowRate

int96

Fn estimateDistributionActualAmountarrow-up-right

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

from

address

to

contract ITagomiPool

requestedAmount

uint256

Fn isMemberConnectedarrow-up-right

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

pool

address

member

address

Fn createIndexarrow-up-right

Creates a new index.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

Fn createIndexarrow-up-right

Creates a new index with userData.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

userData

bytes

Arbitrary user data field.

Fn updateIndexValuearrow-up-right

Updates an index value. This distributes an amount of tokens equal to indexValue - lastIndexValue. See distribute for another way to distribute.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

indexValue

uint128

New TOTAL index value, this will equal the total amount distributed.

Fn updateIndexValuearrow-up-right

Updates an index value with userData. This distributes an amount of tokens equal to indexValue - lastIndexValue. See distribute for another way to distribute.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

indexValue

uint128

New TOTAL index value, this will equal the total amount distributed.

userData

bytes

Arbitrary user data field.

Fn distributearrow-up-right

Distributes tokens in a more developer friendly way than updateIndex. Instead of passing the new total index value, you pass the amount of tokens desired to be distributed.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

amount

uint256

- total number of tokens desired to be distributed

NOTE in many cases, there can be some precision loss

This may cause a slight difference in the amount param specified and the actual amount distributed.

See below for math:

//indexDelta = amount the index will be updated by during an internal call to _updateIndex().

It is calculated like so:

indexDelta = amount / totalUnits

(see the distribute() implementatation in ./agreements/InstantDistributionAgreement.sol)

NOTE Solidity does not support floating point numbers

So the indexDelta will be rounded down to the nearest integer.

This will create a 'remainder' amount of tokens that will not be distributed

(we'll call this the 'distribution modulo')

distributionModulo = amount - indexDelta * totalUnits

NOTE due to rounding, there may be a small amount of tokens left in the publisher's account

This amount is equal to the 'distributionModulo' value

//

Fn distribute (w/userData)arrow-up-right

Distributes tokens in a more developer friendly way than updateIndex (w user data). Instead of passing the new total index value, this function will increase the index value by amount. This takes arbitrary user data.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

amount

uint256

Amount by which the index value should increase.

userData

bytes

Arbitrary user data field.

Fn approveSubscriptionarrow-up-right

Approves a subscription to an index. The subscriber's real time balance will not update until the subscription is approved, but once approved, the balance will be updated with prior distributions.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

Fn approveSubscription (w/userData)arrow-up-right

Approves a subscription to an index with user data. The subscriber's real time balance will not update until the subscription is approved, but once approved, the balance will be updated with prior distributions.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

userData

bytes

Arbitrary user data field.

Fn revokeSubscriptionarrow-up-right

Revokes a previously approved subscription.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

Fn revokeSubscription (w/userData)arrow-up-right

Revokes a previously approved subscription. This takes arbitrary user data.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

userData

bytes

Arbitrary user data field.

Fn updateSubscriptionUnitsarrow-up-right

Updates the units of a subscription. This changes the number of shares the subscriber holds

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address whose units are to be updated.

units

uint128

New number of units the subscriber holds.

Fn updateSubscriptionUnits (w/userData)arrow-up-right

Updates the units of a subscription. This changes the number of shares the subscriber holds. This takes arbitrary user data.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address whose units are to be updated.

units

uint128

New number of units the subscriber holds.

userData

bytes

Arbitrary user data field.

Fn deleteSubscriptionarrow-up-right

Deletes a subscription, setting a subcriber's units to zero

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address whose units are to be deleted.

Fn deleteSubscription (w/userData)arrow-up-right

Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address whose units are to be deleted.

userData

bytes

Arbitrary user data field.

Claims pending distribution. Subscription should not be approved

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address that receives the claim.

Fn claim (w/userData)arrow-up-right

Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address that receives the claim.

userData

bytes

Arbitrary user data field.

Fn createIndexWithCtxarrow-up-right

Creates a new index with ctx. Meant for usage in super app callbacks

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn updateIndexValueWithCtxarrow-up-right

Updates an index value with ctx. This distributes an amount of tokens equal to indexValue - lastIndexValue. See distribute for another way to distribute. Meant for usage in super app callbakcs

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

indexValue

uint128

New TOTAL index value, this will equal the total amount distributed.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn distributeWithCtxarrow-up-right

Distributes tokens in a more developer friendly way than updateIndex.Instead of passing the new total index value, this function will increase the index value by amount.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

amount

uint256

Amount by which the index value should increase.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn approveSubscriptionWithCtxarrow-up-right

Approves a subscription to an index. The subscriber's real time balance will not update until the subscription is approved, but once approved, the balance will be updated with prior distributions.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn revokeSubscriptionWithCtxarrow-up-right

Revokes a previously approved subscription. Meant for usage in super apps

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn updateSubscriptionUnitsWithCtxarrow-up-right

Updates the units of a subscription. This changes the number of shares the subscriber holds. Meant for usage in super apps

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address whose units are to be updated.

units

uint128

New number of units the subscriber holds.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn deleteSubscriptionWithCtxarrow-up-right

Deletes a subscription, setting a subcriber's units to zero. Meant for usage in super apps

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address whose units are to be deleted.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn claimWithCtxarrow-up-right

Claims pending distribution. Subscription should not be approved. Meant for usage in super app callbacks

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

Super Token used with the index.

publisher

address

Publisher of the index.

indexId

uint32

ID of the index.

subscriber

address

Subscriber address that receives the claim.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn createPoolarrow-up-right

Creates a new Tagomi Pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

admin

address

The pool admin address.

poolConfig

struct PoolConfig

The pool configuration (see below)

The PoolConfig struct is defined as follows:

  • transferabilityForUnitsOwner: If true, the pool members can transfer their owned units, else, only the pool admin can manipulate the units for pool members (not recommended)

  • distributionFromAnyAddress: If true, anyone can execute distributions via the pool, else, only the pool admin can execute distributions via the pool

Return Valuesarrow-up-right

Name
Type
Description

pool

contract ITagomiPool

The address of the deployed Tagomi Pool

Fn updateMemberUnitsarrow-up-right

Updates the units of a pool member.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to update.

memberAddress

address

The address of the member to update.

newUnits

uint128

The new units of the member.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

bool A boolean value indicating whether the pool was created successfully.

Fn updateMemberUnits (w/userData)arrow-up-right

Updates the units of a pool member.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to update.

memberAddress

address

The address of the member to update.

newUnits

uint128

The new units of the member.

userData

bytes

User-specific data.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the pool was created successfully.

Claims all tokens from the pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to claim from.

memberAddress

address

The address of the member to claim for.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the claim was successful.

Fn claimAll (w/userData)arrow-up-right

Claims all tokens from the pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to claim from.

memberAddress

address

The address of the member to claim for.

userData

bytes

User-specific data.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the claim was successful.

Fn connectPoolarrow-up-right

Connects a pool member to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to connect.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the connection was successful.

Fn connectPool (w/userData)arrow-up-right

Connects a pool member to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to connect.

userData

bytes

User-specific data.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the connection was successful.

Fn disconnectPoolarrow-up-right

Disconnects a pool member from pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to disconnect.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the disconnection was successful.

Fn disconnectPool (w/userData)arrow-up-right

Disconnects a pool member from pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to disconnect.

userData

bytes

User-specific data.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the disconnection was successful.

Fn distributeToPoolarrow-up-right

Tries to distribute requestedAmount amount of token from from to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

from

address

The address from which to distribute tokens.

pool

contract ITagomiPool

The Tagomi Pool address.

requestedAmount

uint256

The amount of tokens to distribute.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the distribution was successful.

Fn distribute (w/userData)arrow-up-right

Tries to distribute requestedAmount amount of token from from to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

from

address

The address from which to distribute tokens.

pool

contract ITagomiPool

The Tagomi Pool address.

requestedAmount

uint256

The amount of tokens to distribute.

userData

bytes

User-specific data.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the distribution was successful.

Fn distributeFlowarrow-up-right

Tries to distribute flow at requestedFlowRate of token from from to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

from

address

The address from which to distribute tokens.

pool

contract ITagomiPool

The Tagomi Pool address.

requestedFlowRate

int96

The flow rate of tokens to distribute.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the distribution was successful.

Fn distributeFlow (w/userData)arrow-up-right

Tries to distribute flow at requestedFlowRate of token from from to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

from

address

The address from which to distribute tokens.

pool

contract ITagomiPool

The Tagomi Pool address.

requestedFlowRate

int96

The flow rate of tokens to distribute.

userData

bytes

User-specific data.

Return Valuesarrow-up-right

Name
Type
Description

[0]

bool

A boolean value indicating whether the distribution was successful.

Fn updateMemberUnitsWithCtxarrow-up-right

Updates the units of a pool member.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to update.

memberAddress

address

The address of the member to update.

newUnits

uint128

The new units of the member.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn claimAllWithCtxarrow-up-right

Claims all tokens from the pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to claim from.

memberAddress

address

The address of the member to claim for.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn connectPoolWithCtxarrow-up-right

Connects a pool member to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The Tagomi Pool to connect.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn disconnectPoolWithCtxarrow-up-right

Disconnects a pool member from pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

pool

contract ITagomiPool

The STagomi Pool to disconnect.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn distributeWithCtxarrow-up-right

Tries to distribute requestedAmount amount of token from from to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

from

address

The address from which to distribute tokens.

pool

contract ITagomiPool

The Tagomi Pool address.

requestedAmount

uint256

The amount of tokens to distribute.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Fn distributeFlowWithCtxarrow-up-right

Tries to distribute flow at requestedFlowRate of token from from to pool.

Parametersarrow-up-right

Name
Type
Description

token

contract ISuperToken

The Super Token address.

from

address

The address from which to distribute tokens.

pool

contract ITagomiPool

The Tagomi Pool address.

requestedFlowRate

int96

The flow rate of tokens to distribute.

ctx

bytes

Context bytes (see ITagomi.sol for Context struct)

Return Valuesarrow-up-right

Name
Type
Description

newCtx

bytes

The updated context after the execution of the agreement function

Last updated

Was this helpful?