From fb60b15765e7d45e06c84dff147b50ba112a0fa7 Mon Sep 17 00:00:00 2001 From: Iris Date: Wed, 27 Mar 2024 16:58:10 +0100 Subject: [PATCH] feat: add storage read component --- Scarb.toml | 1 + src/resolver.cairo | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Scarb.toml b/Scarb.toml index c4f5698..b7fa650 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -7,6 +7,7 @@ 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" } [[target.starknet-contract]] # Enable Sierra codegen. diff --git a/src/resolver.cairo b/src/resolver.cairo index 485094c..261dbfe 100644 --- a/src/resolver.cairo +++ b/src/resolver.cairo @@ -6,13 +6,29 @@ mod Resolver { 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}; + + component!(path: storage_read_component, storage: storage_read, event: StorageReadEvent); + + #[abi(embed_v0)] + impl StorageReadImpl = storage_read_component::StorageRead; #[storage] struct Storage { public_key: felt252, uri: LegacyMap, + #[substorage(v0)] + storage_read: storage_read_component::Storage, } + #[event] + #[derive(Drop, starknet::Event)] + enum Event { + #[flat] + StorageReadEvent: storage_read_component::Event, + } + + #[constructor] fn constructor(ref self: ContractState, _public_key: felt252, uri: Span) { self.public_key.write(_public_key);