1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| module design::potato;
use sui::coin::Coin;
use sui::transfer::public_transfer;
public struct Receipt {
price: u64,
}
public struct POTATO has drop {}
public struct House has key {
id: UID,
model: u8,
}
public fun buy_house(model: u8, ctx: &mut TxContext): (Receipt, House) {
(Receipt { price: model as u64*1000 }, House { id: object::new(ctx), model })
}
public fun pay_receipt(receipt: Receipt, payment: Coin<POTATO>) {
let Receipt { price } = receipt;
public_transfer(payment, @0x1111);
}
|