# 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 `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 createFlow[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createflow) <a href="#fn-createflow" id="fn-createflow"></a>

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

*Create flow without userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters)

| Name       | Type                 | Description              |
| ---------- | -------------------- | ------------------------ |
| `token`    | contract ISuperToken | The token used in flow   |
| `receiver` | address              | The receiver of the flow |
| `flowRate` | int96                | The desired flowRate     |

### Fn createFlow[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createflow-1) <a href="#fn-createflow-1" id="fn-createflow-1"></a>

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

*Create flow with userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-1)

| 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 updateFlow[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateflow) <a href="#fn-updateflow" id="fn-updateflow"></a>

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

*Update flow without userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-2)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateflow-wuserdata) <a href="#fn-updateflow-wuserdata" id="fn-updateflow-wuserdata"></a>

```
function updateFlow(
    contract ISuperToken token,
    address receiver,
    int96 flowRate,
    bytes userData
) 
    internal 
    returns (bool)
```

*Update flow with userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-3)

| 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 deleteFlow[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deleteflow) <a href="#fn-deleteflow" id="fn-deleteflow"></a>

```
function deleteFlow(
    contract ISuperToken token,
    address sender,
    address receiver
) 
    internal 
    returns (bool)
```

*Delete flow without userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-4)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deleteflow-wuserdata) <a href="#fn-deleteflow-wuserdata" id="fn-deleteflow-wuserdata"></a>

```
function deleteFlow(
    contract ISuperToken token,
    address sender,
    address receiver,
    bytes userData
) 
    internal 
    returns (bool)
```

*Delete flow with userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-5)

| 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 setFlowPermissions[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-setflowpermissions) <a href="#fn-setflowpermissions" id="fn-setflowpermissions"></a>

```
function setFlowPermissions(
    contract ISuperToken token,
    address flowOperator,
    bool allowCreate,
    bool allowUpdate,
    bool allowDelete,
    int96 flowRateAllowance
) 
    internal 
    returns (bool)
```

*Update permissions for flow operator*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-6)

| 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 setMaxFlowPermissions[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-setmaxflowpermissions) <a href="#fn-setmaxflowpermissions" id="fn-setmaxflowpermissions"></a>

```
function setMaxFlowPermissions(
    contract ISuperToken token,
    address flowOperator
) 
    internal 
    returns (bool)
```

*Update permissions for flow operator - give operator max permissions*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-7)

| Name           | Type                 | Description                        |
| -------------- | -------------------- | ---------------------------------- |
| `token`        | contract ISuperToken | The token used in flow             |
| `flowOperator` | address              | The address given flow permissions |

### Fn revokeFlowPermissions[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-revokeflowpermissions) <a href="#fn-revokeflowpermissions" id="fn-revokeflowpermissions"></a>

```
function revokeFlowPermissions(
    contract ISuperToken token,
    address flowOperator
) 
    internal 
    returns (bool)
```

*Update permissions for flow operator - revoke all permission*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-8)

| Name           | Type                 | Description                        |
| -------------- | -------------------- | ---------------------------------- |
| `token`        | contract ISuperToken | The token used in flow             |
| `flowOperator` | address              | The address given flow permissions |

### Fn increaseFlowRateAllowance[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-increaseflowrateallowance) <a href="#fn-increaseflowrateallowance" id="fn-increaseflowrateallowance"></a>

```
function increaseFlowRateAllowance(
    contract ISuperToken token,
    address flowOperator,
    int96 addedFlowRateAllowance
) 
    internal 
    returns (bool)
```

*Increases the flow rate allowance for flow operator*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-9)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-increaseflowrateallowance-wuserdata) <a href="#fn-increaseflowrateallowance-wuserdata" id="fn-increaseflowrateallowance-wuserdata"></a>

```
function increaseFlowRateAllowance(
    contract ISuperToken token,
    address flowOperator,
    int96 addedFlowRateAllowance,
    bytes userData
) 
    internal 
    returns (bool)
```

*Increases the flow rate allowance for flow operator*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-10)

| 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 decreaseFlowRateAllowance[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-decreaseflowrateallowance) <a href="#fn-decreaseflowrateallowance" id="fn-decreaseflowrateallowance"></a>

```
function decreaseFlowRateAllowance(
    contract ISuperToken token,
    address flowOperator,
    int96 subtractedFlowRateAllowance
) 
    internal 
    returns (bool)
```

*Decreases the flow rate allowance for flow operator*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-11)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-decreaseflowrateallowance-wuserdata) <a href="#fn-decreaseflowrateallowance-wuserdata" id="fn-decreaseflowrateallowance-wuserdata"></a>

