Skip to content

Commit

Permalink
check for the right public key emitted
Browse files Browse the repository at this point in the history
  • Loading branch information
mubarak23 committed May 15, 2024
1 parent ea89a17 commit 9b5e1e5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions onchain/src/social_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ pub mod SocialPayAccount {

#[cfg(test)]
mod tests {
use core::traits::Into;
use core::array::ArrayTrait;
use starknet::{
use starknet::{
ContractAddress, get_caller_address, get_contract_address, contract_address_const
};
use snforge_std as snf;
use snforge_std::{
declare, ContractClassTrait, start_prank, stop_prank, CheatTarget, spy_events, SpyOn,
EventSpy, EventFetcher, Event
EventSpy, EventFetcher, Event, EventAssertions
};
use super::{ISocialPayAccountDispatcher, ISocialPayAccountDispatcherTrait};

Expand All @@ -77,6 +78,10 @@ use starknet::{
let (_, event) = spy.events.at(0);
assert(event.keys.at(0) == @selector!("AccountCreated"), 'Wrong event name');

let key_felt252 = *event.keys.at(1);
let key: u256 = key_felt252.into();
assert(key == public_key, 'Wrong Public Key');

deployed_contract_address
}

Expand Down

0 comments on commit 9b5e1e5

Please sign in to comment.