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