-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6aaadb6
commit 779114d
Showing
71 changed files
with
788 additions
and
112 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::tokens::status::v0::TokenStatusV0Accessors; | ||
use crate::tokens::status::TokenStatus; | ||
|
||
impl TokenStatusV0Accessors for TokenStatus { | ||
fn paused(&self) -> bool { | ||
match self { | ||
TokenStatus::V0(status) => status.paused, | ||
} | ||
} | ||
|
||
fn set_paused(&mut self, frozen: bool) { | ||
match self { | ||
TokenStatus::V0(status) => status.set_paused(frozen), | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use crate::tokens::status::v0::TokenStatusV0; | ||
use crate::ProtocolError; | ||
use bincode::Encode; | ||
use derive_more::From; | ||
use platform_serialization::de::Decode; | ||
use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; | ||
use platform_version::version::PlatformVersion; | ||
use platform_versioning::PlatformVersioned; | ||
|
||
mod methods; | ||
pub mod v0; | ||
|
||
#[derive( | ||
Debug, | ||
Clone, | ||
Encode, | ||
Decode, | ||
PlatformDeserialize, | ||
PlatformSerialize, | ||
PlatformVersioned, | ||
From, | ||
PartialEq, | ||
)] | ||
#[platform_serialize(unversioned)] //versioned directly, no need to use platform_version | ||
pub enum TokenStatus { | ||
V0(TokenStatusV0), | ||
} | ||
|
||
impl TokenStatus { | ||
pub fn new(paused: bool, platform_version: &PlatformVersion) -> Result<Self, ProtocolError> { | ||
match platform_version | ||
.dpp | ||
.token_versions | ||
.identity_token_status_default_structure_version | ||
{ | ||
0 => Ok(TokenStatus::V0(TokenStatusV0 { paused })), | ||
version => Err(ProtocolError::UnknownVersionMismatch { | ||
method: "IdentityTokenStatus::new".to_string(), | ||
known_versions: vec![0], | ||
received: version, | ||
}), | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use bincode::{Decode, Encode}; | ||
use derive_more::From; | ||
|
||
#[derive(Debug, Clone, Encode, Decode, From, PartialEq)] | ||
/// Token status | ||
pub struct TokenStatusV0 { | ||
pub paused: bool, | ||
} | ||
|
||
pub trait TokenStatusV0Accessors { | ||
/// Gets the paused state of the token. | ||
fn paused(&self) -> bool; | ||
|
||
/// Sets the paused state of the token. | ||
fn set_paused(&mut self, paused: bool); | ||
} | ||
|
||
impl TokenStatusV0Accessors for TokenStatusV0 { | ||
fn paused(&self) -> bool { | ||
self.paused | ||
} | ||
|
||
fn set_paused(&mut self, paused: bool) { | ||
self.paused = paused; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...sition/state_transitions/batch/action_validation/document_delete_transition_action/mod.rs
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
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
Oops, something went wrong.