// This file was automatically generated // VERSION = 1.0 use obi::{OBIDecode, OBIEncode, OBISchema}; use owasm_kit::{execute_entry_point, ext, oei, prepare_entry_point}; const DATA_SOURCE_ID: i64 = 677; #[derive(OBIDecode, OBISchema)] struct Input { symbols: Vec, multiplier: u64, } #[derive(OBIEncode, OBISchema)] struct Output { rates: Vec, } fn prepare_impl(input: Input) { let symbols = input.symbols; let symbol: String = symbols.get(0).unwrap().to_string(); if symbols.len() != 1 || symbol != "DEVTEST" { panic!("UNKNOWN_SYMBOL_{}", symbol) } oei::ask_external_data(0, DATA_SOURCE_ID, &[]) } fn execute_impl(input: Input) -> Output { if let Some(raw_rate) = ext::load_majority::(0) { Output { rates: vec![(raw_rate * input.multiplier as f64) as u64 ]} } else { panic!("INVALID_RATE"); } } prepare_entry_point!(prepare_impl); execute_entry_point!(execute_impl);