TOGA
TOGA contract API reference for Superfluid protocol governance
The Transparent Ongoing Governance Agreement (TOGA) is a governance mechanism that allows token holders to become the "Patrician In Charge" (PIC) by posting a bond. The PIC can set exit rates for the Super Token.
Overview
TOGA provides:
- Bond-based governance for Super Tokens
- PIC (Patrician In Charge) system
- Exit rate management
- Minimum bond duration requirements
Read Functions
getCurrentPIC
Returns the current Patrician In Charge for a Super Token.
import { useReadToga } from '@sfpro/sdk/hook/core';
const { data: pic } = useReadToga({
address: '0x...',
functionName: 'getCurrentPIC',
args: [superToken],
});
import { togaAbi } from '@sfpro/sdk/abi/core';
const pic = await client.readContract({
address: '0x...',
abi: togaAbi,
functionName: 'getCurrentPIC',
args: [superToken],
});
import { readToga } from '@sfpro/sdk/action/core';
const pic = await readToga(client, {
address: '0x...',
functionName: 'getCurrentPIC',
args: [superToken],
});
getCurrentPICInfo
Returns detailed information about the current PIC including their bond and exit rate.
import { useReadToga } from '@sfpro/sdk/hook/core';
const { data } = useReadToga({
address: '0x...',
functionName: 'getCurrentPICInfo',
args: [superToken],
});
// data = { pic, bond, exitRate }
import { togaAbi } from '@sfpro/sdk/abi/core';
const { pic, bond, exitRate } = await client.readContract({
address: '0x...',
abi: togaAbi,
functionName: 'getCurrentPICInfo',
args: [superToken],
});
import { readToga } from '@sfpro/sdk/action/core';
const { pic, bond, exitRate } = await readToga(client, {
address: '0x...',
functionName: 'getCurrentPICInfo',
args: [superToken],
});
getDefaultExitRateFor
Calculates the default exit rate for a given bond amount.
getMaxExitRateFor
Calculates the maximum allowed exit rate for a given bond amount.
minBondDuration
Returns the minimum bond duration in seconds.
Write Functions
changeExitRate
Allows the current PIC to change the exit rate of the Super Token.
import { useWriteToga } from '@sfpro/sdk/hook/core';
const { writeContract } = useWriteToga();
await writeContract({
address: '0x...',
functionName: 'changeExitRate',
args: [superToken, newExitRate],
});
import { togaAbi } from '@sfpro/sdk/abi/core';
const hash = await client.writeContract({
address: '0x...',
abi: togaAbi,
functionName: 'changeExitRate',
args: [superToken, newExitRate],
});
import { writeToga } from '@sfpro/sdk/action/core';
const hash = await writeToga(client, {
address: '0x...',
functionName: 'changeExitRate',
args: [superToken, newExitRate],
});
tokensReceived
ERC777 token receiver hook that handles bond deposits to become the new PIC.
Related
- Super Token - The tokens governed by TOGA
- Host - Core Superfluid protocol contract