-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use enum for collection prefixes (#4)
- Loading branch information
Showing
5 changed files
with
29 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
pub const BLOBS_KEY: &[u8] = b"BLOBS"; | ||
pub const DEPLOYMENTS_KEY: &[u8] = b"DEPLOYMENTS"; | ||
pub const RELEASES_KEY: &[u8] = b"RELEASES"; | ||
pub const LATEST_KEY: &[u8] = b"LATEST"; | ||
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; | ||
use near_sdk::IntoStorageKey; | ||
|
||
/// Prefixes for the `near-sdk` collections that are used in the smart contract. | ||
#[derive(BorshSerialize, BorshDeserialize)] | ||
pub enum Prefix { | ||
Blobs, | ||
Deployments, | ||
Releases, | ||
LatestRelease, | ||
} | ||
|
||
impl IntoStorageKey for Prefix { | ||
fn into_storage_key(self) -> Vec<u8> { | ||
self.try_to_vec().unwrap() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters