Skip to content

Commit

Permalink
feat(log_data_indexes): Update SerializableDict with custom i128
Browse files Browse the repository at this point in the history
  • Loading branch information
akhercha committed Oct 25, 2023
1 parent 38d5c81 commit 15daea3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/event/event_utils_sandbox.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -47,9 +47,10 @@ impl Felt252IntoContractAddress of Into<felt252, ContractAddress> {
impl I128252DictValue of Felt252DictValue<i128> {
#[inline(always)]
fn zero_default() -> i128 nopanic {
0
i128 { mag: 0, sign: false }
}
}

impl ContractAddressDictValue of Felt252DictValue<ContractAddress> {
#[inline(always)]
fn zero_default() -> ContractAddress nopanic {
Expand Down
1 change: 1 addition & 0 deletions src/utils/i128.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -739,3 +739,4 @@ fn ensure_non_negative_zero(mag: u128, sign: bool) -> i128 {
// }
// }


2 changes: 1 addition & 1 deletion src/utils/serializable_dict.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ trait SerializableFelt252DictTrait<T> {
fn contains_key(self: @SerializableFelt252Dict<T>, key: felt252) -> bool;
/// Checks if a dictionnary is empty.
fn is_empty(self: @SerializableFelt252Dict<T>) -> 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<
Expand Down

0 comments on commit 15daea3

Please sign in to comment.