-
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
e406d63
commit 66dd35e
Showing
15 changed files
with
758 additions
and
8 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
54 changes: 54 additions & 0 deletions
54
packages/rs-dpp/src/errors/consensus/state/document/document_contest_not_paid_for_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,54 @@ | ||
use crate::consensus::state::state_error::StateError; | ||
use crate::consensus::ConsensusError; | ||
use crate::errors::ProtocolError; | ||
use crate::fee::Credits; | ||
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("Contest for document {document_id} was not paid for, needs payment of {expected_amount} Credits")] | ||
#[platform_serialize(unversioned)] | ||
pub struct DocumentContestNotPaidForError { | ||
/* | ||
DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION | ||
*/ | ||
document_id: Identifier, | ||
|
||
expected_amount: Credits, | ||
|
||
paid_amount: Credits, | ||
} | ||
|
||
impl DocumentContestNotPaidForError { | ||
pub fn new(document_id: Identifier, expected_amount: Credits, paid_amount: Credits) -> Self { | ||
Self { | ||
document_id, | ||
expected_amount, | ||
paid_amount, | ||
} | ||
} | ||
|
||
pub fn document_id(&self) -> &Identifier { | ||
&self.document_id | ||
} | ||
|
||
pub fn expected_amount(&self) -> Credits { | ||
self.expected_amount | ||
} | ||
|
||
pub fn paid_amount(&self) -> Credits { | ||
self.paid_amount | ||
} | ||
} | ||
|
||
impl From<DocumentContestNotPaidForError> for ConsensusError { | ||
fn from(err: DocumentContestNotPaidForError) -> Self { | ||
Self::StateError(StateError::DocumentContestNotPaidForError(err)) | ||
} | ||
} |
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.