GDAv1Forwarder
The GDAv1Forwarder contract is a Superfluid forwarder that implements the General Distribution Agreement (GDA) related functions. It is a contract specifically made immutable in order to facilitate the interaction with Distributions through the General Distribution Agreement (GDA).
This contract is optimized for interaction that would happen from ourside the blockchain (off-chain). For more information on the best practices regarding this interaction, please refer the Interact Off-Chain section of this documentation.
ABI
In order to interact with the GDAv1Forwarder
contract, you can use the following ABI:
Click here to show GDAv1Forwarder
ABI
[
{
"inputs": [
{
"internalType": "contract ISuperfluid",
"name": "host",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
},
{ "internalType": "address", "name": "memberAddress", "type": "address" },
{ "internalType": "bytes", "name": "userData", "type": "bytes" }
],
"name": "claimAll",
"outputs": [{ "internalType": "bool", "name": "success", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
},
{ "internalType": "bytes", "name": "userData", "type": "bytes" }
],
"name": "connectPool",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidToken",
"name": "token",
"type": "address"
},
{ "internalType": "address", "name": "admin", "type": "address" },
{
"components": [
{
"internalType": "bool",
"name": "transferabilityForUnitsOwner",
"type": "bool"
},
{
"internalType": "bool",
"name": "distributionFromAnyAddress",
"type": "bool"
}
],
"internalType": "struct PoolConfig",
"name": "config",
"type": "tuple"
}
],
"name": "createPool",
"outputs": [
{ "internalType": "bool", "name": "success", "type": "bool" },
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
},
{ "internalType": "bytes", "name": "userData", "type": "bytes" }
],
"name": "disconnectPool",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidToken",
"name": "token",
"type": "address"
},
{ "internalType": "address", "name": "from", "type": "address" },
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
},
{
"internalType": "uint256",
"name": "requestedAmount",
"type": "uint256"
},
{ "internalType": "bytes", "name": "userData", "type": "bytes" }
],
"name": "distribute",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidToken",
"name": "token",
"type": "address"
},
{ "internalType": "address", "name": "from", "type": "address" },
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
},
{ "internalType": "int96", "name": "requestedFlowRate", "type": "int96" },
{ "internalType": "bytes", "name": "userData", "type": "bytes" }
],
"name": "distributeFlow",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidToken",
"name": "token",
"type": "address"
},
{ "internalType": "address", "name": "from", "type": "address" },
{
"internalType": "contract ISuperfluidPool",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "requestedAmount",
"type": "uint256"
}
],
"name": "estimateDistributionActualAmount",
"outputs": [
{ "internalType": "uint256", "name": "actualAmount", "type": "uint256" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidToken",
"name": "token",
"type": "address"
},
{ "internalType": "address", "name": "from", "type": "address" },
{
"internalType": "contract ISuperfluidPool",
"name": "to",
"type": "address"
},
{ "internalType": "int96", "name": "requestedFlowRate", "type": "int96" }
],
"name": "estimateFlowDistributionActualFlowRate",
"outputs": [
{ "internalType": "int96", "name": "actualFlowRate", "type": "int96" },
{
"internalType": "int96",
"name": "totalDistributionFlowRate",
"type": "int96"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidToken",
"name": "token",
"type": "address"
},
{ "internalType": "address", "name": "from", "type": "address" },
{
"internalType": "contract ISuperfluidPool",
"name": "to",
"type": "address"
}
],
"name": "getFlowDistributionFlowRate",
"outputs": [{ "internalType": "int96", "name": "", "type": "int96" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidToken",
"name": "token",
"type": "address"
},
{ "internalType": "address", "name": "account", "type": "address" }
],
"name": "getNetFlow",
"outputs": [{ "internalType": "int96", "name": "", "type": "int96" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
}
],
"name": "getPoolAdjustmentFlowInfo",
"outputs": [
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "bytes32", "name": "", "type": "bytes32" },
{ "internalType": "int96", "name": "", "type": "int96" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "pool", "type": "address" }
],
"name": "getPoolAdjustmentFlowRate",
"outputs": [{ "internalType": "int96", "name": "", "type": "int96" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
},
{ "internalType": "address", "name": "member", "type": "address" }
],
"name": "isMemberConnected",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidToken",
"name": "token",
"type": "address"
},
{ "internalType": "address", "name": "account", "type": "address" }
],
"name": "isPool",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ISuperfluidPool",
"name": "pool",
"type": "address"
},
{ "internalType": "address", "name": "memberAddress", "type": "address" },
{ "internalType": "uint128", "name": "newUnits", "type": "uint128" },
{ "internalType": "bytes", "name": "userData", "type": "bytes" }
],
"name": "updateMemberUnits",
"outputs": [{ "internalType": "bool", "name": "success", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
}
]
_gda
contract IGeneralDistributionAgreementV1 _gda
Fn constructor
function constructor(
contract ISuperfluid host
)
public
Parameters
Name | Type | Description |
---|---|---|
host | contract ISuperfluid |
Fn createPool
function createPool(
contract ISuperfluidToken token,
address admin,
struct PoolConfig config
)
external
returns (bool success, contract ISuperfluidPool pool)
Creates a new Superfluid Pool.
Parameters
Name | Type | Description |
---|---|---|
token | contract ISuperfluidToken | The Super Token address. |
admin | address | The pool admin address. |
config | struct PoolConfig | The pool configuration (see PoolConfig in IGeneralDistributionAgreementV1.sol) |
Return Values
Name | Type | Description |
---|---|---|
success | bool | A boolean value indicating whether the pool was created successfully. |
pool | contract ISuperfluidPool | The address of the deployed Superfluid Pool |
Fn updateMemberUnits
function updateMemberUnits(
contract ISuperfluidPool pool,
address memberAddress,
uint128 newUnits,
bytes userData
)
external
returns (bool success)
Updates the units of a pool member.
Parameters
Name | Type | Description |
---|---|---|
pool | contract ISuperfluidPool | The Superfluid 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. |
Fn claimAll
function claimAll(
contract ISuperfluidPool pool,
address memberAddress,
bytes userData
)
external
returns (bool success)
Claims all tokens from the pool.
Parameters
Name | Type | Description |
---|---|---|
pool | contract ISuperfluidPool | The Superfluid Pool to claim from. |
memberAddress | address | The address of the member to claim for. |
userData | bytes | User-specific data. |
Fn connectPool
function connectPool(
contract ISuperfluidPool pool,
bytes userData
)
external
returns (bool)
Connects a pool member to pool
.
Parameters
Name | Type | Description |
---|---|---|
pool | contract ISuperfluidPool | The Superfluid Pool to connect. |
userData | bytes | User-specific data. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A boolean value indicating whether the connection was successful. |
Fn disconnectPool
function disconnectPool(
contract ISuperfluidPool pool,
bytes userData
)
external
returns (bool)
Disconnects a pool member from pool
.
Parameters
Name | Type | Description |
---|---|---|
pool | contract ISuperfluidPool | The Superfluid Pool to disconnect. |
userData | bytes | User-specific data. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A boolean value indicating whether the disconnection was successful. |
Fn distribute
function distribute(
contract ISuperfluidToken token,
address from,
contract ISuperfluidPool pool,
uint256 requestedAmount,
bytes userData
)
external
returns (bool)
Tries to distribute requestedAmount
amount of token
from from
to pool
.
Parameters
Name | Type | Description |
---|---|---|
token | contract ISuperfluidToken | The Super Token address. |
from | address | The address from which to distribute tokens. |
pool | contract ISuperfluidPool | The Superfluid Pool address. |
requestedAmount | uint256 | The amount of tokens to distribute. |
userData | bytes | User-specific data. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A boolean value indicating whether the distribution was successful. |
Fn distributeFlow
function distributeFlow(
contract ISuperfluidToken token,
address from,
contract ISuperfluidPool pool,
int96 requestedFlowRate,
bytes userData
)
external
returns (bool)
Tries to distribute flow at requestedFlowRate
of token
from from
to pool
.
Parameters
Name | Type | Description |
---|---|---|
token | contract ISuperfluidToken | The Super Token address. |
from | address | The address from which to distribute tokens. |
pool | contract ISuperfluidPool | The Superfluid Pool address. |
requestedFlowRate | int96 | The flow rate of tokens to distribute. |
userData | bytes | User-specific data. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A boolean value indicating whether the distribution was successful. |
Fn isPool
function isPool(
contract ISuperfluidToken token,
address account
)
external
returns (bool)
Checks if the specified account is a pool.
Parameters
Name | Type | Description |
---|---|---|
token | contract ISuperfluidToken | The Super Token address. |
account | address | The account address to check. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A boolean value indicating whether the account is a pool. |
Fn getNetFlow
function getNetFlow(
contract ISuperfluidToken token,
address account
)
external
returns (int96)
Gets the GDA net flow rate for the specified account.
Parameters
Name | Type | Description |
---|---|---|
token | contract ISuperfluidToken | The Super Token address. |
account | address | The account address. |
Return Values
Name | Type | Description |
---|---|---|
[0] | int96 | The gda net flow rate for the account. |
Fn getFlowDistributionFlowRate
function getFlowDistributionFlowRate(
contract ISuperfluidToken token,
address from,
contract ISuperfluidPool to
)
external
returns (int96)
Gets the flow rate of tokens between the specified accounts.
Parameters
Name | Type | Description |
---|---|---|
token | contract ISuperfluidToken | The Super Token address. |
from | address | The sender address. |
to | contract ISuperfluidPool | The receiver address (the pool address). |
Return Values
Name | Type | Description |
---|---|---|
[0] | int96 | The flow distribution flow rate |
Fn getPoolAdjustmentFlowRate
function getPoolAdjustmentFlowRate(
address pool
)
external
returns (int96)
Gets the pool adjustment flow rate for the specified pool.
Parameters
Name | Type | Description |
---|---|---|
pool | address | The pool address. |
Return Values
Name | Type | Description |
---|---|---|
[0] | int96 | The pool adjustment flow rate. |
Fn estimateFlowDistributionActualFlowRate
function estimateFlowDistributionActualFlowRate(
contract ISuperfluidToken token,
address from,
contract ISuperfluidPool to,
int96 requestedFlowRate
)
external
returns (int96 actualFlowRate, int96 totalDistributionFlowRate)
Estimates the actual flow rate for flow distribution to the specified pool.
Parameters
Name | Type | Description |
---|---|---|
token | contract ISuperfluidToken | The Super Token address. |
from | address | The sender address. |
to | contract ISuperfluidPool | The pool address. |
requestedFlowRate | int96 | The requested flow rate. |
Return Values
Name | Type | Description |
---|---|---|
actualFlowRate | int96 | |
totalDistributionFlowRate | int96 |
Fn estimateDistributionActualAmount
function estimateDistributionActualAmount(
contract ISuperfluidToken token,
address from,
contract ISuperfluidPool to,
uint256 requestedAmount
)
external
returns (uint256 actualAmount)
Estimates the actual amount for distribution to the specified pool.
Parameters
Name | Type | Description |
---|---|---|
token | contract ISuperfluidToken | The Super Token address. |
from | address | The sender address. |
to | contract ISuperfluidPool | The pool address. |
requestedAmount | uint256 | The requested amount. |
Return Values
Name | Type | Description |
---|---|---|
actualAmount | uint256 | The actual amount for distribution. |
Fn isMemberConnected
function isMemberConnected(
contract ISuperfluidPool pool,
address member
)
external
returns (bool)
Checks if the specified member is connected to the pool.
Parameters
Name | Type | Description |
---|---|---|
pool | contract ISuperfluidPool | The Superfluid Pool address. |
member | address | The member address. |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | A boolean value indicating whether the member is connected to the pool. |
Fn getPoolAdjustmentFlowInfo
function getPoolAdjustmentFlowInfo(
contract ISuperfluidPool pool
)
external
returns (address, bytes32, int96)
Gets the pool adjustment flow information for the specified pool.
Parameters
Name | Type | Description |
---|---|---|
pool | contract ISuperfluidPool | The pool address. |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The pool admin, pool ID, and pool adjustment flow rate. |
[1] | bytes32 | |
[2] | int96 |