SuperTokenV1Library
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
usingstatement 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 createFlow​
function createFlow(
contract ISuperToken token,
address receiver,
int96 flowRate
)
internal
returns (bool)Create flow without userData
Parameters​
token
contract ISuperToken
The token used in flow
receiver
address
The receiver of the flow
flowRate
int96
The desired flowRate
Fn createFlow​
Create flow with userData
Parameters​
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 updateFlow​
Update flow without userData
Parameters​
token
contract ISuperToken
The token used in flow
receiver
address
The receiver of the flow
flowRate
int96
The desired flowRate
Fn updateFlow (w/userData)​
Update flow with userData
Parameters​
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 deleteFlow​
Delete flow without userData
Parameters​
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)​
Delete flow with userData
Parameters​
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 setFlowPermissions​
Update permissions for flow operator
Parameters​
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 setMaxFlowPermissions​
Update permissions for flow operator - give operator max permissions
Parameters​
token
contract ISuperToken
The token used in flow
flowOperator
address
The address given flow permissions
Fn revokeFlowPermissions​
Update permissions for flow operator - revoke all permission
Parameters​
token
contract ISuperToken
The token used in flow
flowOperator
address
The address given flow permissions
Fn increaseFlowRateAllowance​
Increases the flow rate allowance for flow operator
Parameters​
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)​
Increases the flow rate allowance for flow operator
Parameters​
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 decreaseFlowRateAllowance​
Decreases the flow rate allowance for flow operator
Parameters​
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)​
Decreases the flow rate allowance for flow operator
Parameters​
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 increaseFlowRateAllowanceWithPermissions​
Increases the flow rate allowance for flow operator and adds the permissions
Parameters​
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)​
Increases the flow rate allowance for flow operator and adds the permissions
Parameters​
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 decreaseFlowRateAllowanceWithPermissions​
Decreases the flow rate allowance for flow operator and removes the permissions
Parameters​
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)​
Decreases the flow rate allowance for flow operator and removes the permissions
Parameters​
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 setFlowPermissionsWithCtx​
Update permissions for flow operator in callback
Parameters​
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 Values​
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 setMaxFlowPermissionsWithCtx​
Update permissions for flow operator - give operator max permissions
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn revokeFlowPermissionsWithCtx​
Update permissions for flow operator - revoke all permission
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn createFlowFrom​
Creates flow as an operator without userData
Parameters​
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)​
Creates flow as an operator with userData
Parameters​
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 updateFlowFrom​
Updates flow as an operator without userData
Parameters​
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)​
Updates flow as an operator with userData
Parameters​
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 deleteFlowFrom​
Deletes flow as an operator without userData
Parameters​
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)​
Deletes flow as an operator with userData
Parameters​
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 createFlowWithCtx​
Create flow with context and userData
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn createFlowFromWithCtx​
Create flow by operator with context
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn updateFlowWithCtx​
Update flow with context
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn updateFlowFromWithCtx​
Update flow by operator with context
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn deleteFlowWithCtx​
Delete flow with context
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn deleteFlowFromWithCtx​
Delete flow by operator with context
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn getFlowRate​
get flow rate between two accounts for given token
Parameters​
token
contract ISuperToken
The token used in flow
sender
address
The sender of the flow
receiver
address
The receiver of the flow
Return Values​
flowRate
int96
The flow rate
Fn getFlowInfo​
get flow info between two accounts for given token
Parameters​
token
contract ISuperToken
The token used in flow
sender
address
The sender of the flow
receiver
address
The receiver of the flow
Return Values​
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 getNetFlowRate​
get net flow rate for given account for given token (CFA + GDA)
Parameters​
token
contract ISuperToken
Super token address
account
address
Account to query
Return Values​
flowRate
int96
The net flow rate of the account
Fn getCFANetFlowRate​
get CFA net flow rate for given account for given token
Parameters​
token
contract ISuperToken
Super token address
account
address
Account to query
Return Values​
flowRate
int96
The net flow rate of the account
Fn getGDANetFlowRate​
get GDA net flow rate for given account for given token
Parameters​
token
contract ISuperToken
Super token address
account
address
Account to query
Return Values​
flowRate
int96
The net flow rate of the account
Fn getNetFlowInfo​
get the aggregated flow info of the account
Parameters​
token
contract ISuperToken
Super token address
account
address
Account to query
Return Values​
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 getBufferAmountByFlowRate​
calculate buffer for a flow rate
Parameters​
token
contract ISuperToken
The token used in flow
flowRate
int96
The flowrate to calculate the needed buffer for
Return Values​
bufferAmount
uint256
The buffer amount based on flowRate, liquidationPeriod and minimum deposit
Fn getFlowPermissions​
get existing flow permissions
Parameters​
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 Values​
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)
Fn getIndex​
Gets an index by its ID and publisher.
Parameters​
token
contract ISuperToken
Super token used with the index.
publisher
address
Publisher of the index.
indexId
uint32
ID of the index.
Return Values​
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 calculateDistribution​
Calculates the distribution amount based on the amount of tokens desired to distribute.
Parameters​
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 Values​
actualAmount
uint256
Amount to be distributed with correct rounding.
newIndexValue
uint128
The index value after the distribution would be called.
Fn listSubscriptions​
List all subscriptions of an address
Parameters​
token
contract ISuperToken
Super token used in the indexes listed.
subscriber
address
Subscriber address.
Return Values​
publishers
address[]
Publishers of the indices.
indexIds
uint32[]
IDs of the indices.
unitsList
uint128[]
Units owned of the indices.
Fn getSubscription​
Gets subscription by publisher, index id, and subscriber.
Parameters​
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 Values​
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 getSubscriptionByID​
Parameters​
token
contract ISuperToken
agreementId
bytes32
Fn getFlowDistributionFlowRate​
Parameters​
token
contract ISuperToken
from
address
to
contract ITagomiPool
GDA VIEW FUNCTIONS *************************************
Fn estimateFlowDistributionActualFlowRate​
Parameters​
token
contract ISuperToken
from
address
to
contract ITagomiPool
requestedFlowRate
int96
Fn estimateDistributionActualAmount​
Parameters​
token
contract ISuperToken
from
address
to
contract ITagomiPool
requestedAmount
uint256
Fn isMemberConnected​
Parameters​
token
contract ISuperToken
pool
address
member
address
Fn createIndex​
Creates a new index.
Parameters​
token
contract ISuperToken
Super Token used with the index.
indexId
uint32
ID of the index.
Fn createIndex​
Creates a new index with userData.
Parameters​
token
contract ISuperToken
Super Token used with the index.
indexId
uint32
ID of the index.
userData
bytes
Arbitrary user data field.
Fn updateIndexValue​
Updates an index value. This distributes an amount of tokens equal to indexValue - lastIndexValue. See distribute for another way to distribute.
Parameters​
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 updateIndexValue​
Updates an index value with userData. This distributes an amount of tokens equal to indexValue - lastIndexValue. See distribute for another way to distribute.
Parameters​
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 distribute​
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.
Parameters​
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)​
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.
Parameters​
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 approveSubscription​
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.
Parameters​
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)​
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.
Parameters​
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 revokeSubscription​
Revokes a previously approved subscription.
Parameters​
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)​
Revokes a previously approved subscription. This takes arbitrary user data.
Parameters​
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 updateSubscriptionUnits​
Updates the units of a subscription. This changes the number of shares the subscriber holds
Parameters​
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)​
Updates the units of a subscription. This changes the number of shares the subscriber holds. This takes arbitrary user data.
Parameters​
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 deleteSubscription​
Deletes a subscription, setting a subcriber's units to zero
Parameters​
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)​
Deletes a subscription, setting a subcriber's units to zero. This takes arbitrary userdata.
Parameters​
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.
Fn claim​
Claims pending distribution. Subscription should not be approved
Parameters​
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)​
Claims pending distribution. Subscription should not be approved. This takes arbitrary user data.
Parameters​
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 createIndexWithCtx​
Creates a new index with ctx. Meant for usage in super app callbacks
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn updateIndexValueWithCtx​
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
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn distributeWithCtx​
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.
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn approveSubscriptionWithCtx​
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.
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn revokeSubscriptionWithCtx​
Revokes a previously approved subscription. Meant for usage in super apps
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn updateSubscriptionUnitsWithCtx​
Updates the units of a subscription. This changes the number of shares the subscriber holds. Meant for usage in super apps
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn deleteSubscriptionWithCtx​
Deletes a subscription, setting a subcriber's units to zero. Meant for usage in super apps
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn claimWithCtx​
Claims pending distribution. Subscription should not be approved. Meant for usage in super app callbacks
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn createPool​
Creates a new Tagomi Pool.
Parameters​
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 Values​
pool
contract ITagomiPool
The address of the deployed Tagomi Pool
Fn updateMemberUnits​
Updates the units of a pool member.
Parameters​
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 Values​
[0]
bool
bool A boolean value indicating whether the pool was created successfully.
Fn updateMemberUnits (w/userData)​
Updates the units of a pool member.
Parameters​
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 Values​
[0]
bool
A boolean value indicating whether the pool was created successfully.
Fn claimAll​
Claims all tokens from the pool.
Parameters​
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 Values​
[0]
bool
A boolean value indicating whether the claim was successful.
Fn claimAll (w/userData)​
Claims all tokens from the pool.
Parameters​
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 Values​
[0]
bool
A boolean value indicating whether the claim was successful.
Fn connectPool​
Connects a pool member to pool.
Parameters​
token
contract ISuperToken
The Super Token address.
pool
contract ITagomiPool
The Tagomi Pool to connect.
Return Values​
[0]
bool
A boolean value indicating whether the connection was successful.
Fn connectPool (w/userData)​
Connects a pool member to pool.
Parameters​
token
contract ISuperToken
The Super Token address.
pool
contract ITagomiPool
The Tagomi Pool to connect.
userData
bytes
User-specific data.
Return Values​
[0]
bool
A boolean value indicating whether the connection was successful.
Fn disconnectPool​
Disconnects a pool member from pool.
Parameters​
token
contract ISuperToken
The Super Token address.
pool
contract ITagomiPool
The Tagomi Pool to disconnect.
Return Values​
[0]
bool
A boolean value indicating whether the disconnection was successful.
Fn disconnectPool (w/userData)​
Disconnects a pool member from pool.
Parameters​
token
contract ISuperToken
The Super Token address.
pool
contract ITagomiPool
The Tagomi Pool to disconnect.
userData
bytes
User-specific data.
Return Values​
[0]
bool
A boolean value indicating whether the disconnection was successful.
Fn distributeToPool​
Tries to distribute requestedAmount amount of token from from to pool.
Parameters​
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 Values​
[0]
bool
A boolean value indicating whether the distribution was successful.
Fn distribute (w/userData)​
Tries to distribute requestedAmount amount of token from from to pool.
Parameters​
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 Values​
[0]
bool
A boolean value indicating whether the distribution was successful.
Fn distributeFlow​
Tries to distribute flow at requestedFlowRate of token from from to pool.
Parameters​
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 Values​
[0]
bool
A boolean value indicating whether the distribution was successful.
Fn distributeFlow (w/userData)​
Tries to distribute flow at requestedFlowRate of token from from to pool.
Parameters​
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 Values​
[0]
bool
A boolean value indicating whether the distribution was successful.
Fn updateMemberUnitsWithCtx​
Updates the units of a pool member.
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn claimAllWithCtx​
Claims all tokens from the pool.
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn connectPoolWithCtx​
Connects a pool member to pool.
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn disconnectPoolWithCtx​
Disconnects a pool member from pool.
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn distributeWithCtx​
Tries to distribute requestedAmount amount of token from from to pool.
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Fn distributeFlowWithCtx​
Tries to distribute flow at requestedFlowRate of token from from to pool.
Parameters​
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 Values​
newCtx
bytes
The updated context after the execution of the agreement function
Last updated
Was this helpful?