Skip to content

Commit

Permalink
fix: use get_block_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveVodrazka committed Dec 12, 2023
1 parent 92518f3 commit e422b39
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/proposals.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mod Proposals {

use starknet::contract_address::ContractAddressZeroable;
use starknet::get_block_info;
use starknet::get_block_timestamp;
use starknet::get_caller_address;
use starknet::BlockInfo;
use starknet::ContractAddress;
Expand Down Expand Up @@ -65,7 +66,7 @@ mod Proposals {
let end_timestamp: u64 = state.proposal_vote_end_timestamp.read(prop_id);
assert(end_timestamp != 0, 'prop_id not found');

let current_timestamp: u64 = get_block_info().unbox().block_timestamp;
let current_timestamp: u64 = get_block_timestamp();

assert(end_timestamp > current_timestamp, 'voting concluded');
}
Expand Down Expand Up @@ -120,7 +121,7 @@ mod Proposals {
let prop_details = PropDetails { payload: payload, to_upgrade: to_upgrade };
state.proposal_details.write(prop_id, prop_details);

let current_timestamp: u64 = get_block_info().unbox().block_timestamp;
let current_timestamp: u64 = get_block_timestamp();
let end_timestamp: u64 = current_timestamp + constants::PROPOSAL_VOTING_SECONDS;
state.proposal_vote_end_timestamp.write(prop_id, end_timestamp);

Expand Down Expand Up @@ -316,7 +317,7 @@ mod Proposals {
let state = Governance::unsafe_new_contract_state();

let end_timestamp: u64 = state.proposal_vote_end_timestamp.read(prop_id);
let current_timestamp: u64 = get_block_info().unbox().block_timestamp;
let current_timestamp: u64 = get_block_timestamp();

if current_timestamp <= end_timestamp {
return check_proposal_passed_express(prop_id).into();
Expand Down

0 comments on commit e422b39

Please sign in to comment.