iota_types/stardust/output/
unlock_conditions.rs

1// Copyright (c) 2024 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6use serde_with::serde_as;
7
8use crate::base_types::IotaAddress;
9
10/// Rust version of the stardust expiration unlock condition.
11#[serde_as]
12#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, JsonSchema)]
13pub struct ExpirationUnlockCondition {
14    /// The address who owns the output before the timestamp has passed.
15    pub owner: IotaAddress,
16    /// The address that is allowed to spend the locked funds after the
17    /// timestamp has passed.
18    pub return_address: IotaAddress,
19    /// Before this unix time, Address Unlock Condition is allowed to unlock the
20    /// output, after that only the address defined in Return Address.
21    pub unix_time: u32,
22}
23
24/// Rust version of the stardust storage deposit return unlock condition.
25#[serde_as]
26#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, JsonSchema)]
27pub struct StorageDepositReturnUnlockCondition {
28    /// The address to which the consuming transaction should deposit the amount
29    /// defined in Return Amount.
30    pub return_address: IotaAddress,
31    /// The amount of IOTA coins the consuming transaction should deposit to the
32    /// address defined in Return Address.
33    pub return_amount: u64,
34}
35
36/// Rust version of the stardust timelock unlock condition.
37#[serde_as]
38#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, JsonSchema)]
39pub struct TimelockUnlockCondition {
40    /// The unix time (seconds since Unix epoch) starting from which the output
41    /// can be consumed.
42    pub unix_time: u32,
43}