Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use BorshStorageKey for the prefix of LookupMap for pending_requests #608

Merged
merged 1 commit into from
May 27, 2024
Merged
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
14 changes: 10 additions & 4 deletions contract/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ pub mod primitives;
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::collections::LookupMap;
use near_sdk::serde::{Deserialize, Serialize};
use near_sdk::{env, near_bindgen, AccountId, Promise, PromiseOrValue, PublicKey};
use near_sdk::{log, Gas};
use near_sdk::{
env, log, near_bindgen, AccountId, BorshStorageKey, Gas, Promise, PromiseOrValue, PublicKey,
};
use primitives::{CandidateInfo, Candidates, ParticipantInfo, Participants, PkVotes, Votes};
use std::collections::{BTreeMap, HashSet};

Expand Down Expand Up @@ -47,6 +48,11 @@ pub enum ProtocolContractState {
Resharing(ResharingContractState),
}

#[derive(BorshSerialize, BorshDeserialize, BorshStorageKey, Hash, Clone, Debug, PartialEq, Eq)]
pub enum StorageKey {
PendingRequests,
}

#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize, Debug)]
pub enum VersionedMpcContract {
Expand Down Expand Up @@ -103,7 +109,7 @@ impl MpcContract {
threshold,
pk_votes: PkVotes::new(),
}),
pending_requests: LookupMap::new(b"m"),
pending_requests: LookupMap::new(StorageKey::PendingRequests),
request_counter: 0,
}
}
Expand Down Expand Up @@ -527,7 +533,7 @@ impl VersionedMpcContract {
}
Self::V0(MpcContract {
protocol_state: ProtocolContractState::NotInitialized,
pending_requests: LookupMap::new(b"m"),
pending_requests: LookupMap::new(StorageKey::PendingRequests),
request_counter: 0,
})
}
Expand Down
Loading