```
function decreaseFlowRateAllowance(
    contract ISuperToken token,
    address flowOperator,
    int96 subtractedFlowRateAllowance,
    bytes userData
) 
    internal 
    returns (bool)
```

*Decreases the flow rate allowance for flow operator*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-12)

| 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 increaseFlowRateAllowanceWithPermissions[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-increaseflowrateallowancewithpermissions) <a href="#fn-increaseflowrateallowancewithpermissions" id="fn-increaseflowrateallowancewithpermissions"></a>

```
function increaseFlowRateAllowanceWithPermissions(
    contract ISuperToken token,
    address flowOperator,
    uint8 permissionsToAdd,
    int96 addedFlowRateAllowance
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-13)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-increaseflowrateallowancewithpermissions-wuserdata) <a href="#fn-increaseflowrateallowancewithpermissions-wuserdata" id="fn-increaseflowrateallowancewithpermissions-wuserdata"></a>

```
function increaseFlowRateAllowanceWithPermissions(
    contract ISuperToken token,
    address flowOperator,
    uint8 permissionsToAdd,
    int96 addedFlowRateAllowance,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-14)

| 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 decreaseFlowRateAllowanceWithPermissions[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-decreaseflowrateallowancewithpermissions) <a href="#fn-decreaseflowrateallowancewithpermissions" id="fn-decreaseflowrateallowancewithpermissions"></a>

```
function decreaseFlowRateAllowanceWithPermissions(
    contract ISuperToken token,
    address flowOperator,
    uint8 permissionsToRemove,
    int96 subtractedFlowRateAllowance
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-15)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-decreaseflowrateallowancewithpermissions-wuserdata) <a href="#fn-decreaseflowrateallowancewithpermissions-wuserdata" id="fn-decreaseflowrateallowancewithpermissions-wuserdata"></a>

```
function decreaseFlowRateAllowanceWithPermissions(
    contract ISuperToken token,
    address flowOperator,
    uint8 permissionsToRemove,
    int96 subtractedFlowRateAllowance,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-16)

| 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 setFlowPermissionsWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-setflowpermissionswithctx) <a href="#fn-setflowpermissionswithctx" id="fn-setflowpermissionswithctx"></a>

```
function setFlowPermissionsWithCtx(
    contract ISuperToken token,
    address flowOperator,
    bool allowCreate,
    bool allowUpdate,
    bool allowDelete,
    int96 flowRateAllowance,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Update permissions for flow operator in callback*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-17)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values)

| 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 setMaxFlowPermissionsWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-setmaxflowpermissionswithctx) <a href="#fn-setmaxflowpermissionswithctx" id="fn-setmaxflowpermissionswithctx"></a>

```
function setMaxFlowPermissionsWithCtx(
    contract ISuperToken token,
    address flowOperator,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Update permissions for flow operator - give operator max permissions*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-18)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-1)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn revokeFlowPermissionsWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-revokeflowpermissionswithctx) <a href="#fn-revokeflowpermissionswithctx" id="fn-revokeflowpermissionswithctx"></a>

```
function revokeFlowPermissionsWithCtx(
    contract ISuperToken token,
    address flowOperator,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Update permissions for flow operator - revoke all permission*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-19)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-2)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn createFlowFrom[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createflowfrom) <a href="#fn-createflowfrom" id="fn-createflowfrom"></a>

```
function createFlowFrom(
    contract ISuperToken token,
    address sender,
    address receiver,
    int96 flowRate
) 
    internal 
    returns (bool)
```

*Creates flow as an operator without userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-20)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createflowfrom-wuserdata) <a href="#fn-createflowfrom-wuserdata" id="fn-createflowfrom-wuserdata"></a>

```
function createFlowFrom(
    contract ISuperToken token,
    address sender,
    address receiver,
    int96 flowRate,
    bytes userData
) 
    internal 
    returns (bool)
```

*Creates flow as an operator with userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-21)

| 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 updateFlowFrom[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateflowfrom) <a href="#fn-updateflowfrom" id="fn-updateflowfrom"></a>

```
function updateFlowFrom(
    contract ISuperToken token,
    address sender,
    address receiver,
    int96 flowRate
) 
    internal 
    returns (bool)
```

*Updates flow as an operator without userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-22)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateflowfrom-wuserdata) <a href="#fn-updateflowfrom-wuserdata" id="fn-updateflowfrom-wuserdata"></a>

```
function updateFlowFrom(
    contract ISuperToken token,
    address sender,
    address receiver,
    int96 flowRate,
    bytes userData
) 
    internal 
    returns (bool)
```

*Updates flow as an operator with userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-23)

| 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 deleteFlowFrom[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deleteflowfrom) <a href="#fn-deleteflowfrom" id="fn-deleteflowfrom"></a>

```
function deleteFlowFrom(
    contract ISuperToken token,
    address sender,
    address receiver
) 
    internal 
    returns (bool)
