Great question! I was stuck there as well some time ago.
In order to show people how it works, I've created a quick repo on github.
The way it works is: You mint your token using something like:
pub struct MintCtrl<'info> {
#[account(init_if_needed, payer = payer, seeds = [CTRLSEED.as_ref()], bump, mint::decimals = 6, mint::authority = mint)]
pub mint: Account<'info, Mint>,
#[account(init_if_needed, payer = payer, associated_token::mint = mint, associated_token::authority = payer)]
pub destination: Account<'info, TokenAccount>,
#[account(mut)]
pub payer: Signer<'info>,
pub system_program: Program<'info, System>,
pub token_program: Program<'info, Token>,
pub associated_token_program: Program<'info, AssociatedToken>,
pub rent: Sysvar<'info, Rent>,
}
Then, in order to have a ticker symbol and logo associated with your token, you have to add metadata.
pub fn tok_meta(ctx: Context<TokMeta>, bump: u8) -> Result<()> {
let ix = create_metadata_accounts_v2(
*ctx.accounts.metadata_program.to_account_info().key, // program_id,
*ctx.accounts.metadata_pda.to_account_info().key, // metadata_account,
*ctx.accounts.mint.to_account_info().key, //mint,
*ctx.accounts.mint.to_account_info().key, //mint_authority,
*ctx.accounts.payer.to_account_info().key, //payer,
*ctx.accounts.updauth.to_account_info().key, //update_authority,
String::from("CTRL - Program Controlled Token"), // name,
String::from("CTRL"), // symbol,
String::from("https://bernieblume.github.io/Ctrl/Ctrl.json"), // uri,
None, // creators,
0u16, //seller_fee_basis_points,
false, // update_authority_is_signer,
true, // is_mutable,
None, // collection,
None, // uses,
// for create_metadata_accounts_v3, add: None, // collection_details
);
invoke_signed(
&ix,
&[
ctx.accounts.metadata_program.to_account_info().clone(), // Metadata program id
ctx.accounts.metadata_pda.to_account_info().clone(), // Metadata account
ctx.accounts.mint.to_account_info().clone(), // Mint
ctx.accounts.mint.to_account_info().clone(), // Mint Authority
ctx.accounts.payer.to_account_info().clone(), // Payer
ctx.accounts.updauth.to_account_info().clone(), // Update Authority
ctx.accounts.system_program.to_account_info().clone(), // System Program
ctx.accounts.rent.to_account_info().clone(), // Rent Sysvar
],
&[
&[CTRLSEED.as_ref(), &[bump]],
],
)?;
Ok(())
}
You can find the full github repo here.