Skip to main content

VibeFactory Contract

The VibeFactory contract is the core factory for creating Real-Time Asset (RTA) NFTs and managing their delegation system. It extends ERC-721 functionality with integrated delegation management.

Contract Overview

Address: 0x49B2E60fF51B107624be84363B718cfF292A0517
Standard: ERC-721 (NFT) with custom extensions
Features: RTA creation, delegation management, cross-contract integration

Core Functions

Creating RTAs

Basic RTA Creation

Creates a new RTA NFT with the specified parameters. Parameters:
  • mode: Stream mode identifier
  • storeToFilecoin: Whether to store content on Filecoin
  • distance: Geographic constraint in meters
  • metadataURI: IPFS URI for metadata
  • ticketsAmount: Number of tickets available (0 for no tickets)
  • ticketPrice: Price per ticket in wei
  • payPerStream: Enable real-time payments via PPM
  • streamPrice: Payment rate per minute in wei
Returns: The newly created RTA’s unique identifier

RTA Creation with Delegation

Creates an RTA and sets up delegation in a single transaction.

Delegation System

The VibeFactory implements a ProxyAdmin-based delegation system that allows RTA creators to authorize others to manage their vibestreams.

Setting Delegates

Sets a delegate for a specific RTA. Can only be called by:
  • ProxyAdmin
  • ProxyAdmin owner
  • RTA creator (through authorized addresses)

Removing Delegates

Removes the delegate for an RTA.

Authorization Management

Manages the global whitelist of authorized addresses that can perform delegation operations.

Access Control

Permission Hierarchy

  1. Contract Owner: Full administrative control
  2. ProxyAdmin: Delegation management across all RTAs
  3. Authorized Addresses: Global permissions for delegation
  4. RTA Creator: Permissions for their specific RTAs
  5. Delegates: Permissions for delegated RTAs

Modifier: canModifyVibestream

RTA Management

Metadata Updates

Updates the metadata URI for an RTA. Requires canModifyVibestream permission.

Finalization

Marks an RTA as finalized. This is a one-way operation that cannot be reversed.

Cross-Contract Integration

PPM Integration

When creating RTAs with payPerStream = true, the contract automatically registers the vibestream with the PPM contract:

VibeKiosk Integration

RTAs with ticketsAmount > 0 are registered with the VibeKiosk for ticket sales:

View Functions

RTA Data Retrieval

Returns complete RTA data structure.
Returns the current delegate for an RTA.
Checks if an address is globally authorized.

Events

RTA Creation

Delegation Events

Gas Optimization

Gas Buffer

The contract implements a gas buffer mechanism to prevent operations from failing due to insufficient gas:

Security Features

Reentrancy Protection

All state-changing functions use OpenZeppelin’s ReentrancyGuard:

Input Validation

Comprehensive validation on all parameters:

Usage Examples

Creating a Basic RTA

Creating RTA with Tickets and Delegation

Next Steps

PPM Contract

Learn about real-time payments

Delegation Guide

Understand delegation mechanics