```

*Deletes flow as an operator without userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-24)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deleteflowfrom-wuserdata) <a href="#fn-deleteflowfrom-wuserdata" id="fn-deleteflowfrom-wuserdata"></a>

```
function deleteFlowFrom(
    contract ISuperToken token,
    address sender,
    address receiver,
    bytes userData
) 
    internal 
    returns (bool)
```

*Deletes flow as an operator with userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-25)

| 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 createFlowWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createflowwithctx) <a href="#fn-createflowwithctx" id="fn-createflowwithctx"></a>

```
function createFlowWithCtx(
    contract ISuperToken token,
    address receiver,
    int96 flowRate,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Create flow with context and userData*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-26)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-3)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn createFlowFromWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createflowfromwithctx) <a href="#fn-createflowfromwithctx" id="fn-createflowfromwithctx"></a>

```
function createFlowFromWithCtx(
    contract ISuperToken token,
    address sender,
    address receiver,
    int96 flowRate,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Create flow by operator with context*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-27)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-4)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn updateFlowWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateflowwithctx) <a href="#fn-updateflowwithctx" id="fn-updateflowwithctx"></a>

```
function updateFlowWithCtx(
    contract ISuperToken token,
    address receiver,
    int96 flowRate,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Update flow with context*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-28)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-5)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn updateFlowFromWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateflowfromwithctx) <a href="#fn-updateflowfromwithctx" id="fn-updateflowfromwithctx"></a>

```
function updateFlowFromWithCtx(
    contract ISuperToken token,
    address sender,
    address receiver,
    int96 flowRate,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Update flow by operator with context*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-29)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-6)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn deleteFlowWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deleteflowwithctx) <a href="#fn-deleteflowwithctx" id="fn-deleteflowwithctx"></a>

```
function deleteFlowWithCtx(
    contract ISuperToken token,
    address sender,
    address receiver,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Delete flow with context*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-30)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-7)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn deleteFlowFromWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deleteflowfromwithctx) <a href="#fn-deleteflowfromwithctx" id="fn-deleteflowfromwithctx"></a>

```
function deleteFlowFromWithCtx(
    contract ISuperToken token,
    address sender,
    address receiver,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Delete flow by operator with context*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-31)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-8)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn getFlowRate[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getflowrate) <a href="#fn-getflowrate" id="fn-getflowrate"></a>

```
function getFlowRate(
    contract ISuperToken token,
    address sender,
    address receiver
) 
    internal 
    returns (int96 flowRate)
```

*get flow rate between two accounts for given token*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-32)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-9)

| Name       | Type  | Description   |
| ---------- | ----- | ------------- |
| `flowRate` | int96 | The flow rate |

### Fn getFlowInfo[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getflowinfo) <a href="#fn-getflowinfo" id="fn-getflowinfo"></a>

```
function getFlowInfo(
    contract ISuperToken token,
    address sender,
    address receiver
) 
    internal 
    returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)
```

*get flow info between two accounts for given token*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-33)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-10)

| 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 getNetFlowRate[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getnetflowrate) <a href="#fn-getnetflowrate" id="fn-getnetflowrate"></a>

```
function getNetFlowRate(
    contract ISuperToken token,
    address account
) 
    internal 
    returns (int96 flowRate)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-34)

| Name      | Type                 | Description         |
| --------- | -------------------- | ------------------- |
| `token`   | contract ISuperToken | Super token address |
| `account` | address              | Account to query    |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-11)

| Name       | Type  | Description                      |
| ---------- | ----- | -------------------------------- |
| `flowRate` | int96 | The net flow rate of the account |

### Fn getCFANetFlowRate[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getcfanetflowrate) <a href="#fn-getcfanetflowrate" id="fn-getcfanetflowrate"></a>

```
function getCFANetFlowRate(
    contract ISuperToken token,
    address account
) 
    internal 
    returns (int96 flowRate)
```

*get CFA net flow rate for given account for given token*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-35)

| Name      | Type                 | Description         |
| --------- | -------------------- | ------------------- |
| `token`   | contract ISuperToken | Super token address |
| `account` | address              | Account to query    |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-12)

| Name       | Type  | Description                      |
| ---------- | ----- | -------------------------------- |
| `flowRate` | int96 | The net flow rate of the account |

### Fn getGDANetFlowRate[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getgdanetflowrate) <a href="#fn-getgdanetflowrate" id="fn-getgdanetflowrate"></a>

```
function getGDANetFlowRate(
    contract ISuperToken token,
    address account
) 
    internal 
    returns (int96 flowRate)
```

*get GDA net flow rate for given account for given token*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-36)

