mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 13:31:04 +00:00
Emit ContractReverted error when revert flag is set (#10481)
* Emit `ContractReverted` error when revert flag is set * `is_success()` -> `did_revert()`
This commit is contained in:
committed by
GitHub
parent
7ee25416c2
commit
1939567a79
@@ -131,9 +131,9 @@ pub struct ExecReturnValue {
|
||||
}
|
||||
|
||||
impl ExecReturnValue {
|
||||
/// We understand the absense of a revert flag as success.
|
||||
pub fn is_success(&self) -> bool {
|
||||
!self.flags.contains(ReturnFlags::REVERT)
|
||||
/// The contract did revert all storage changes.
|
||||
pub fn did_revert(&self) -> bool {
|
||||
self.flags.contains(ReturnFlags::REVERT)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +170,12 @@ pub enum Code<Hash> {
|
||||
Existing(Hash),
|
||||
}
|
||||
|
||||
impl<T: Into<Vec<u8>>, Hash> From<T> for Code<Hash> {
|
||||
fn from(from: T) -> Self {
|
||||
Code::Upload(Bytes(from.into()))
|
||||
}
|
||||
}
|
||||
|
||||
/// The amount of balance that was either charged or refunded in order to pay for storage.
|
||||
#[derive(Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, Clone)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
|
||||
Reference in New Issue
Block a user