GDA
GDA contract API reference for distributing tokens to multiple recipients
The General Distribution Agreement (GDA) enables efficient distribution of tokens to multiple recipients through a pool-based system. It's designed for scalable airdrops, rewards distribution, and multi-recipient streaming.
Overview
The GDA contract provides:
- Pool creation and management
- Proportional distribution to pool members
- Instant and streaming distributions
- Gas-efficient multi-recipient transfers
Read Functions
getPool
Returns information about a distribution pool.
import { useReadGda } from '@sfpro/sdk/hook/core';
const { data: pool } = useReadGda({
address: '0x...',
functionName: 'getPool',
args: [token, poolAddress],
});
import { gdaAbi } from '@sfpro/sdk/abi/core';
const pool = await client.readContract({
address: '0x...',
abi: gdaAbi,
functionName: 'getPool',
args: [token, poolAddress],
});
import { readGda } from '@sfpro/sdk/action/core';
const pool = await readGda(client, {
address: '0x...',
functionName: 'getPool',
args: [token, poolAddress],
});
getMemberFlowRate
Returns the flow rate a member receives from a pool.
getPoolAdjustmentFlowRate
Returns the adjustment flow rate for a pool.
isPool
Checks if an address is a registered pool.
Write Functions
createPool
Creates a new distribution pool through the Host contract.
import { useWriteGda } from '@sfpro/sdk/hook/core';
const { writeContract } = useWriteGda();
await writeContract({
address: '0x...',
functionName: 'createPool',
args: [token, admin, poolConfig],
});
import { gdaAbi } from '@sfpro/sdk/abi/core';
// Note: GDA operations must be called through the Host contract
const callData = encodeFunctionData({
abi: gdaAbi,
functionName: 'createPool',
args: [token, admin, poolConfig],
});
// Use the forwarder contract for direct calls
import { writeGda } from '@sfpro/sdk/action/core';
const hash = await writeGda(client, {
address: '0x...',
functionName: 'createPool',
args: [token, admin, poolConfig],
});
updateMemberUnits
Updates a member's units (share) in the pool.
distribute
Distributes tokens instantly to all pool members.
distributeFlow
Creates or updates a continuous distribution stream to the pool.
connectPool
Connects a member to a pool to start receiving distributions.
disconnectPool
Disconnects a member from a pool.
Related
- GDA Forwarder - Simplified interface for GDA operations
- Host Contract - Required for direct GDA calls
- Super Token - Tokens used in distributions