| Name      | Type                 | Description         |
| --------- | -------------------- | ------------------- |
| `token`   | contract ISuperToken | Super token address |
| `account` | address              | Account to query    |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-13)

| Name       | Type  | Description                      |
| ---------- | ----- | -------------------------------- |
| `flowRate` | int96 | The net flow rate of the account |

### Fn getNetFlowInfo[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getnetflowinfo) <a href="#fn-getnetflowinfo" id="fn-getnetflowinfo"></a>

```
function getNetFlowInfo(
    contract ISuperToken token,
    address account
) 
    internal 
    returns (uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)
```

*get the aggregated flow info of the account*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-37)

| Name      | Type                 | Description         |
| --------- | -------------------- | ------------------- |
| `token`   | contract ISuperToken | Super token address |
| `account` | address              | Account to query    |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-14)

| 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 getBufferAmountByFlowRate[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getbufferamountbyflowrate) <a href="#fn-getbufferamountbyflowrate" id="fn-getbufferamountbyflowrate"></a>

```
function getBufferAmountByFlowRate(
    contract ISuperToken token,
    int96 flowRate
) 
    internal 
    returns (uint256 bufferAmount)
```

*calculate buffer for a flow rate*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-38)

| Name       | Type                 | Description                                     |
| ---------- | -------------------- | ----------------------------------------------- |
| `token`    | contract ISuperToken | The token used in flow                          |
| `flowRate` | int96                | The flowrate to calculate the needed buffer for |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-15)

| Name           | Type    | Description                                                                |
| -------------- | ------- | -------------------------------------------------------------------------- |
| `bufferAmount` | uint256 | The buffer amount based on flowRate, liquidationPeriod and minimum deposit |

### Fn getFlowPermissions[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getflowpermissions) <a href="#fn-getflowpermissions" id="fn-getflowpermissions"></a>

```
function getFlowPermissions(
    contract ISuperToken token,
    address sender,
    address flowOperator
) 
    internal 
    returns (bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance)
```

*get existing flow permissions*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-39)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-16)

| 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) |

### Fn getIndex[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getindex) <a href="#fn-getindex" id="fn-getindex"></a>

```
function getIndex(
    contract ISuperToken token,
    address publisher,
    uint32 indexId
) 
    internal 
    returns (bool exist, uint128 indexValue, uint128 totalUnitsApproved, uint128 totalUnitsPending)
```

*Gets an index by its ID and publisher.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-40)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-17)

| 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 calculateDistribution[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-calculatedistribution) <a href="#fn-calculatedistribution" id="fn-calculatedistribution"></a>

```
function calculateDistribution(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    uint256 amount
) 
    internal 
    returns (uint256 actualAmount, uint128 newIndexValue)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-41)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-18)

| Name            | Type    | Description                                             |
| --------------- | ------- | ------------------------------------------------------- |
| `actualAmount`  | uint256 | Amount to be distributed with correct rounding.         |
| `newIndexValue` | uint128 | The index value after the distribution would be called. |

### Fn listSubscriptions[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-listsubscriptions) <a href="#fn-listsubscriptions" id="fn-listsubscriptions"></a>

```
function listSubscriptions(
    contract ISuperToken token,
    address subscriber
) 
    internal 
    returns (address[] publishers, uint32[] indexIds, uint128[] unitsList)
```

*List all subscriptions of an address*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-42)

| Name         | Type                 | Description                             |
| ------------ | -------------------- | --------------------------------------- |
| `token`      | contract ISuperToken | Super token used in the indexes listed. |
| `subscriber` | address              | Subscriber address.                     |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-19)

| Name         | Type       | Description                 |
| ------------ | ---------- | --------------------------- |
| `publishers` | address\[] | Publishers of the indices.  |
| `indexIds`   | uint32\[]  | IDs of the indices.         |
| `unitsList`  | uint128\[] | Units owned of the indices. |

### Fn getSubscription[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getsubscription) <a href="#fn-getsubscription" id="fn-getsubscription"></a>

```
function getSubscription(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    address subscriber
) 
    internal 
    returns (bool exist, bool approved, uint128 units, uint256 pendingDistribution)
```

*Gets subscription by publisher, index id, and subscriber.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-43)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-20)

| 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 getSubscriptionByID[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getsubscriptionbyid) <a href="#fn-getsubscriptionbyid" id="fn-getsubscriptionbyid"></a>

```
function getSubscriptionByID(
    contract ISuperToken token,
    bytes32 agreementId
) 
    internal 
    returns (address publisher, uint32 indexId, bool approved, uint128 units, uint256 pendingDistribution)
