Overview
Below is an overview of the AGORA staking program
Introduction
The AGORA staking program is a DeFi solution designed for AGORA token holders to earn rewards through staking. This documentation covers the key features, functions, and processes involved in the staking program.
The contract was deployed on Base with the address: 0xfD3242410F7aC1E961b31f9CE98C33aBb9d09507
The source code has been published and is available on BaseScan:
A simple UI for interacting with the contract is available at:

Using the Staking Portal
Staking Tokens
Sign up for an account on the Agora App
Connect your wallet in your Account Dashboard

Navigate to the Staking Portal and check your available balance displayed at the bottom of the staking panel
Enter the amount you wish to stake in the input field, or click "MAX" to stake your entire balance
If this is your first time staking, you will be prompted to submit an approval transaction that allows the staking contract to use your tokens
Click "Stake AGORA" to confirm your transaction
This calls the
stake(amount)
function in the contractYour wallet will prompt you to approve the transaction
Unstaking Tokens
Navigate to the Unstake AGORA Tokens panel
Enter the amount you wish to unstake, or click "MAX" to unstake your entire staked balance
Note there is a cooldown period (1 hour) before you can unstake after staking
Click "Unstake AGORA" to confirm your transaction
This calls the
unstake(amount)
function in the contractYour tokens will be returned to your wallet upon successful completion
Managing Rewards
View your accumulated rewards in the Rewards panel
You have two options for your rewards:
Claim Rewards: Click the "Claim Rewards" button to withdraw your rewards to your wallet
This calls the
claimRewards()
function in the contract
Compound Rewards: Click the "Compound Rewards" button to add your rewards to your staked amount
This calls the
compoundRewards()
function in the contract
Viewing Your Staking Information
The dashboard provides key information about your staking position:
Your Stake: Total amount of AGORA tokens you have staked
Pool Share: Your percentage of the total staking pool
Rewards: Accumulated rewards available for claiming
Current Rate: Current APY based on the reward pool and total staked tokens
Total Staked: Total AGORA tokens staked across all users
Reward Pool Size: Total available rewards in the pool
Contract Functionality
Key Features
Flexible Staking & Unstaking: Stake and unstake AGORA tokens at any time (subject to cooldown periods)
Reward Distribution: Earn rewards proportional to your staked amount
Compounding: Option to compound rewards directly into your stake
Cooldown Periods: Protection against flash loan attacks and market manipulation
Emergency Protocols: Multi-signature emergency controls for enhanced security
Transparent Rewards: Real-time reward calculation and distribution
Reward Calculation
The staking contract uses a global index approach to calculate rewards:
A global reward index tracks accumulated rewards per staked token
When you stake, your personal index is set to the current global index
Rewards are calculated as the difference between the current global index and your personal index, multiplied by your staked amount
The global index updates whenever the reward state changes
The contract uses a rolling distribution mechanism, where the reward pool is always designed to distribute evenly over the next 365 days from the current moment. Each time the reward state updates, the system recalculates the per-second reward rate based on the current reward pool divided by the 365-day period, ensuring a consistent distribution timeline regardless of when rewards are added.
Cooldown Periods
To prevent flash loan attacks and market manipulation, the contract implements cooldown periods:
Stake Cooldown: Time required between staking and claiming rewards
Unstake Cooldown: Time required before unstaking is allowed
Reward Claim Cooldown: Time required between reward claims
Cooldown periods are currently set to 1 hour but can be adjusted by the contract administrator.
Funding of the Staking Program
The AGORA staking program is funded from three primary sources:
1. Initial Team Contributions
The AGORA team is allocating up to 100 million tokens to the staking program, added incrementally over time. This allocation serves as an alternative to a traditional airdrop, allowing token holders to earn rewards through active participation rather than passive distribution.
2. Uniswap LP Position Revenue
The revenue generated from Agora's liquidity provider (LP) position on Uniswap will be directed to the staking reward pool. This creates a sustainable source of rewards tied to actual trading activity of the token. This LP can be monitored on DexScreener.
3. Marketplace Revenue
Revenue generated from the AGORA marketplace application will contribute to the staking rewards. This aligns the success of the platform with staker rewards, creating a positive feedback loop where platform growth benefits token stakers.
Advanced Information
Additional View Functions
The contract provides several view functions that aren't directly exposed in the UI but can be accessed via blockchain explorers or direct contract interaction:
getPendingRewards(address)
: Check your pending rewardsgetUserStakedAmount(address)
: View your staked amountgetUserPoolPercentage(address)
: See what percentage of the total staking pool you owngetTimeUntilNextRewardClaim(address)
: Check when you can next claim rewardsgetUserStakingStats(address)
: Get comprehensive staking statisticsgetCurrentAPR()
: Get the current annual percentage rate
Security Features
The AGORA staking contract implements several security measures:
Reentrancy Guards: Protection against reentrancy attacks
Timelock Mechanisms: Large reward additions require a timelock period
Transfer Verification: Verifies actual amounts received in token transfers
Timelocked Recovery: Pending withdrawals have a recovery mechanism with timelock
Multi-signature Control: Critical functions require multiple approvals
Best Practices
Start Small: Begin with a smaller stake to understand the process
Be Aware of Gas Costs: Consider gas costs when claiming rewards
Monitor APR: Check the current APR regularly as it fluctuates
Compound for Growth: Consider compounding rewards to maximize returns
Understand Cooldowns: Be aware of cooldown periods when planning transactions
Technical Implementation
The contract is built on Solidity 0.8.20 and incorporates OpenZeppelin libraries for security and standardization:
AccessControl
for role-based permissionsReentrancyGuard
for protection against reentrancy attacksSafeERC20
for safe token transfersECDSA
for signature verification
Conclusion
The AGORA staking program provides a secure and efficient way to earn rewards on your AGORA tokens. By staking, you contribute to the stability of the AGORA ecosystem while earning proportional rewards from multiple revenue streams.
Last updated