dpp/asset_lock/reduced_asset_lock_value/v0/
mod.rs

1use crate::fee::Credits;
2use bincode::{Decode, Encode};
3use platform_value::Bytes32;
4
5#[derive(Debug, Clone, Encode, Decode, PartialEq, serde::Serialize, serde::Deserialize)]
6pub struct AssetLockValueV0 {
7    pub(super) initial_credit_value: Credits,
8    pub(super) tx_out_script: Vec<u8>,
9    pub(super) remaining_credit_value: Credits,
10    /// The used tags can represent any token of that we want to say has been used
11    /// In practice for Platform this means that we are storing the asset lock transactions
12    /// to prevent replay attacks.
13    pub(super) used_tags: Vec<Bytes32>,
14}
15
16pub trait AssetLockValueGettersV0 {
17    fn initial_credit_value(&self) -> Credits;
18    fn tx_out_script(&self) -> &Vec<u8>;
19
20    fn tx_out_script_owned(self) -> Vec<u8>;
21    fn remaining_credit_value(&self) -> Credits;
22
23    fn used_tags_ref(&self) -> &Vec<Bytes32>;
24}
25
26pub trait AssetLockValueSettersV0 {
27    fn set_initial_credit_value(&mut self, value: Credits);
28    fn set_tx_out_script(&mut self, value: Vec<u8>);
29    fn set_remaining_credit_value(&mut self, value: Credits);
30
31    fn set_used_tags(&mut self, tags: Vec<Bytes32>);
32    fn add_used_tag(&mut self, tag: Bytes32);
33}