mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-29 15:09:22 +00:00
34 lines
1,013 B
Rust
34 lines
1,013 B
Rust
|
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||
|
|
||
|
use scale::{Encode, Decode, MaxEncodedLen};
|
||
|
use scale_info::TypeInfo;
|
||
|
|
||
|
#[cfg(feature = "std")]
|
||
|
use serde::{Serialize, Deserialize};
|
||
|
|
||
|
use serai_primitives::{SeraiAddress, ExternalAddress, Data, pallet_address};
|
||
|
|
||
|
pub const ADDRESS: SeraiAddress = pallet_address(b"Tokens");
|
||
|
|
||
|
#[derive(Clone, PartialEq, Eq, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
|
||
|
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||
|
pub struct OutInstruction {
|
||
|
pub address: ExternalAddress,
|
||
|
pub data: Option<Data>,
|
||
|
}
|
||
|
|
||
|
#[derive(Clone, PartialEq, Eq, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
|
||
|
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||
|
pub enum Destination {
|
||
|
Native(SeraiAddress),
|
||
|
External(OutInstruction),
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn address() {
|
||
|
use sp_runtime::traits::TrailingZeroInput;
|
||
|
assert_eq!(ADDRESS, SeraiAddress::decode(&mut TrailingZeroInput::new(b"Tokens")).unwrap());
|
||
|
}
|