From 5ae7fafdd20abf4b1e789b83af5db7e23ad39a7c Mon Sep 17 00:00:00 2001 From: Thomas Marchand Date: Tue, 23 Apr 2024 10:53:58 +0100 Subject: [PATCH] feat: add migration function --- Scarb.toml | 4 ++-- src/identity/main.cairo | 5 +++++ src/interface/identity.cairo | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Scarb.toml b/Scarb.toml index 4f99135..861d942 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -9,8 +9,8 @@ repository = "https://github.com/starknet-id/identity" [dependencies] starknet = "2.6.3" -openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", rev = "a83f36b23f1af6e160288962be4a2701c3ecbcda" } -storage_read = { git = "https://github.com/starknet-id/storage_read_component.git", rev = "c7a640371d0336cc09b907154cbfeec743739ff9" } +openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", rev = "0697004db74502ce49900edef37331dd03531356" } +storage_read = { git = "https://github.com/starknet-id/storage_read_component.git", rev = "6440184cc078188d1efeab1283d1698738cde435" } [[target.starknet-contract]] sierra = true diff --git a/src/identity/main.cairo b/src/identity/main.cairo index dad3de6..577700b 100644 --- a/src/identity/main.cairo +++ b/src/identity/main.cairo @@ -312,5 +312,10 @@ mod Identity { ) ); } + + fn migrate(ref self: ContractState, token_uri: ByteArray) { + self.ownable.assert_only_owner(); + self.erc721.initializer("Starknet.id", "ID", token_uri); + } } } diff --git a/src/interface/identity.cairo b/src/interface/identity.cairo index 1327d02..3af15e8 100644 --- a/src/interface/identity.cairo +++ b/src/interface/identity.cairo @@ -60,4 +60,8 @@ trait IIdentity { fn set_extended_verifier_data( ref self: TContractState, id: u128, field: felt252, data: Span, domain: u32 ); + + fn migrate( + ref self: TContractState, token_uri: ByteArray + ); }