```

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-44)

| Name          | Type                 | Description |
| ------------- | -------------------- | ----------- |
| `token`       | contract ISuperToken |             |
| `agreementId` | bytes32              |             |

### Fn getFlowDistributionFlowRate[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-getflowdistributionflowrate) <a href="#fn-getflowdistributionflowrate" id="fn-getflowdistributionflowrate"></a>

```
function getFlowDistributionFlowRate(
    contract ISuperToken token,
    address from,
    contract ITagomiPool to
) 
    internal 
    returns (int96)
```

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-45)

| Name    | Type                 | Description |
| ------- | -------------------- | ----------- |
| `token` | contract ISuperToken |             |
| `from`  | address              |             |
| `to`    | contract ITagomiPool |             |

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

### Fn estimateFlowDistributionActualFlowRate[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-estimateflowdistributionactualflowrate) <a href="#fn-estimateflowdistributionactualflowrate" id="fn-estimateflowdistributionactualflowrate"></a>

```
function estimateFlowDistributionActualFlowRate(
    contract ISuperToken token,
    address from,
    contract ITagomiPool to,
    int96 requestedFlowRate
) 
    internal 
    returns (int96 actualFlowRate, int96 totalDistributionFlowRate)
```

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-46)

| Name                | Type                 | Description |
| ------------------- | -------------------- | ----------- |
| `token`             | contract ISuperToken |             |
| `from`              | address              |             |
| `to`                | contract ITagomiPool |             |
| `requestedFlowRate` | int96                |             |

### Fn estimateDistributionActualAmount[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-estimatedistributionactualamount) <a href="#fn-estimatedistributionactualamount" id="fn-estimatedistributionactualamount"></a>

```
function estimateDistributionActualAmount(
    contract ISuperToken token,
    address from,
    contract ITagomiPool to,
    uint256 requestedAmount
) 
    internal 
    returns (uint256 actualAmount)
```

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-47)

| Name              | Type                 | Description |
| ----------------- | -------------------- | ----------- |
| `token`           | contract ISuperToken |             |
| `from`            | address              |             |
| `to`              | contract ITagomiPool |             |
| `requestedAmount` | uint256              |             |

### Fn isMemberConnected[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-ismemberconnected) <a href="#fn-ismemberconnected" id="fn-ismemberconnected"></a>

```
function isMemberConnected(
    contract ISuperToken token,
    address pool,
    address member
) 
    internal 
    returns (bool)
```

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-48)

| Name     | Type                 | Description |
| -------- | -------------------- | ----------- |
| `token`  | contract ISuperToken |             |
| `pool`   | address              |             |
| `member` | address              |             |

### Fn createIndex[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createindex) <a href="#fn-createindex" id="fn-createindex"></a>

```
function createIndex(
    contract ISuperToken token,
    uint32 indexId
) 
    internal 
    returns (bool)
```

*Creates a new index.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-49)

| Name      | Type                 | Description                      |
| --------- | -------------------- | -------------------------------- |
| `token`   | contract ISuperToken | Super Token used with the index. |
| `indexId` | uint32               | ID of the index.                 |

### Fn createIndex[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createindex-1) <a href="#fn-createindex-1" id="fn-createindex-1"></a>

```
function createIndex(
    contract ISuperToken token,
    uint32 indexId,
    bytes userData
) 
    internal 
    returns (bool)
```

*Creates a new index with userData.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-50)

| 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 updateIndexValue[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateindexvalue) <a href="#fn-updateindexvalue" id="fn-updateindexvalue"></a>

```
function updateIndexValue(
    contract ISuperToken token,
    uint32 indexId,
    uint128 indexValue
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-51)

| 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 updateIndexValue[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateindexvalue-1) <a href="#fn-updateindexvalue-1" id="fn-updateindexvalue-1"></a>

```
function updateIndexValue(
    contract ISuperToken token,
    uint32 indexId,
    uint128 indexValue,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-52)

| 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 distribute[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distribute) <a href="#fn-distribute" id="fn-distribute"></a>

```
function distribute(
    contract ISuperToken token,
    uint32 indexId,
    uint256 amount
) 
    internal 
    returns (bool)
```

*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**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-53)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distribute-wuserdata) <a href="#fn-distribute-wuserdata" id="fn-distribute-wuserdata"></a>

```
function distribute(
    contract ISuperToken token,
    uint32 indexId,
    uint256 amount,
    bytes userData
) 
    internal 
    returns (bool)
```

*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**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-54)

| 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 approveSubscription[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-approvesubscription) <a href="#fn-approvesubscription" id="fn-approvesubscription"></a>

```
function approveSubscription(
    contract ISuperToken token,
    address publisher,
    uint32 indexId
) 
    internal 
    returns (bool)
