-
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.
feat(platform)!: enhance token configuration and validation mechanisms (
- Loading branch information
1 parent
2480ceb
commit 3733f56
Showing
42 changed files
with
2,909 additions
and
75 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
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,9 +1,23 @@ | ||
mod identity_does_not_have_enough_token_balance_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_mint_past_max_supply_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_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_mint_past_max_supply_error::*; | ||
pub use token_setting_max_supply_to_less_than_current_supply_error::*; | ||
pub use unauthorized_token_action_error::*; |
36 changes: 36 additions & 0 deletions
36
...rc/errors/consensus/state/token/new_authorized_action_taker_group_does_not_exist_error.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use crate::consensus::state::state_error::StateError; | ||
use crate::consensus::ConsensusError; | ||
use crate::data_contract::GroupContractPosition; | ||
use crate::ProtocolError; | ||
use bincode::{Decode, Encode}; | ||
use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; | ||
use thiserror::Error; | ||
|
||
#[derive( | ||
Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, | ||
)] | ||
#[error("The specified new authorized action taker group {group_contract_position} does not exist")] | ||
#[platform_serialize(unversioned)] | ||
pub struct NewAuthorizedActionTakerGroupDoesNotExistError { | ||
group_contract_position: GroupContractPosition, | ||
} | ||
|
||
impl NewAuthorizedActionTakerGroupDoesNotExistError { | ||
pub fn new(group_contract_position: GroupContractPosition) -> Self { | ||
Self { | ||
group_contract_position, | ||
} | ||
} | ||
|
||
pub fn group_contract_position(&self) -> GroupContractPosition { | ||
self.group_contract_position | ||
} | ||
} | ||
|
||
impl From<NewAuthorizedActionTakerGroupDoesNotExistError> for ConsensusError { | ||
fn from(err: NewAuthorizedActionTakerGroupDoesNotExistError) -> Self { | ||
Self::StateError(StateError::NewAuthorizedActionTakerGroupDoesNotExistError( | ||
err, | ||
)) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...errors/consensus/state/token/new_authorized_action_taker_identity_does_not_exist_error.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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("The specified new authorized action taker identity {identity_id} does not exist")] | ||
#[platform_serialize(unversioned)] | ||
pub struct NewAuthorizedActionTakerIdentityDoesNotExistError { | ||
identity_id: Identifier, | ||
} | ||
|
||
impl NewAuthorizedActionTakerIdentityDoesNotExistError { | ||
pub fn new(identity_id: Identifier) -> Self { | ||
Self { identity_id } | ||
} | ||
|
||
pub fn identity_id(&self) -> &Identifier { | ||
&self.identity_id | ||
} | ||
} | ||
|
||
impl From<NewAuthorizedActionTakerIdentityDoesNotExistError> for ConsensusError { | ||
fn from(err: NewAuthorizedActionTakerIdentityDoesNotExistError) -> Self { | ||
Self::StateError(StateError::NewAuthorizedActionTakerIdentityDoesNotExistError(err)) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
.../src/errors/consensus/state/token/new_authorized_action_taker_main_group_not_set_error.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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 thiserror::Error; | ||
|
||
#[derive( | ||
Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, | ||
)] | ||
#[error( | ||
"The specified new authorized action taker main group is not set in the token configuration" | ||
)] | ||
#[platform_serialize(unversioned)] | ||
pub struct NewAuthorizedActionTakerMainGroupNotSetError {} | ||
|
||
impl NewAuthorizedActionTakerMainGroupNotSetError { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
impl From<NewAuthorizedActionTakerMainGroupNotSetError> for ConsensusError { | ||
fn from(err: NewAuthorizedActionTakerMainGroupNotSetError) -> Self { | ||
Self::StateError(StateError::NewAuthorizedActionTakerMainGroupNotSetError( | ||
err, | ||
)) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
.../src/errors/consensus/state/token/new_tokens_destination_identity_does_not_exist_error.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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("The specified new tokens destination identity {identity_id} does not exist")] | ||
#[platform_serialize(unversioned)] | ||
pub struct NewTokensDestinationIdentityDoesNotExistError { | ||
identity_id: Identifier, | ||
} | ||
|
||
impl NewTokensDestinationIdentityDoesNotExistError { | ||
pub fn new(identity_id: Identifier) -> Self { | ||
Self { identity_id } | ||
} | ||
|
||
pub fn identity_id(&self) -> &Identifier { | ||
&self.identity_id | ||
} | ||
} | ||
|
||
impl From<NewTokensDestinationIdentityDoesNotExistError> for ConsensusError { | ||
fn from(err: NewTokensDestinationIdentityDoesNotExistError) -> Self { | ||
Self::StateError(StateError::NewTokensDestinationIdentityDoesNotExistError( | ||
err, | ||
)) | ||
} | ||
} |
Oops, something went wrong.