Skip to main content

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

NameTypeDescription
hostcontract 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

NameTypeDescription
tokencontract ISuperfluidTokenThe Super Token address.
adminaddressThe pool admin address.
configstruct PoolConfigThe pool configuration (see PoolConfig in IGeneralDistributionAgreementV1.sol)

Return Values

NameTypeDescription
successboolA boolean value indicating whether the pool was created successfully.
poolcontract ISuperfluidPoolThe 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

NameTypeDescription
poolcontract ISuperfluidPoolThe Superfluid Pool to update.
memberAddressaddressThe address of the member to update.
newUnitsuint128The new units of the member.
userDatabytesUser-specific data.

Fn claimAll

function claimAll(
contract ISuperfluidPool pool,
address memberAddress,
bytes userData
)
external
returns (bool success)

Claims all tokens from the pool.

Parameters

NameTypeDescription
poolcontract ISuperfluidPoolThe Superfluid Pool to claim from.
memberAddressaddressThe address of the member to claim for.
userDatabytesUser-specific data.

Fn connectPool

function connectPool(
contract ISuperfluidPool pool,
bytes userData
)
external
returns (bool)

Connects a pool member to pool.

Parameters

NameTypeDescription
poolcontract ISuperfluidPoolThe Superfluid Pool to connect.
userDatabytesUser-specific data.

Return Values

NameTypeDescription
[0]boolA 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

NameTypeDescription
poolcontract ISuperfluidPoolThe Superfluid Pool to disconnect.
userDatabytesUser-specific data.

Return Values

NameTypeDescription
[0]boolA 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

NameTypeDescription
tokencontract ISuperfluidTokenThe Super Token address.
fromaddressThe address from which to distribute tokens.
poolcontract ISuperfluidPoolThe Superfluid Pool address.
requestedAmountuint256The amount of tokens to distribute.
userDatabytesUser-specific data.

Return Values

NameTypeDescription
[0]boolA 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

NameTypeDescription
tokencontract ISuperfluidTokenThe Super Token address.
fromaddressThe address from which to distribute tokens.
poolcontract ISuperfluidPoolThe Superfluid Pool address.
requestedFlowRateint96The flow rate of tokens to distribute.
userDatabytesUser-specific data.

Return Values

NameTypeDescription
[0]boolA 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

NameTypeDescription
tokencontract ISuperfluidTokenThe Super Token address.
accountaddressThe account address to check.

Return Values

NameTypeDescription
[0]boolA 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

NameTypeDescription
tokencontract ISuperfluidTokenThe Super Token address.
accountaddressThe account address.

Return Values

NameTypeDescription
[0]int96The 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

NameTypeDescription
tokencontract ISuperfluidTokenThe Super Token address.
fromaddressThe sender address.
tocontract ISuperfluidPoolThe receiver address (the pool address).

Return Values

NameTypeDescription
[0]int96The flow distribution flow rate

Fn getPoolAdjustmentFlowRate

function getPoolAdjustmentFlowRate(
address pool
)
external
returns (int96)

Gets the pool adjustment flow rate for the specified pool.

Parameters

NameTypeDescription
pooladdressThe pool address.

Return Values

NameTypeDescription
[0]int96The 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

NameTypeDescription
tokencontract ISuperfluidTokenThe Super Token address.
fromaddressThe sender address.
tocontract ISuperfluidPoolThe pool address.
requestedFlowRateint96The requested flow rate.

Return Values

NameTypeDescription
actualFlowRateint96
totalDistributionFlowRateint96

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

NameTypeDescription
tokencontract ISuperfluidTokenThe Super Token address.
fromaddressThe sender address.
tocontract ISuperfluidPoolThe pool address.
requestedAmountuint256The requested amount.

Return Values

NameTypeDescription
actualAmountuint256The 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

NameTypeDescription
poolcontract ISuperfluidPoolThe Superfluid Pool address.
memberaddressThe member address.

Return Values

NameTypeDescription
[0]boolA 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

NameTypeDescription
poolcontract ISuperfluidPoolThe pool address.

Return Values

NameTypeDescription
[0]addressThe pool admin, pool ID, and pool adjustment flow rate.
[1]bytes32
[2]int96