From cab53f721fda861baebc8a56bb6f68ccb0f9dd1a Mon Sep 17 00:00:00 2001 From: Jordy Romuald <87231934+JordyRo1@users.noreply.github.com> Date: Thu, 10 Aug 2023 13:51:24 +0200 Subject: [PATCH] fix: admin initializer (#13) --- src/oracle/oracle.cairo | 2 ++ src/tests/test_oracle.cairo | 3 ++- src/tests/test_summary_stats.cairo | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/oracle/oracle.cairo b/src/oracle/oracle.cairo index a26bf8bd..edd7be7e 100644 --- a/src/oracle/oracle.cairo +++ b/src/oracle/oracle.cairo @@ -516,10 +516,12 @@ mod Oracle { #[constructor] fn constructor( ref self: ContractState, + admin_address: ContractAddress, publisher_registry_address: ContractAddress, currencies: Span, pairs: Span ) { + self.set_admin_address(admin_address); self.oracle_publisher_registry_address_storage.write(publisher_registry_address); self._set_keys_currencies(currencies); self._set_keys_pairs(pairs); diff --git a/src/tests/test_oracle.cairo b/src/tests/test_oracle.cairo index ab1d9f15..9d21841f 100644 --- a/src/tests/test_oracle.cairo +++ b/src/tests/test_oracle.cairo @@ -127,7 +127,7 @@ fn setup() -> (IPublisherRegistryABIDispatcher, IOracleABIDispatcher) { ); let admin = contract_address_const::<0x123456789>(); - set_caller_address(admin); + set_contract_address(admin); set_block_timestamp(BLOCK_TIMESTAMP); set_chain_id(CHAIN_ID); let now = 100000; @@ -144,6 +144,7 @@ fn setup() -> (IPublisherRegistryABIDispatcher, IOracleABIDispatcher) { //Deploy the oracle let mut oracle_calldata = ArrayTrait::::new(); + admin.serialize(ref oracle_calldata); publisher_registry_address.serialize(ref oracle_calldata); currencies.serialize(ref oracle_calldata); pairs.serialize(ref oracle_calldata); diff --git a/src/tests/test_summary_stats.cairo b/src/tests/test_summary_stats.cairo index f1d7f910..dbd140f0 100644 --- a/src/tests/test_summary_stats.cairo +++ b/src/tests/test_summary_stats.cairo @@ -107,7 +107,7 @@ fn setup() -> (ISummaryStatsABIDispatcher, IOracleABIDispatcher) { ); let admin = contract_address_const::<0x123456789>(); - set_caller_address(admin); + set_contract_address(admin); set_block_timestamp(BLOCK_TIMESTAMP); set_chain_id(CHAIN_ID); let now = 100000; @@ -124,6 +124,7 @@ fn setup() -> (ISummaryStatsABIDispatcher, IOracleABIDispatcher) { //Deploy the oracle let mut oracle_calldata = ArrayTrait::::new(); + admin.serialize(ref oracle_calldata); publisher_registry_address.serialize(ref oracle_calldata); currencies.serialize(ref oracle_calldata); pairs.serialize(ref oracle_calldata);