ARPA Network
  • ARPA Network
  • Becoming a node & get rewarded
    • Native Staking
      • Introduction to Staking v0.1
    • Eigenlayer Integration
  • Randcast
    • Getting Started
      • Use Web GUI
        • Subscription Management Portal
        • Remix
      • Use Randcast CLI
      • Use Solidity Development Tools
    • Using the SDK
      • Adapter
      • BasicRandcastConsumerBase
      • GeneralRandcastConsumerBase
      • Randcast Utilities
      • Consumer Contract Examples
        • Example - Get Random Number
        • Example - Roll a Dice
        • Example - Shuffle an Array
        • Example - Draw a Lottery
        • Example - Pick a Property
        • Example - Pick a Rarity
        • Example - Pick a Winner
        • Example - Advanced Request
    • Supported Networks & Parameters
  • GitHub Repositories
Powered by GitBook
On this page
  1. Randcast
  2. Using the SDK

Adapter

Overview

The Adapter is designed to facilitate a range of functionalities, including subscription management, randomness generation, payment calculation, task assignment, rewards distribution, and data retrieval. Developed using the Solidity programming language, the contract operates on the Ethereum blockchain and employs safety mechanisms to ensure secure and reliable interactions. With a focus on extensibility and adaptability, the contract is well-suited for applications that require dynamic interactions, payment calculations, and randomness generation within a decentralized environment.

  • Subscription Management:

    • The contract allows creating and deleting subscriptions, each identified by a unique ID.

    • Each subscription can have multiple consumers, with a limit defined in the configuration.

    • Subscriptions can be funded by sending Ether to the contract.

  • Randomness Generation:

    • The contract includes functionality for requesting and fulfilling randomness.

    • Randomness requests have three types and are identified by request IDs.

    • The Adapter contract verifies the randomness and calls the callback function in the user's consumer contract.

  • Payment Calculation:

    • The contract includes functions to estimate and calculate payment amounts based on gas consumption.

    • Payments are calculated using various configurable fee tiers and gas parameters.

  • Data Retrieval:

    • The contract includes views and events to query data such as a consumer's last subscription, subscription details, pending requests, and historical callback and payment results.

  • Task Assignment:

    • The task is assigned to available groups using an algorithm that resembles round-robin scheduling.

  • Rewards Distribution:

    • The contract includes functionality for rewarding participants in the group based on the configuration.

  • Safety Mechanisms:

    • The contract includes nonReentrant and notPaused modifiers to prevent reentrancy attacks and ensure operations are only performed when the contract is not paused.

PreviousUsing the SDKNextBasicRandcastConsumerBase

Last updated 15 days ago

Note: The descriptions provided above are high-level summaries of the functionalities present in the Adapter.sol smart contract. For a detailed understanding of the code and its implementation, please refer to the full of the smart contract.

source code