-
Notifications
You must be signed in to change notification settings - Fork 54
fix: token already paused unpaused and frozen validation #2466
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
341afed
fix: token already paused unpaused and frozen validation
pauldelucia e187380
fix: rename symbol
pauldelucia af824f5
fix: not operator and redundant handling of bool
pauldelucia e34d8fb
fix: not operator
pauldelucia d055700
fix: documentation for fetch token status operations
pauldelucia 0566ef5
Merge remote-tracking branch 'origin/v2.0-dev' into fix/already-froze…
pauldelucia 7553a78
chore: rename frozen_identity_id to identity_to_freeze_id
pauldelucia d9b7dc3
Merge branch 'v2.0-dev' into fix/already-frozen-or-paused-tokens
shumkov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
51 changes: 51 additions & 0 deletions
51
...es/rs-dpp/src/errors/consensus/state/token/identity_token_account_already_frozen_error.rs
This file contains hidden or 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,51 @@ | ||
| use crate::consensus::state::state_error::StateError; | ||
| use crate::consensus::ConsensusError; | ||
| use crate::ProtocolError; | ||
| use bincode::{Decode, Encode}; | ||
| use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; | ||
| use platform_value::Identifier; | ||
| use thiserror::Error; | ||
|
|
||
| #[derive( | ||
| Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, | ||
| )] | ||
| #[error( | ||
| "Identity {} account is already frozen for token {}. Action attempted: {}", | ||
| identity_id, | ||
| token_id, | ||
| action | ||
| )] | ||
| #[platform_serialize(unversioned)] | ||
| pub struct IdentityTokenAccountAlreadyFrozenError { | ||
| token_id: Identifier, | ||
| identity_id: Identifier, | ||
| action: String, | ||
| } | ||
|
|
||
| impl IdentityTokenAccountAlreadyFrozenError { | ||
| pub fn new(token_id: Identifier, identity_id: Identifier, action: String) -> Self { | ||
| Self { | ||
| token_id, | ||
| identity_id, | ||
| action, | ||
| } | ||
| } | ||
|
|
||
| pub fn token_id(&self) -> &Identifier { | ||
| &self.token_id | ||
| } | ||
|
|
||
| pub fn identity_id(&self) -> &Identifier { | ||
| &self.identity_id | ||
| } | ||
|
|
||
| pub fn action(&self) -> &str { | ||
| &self.action | ||
| } | ||
| } | ||
|
|
||
| impl From<IdentityTokenAccountAlreadyFrozenError> for ConsensusError { | ||
| fn from(err: IdentityTokenAccountAlreadyFrozenError) -> Self { | ||
| Self::StateError(StateError::IdentityTokenAccountAlreadyFrozenError(err)) | ||
| } | ||
| } |
This file contains hidden or 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,25 +1,31 @@ | ||
| mod identity_does_not_have_enough_token_balance_error; | ||
| mod identity_token_account_already_frozen_error; | ||
| mod identity_token_account_frozen_error; | ||
| mod identity_token_account_not_frozen_error; | ||
| mod invalid_group_position_error; | ||
| mod new_authorized_action_taker_group_does_not_exist_error; | ||
| mod new_authorized_action_taker_identity_does_not_exist_error; | ||
| mod new_authorized_action_taker_main_group_not_set_error; | ||
| mod new_tokens_destination_identity_does_not_exist_error; | ||
| mod token_already_paused_error; | ||
| mod token_is_paused_error; | ||
| mod token_mint_past_max_supply_error; | ||
| mod token_not_paused_error; | ||
| mod token_setting_max_supply_to_less_than_current_supply_error; | ||
| mod unauthorized_token_action_error; | ||
|
|
||
| pub use identity_does_not_have_enough_token_balance_error::*; | ||
| pub use identity_token_account_already_frozen_error::*; | ||
| pub use identity_token_account_frozen_error::*; | ||
| pub use identity_token_account_not_frozen_error::*; | ||
| pub use invalid_group_position_error::*; | ||
| pub use new_authorized_action_taker_group_does_not_exist_error::*; | ||
| pub use new_authorized_action_taker_identity_does_not_exist_error::*; | ||
| pub use new_authorized_action_taker_main_group_not_set_error::*; | ||
| pub use new_tokens_destination_identity_does_not_exist_error::*; | ||
| pub use token_already_paused_error::*; | ||
| pub use token_is_paused_error::*; | ||
| pub use token_mint_past_max_supply_error::*; | ||
| pub use token_not_paused_error::*; | ||
| pub use token_setting_max_supply_to_less_than_current_supply_error::*; | ||
| pub use unauthorized_token_action_error::*; |
37 changes: 37 additions & 0 deletions
37
packages/rs-dpp/src/errors/consensus/state/token/token_already_paused_error.rs
This file contains hidden or 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,37 @@ | ||
| use crate::consensus::state::state_error::StateError; | ||
| use crate::consensus::ConsensusError; | ||
| use crate::ProtocolError; | ||
| use bincode::{Decode, Encode}; | ||
| use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; | ||
| use platform_value::Identifier; | ||
| use thiserror::Error; | ||
|
|
||
| #[derive( | ||
| Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, | ||
| )] | ||
| #[error("Token {} is already paused. Action attempted: {}", token_id, action)] | ||
| #[platform_serialize(unversioned)] | ||
| pub struct TokenAlreadyPausedError { | ||
| token_id: Identifier, | ||
| action: String, | ||
| } | ||
|
|
||
| impl TokenAlreadyPausedError { | ||
| pub fn new(token_id: Identifier, action: String) -> Self { | ||
| Self { token_id, action } | ||
| } | ||
|
|
||
| pub fn token_id(&self) -> &Identifier { | ||
| &self.token_id | ||
| } | ||
|
|
||
| pub fn action(&self) -> &str { | ||
| &self.action | ||
| } | ||
| } | ||
|
|
||
| impl From<TokenAlreadyPausedError> for ConsensusError { | ||
| fn from(err: TokenAlreadyPausedError) -> Self { | ||
| Self::StateError(StateError::TokenAlreadyPausedError(err)) | ||
| } | ||
| } |
37 changes: 37 additions & 0 deletions
37
packages/rs-dpp/src/errors/consensus/state/token/token_not_paused_error.rs
This file contains hidden or 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,37 @@ | ||
| use crate::consensus::state::state_error::StateError; | ||
| use crate::consensus::ConsensusError; | ||
| use crate::ProtocolError; | ||
| use bincode::{Decode, Encode}; | ||
| use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; | ||
| use platform_value::Identifier; | ||
| use thiserror::Error; | ||
|
|
||
| #[derive( | ||
| Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, | ||
| )] | ||
| #[error("Token {} is not paused. Action attempted: {}", token_id, action)] | ||
| #[platform_serialize(unversioned)] | ||
| pub struct TokenNotPausedError { | ||
| token_id: Identifier, | ||
| action: String, | ||
| } | ||
|
|
||
| impl TokenNotPausedError { | ||
| pub fn new(token_id: Identifier, action: String) -> Self { | ||
| Self { token_id, action } | ||
| } | ||
|
|
||
| pub fn token_id(&self) -> &Identifier { | ||
| &self.token_id | ||
| } | ||
|
|
||
| pub fn action(&self) -> &str { | ||
| &self.action | ||
| } | ||
| } | ||
|
|
||
| impl From<TokenNotPausedError> for ConsensusError { | ||
| fn from(err: TokenNotPausedError) -> Self { | ||
| Self::StateError(StateError::TokenNotPausedError(err)) | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.