Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions contracts/vault/src/emergency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ pub fn read_proposal(env: &Env, id: u32) -> Option<EmergencyProposal> {
}

pub fn write_proposal(env: &Env, id: u32, proposal: &EmergencyProposal) {
env.storage()
.instance()
.set(&DataKey::Emergency(EmergencyStorageKey::Proposal(id)), proposal);
env.storage().instance().set(
&DataKey::Emergency(EmergencyStorageKey::Proposal(id)),
proposal,
);
}

pub fn next_proposal_id(env: &Env) -> u32 {
Expand All @@ -70,9 +71,10 @@ pub fn next_proposal_id(env: &Env) -> u32 {
.get(&DataKey::Emergency(EmergencyStorageKey::ProposalNonce))
.unwrap_or(0);
let next = nonce.checked_add(1).expect("proposal nonce overflow");
env.storage()
.instance()
.set(&DataKey::Emergency(EmergencyStorageKey::ProposalNonce), &next);
env.storage().instance().set(
&DataKey::Emergency(EmergencyStorageKey::ProposalNonce),
&next,
);
next
}

Expand Down Expand Up @@ -153,7 +155,6 @@ pub fn simulate_emergency_unwind(
#[cfg(test)]
mod tests {
use super::*;
use soroban_sdk::testutils::Address as _;

#[test]
fn test_distinct_approvers_required() {
Expand Down
Loading
Loading