Skip to main content

iota_types/stardust/output/
unlock_conditions.rs

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