Skip to content

Commit

Permalink
#[type_abi] for structs and proxy regen
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaicalinluca committed Apr 22, 2024
1 parent dbf0e2b commit 4be479b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion contracts/core/price-aggregator/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ multiversx_sc::derive_imports!();

use crate::price_aggregator_data::{TimestampedPrice, TokenPair};

#[derive(TypeAbi, TopEncode)]
#[type_abi]
#[derive(TopEncode)]
pub struct NewRoundEvent<M: ManagedTypeApi> {
price: BigUint<M>,
timestamp: u64,
Expand Down
12 changes: 8 additions & 4 deletions contracts/core/price-aggregator/src/price_aggregator_data.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
multiversx_sc::imports!();
multiversx_sc::derive_imports!();

#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, TypeAbi, Clone)]
#[type_abi]
#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, Clone)]
pub struct TokenPair<M: ManagedTypeApi> {
pub from: ManagedBuffer<M>,
pub to: ManagedBuffer<M>,
}

#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, TypeAbi)]
#[type_abi]
#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)]
pub struct PriceFeed<M: ManagedTypeApi> {
pub round_id: u32,
pub from: ManagedBuffer<M>,
Expand All @@ -17,14 +19,16 @@ pub struct PriceFeed<M: ManagedTypeApi> {
pub decimals: u8,
}

#[derive(TopEncode, TopDecode, TypeAbi, Debug, PartialEq, Eq)]
#[type_abi]
#[derive(TopEncode, TopDecode, Debug, PartialEq, Eq)]
pub struct TimestampedPrice<M: ManagedTypeApi> {
pub price: BigUint<M>,
pub timestamp: u64,
pub decimals: u8,
}

#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, TypeAbi, Debug, PartialEq, Eq)]
#[type_abi]
#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, Debug, PartialEq, Eq)]
pub struct OracleStatus {
pub accepted_submissions: u64,
pub total_submissions: u64,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ where
}
}

#[derive(TopEncode, TopDecode)]
#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)]
pub struct PriceFeed<Api>
where
Api: ManagedTypeApi,
Expand All @@ -353,7 +353,7 @@ where
pub decimals: u8,
}

#[derive(TopEncode, TopDecode)]
#[derive(TopEncode)]
pub struct NewRoundEvent<Api>
where
Api: ManagedTypeApi,
Expand Down

0 comments on commit 4be479b

Please sign in to comment.