Skip to main content
The GlobalParams contract is the central configuration contract for the Oak Network protocol. It manages protocol-wide parameters, platform listings, fees, and administrative access control.

Overview

Key Features

  • Protocol Administration: Centralized protocol admin for emergency operations
  • Platform Management: List, delist, and configure platforms
  • Fee Configuration: Manage protocol and platform fees
  • Token Management: Set default token address for campaigns
  • Platform Data: Store platform-specific metadata
  • Access Control: Role-based permissions for protocol and platform admins

State Variables

Protocol Configuration

Platform Management

Platform Data

Functions

Platform Management

Enlist Platform

Parameters:
  • platformHash: Unique platform identifier
  • platformAdminAddress: Platform administrator address
  • platformFeePercent: Platform fee percentage
Effects:
  • Lists the platform in the protocol
  • Sets platform administrator
  • Configures platform fee
  • Emits PlatformEnlisted event
Requirements:
  • Only callable by owner
  • Platform must not already be listed
  • Admin address must be non-zero

Delist Platform

Parameters:
  • platformHash: Platform identifier to delist
Effects:
  • Removes platform from listings
  • Emits PlatformDelisted event
Requirements:
  • Only callable by owner
  • Platform must be listed

Check If Platform Is Listed

Parameters:
  • platformHash: Platform identifier
Returns:
  • True if platform is listed

Get Number Of Listed Platforms

Returns:
  • Total number of listed platforms

Protocol Configuration

Get Protocol Admin Address

Returns:
  • Protocol administrator address

Update Protocol Admin Address

Parameters:
  • newAdminAddress: New protocol admin address
Effects:
  • Updates protocol admin
  • Emits ProtocolAdminAddressUpdated event
Requirements:
  • Only callable by owner
  • Address must be non-zero

Get Token Address

Returns:
  • Default campaign token address

Update Token Address

Parameters:
  • newTokenAddress: New token address
Effects:
  • Updates default token address
  • Emits TokenAddressUpdated event
Requirements:
  • Only callable by owner
  • Address must be non-zero

Get Protocol Fee Percent

Returns:
  • Protocol fee percentage

Update Protocol Fee Percent

Parameters:
  • newFeePercent: New protocol fee percentage
Effects:
  • Updates protocol fee
  • Emits ProtocolFeePercentUpdated event
Requirements:
  • Only callable by owner

Platform Configuration

Get Platform Admin Address

Parameters:
  • platformHash: Platform identifier
Returns:
  • Platform admin address

Update Platform Admin Address

Parameters:
  • platformHash: Platform identifier
  • newAdminAddress: New admin address
Effects:
  • Updates platform admin
  • Emits PlatformAdminAddressUpdated event
Requirements:
  • Only callable by platform admin
  • Address must be non-zero

Get Platform Fee Percent

Parameters:
  • platformHash: Platform identifier
Returns:
  • Platform fee percentage

Update Platform Fee Percent

Parameters:
  • platformHash: Platform identifier
  • newFeePercent: New platform fee percentage
Effects:
  • Updates platform fee
Requirements:
  • Only callable by platform admin

Platform Data Management

Add Platform Data

Parameters:
  • platformHash: Platform identifier
  • platformDataKey: Data key to add
Effects:
  • Stores platform data key
  • Emits PlatformDataAdded event
Requirements:
  • Only callable by platform admin
  • Data key must not already exist

Remove Platform Data

Parameters:
  • platformHash: Platform identifier
  • platformDataKey: Data key to remove
Effects:
  • Removes platform data key
  • Emits PlatformDataRemoved event
Requirements:
  • Only callable by platform admin

Check Platform Data

Parameters:
  • platformHash: Platform identifier
  • platformDataKey: Data key to check
Returns:
  • True if data key exists

Modifiers

notAddressZero

Effect: Reverts if address is zero

onlyPlatformAdmin

Effect: Restricts access to platform admin only Parameters:
  • platformHash: Platform identifier

Events

PlatformEnlisted

Emitted when: New platform is enlisted

PlatformDelisted

Emitted when: Platform is delisted

ProtocolAdminAddressUpdated

Emitted when: Protocol admin address changes

TokenAddressUpdated

Emitted when: Default token address changes

ProtocolFeePercentUpdated

Emitted when: Protocol fee percentage changes

PlatformAdminAddressUpdated

Emitted when: Platform admin address changes

PlatformDataAdded

Emitted when: Platform data key is added

PlatformDataRemoved

Emitted when: Platform data key is removed

Errors

GlobalParamsInvalidInput

Emitted when: Invalid input provided

GlobalParamsPlatformAlreadyListed

Emitted when: Attempting to list already-listed platform

GlobalParamsPlatformNotListed

Emitted when: Operation attempted on non-listed platform

Usage Examples

Platform Registration

Protocol Configuration

Platform Management

Querying Platform Data

Campaign Creation Flow

Security Considerations

Access Control

  • Owner Only: Critical operations (enlist/delist platforms, update protocol params) restricted to owner
  • Platform Admin: Platform-specific configurations managed by platform admins
  • Protocol Admin: Emergency and maintenance operations

Input Validation

  • Non-Zero Addresses: All address inputs validated for non-zero values
  • Fee Limits: Consider implementing reasonable fee bounds
  • Platform Validation: Platform listing verified before operations

Upgradeability

  • Owner Transfer: Ownership can be transferred to new admin
  • Fee Changes: Fee percentages can be updated without redeployment
  • Platform Changes: Platforms can be delisted without affecting existing campaigns

Integration Notes

With CampaignInfoFactory

With Campaign Contracts

Event Monitoring

Best Practices

Fee Management

  • Set reasonable fee percentages (typically 1-10%)
  • Document fee structure clearly
  • Consider implementing fee limits in contract

Platform Administration

  • Use multi-sig wallets for platform admins
  • Keep admin keys secure
  • Monitor platform configurations regularly

Event Logging

  • Listen to all events for audit trail
  • Store event data off-chain
  • Implement alerting for critical changes

Next Steps