```

*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**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-55)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-approvesubscription-wuserdata) <a href="#fn-approvesubscription-wuserdata" id="fn-approvesubscription-wuserdata"></a>

```
function approveSubscription(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    bytes userData
) 
    internal 
    returns (bool)
```

*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**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-56)

| 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 revokeSubscription[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-revokesubscription) <a href="#fn-revokesubscription" id="fn-revokesubscription"></a>

```
function revokeSubscription(
    contract ISuperToken token,
    address publisher,
    uint32 indexId
) 
    internal 
    returns (bool)
```

*Revokes a previously approved subscription.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-57)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-revokesubscription-wuserdata) <a href="#fn-revokesubscription-wuserdata" id="fn-revokesubscription-wuserdata"></a>

```
function revokeSubscription(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-58)

| 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 updateSubscriptionUnits[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updatesubscriptionunits) <a href="#fn-updatesubscriptionunits" id="fn-updatesubscriptionunits"></a>

```
function updateSubscriptionUnits(
    contract ISuperToken token,
    uint32 indexId,
    address subscriber,
    uint128 units
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-59)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updatesubscriptionunits-wuserdata) <a href="#fn-updatesubscriptionunits-wuserdata" id="fn-updatesubscriptionunits-wuserdata"></a>

```
function updateSubscriptionUnits(
    contract ISuperToken token,
    uint32 indexId,
    address subscriber,
    uint128 units,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-60)

| 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 deleteSubscription[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deletesubscription) <a href="#fn-deletesubscription" id="fn-deletesubscription"></a>

```
function deleteSubscription(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    address subscriber
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-61)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deletesubscription-wuserdata) <a href="#fn-deletesubscription-wuserdata" id="fn-deletesubscription-wuserdata"></a>

```
function deleteSubscription(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    address subscriber,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-62)

| 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.                        |

### Fn claim[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-claim) <a href="#fn-claim" id="fn-claim"></a>

```
function claim(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    address subscriber
) 
    internal 
    returns (bool)
```

*Claims pending distribution. Subscription should not be approved*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-63)

| 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)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-claim-wuserdata) <a href="#fn-claim-wuserdata" id="fn-claim-wuserdata"></a>

```
function claim(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    address subscriber,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-64)

| 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 createIndexWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createindexwithctx) <a href="#fn-createindexwithctx" id="fn-createindexwithctx"></a>

```
function createIndexWithCtx(
    contract ISuperToken token,
    uint32 indexId,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-65)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-21)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn updateIndexValueWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updateindexvaluewithctx) <a href="#fn-updateindexvaluewithctx" id="fn-updateindexvaluewithctx"></a>

```
function updateIndexValueWithCtx(
    contract ISuperToken token,
    uint32 indexId,
    uint128 indexValue,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*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**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-66)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-22)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn distributeWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distributewithctx) <a href="#fn-distributewithctx" id="fn-distributewithctx"></a>

```
function distributeWithCtx(
    contract ISuperToken token,
    uint32 indexId,
    uint256 amount,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*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**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-67)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-23)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn approveSubscriptionWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-approvesubscriptionwithctx) <a href="#fn-approvesubscriptionwithctx" id="fn-approvesubscriptionwithctx"></a>

```
function approveSubscriptionWithCtx(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*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**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-68)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-24)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn revokeSubscriptionWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-revokesubscriptionwithctx) <a href="#fn-revokesubscriptionwithctx" id="fn-revokesubscriptionwithctx"></a>

```
function revokeSubscriptionWithCtx(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-69)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-25)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn updateSubscriptionUnitsWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updatesubscriptionunitswithctx) <a href="#fn-updatesubscriptionunitswithctx" id="fn-updatesubscriptionunitswithctx"></a>

```
function updateSubscriptionUnitsWithCtx(
    contract ISuperToken token,
    uint32 indexId,
    address subscriber,
    uint128 units,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-70)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-26)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn deleteSubscriptionWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-deletesubscriptionwithctx) <a href="#fn-deletesubscriptionwithctx" id="fn-deletesubscriptionwithctx"></a>

```
function deleteSubscriptionWithCtx(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    address subscriber,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-71)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-27)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn claimWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-claimwithctx) <a href="#fn-claimwithctx" id="fn-claimwithctx"></a>

```
function claimWithCtx(
    contract ISuperToken token,
    address publisher,
    uint32 indexId,
    address subscriber,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-72)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-28)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn createPool[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-createpool) <a href="#fn-createpool" id="fn-createpool"></a>

```
function createPool(
    contract ISuperToken token,
    address admin,
    struct PoolConfig poolConfig
) 
    internal 
    returns (contract ITagomiPool pool)
```

*Creates a new* Tagomi *Pool.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-73)

| 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:

```
struct PoolConfig {
    bool transferabilityForUnitsOwner;
    bool distributionFromAnyAddress;
}
```

* `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**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-29)

