- Resource
UTXO
- Struct
UTXOSeal
- Struct
SealOut
- Struct
SpendUTXOEvent
- Struct
ReceiveUTXOEvent
- Struct
TempStateDropEvent
- Resource
BitcoinUTXOStore
- Constants
- Function
genesis_init
- Function
borrow_utxo_store
- Function
borrow_mut_utxo_store
- Function
new
- Function
mock_utxo
- Function
derive_utxo_id
- Function
value
- Function
txid
- Function
vout
- Function
exists_utxo
- Function
borrow_utxo
- Function
borrow_mut_utxo
- Function
has_seal
- Function
has_seal_internal
- Function
get_seals
- Function
remove_seals_internal
- Function
add_seal_internal
- Function
transfer
- Function
take
- Function
remove
- Function
drop
- Function
new_utxo_seal
- Function
unpack_utxo_seal
- Function
new_seal_out
- Function
unpack_seal_out
- Function
add_temp_state
- Function
contains_temp_state
- Function
borrow_temp_state
- Function
borrow_mut_temp_state
- Function
remove_temp_state
- Function
check_utxo_input
- Function
unpack_spend_utxo_event
- Function
unpack_receive_utxo_event
- Function
unpack_temp_state_drop_event
use 0x1::option;
use 0x1::string;
use 0x2::address;
use 0x2::event_queue;
use 0x2::object;
use 0x2::simple_multimap;
use 0x2::type_info;
use 0x3::chain_id;
use 0x4::temp_state;
use 0x4::types;
The UTXO Object
struct UTXO has key
struct UTXOSeal has copy, drop, store
struct SealOut has copy, drop, store
Event emitted when a UTXO is spent In the Bitcoin UTXO model, there's no inherent concept of sender and receiver. However, for simplifying payment scenarios, we define sender and receiver as follows:
- Sender: The address of the first input UTXO that can be identified
- Receiver: The address of each output UTXO that can be identified
struct SpendUTXOEvent has copy, drop, store
Event emitted when a UTXO is received In the Bitcoin UTXO model, there's no inherent concept of sender and receiver. However, for simplifying payment scenarios, we define sender and receiver as follows:
- Sender: The address of the first input UTXO that can be identified
- Receiver: The address of each output UTXO that can be identified
struct ReceiveUTXOEvent has copy, drop, store
Event emitted when the temporary state of a UTXO is dropped The temporary state is dropped when the UTXO is spent The event is onchain event, and the event_queue name is type_name of the temporary state
struct TempStateDropEvent has copy, drop, store
struct BitcoinUTXOStore has key
const ErrorDeprecatedFunction: u64 = 1;
const TEMPORARY_AREA: vector<u8> = [116, 101, 109, 112, 111, 114, 97, 114, 121, 95, 97, 114, 101, 97];
public(friend) fun genesis_init()
public fun borrow_utxo_store(): &object::Object<utxo::BitcoinUTXOStore>
public(friend) fun borrow_mut_utxo_store(): &mut object::Object<utxo::BitcoinUTXOStore>
public(friend) fun new(txid: address, vout: u32, value: u64): object::Object<utxo::UTXO>
public(friend) fun mock_utxo(outpoint: types::OutPoint, value: u64): utxo::UTXO
public fun derive_utxo_id(outpoint: types::OutPoint): object::ObjectID
Get the UTXO's value
public fun value(utxo: &utxo::UTXO): u64
Get the UTXO's txid
public fun txid(utxo: &utxo::UTXO): address
Get the UTXO's vout
public fun vout(utxo: &utxo::UTXO): u32
public fun exists_utxo(outpoint: types::OutPoint): bool
public fun borrow_utxo(outpoint: types::OutPoint): &object::Object<utxo::UTXO>
public(friend) fun borrow_mut_utxo(outpoint: types::OutPoint): &mut object::Object<utxo::UTXO>
public fun has_seal<T>(utxo: &utxo::UTXO): bool
public(friend) fun has_seal_internal(utxo: &utxo::UTXO, protocol: &string::String): bool
public fun get_seals<T>(utxo: &utxo::UTXO): vector<object::ObjectID>
public(friend) fun remove_seals_internal<T>(utxo: &mut utxo::UTXO): vector<object::ObjectID>
public(friend) fun add_seal_internal(utxo: &mut utxo::UTXO, utxo_seal: utxo::UTXOSeal)
public(friend) fun transfer(utxo_obj: object::Object<utxo::UTXO>, sender: option::Option<address>, receiver: address)
public(friend) fun take(object_id: object::ObjectID): object::Object<utxo::UTXO>
public(friend) fun remove(utxo_obj: object::Object<utxo::UTXO>): utxo::UTXO
public(friend) fun drop(utxo: utxo::UTXO)
public(friend) fun new_utxo_seal(protocol: string::String, seal_object_id: object::ObjectID): utxo::UTXOSeal
public(friend) fun unpack_utxo_seal(utxo_seal: utxo::UTXOSeal): (string::String, object::ObjectID)
public(friend) fun new_seal_out(vout: u32, seal: utxo::UTXOSeal): utxo::SealOut
public(friend) fun unpack_seal_out(seal_out: utxo::SealOut): (u32, utxo::UTXOSeal)
#[private_generics(#[S])]
public fun add_temp_state<S: drop, store>(utxo: &mut object::Object<utxo::UTXO>, state: S)
public fun contains_temp_state<S: drop, store>(utxo: &object::Object<utxo::UTXO>): bool
public fun borrow_temp_state<S: drop, store>(utxo: &object::Object<utxo::UTXO>): &S
#[private_generics(#[S])]
public fun borrow_mut_temp_state<S: drop, store>(utxo: &mut object::Object<utxo::UTXO>): &mut S
#[private_generics(#[S])]
public fun remove_temp_state<S: drop, store>(utxo: &mut object::Object<utxo::UTXO>): S
public(friend) fun check_utxo_input(): bool
public fun unpack_spend_utxo_event(event: utxo::SpendUTXOEvent): (address, address, option::Option<address>, u64)
public fun unpack_receive_utxo_event(event: utxo::ReceiveUTXOEvent): (address, option::Option<address>, address, u64)
public fun unpack_temp_state_drop_event(event: utxo::TempStateDropEvent): (object::ObjectID, types::OutPoint, u64)