pub trait PriceAggregator:
ContractBase
+ Sized
+ PauseModule
+ StakingModule
+ EventsModule {
Show 29 methods
// Required methods
fn pair_decimals(
&self,
from: &ManagedBuffer<Self::Api>,
to: &ManagedBuffer<Self::Api>,
) -> SingleValueMapper<Self::Api, Option<u8>>;
fn submission_count(&self) -> SingleValueMapper<Self::Api, usize>;
fn oracle_status(
&self,
) -> MapMapper<Self::Api, ManagedAddress<Self::Api>, OracleStatus>;
fn rounds(
&self,
) -> MapStorageMapper<Self::Api, TokenPair<Self::Api>, VecMapper<Self::Api, TimestampedPrice<Self::Api>>>;
fn first_submission_timestamp(
&self,
token_pair: &TokenPair<Self::Api>,
) -> SingleValueMapper<Self::Api, u64>;
fn last_submission_timestamp(
&self,
token_pair: &TokenPair<Self::Api>,
) -> SingleValueMapper<Self::Api, u64>;
fn submissions(
&self,
) -> MapStorageMapper<Self::Api, TokenPair<Self::Api>, MapMapper<Self::Api, ManagedAddress<Self::Api>, BigUint<Self::Api>>>;
// Provided methods
fn init(
&self,
staking_token: EgldOrEsdtTokenIdentifier<Self::Api>,
staking_amount: BigUint<Self::Api>,
slash_amount: BigUint<Self::Api>,
slash_quorum: usize,
submission_count: usize,
oracles: MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>,
) { ... }
fn upgrade(&self) { ... }
fn change_amounts(
&self,
staking_amount: BigUint<Self::Api>,
slash_amount: BigUint<Self::Api>,
) { ... }
fn add_oracles(
&self,
oracles: MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>,
) { ... }
fn remove_oracles(
&self,
submission_count: usize,
oracles: MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>,
) { ... }
fn submit(
&self,
from: ManagedBuffer<Self::Api>,
to: ManagedBuffer<Self::Api>,
submission_timestamp: u64,
price: BigUint<Self::Api>,
decimals: u8,
) { ... }
fn submit_unchecked(
&self,
from: ManagedBuffer<Self::Api>,
to: ManagedBuffer<Self::Api>,
price: BigUint<Self::Api>,
decimals: u8,
) { ... }
fn require_valid_submission_timestamp(&self, submission_timestamp: u64) { ... }
fn submit_batch(
&self,
submissions: MultiValueEncoded<Self::Api, MultiValue5<ManagedBuffer<Self::Api>, ManagedBuffer<Self::Api>, u64, BigUint<Self::Api>, u8>>,
) { ... }
fn require_is_oracle(&self) { ... }
fn require_valid_submission_count(&self, submission_count: usize) { ... }
fn create_new_round(
&self,
token_pair: TokenPair<Self::Api>,
round: usize,
submissions: MapMapper<Self::Api, ManagedAddress<Self::Api>, BigUint<Self::Api>>,
decimals: u8,
) { ... }
fn latest_round_data(
&self,
) -> MultiValueEncoded<Self::Api, PriceFeed<Self::Api>> { ... }
fn latest_price_feed(
&self,
from: ManagedBuffer<Self::Api>,
to: ManagedBuffer<Self::Api>,
) -> MultiValue6<u32, ManagedBuffer<Self::Api>, ManagedBuffer<Self::Api>, u64, BigUint<Self::Api>, u8> { ... }
fn latest_price_feed_optional(
&self,
from: ManagedBuffer<Self::Api>,
to: ManagedBuffer<Self::Api>,
) -> OptionalValue<MultiValue6<u32, ManagedBuffer<Self::Api>, ManagedBuffer<Self::Api>, u64, BigUint<Self::Api>, u8>> { ... }
fn set_submission_count(&self, submission_count: usize) { ... }
fn make_price_feed(
&self,
token_pair: TokenPair<Self::Api>,
round_values: VecMapper<Self::Api, TimestampedPrice<Self::Api>>,
) -> PriceFeed<Self::Api> { ... }
fn get_oracles(
&self,
) -> MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>> { ... }
fn clear_submissions(&self, token_pair: &TokenPair<Self::Api>) { ... }
fn set_pair_decimals(
&self,
from: ManagedBuffer<Self::Api>,
to: ManagedBuffer<Self::Api>,
decimals: u8,
) { ... }
fn check_decimals(
&self,
from: &ManagedBuffer<Self::Api>,
to: &ManagedBuffer<Self::Api>,
decimals: u8,
) { ... }
fn get_pair_decimals(
&self,
from: &ManagedBuffer<Self::Api>,
to: &ManagedBuffer<Self::Api>,
) -> u8 { ... }
}
Required Methods§
fn pair_decimals( &self, from: &ManagedBuffer<Self::Api>, to: &ManagedBuffer<Self::Api>, ) -> SingleValueMapper<Self::Api, Option<u8>>
fn submission_count(&self) -> SingleValueMapper<Self::Api, usize>
fn oracle_status( &self, ) -> MapMapper<Self::Api, ManagedAddress<Self::Api>, OracleStatus>
fn rounds( &self, ) -> MapStorageMapper<Self::Api, TokenPair<Self::Api>, VecMapper<Self::Api, TimestampedPrice<Self::Api>>>
fn first_submission_timestamp( &self, token_pair: &TokenPair<Self::Api>, ) -> SingleValueMapper<Self::Api, u64>
fn last_submission_timestamp( &self, token_pair: &TokenPair<Self::Api>, ) -> SingleValueMapper<Self::Api, u64>
fn submissions( &self, ) -> MapStorageMapper<Self::Api, TokenPair<Self::Api>, MapMapper<Self::Api, ManagedAddress<Self::Api>, BigUint<Self::Api>>>
Provided Methods§
fn init( &self, staking_token: EgldOrEsdtTokenIdentifier<Self::Api>, staking_amount: BigUint<Self::Api>, slash_amount: BigUint<Self::Api>, slash_quorum: usize, submission_count: usize, oracles: MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>, )
fn upgrade(&self)
fn change_amounts( &self, staking_amount: BigUint<Self::Api>, slash_amount: BigUint<Self::Api>, )
fn add_oracles( &self, oracles: MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>, )
Sourcefn remove_oracles(
&self,
submission_count: usize,
oracles: MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>,
)
fn remove_oracles( &self, submission_count: usize, oracles: MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>, )
Also receives submission count, so the owner does not have to update it manually with setSubmissionCount before this call
fn submit( &self, from: ManagedBuffer<Self::Api>, to: ManagedBuffer<Self::Api>, submission_timestamp: u64, price: BigUint<Self::Api>, decimals: u8, )
fn submit_unchecked( &self, from: ManagedBuffer<Self::Api>, to: ManagedBuffer<Self::Api>, price: BigUint<Self::Api>, decimals: u8, )
fn require_valid_submission_timestamp(&self, submission_timestamp: u64)
fn submit_batch( &self, submissions: MultiValueEncoded<Self::Api, MultiValue5<ManagedBuffer<Self::Api>, ManagedBuffer<Self::Api>, u64, BigUint<Self::Api>, u8>>, )
fn require_is_oracle(&self)
fn require_valid_submission_count(&self, submission_count: usize)
fn create_new_round( &self, token_pair: TokenPair<Self::Api>, round: usize, submissions: MapMapper<Self::Api, ManagedAddress<Self::Api>, BigUint<Self::Api>>, decimals: u8, )
fn latest_round_data( &self, ) -> MultiValueEncoded<Self::Api, PriceFeed<Self::Api>>
fn latest_price_feed( &self, from: ManagedBuffer<Self::Api>, to: ManagedBuffer<Self::Api>, ) -> MultiValue6<u32, ManagedBuffer<Self::Api>, ManagedBuffer<Self::Api>, u64, BigUint<Self::Api>, u8>
fn latest_price_feed_optional( &self, from: ManagedBuffer<Self::Api>, to: ManagedBuffer<Self::Api>, ) -> OptionalValue<MultiValue6<u32, ManagedBuffer<Self::Api>, ManagedBuffer<Self::Api>, u64, BigUint<Self::Api>, u8>>
fn set_submission_count(&self, submission_count: usize)
fn make_price_feed( &self, token_pair: TokenPair<Self::Api>, round_values: VecMapper<Self::Api, TimestampedPrice<Self::Api>>, ) -> PriceFeed<Self::Api>
fn get_oracles(&self) -> MultiValueEncoded<Self::Api, ManagedAddress<Self::Api>>
fn clear_submissions(&self, token_pair: &TokenPair<Self::Api>)
fn set_pair_decimals( &self, from: ManagedBuffer<Self::Api>, to: ManagedBuffer<Self::Api>, decimals: u8, )
fn check_decimals( &self, from: &ManagedBuffer<Self::Api>, to: &ManagedBuffer<Self::Api>, decimals: u8, )
fn get_pair_decimals( &self, from: &ManagedBuffer<Self::Api>, to: &ManagedBuffer<Self::Api>, ) -> u8
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.