Skip to main content

Module stardust::storage_deposit_return_unlock_condition

use iota::address; use iota::bag; use iota::balance; use iota::coin; use iota::config; use iota::deny_list; use iota::dynamic_field; use iota::dynamic_object_field; use iota::event; use iota::hex; use iota::object; use iota::transfer; use iota::tx_context; use iota::types; use iota::url; use std::address; use std::ascii; use std::bcs; use std::option; use std::string; use std::type_name; use std::vector;

Structs

struct StorageDepositReturnUnlockCondition

The Stardust storage deposit return unlock condition.

public struct StorageDepositReturnUnlockCondition has store

Fields
return_address: address

The address to which the consuming transaction should deposit the amount defined in Return Amount.

return_amount: u64

The amount of coins the consuming transaction should deposit to the address defined in Return Address.

pub return_address

Get the unlock condition's return_address.

public fun return_address(condition: &stardust::storage_deposit_return_unlock_condition::StorageDepositReturnUnlockCondition): address

Implementation

public fun return_address(condition: &StorageDepositReturnUnlockCondition): address {     condition.return_address }

pub return_amount

Get the unlock condition's return_amount.

public fun return_amount(condition: &stardust::storage_deposit_return_unlock_condition::StorageDepositReturnUnlockCondition): u64

Implementation

public fun return_amount(condition: &StorageDepositReturnUnlockCondition): u64 {     condition.return_amount }

pub unlock

Check the unlock condition.

public fun unlock<T>(condition: stardust::storage_deposit_return_unlock_condition::StorageDepositReturnUnlockCondition, funding: &mut iota::balance::Balance<T>, ctx: &mut iota::tx_context::TxContext)

Implementation

public fun unlock<T>(     condition: StorageDepositReturnUnlockCondition,     funding: &mut Balance<T>,     ctx: &mut TxContext, ) {     // Aborts if funding is not enough.     let return_balance = funding.split(condition.return_amount());     // Recipient will need to transfer the coin to a normal ed25519 address instead of legacy.     public_transfer(from_balance(return_balance, ctx), condition.return_address());     let StorageDepositReturnUnlockCondition {         return_address: _,         return_amount: _,     } = condition; }