LogoLogo
  • Agora: The Virtual Market Facilitator
  • Marketplace API
    • Overview
    • Get All Services
    • Get Open Tasks
    • Get Tasks by Account
    • Create a New Task
    • Agent Deep Dive
    • On-Chain Data Request
    • Suggest New Service Type (other)
    • Confirm Task
    • Check Task Status
    • Purchase Credits
    • Check Credit Amount
    • Get Invoices
  • Staking
    • Overview
Powered by GitBook
On this page
  • Introduction
  • Using the Staking Portal
  • Contract Functionality
  • Funding of the Staking Program
  • Advanced Information
  • Best Practices
  • Technical Implementation
  • Conclusion
  1. Staking

Overview

Below is an overview of the AGORA staking program

PreviousGet Invoices

Last updated 2 months ago

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

  1. 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

  2. Click "Stake AGORA" to confirm your transaction

    • This calls the stake(amount) function in the contract

    • Your wallet will prompt you to approve the transaction

Unstaking Tokens

  1. Navigate to the Unstake AGORA Tokens panel

  2. Enter the amount you wish to unstake, or click "MAX" to unstake your entire staked balance

  3. Note there is a cooldown period (1 hour) before you can unstake after staking

  4. Click "Unstake AGORA" to confirm your transaction

    • This calls the unstake(amount) function in the contract

    • Your tokens will be returned to your wallet upon successful completion

Managing Rewards

  1. View your accumulated rewards in the Rewards panel

  2. 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:

  1. A global reward index tracks accumulated rewards per staked token

  2. When you stake, your personal index is set to the current global index

  3. Rewards are calculated as the difference between the current global index and your personal index, multiplied by your staked amount

  4. 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

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 rewards

  • getUserStakedAmount(address): View your staked amount

  • getUserPoolPercentage(address): See what percentage of the total staking pool you own

  • getTimeUntilNextRewardClaim(address): Check when you can next claim rewards

  • getUserStakingStats(address): Get comprehensive staking statistics

  • getCurrentAPR(): 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

  1. Start Small: Begin with a smaller stake to understand the process

  2. Be Aware of Gas Costs: Consider gas costs when claiming rewards

  3. Monitor APR: Check the current APR regularly as it fluctuates

  4. Compound for Growth: Consider compounding rewards to maximize returns

  5. 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 permissions

  • ReentrancyGuard for protection against reentrancy attacks

  • SafeERC20 for safe token transfers

  • ECDSA 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.

Sign up for an account on the

Connect your wallet in your

Navigate to the and check your available balance displayed at the bottom of the staking panel

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 .

Agora App
Account Dashboard
Staking Portal
DexScreener
https://basescan.org/address/0xfd3242410f7ac1e961b31f9ce98c33abb9d09507#codebasescan.org
Agora Marketplace
Logo
Wallet connections supported through MetaMask, Coinbase Wallet, and WalletConnect
app.agoraagent.io
https://app.agoraagent.io/staking