From ca5528b8fed513462410e7201d1d47641f8f5ac7 Mon Sep 17 00:00:00 2001 From: pscott <30843220+pscott@users.noreply.github.com> Date: Tue, 10 Oct 2023 17:02:21 +0200 Subject: [PATCH] refactor: update comments regarding components (#596) --- starknet/src/space/space.cairo | 21 ++++++++++++------- starknet/src/tests/mocks/space_v2.cairo | 3 ++- .../mocks/vanilla_execution_strategy.cairo | 3 ++- .../voting_strategies/eth_balance_of.cairo | 6 ++++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/starknet/src/space/space.cairo b/starknet/src/space/space.cairo index 74d72b8c3..ba3d24c4d 100644 --- a/starknet/src/space/space.cairo +++ b/starknet/src/space/space.cairo @@ -206,7 +206,8 @@ mod Space { ); // Checking that the contract is not already initialized - //TODO: temporary component syntax + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let mut state: Reinitializable::ContractState = Reinitializable::unsafe_new_contract_state(); Reinitializable::InternalImpl::initialize(ref state); @@ -215,7 +216,8 @@ mod Space { assert(authenticators.len() != 0, 'empty authenticators'); assert(voting_strategies.len() == voting_strategy_metadata_uris.len(), 'len mismatch'); - //TODO: temporary component syntax + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let mut state = Ownable::unsafe_new_contract_state(); Ownable::InternalImpl::initializer(ref state, owner); self.set_dao_uri(dao_uri); @@ -385,7 +387,8 @@ mod Space { } fn cancel(ref self: ContractState, proposal_id: u256) { - //TODO: temporary component syntax + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let state = Ownable::unsafe_new_contract_state(); Ownable::InternalImpl::assert_only_owner(@state); @@ -470,7 +473,8 @@ mod Space { } fn owner(self: @ContractState) -> ContractAddress { - //TODO: temporary component syntax + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let state = Ownable::unsafe_new_contract_state(); Ownable::OwnableImpl::owner(@state) } @@ -532,7 +536,8 @@ mod Space { } fn update_settings(ref self: ContractState, input: UpdateSettingsCalldata) { - //TODO: temporary component syntax + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let state = Ownable::unsafe_new_contract_state(); Ownable::InternalImpl::assert_only_owner(@state); @@ -699,13 +704,15 @@ mod Space { } fn transfer_ownership(ref self: ContractState, new_owner: ContractAddress) { - //TODO: temporary component syntax + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let mut state = Ownable::unsafe_new_contract_state(); Ownable::OwnableImpl::transfer_ownership(ref state, new_owner); } fn renounce_ownership(ref self: ContractState) { - //TODO: temporary component syntax + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let mut state = Ownable::unsafe_new_contract_state(); Ownable::OwnableImpl::renounce_ownership(ref state); } diff --git a/starknet/src/tests/mocks/space_v2.cairo b/starknet/src/tests/mocks/space_v2.cairo index bd7d2b532..c2a38090e 100644 --- a/starknet/src/tests/mocks/space_v2.cairo +++ b/starknet/src/tests/mocks/space_v2.cairo @@ -17,7 +17,8 @@ mod SpaceV2 { #[external(v0)] impl SpaceV2 of ISpaceV2 { fn initialize(ref self: ContractState, var: felt252) { - // TODO: Temp component syntax + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let mut state = Reinitializable::unsafe_new_contract_state(); Reinitializable::InternalImpl::initialize(ref state); self._var.write(var); diff --git a/starknet/src/tests/mocks/vanilla_execution_strategy.cairo b/starknet/src/tests/mocks/vanilla_execution_strategy.cairo index 4b8a667cd..42dbc8fdf 100644 --- a/starknet/src/tests/mocks/vanilla_execution_strategy.cairo +++ b/starknet/src/tests/mocks/vanilla_execution_strategy.cairo @@ -62,7 +62,8 @@ mod VanillaExecutionStrategy { #[constructor] fn constructor(ref self: ContractState, quorum: u256) { - // TODO: temporary until components are released + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let mut state = SimpleQuorumExecutionStrategy::unsafe_new_contract_state(); SimpleQuorumExecutionStrategy::InternalImpl::initializer(ref state, quorum); } diff --git a/starknet/src/voting_strategies/eth_balance_of.cairo b/starknet/src/voting_strategies/eth_balance_of.cairo index aed5df38c..78f9727f5 100644 --- a/starknet/src/voting_strategies/eth_balance_of.cairo +++ b/starknet/src/voting_strategies/eth_balance_of.cairo @@ -43,7 +43,8 @@ mod EthBalanceOfVotingStrategy { .unwrap(); // Get the balance of the voter at the given block timestamp - // TODO: temporary until components are released + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let state = SingleSlotProof::unsafe_new_contract_state(); let balance = SingleSlotProof::InternalImpl::get_storage_slot( @state, timestamp, l1_account_address, slot_index, voter.into(), user_params @@ -58,7 +59,8 @@ mod EthBalanceOfVotingStrategy { timestamp_remappers: ContractAddress, facts_registry: ContractAddress ) { - // TODO: temporary until components are released + // Migration to components planned ; disregard the `unsafe` keyword, + // it is actually safe. let mut state = SingleSlotProof::unsafe_new_contract_state(); SingleSlotProof::InternalImpl::initializer(ref state, timestamp_remappers, facts_registry); }