diff --git a/Scarb.toml b/Scarb.toml index b7fa650..cece744 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -3,11 +3,11 @@ name = "resolver" version = "0.1.0" [dependencies] -starknet = "2.3.1" -naming = { git = "https://github.com/starknet-id/naming.git", rev = "6e45f7fc2bc9e8e9d874a1d2c2d46e3226a96f6d" } -openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", rev = "f3e2a5f0547a429c716f32471b06df729cbdfb9f" } -identity = { git = "https://github.com/starknet-id/identity.git", rev = "eb37846330b78e1410cf5e3e17a5dcca5652f921" } -storage_read = { git = "https://github.com/starknet-id/storage_read_component.git", rev = "c6c69e15d34abfc39ac51dc21b96724e2e19ff31" } +starknet = "2.6.3" +naming = { git = "https://github.com/starknet-id/naming.git", rev = "7fa861a7a6e56c96ba3b508c66d7587d2597385a" } +openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", rev = "0697004db74502ce49900edef37331dd03531356" } +identity = { git = "https://github.com/starknet-id/identity.git", rev = "2185e542838c639be5cee47979e2462822000fd0" } +storage_read = { git = "https://github.com/starknet-id/storage_read_component.git", rev = "6440184cc078188d1efeab1283d1698738cde435" } [[target.starknet-contract]] # Enable Sierra codegen. diff --git a/src/resolver.cairo b/src/resolver.cairo index 38c9602..65d51e1 100644 --- a/src/resolver.cairo +++ b/src/resolver.cairo @@ -2,12 +2,15 @@ mod Resolver { use core::option::OptionTrait; use core::traits::TryInto; - use core::array::SpanTrait; use starknet::{ContractAddress, get_block_timestamp}; use ecdsa::check_ecdsa_signature; use resolver::interface::resolver::{IResolver, IResolverDispatcher, IResolverDispatcherTrait}; use storage_read::{main::storage_read_component, interface::IStorageRead}; use openzeppelin::access::ownable::OwnableComponent; + use core::starknet::storage::{ + StoragePointerReadAccess, StoragePointerWriteAccess, + Map, StoragePathEntry + }; component!(path: storage_read_component, storage: storage_read, event: StorageReadEvent); component!(path: OwnableComponent, storage: ownable, event: OwnableEvent); @@ -21,7 +24,7 @@ mod Resolver { #[storage] struct Storage { public_key: felt252, - uri: LegacyMap<(felt252, felt252), felt252>, + uri: Map<(felt252, felt252), felt252>, #[substorage(v0)] storage_read: storage_read_component::Storage, #[substorage(v0)] @@ -51,7 +54,7 @@ mod Resolver { self.public_key.write(_public_key); } - #[external(v0)] + #[abi(embed_v0)] impl ResolverImpl of IResolver { fn resolve( self: @ContractState, domain: Span, field: felt252, hint: Span @@ -127,8 +130,8 @@ mod Resolver { fn remove_uri(ref self: ContractState, index: felt252) { self.ownable.assert_only_owner(); - let uri_removed = self.get_uri_at_index(index).span(); - self.emit(StarknetIDOffChainResolverUpdate { uri_added: array![].span(), uri_removed }); + let uri_removed = self.get_uri_at_index(index); + self.emit(StarknetIDOffChainResolverUpdate { uri_added: array![].span(), uri_removed: uri_removed.span() }); self.uri.write((index, 0), 'this call was removed'); } }