Module 0x0::deep
use 0x1::option;
use 0x2::coin;
use 0x2::dynamic_object_field;
use 0x2::object;
use 0x2::transfer;
use 0x2::tx_context;
use 0x2::url;
Struct DEEP
struct DEEP has drop
Fields
-
dummy_field: bool
-
Resource ProtectedTreasury
struct ProtectedTreasury has key
Fields
-
id: object::UID
-
Struct TreasuryCapKey
struct TreasuryCapKey has copy, drop, store
Fields
-
dummy_field: bool
-
Function burn
public fun burn(arg0: &mut deep::ProtectedTreasury, arg1: coin::Coin<deep::DEEP>)
Implementation
public fun burn(arg0: &mut ProtectedTreasury, arg1: sui::coin::Coin<DEEP>) {
sui::coin::burn<DEEP>(borrow_cap_mut(arg0), arg1);
}
Function total_supply
public fun total_supply(arg0: &deep::ProtectedTreasury): u64
Implementation
public fun total_supply(arg0: &ProtectedTreasury): u64 {
sui::coin::total_supply<DEEP>(borrow_cap(arg0))
}
Function borrow_cap
fun borrow_cap(arg0: &deep::ProtectedTreasury): &coin::TreasuryCap<deep::DEEP>
Implementation
fun borrow_cap(arg0: &ProtectedTreasury): &sui::coin::TreasuryCap<DEEP> {
let v0 = TreasuryCapKey {};
sui::dynamic_object_field::borrow<TreasuryCapKey, sui::coin::TreasuryCap<DEEP>>(
&arg0.id,
v0,
)
}
Function borrow_cap_mut
fun borrow_cap_mut(arg0: &mut deep::ProtectedTreasury): &mut coin::TreasuryCap<deep::DEEP>
Implementation
fun borrow_cap_mut(arg0: &mut ProtectedTreasury): &mut sui::coin::TreasuryCap<DEEP> {
let v0 = TreasuryCapKey {};
sui::dynamic_object_field::borrow_mut<TreasuryCapKey, sui::coin::TreasuryCap<DEEP>>(
&mut arg0.id,
v0,
)
}
Function create_coin
fun create_coin(arg0: deep::DEEP, arg1: u64, arg2: &mut tx_context::TxContext): (deep::ProtectedTreasury, coin::Coin<deep::DEEP>)
Implementation
fun create_coin(
arg0: DEEP,
arg1: u64,
arg2: &mut sui::tx_context::TxContext,
): (ProtectedTreasury, sui::coin::Coin<DEEP>) {
let (v0, v1) = sui::coin::create_currency<DEEP>(
arg0,
6,
b"DEEP",
b"DeepBook Token",
b"The DEEP token secures the DeepBook protocol, the premier wholesale liquidity venue for on-chain trading.",
std::option::some<
sui::url::Url,
>(sui::url::new_unsafe_from_bytes(b"https://images.deepbook.tech/icon.svg")),
arg2,
);
let mut cap = v0;
sui::transfer::public_freeze_object<sui::coin::CoinMetadata<DEEP>>(v1);
let mut protected_treasury = ProtectedTreasury { id: sui::object::new(arg2) };
let coin = sui::coin::mint<DEEP>(&mut cap, arg1, arg2);
sui::dynamic_object_field::add<TreasuryCapKey, sui::coin::TreasuryCap<DEEP>>(
&mut protected_treasury.id,
TreasuryCapKey {},
cap,
);
(protected_treasury, coin)
}
Function init
fun init(arg0: deep::DEEP, arg1: &mut tx_context::TxContext)
Implementation
fun init(arg0: DEEP, arg1: &mut TxContext) {
let (v0, v1) = create_coin(arg0, 10000000000000000, arg1);
sui::transfer::share_object<ProtectedTreasury>(v0);
sui::transfer::public_transfer<sui::coin::Coin<DEEP>>(v1, sui::tx_context::sender(arg1));
}