| Name   | Type                 | Description                             |
| ------ | -------------------- | --------------------------------------- |
| `pool` | contract ITagomiPool | The address of the deployed Tagomi Pool |

### Fn updateMemberUnits[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updatememberunits) <a href="#fn-updatememberunits" id="fn-updatememberunits"></a>

```
function updateMemberUnits(
    contract ISuperToken token,
    contract ITagomiPool pool,
    address memberAddress,
    uint128 newUnits
) 
    internal 
    returns (bool)
```

*Updates the units of a pool member.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-74)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-30)

| Name  | Type | Description                                                                |
| ----- | ---- | -------------------------------------------------------------------------- |
| `[0]` | bool | bool A boolean value indicating whether the pool was created successfully. |

### Fn updateMemberUnits (w/userData)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updatememberunits-wuserdata) <a href="#fn-updatememberunits-wuserdata" id="fn-updatememberunits-wuserdata"></a>

```
function updateMemberUnits(
    contract ISuperToken token,
    contract ITagomiPool pool,
    address memberAddress,
    uint128 newUnits,
    bytes userData
) 
    internal 
    returns (bool)
```

*Updates the units of a pool member.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-75)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-31)

| Name  | Type | Description                                                           |
| ----- | ---- | --------------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the pool was created successfully. |

### Fn claimAll[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-claimall) <a href="#fn-claimall" id="fn-claimall"></a>

```
function claimAll(
    contract ISuperToken token,
    contract ITagomiPool pool,
    address memberAddress
) 
    internal 
    returns (bool)
```

*Claims all tokens from the pool.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-76)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-32)

| Name  | Type | Description                                                  |
| ----- | ---- | ------------------------------------------------------------ |
| `[0]` | bool | A boolean value indicating whether the claim was successful. |

### Fn claimAll (w/userData)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-claimall-wuserdata) <a href="#fn-claimall-wuserdata" id="fn-claimall-wuserdata"></a>

```
function claimAll(
    contract ISuperToken token,
    contract ITagomiPool pool,
    address memberAddress,
    bytes userData
) 
    internal 
    returns (bool)
```

*Claims all tokens from the pool.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-77)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-33)

| Name  | Type | Description                                                  |
| ----- | ---- | ------------------------------------------------------------ |
| `[0]` | bool | A boolean value indicating whether the claim was successful. |

### Fn connectPool[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-connectpool) <a href="#fn-connectpool" id="fn-connectpool"></a>

```
function connectPool(
    contract ISuperToken token,
    contract ITagomiPool pool
) 
    internal 
    returns (bool)
```

*Connects a pool member to `pool`.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-78)

| Name    | Type                 | Description                 |
| ------- | -------------------- | --------------------------- |
| `token` | contract ISuperToken | The Super Token address.    |
| `pool`  | contract ITagomiPool | The Tagomi Pool to connect. |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-34)

| Name  | Type | Description                                                       |
| ----- | ---- | ----------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the connection was successful. |

### Fn connectPool (w/userData)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-connectpool-wuserdata) <a href="#fn-connectpool-wuserdata" id="fn-connectpool-wuserdata"></a>

```
function connectPool(
    contract ISuperToken token,
    contract ITagomiPool pool,
    bytes userData
) 
    internal 
    returns (bool)
```

*Connects a pool member to `pool`.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-79)

| Name       | Type                 | Description                 |
| ---------- | -------------------- | --------------------------- |
| `token`    | contract ISuperToken | The Super Token address.    |
| `pool`     | contract ITagomiPool | The Tagomi Pool to connect. |
| `userData` | bytes                | User-specific data.         |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-35)

| Name  | Type | Description                                                       |
| ----- | ---- | ----------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the connection was successful. |

### Fn disconnectPool[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-disconnectpool) <a href="#fn-disconnectpool" id="fn-disconnectpool"></a>

```
function disconnectPool(
    contract ISuperToken token,
    contract ITagomiPool pool
) 
    internal 
    returns (bool)
```

*Disconnects a pool member from `pool`.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-80)

| Name    | Type                 | Description                    |
| ------- | -------------------- | ------------------------------ |
| `token` | contract ISuperToken | The Super Token address.       |
| `pool`  | contract ITagomiPool | The Tagomi Pool to disconnect. |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-36)

| Name  | Type | Description                                                          |
| ----- | ---- | -------------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the disconnection was successful. |

### Fn disconnectPool (w/userData)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-disconnectpool-wuserdata) <a href="#fn-disconnectpool-wuserdata" id="fn-disconnectpool-wuserdata"></a>

```
function disconnectPool(
    contract ISuperToken token,
    contract ITagomiPool pool,
    bytes userData
) 
    internal 
    returns (bool)
```

