Skip to content

Instantly share code, notes, and snippets.

@ubinix-warun
Last active May 20, 2024 07:27
Show Gist options
  • Save ubinix-warun/c8ae4e954f2f3ad7eb6d510f89b2cf2c to your computer and use it in GitHub Desktop.
Save ubinix-warun/c8ae4e954f2f3ad7eb6d510f89b2cf2c to your computer and use it in GitHub Desktop.
module metaschool::pepe {
use std::option;
use sui::coin;
use sui::transfer;
use sui::tx_context::{Self, TxContext};
// Name matches the module name but in UPPERCASE
public struct PEPE has drop {}
// Module initializer is called once on module publish.
// A treasury cap is sent to the publisher, who then controls minting and burning.
fun init(witness: PEPE, ctx: &mut TxContext) {
let (treasury, metadata) = coin::create_currency(witness, 9, b"PE", b"PEPE", b"", option::none(), ctx);
transfer::public_freeze_object(metadata);
transfer::public_transfer(treasury, tx_context::sender(ctx))
}
public entry fun mint(
treasury: &mut coin::TreasuryCap<PEPE>, amount: u64, recipient: address, ctx: &mut TxContext
) {
coin::mint_and_transfer(treasury, amount, recipient, ctx)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment