| Crates.io | rialo-aggregator-interface |
| lib.rs | rialo-aggregator-interface |
| version | 0.1.10 |
| created_at | 2025-12-08 19:42:49.316488+00 |
| updated_at | 2025-12-09 21:52:52.619549+00 |
| description | Instructions and constructors for aggregators program |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1974273 |
| size | 59,878 |
This crate provides the standardized interface for building aggregator programs in the Rialo ecosystem. It defines the common instruction set and account structure that all aggregator implementations should follow.
The Rialo Aggregator Interface serves as the foundation for programs that consume oracle data and transform it into processed outputs. This interface ensures consistency across different aggregator implementations while providing flexibility for various aggregation strategies.
The interface defines a single instruction type:
Aggregate {}: The primary instruction for processing oracle data and generating aggregated resultsThe AggregatorInstruction::aggregate() function creates properly formatted instructions with the required account
structure:
pub fn aggregate(
aggregator_program_id: &Pubkey,
payer: &Pubkey,
oracle_report: &Pubkey,
aggregated_data_key: &Pubkey,
) -> Instruction
All aggregator programs following this interface expect accounts in this specific order:
Payer Account (AccountMeta::new(payer, true))
Oracle Report Account (AccountMeta::new_readonly(oracle_report, false))
Aggregated Data Account (AccountMeta::new(aggregated_data_key, false))
System Program Account (AccountMeta::new_readonly(system_program::id(), false))
When implementing an aggregator program using this interface:
match instruction {
AggregatorInstruction::Aggregate {} => {
// Your aggregation logic here
// 1. Read oracle data from oracle_report_account
// 2. Process/aggregate the data
// 3. Store results in aggregated_data_account
// 4. Optionally emit events
}
}
ProgramError variantsmsg!() macrouse rialo_aggregator_interface::instruction::AggregatorInstruction;
use rialo_s_pubkey::Pubkey;
let aggregator_program_id = Pubkey::new_unique();
let payer_pubkey = Pubkey::new_unique();
let oracle_report_pubkey = Pubkey::new_unique();
let topic = String::from("price_feed");
let instruction = AggregatorInstruction::aggregate(
&aggregator_program_id,
&payer_pubkey,
&oracle_report_pubkey,
topic,
);
use rialo_aggregator_interface::instruction::AggregatorInstruction;
pub fn process_instruction(
program_id: &Pubkey,
accounts: &[AccountInfo<'_>],
instruction_data: &[u8],
) -> ProgramResult {
let instruction: AggregatorInstruction =
limited_deserialize(instruction_data, rialo_limits::MAX_INSTRUCTION_DATA_SIZE)?;
match instruction {
AggregatorInstruction::Aggregate {} => {
// Implement your specific aggregation logic
process_aggregate(program_id, accounts)
}
}
}
This interface supports various aggregation strategies:
Aggregator programs built with this interface integrate seamlessly with:
The interface includes comprehensive tests demonstrating proper usage:
#[test]
fn test_aggregate() {
let instruction = AggregatorInstruction::aggregate(
&program_id,
&payer,
&oracle_report,
&aggregated_data_key,
);
// Verify instruction structure and serializability
}
serde: Serialization and deserialization supportrialo_s_instruction: Solana instruction creation utilitiesrialo_s_program: Core Solana program typesrialo_s_pubkey: Public key handlingCopyright (c) Subzero Labs, Inc. SPDX-License-Identifier: Apache-2.0