-
Notifications
You must be signed in to change notification settings - Fork 44
feat(platform)!: enhance token configuration and validation mechanisms #2439
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
6 commits
Select commit
Hold shift + click to select a range
4bfc573
more tests for token update
QuantumExplorer 7e4cd57
more work
QuantumExplorer acd855f
a lot more tests
QuantumExplorer b9a0a26
more tests
QuantumExplorer 197de1e
small fix
QuantumExplorer b59f157
wasm fixes
QuantumExplorer 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
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
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 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,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 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,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 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,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 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,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.
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.