*Disconnects a pool member from `pool`.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-81)

| Name       | Type                 | Description                    |
| ---------- | -------------------- | ------------------------------ |
| `token`    | contract ISuperToken | The Super Token address.       |
| `pool`     | contract ITagomiPool | The Tagomi Pool to disconnect. |
| `userData` | bytes                | User-specific data.            |

**Return Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-37)

| Name  | Type | Description                                                          |
| ----- | ---- | -------------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the disconnection was successful. |

### Fn distributeToPool[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distributetopool) <a href="#fn-distributetopool" id="fn-distributetopool"></a>

```
function distributeToPool(
    contract ISuperToken token,
    address from,
    contract ITagomiPool pool,
    uint256 requestedAmount
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-82)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-38)

| Name  | Type | Description                                                         |
| ----- | ---- | ------------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the distribution was successful. |

### Fn distribute (w/userData)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distribute-wuserdata-1) <a href="#fn-distribute-wuserdata-1" id="fn-distribute-wuserdata-1"></a>

```
function distribute(
    contract ISuperToken token,
    address from,
    contract ITagomiPool pool,
    uint256 requestedAmount,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-83)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-39)

| Name  | Type | Description                                                         |
| ----- | ---- | ------------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the distribution was successful. |

### Fn distributeFlow[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distributeflow) <a href="#fn-distributeflow" id="fn-distributeflow"></a>

```
function distributeFlow(
    contract ISuperToken token,
    address from,
    contract ITagomiPool pool,
    int96 requestedFlowRate
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-84)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-40)

| Name  | Type | Description                                                         |
| ----- | ---- | ------------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the distribution was successful. |

### Fn distributeFlow (w/userData)[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distributeflow-wuserdata) <a href="#fn-distributeflow-wuserdata" id="fn-distributeflow-wuserdata"></a>

```
function distributeFlow(
    contract ISuperToken token,
    address from,
    contract ITagomiPool pool,
    int96 requestedFlowRate,
    bytes userData
) 
    internal 
    returns (bool)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-85)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-41)

| Name  | Type | Description                                                         |
| ----- | ---- | ------------------------------------------------------------------- |
| `[0]` | bool | A boolean value indicating whether the distribution was successful. |

### Fn updateMemberUnitsWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-updatememberunitswithctx) <a href="#fn-updatememberunitswithctx" id="fn-updatememberunitswithctx"></a>

```
function updateMemberUnitsWithCtx(
    contract ISuperToken token,
    contract ITagomiPool pool,
    address memberAddress,
    uint128 newUnits,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Updates the units of a pool member.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-86)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-42)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn claimAllWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-claimallwithctx) <a href="#fn-claimallwithctx" id="fn-claimallwithctx"></a>

```
function claimAllWithCtx(
    contract ISuperToken token,
    contract ITagomiPool pool,
    address memberAddress,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Claims all tokens from the pool.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-87)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-43)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn connectPoolWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-connectpoolwithctx) <a href="#fn-connectpoolwithctx" id="fn-connectpoolwithctx"></a>

```
function connectPoolWithCtx(
    contract ISuperToken token,
    contract ITagomiPool pool,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Connects a pool member to `pool`.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-88)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-44)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn disconnectPoolWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-disconnectpoolwithctx) <a href="#fn-disconnectpoolwithctx" id="fn-disconnectpoolwithctx"></a>

```
function disconnectPoolWithCtx(
    contract ISuperToken token,
    contract ITagomiPool pool,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

*Disconnects a pool member from `pool`.*

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-89)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-45)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn distributeWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distributewithctx-1) <a href="#fn-distributewithctx-1" id="fn-distributewithctx-1"></a>

```
function distributeWithCtx(
    contract ISuperToken token,
    address from,
    contract ITagomiPool pool,
    uint256 requestedAmount,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-90)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-46)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |

### Fn distributeFlowWithCtx[​](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#fn-distributeflowwithctx) <a href="#fn-distributeflowwithctx" id="fn-distributeflowwithctx"></a>

```
function distributeFlowWithCtx(
    contract ISuperToken token,
    address from,
    contract ITagomiPool pool,
    int96 requestedFlowRate,
    bytes ctx
) 
    internal 
    returns (bytes newCtx)
```

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

**Parameters**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#parameters-91)

| 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 Values**[**​**](https://docs.superfluid.finance/docs/technical-reference/SuperTokenV1Library#return-values-47)

| Name     | Type  | Description                                                       |
| -------- | ----- | ----------------------------------------------------------------- |
| `newCtx` | bytes | The updated context after the execution of the agreement function |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tagomisystems.gitbook.io/tagomi-docs/supertokenv1library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
