From 15daea3f276c10957547c061bc9b3fce04fb6cb1 Mon Sep 17 00:00:00 2001 From: akhercha Date: Wed, 25 Oct 2023 15:24:11 +0200 Subject: [PATCH] feat(log_data_indexes): Update SerializableDict with custom i128 --- src/event/event_utils_sandbox.cairo | 5 +++-- src/utils/i128.cairo | 1 + src/utils/serializable_dict.cairo | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/event/event_utils_sandbox.cairo b/src/event/event_utils_sandbox.cairo index 238186f0..05c9711f 100644 --- a/src/event/event_utils_sandbox.cairo +++ b/src/event/event_utils_sandbox.cairo @@ -3,7 +3,7 @@ use starknet::{ contract_address_const }; use array::ArrayTrait; -use satoru::utils::i128::{I128Serde, I128Default}; +use satoru::utils::i128::i128; use traits::Default; use satoru::utils::traits::ContractAddressDefault; @@ -47,9 +47,10 @@ impl Felt252IntoContractAddress of Into { impl I128252DictValue of Felt252DictValue { #[inline(always)] fn zero_default() -> i128 nopanic { - 0 + i128 { mag: 0, sign: false } } } + impl ContractAddressDictValue of Felt252DictValue { #[inline(always)] fn zero_default() -> ContractAddress nopanic { diff --git a/src/utils/i128.cairo b/src/utils/i128.cairo index 256f8e72..5e63680e 100644 --- a/src/utils/i128.cairo +++ b/src/utils/i128.cairo @@ -739,3 +739,4 @@ fn ensure_non_negative_zero(mag: u128, sign: bool) -> i128 { // } // } + diff --git a/src/utils/serializable_dict.cairo b/src/utils/serializable_dict.cairo index 43729ec0..43f03f03 100644 --- a/src/utils/serializable_dict.cairo +++ b/src/utils/serializable_dict.cairo @@ -110,7 +110,7 @@ trait SerializableFelt252DictTrait { fn contains_key(self: @SerializableFelt252Dict, key: felt252) -> bool; /// Checks if a dictionnary is empty. fn is_empty(self: @SerializableFelt252Dict) -> bool; -/// TODO: When Cairo is updated we can use unique() from Alexandria & have fn len() +/// TODO: When Scarb is updated we can use unique() from Alexandria & have fn len() } impl SerializableFelt252DictTraitImpl<