RevenueTracker

The RevenueTracker contract serves as an intermediary that manages and tracks project revenue deposits, ensuring a transparent revenue flow from project teams to IMO token holders. It records all revenue deposits and forwards them to the IMO token contract for distribution.

Key Features

  • Secure revenue deposits handling.

  • Complete revenue history tracking.

  • Automated forwarding to the IMO token contract.

  • Project wallet management.

  • Detailed revenue reporting.

Contract Details

State Variables

imoToken: IERC20        // IMO token contract
revenueToken: IERC20    // Revenue token (USDT/native)
projectWallet: address  // Authorized depositor
totalRevenue: uint256   // Total deposits tracked
struct RevenueEntry {
    amount: uint256     // Deposit amount
    timestamp: uint256  // Deposit time
}
RevenueEntry[] public revenueHistory

Functions

Core Operations

depositRevenue(uint256 amount)

  • Purpose: Processes revenue deposits made by the project team.

  • Access: Project wallet only.

  • Requirements:

    • IMO token address to be set.

    • Amount > 0.

    • Overflow protection is in place.

  • Process Flow:

    1. Transfers revenue tokens from the project wallet.

    2. Updates the total revenue counter.

    3. Records the deposit in revenue history.

    4. Forwards tokens to the IMO token contract.

  • Events Triggered:

    • RevenueDeposited.

    • RevenueTransferredToIMOToken.

  • Error Cases:

    • IMO token address is not set.

    • Zero amount provided.

    • Transfer has failed.

    • Overflow protection mechanism has triggered.


Administrative Functions

constructor(address _projectWallet, address _revenueToken)

  • Purpose: Initializes the contract with core addresses.

  • Parameters:

    • _projectWallet: The address of the project wallet for revenue deposits.

    • _revenueToken: The address of the revenue token.

  • Validation:

    • Requires both addresses to be non-zero.

    • Addresses are immutable once set.


setIMOToken(address _imoToken)

  • Purpose: Sets the IMO token contract address.

  • Access: Owner only.

  • Restrictions:

    • One-time setting.

    • Cannot be zero address.

  • Events Triggered: IMOTokenSet.


updateProjectWallet(address _newProjectWallet)

  • Purpose: Updates the authorized project wallet address for deposits.

  • Access: Owner only.

  • Validation: Non-zero address.

  • Events Triggered: ProjectWalletUpdated.


View Functions

getRevenueData()

  • Purpose: Retrieves the complete history of revenue deposits.

  • Returns:

    • totalRevenueAmount: Total deposits made.

    • revenueEntries: An array of all deposit records.

  • Usage: Milestone verification and auditing.


Events

RevenueDeposited(
    address indexed sender, 
    uint256 amount
)
RevenueTransferredToIMOToken(
    uint256 amount
)
ProjectWalletUpdated(
    address newProjectWallet
)
IMOTokenSet(
    address indexed tokenAddress
)

Access Control

Modifiers

onlyProjectWallet()  // Project wallet access
onlyOwner()         // Administrative access

Authorization Levels

  1. Owner:

    • Set the IMO token address.

    • Update the project wallet address.

    • Perform contract administration.

  2. Project Wallet:

    • Deposit revenue into the contract.

    • Act as the primary operational user for revenue handling.

  3. Public:

    • View functions only.


Security Features

Reentrancy Protection

  • NonReentrant modifier on deposit function.

  • Secure transfer pattern for token handling.

Overflow Protection

  • Safe math operations.

  • Explicit overflow checks.

Access Controls

  • Role-based access.

  • Restricted access for administrative functions.


Integration Points

IMO Token Contract

  • Revenue forwarding destination.

  • Must be ERC-7641 compliant.

Revenue Token

  • Either USDT or the project's native token.

  • Standard ERC-20 interface.

MilestoneChecker

  • Uses revenue data for verification.

  • Tracks project performance.


Common Workflows

Revenue Depositing Process

  1. The project wallet approves revenue tokens.

  2. Calls depositRevenue, specifying amount.

  3. The Contract logs in the deposit details.

  4. Forwards tokens to the IMO contract.

  5. Emits appropriate events.

Revenue Verification

  1. MilestoneChecker requests revenue data.

  2. Analyzes deposit history.

  3. Verifies deposit data against milestones.

  4. Authorizes escrow releases.

Last updated