From 15c9bbd7f9c7b4912798c9b240a4cf216a7005b6 Mon Sep 17 00:00:00 2001 From: Thomas Marchand Date: Tue, 12 Mar 2024 20:55:29 +0000 Subject: [PATCH] fix: ERC721 owner_of causes panic --- src/identity/main.cairo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/identity/main.cairo b/src/identity/main.cairo index 1210139..954af2a 100644 --- a/src/identity/main.cairo +++ b/src/identity/main.cairo @@ -175,7 +175,7 @@ mod Identity { fn get_main_id(self: @ContractState, user: ContractAddress) -> u128 { let main_id = self.main_id_by_addr.read(user); - if self.erc721._owner_of(main_id.into()) == user { + if self.owner_from_id(main_id) == user { main_id } else { // if you transfer your main_id to someone, it is no longer your main_id @@ -255,7 +255,7 @@ mod Identity { fn set_main_id(ref self: ContractState, id: u128) { let caller = get_caller_address(); - assert(caller == self.erc721._owner_of(id.into()), 'you don\'t own this id'); + assert(caller == self.owner_from_id(id), 'you don\'t own this id'); self.main_id_by_addr.write(caller, id); self.emit(Event::MainIdUpdate(MainIdUpdate { id, owner: caller })); } @@ -273,7 +273,7 @@ mod Identity { ref self: ContractState, id: u128, field: felt252, data: felt252, domain: u32 ) { let caller = get_caller_address(); - assert(caller == self.erc721._owner_of(id.into()), 'you don\'t own this id'); + assert(caller == self.owner_from_id(id), 'you don\'t own this id'); self.user_data.write((id, field), data); self.emit(Event::UserDataUpdate(UserDataUpdate { id, field, _data: data })) } @@ -282,7 +282,7 @@ mod Identity { ref self: ContractState, id: u128, field: felt252, data: Span, domain: u32 ) { let caller = get_caller_address(); - assert(caller == self.erc721._owner_of(id.into()), 'you don\'t own this id'); + assert(caller == self.owner_from_id(id), 'you don\'t own this id'); self.set(USER_DATA_ADDR, array![id.into(), field].span(), data, domain); self .emit(