forked from kaspanet/rusty-kaspa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implemented an interface for fetching information from oracles. - Developed a transaction selector logic based on the ReserveRatioState. - Enhanced transaction payloads to store detailed information about asset conversions. - Added validation for transaction payloads. - Refactored other functions and unit tests for improved efficiency and clarity.
- Loading branch information
1 parent
58be95e
commit 9b81376
Showing
46 changed files
with
977 additions
and
71 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use crate::asset_type::AssetType; | ||
use serde::{Deserialize, Serialize}; | ||
use serde_cbor; | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct AssetConversionDetails { | ||
pub to_asset_type: AssetType, | ||
pub from_asset_type: AssetType, | ||
pub to_amount: u64, | ||
pub from_amount: u64, | ||
} | ||
|
||
pub struct AssetConversionSerializer; | ||
|
||
impl AssetConversionSerializer { | ||
pub fn serialize(details: &AssetConversionDetails) -> Vec<u8> { | ||
serde_cbor::to_vec(details).expect("Serialization failed") | ||
} | ||
|
||
pub fn deserialize(data: &[u8]) -> AssetConversionDetails { | ||
serde_cbor::from_slice(data).expect("Deserialization failed") | ||
} | ||
} |
Oops, something went wrong.