Skip to content

Commit

Permalink
updated token-minter code
Browse files Browse the repository at this point in the history
  • Loading branch information
adpthegreat committed Oct 29, 2024
1 parent 2c0f98f commit 09eb534
Show file tree
Hide file tree
Showing 23 changed files with 96 additions and 392 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolution = true
skip-lint = false

[programs.localnet]
token_minter = "EWEURHBPCLgFnxMV6yKmmj2xS9386Rcr2ixBah8Pyjjv"
token_minter = "AMXNdYTyDpcLLJ9CzVJQ1kw5gqE4JeZxjtUbH2MwntdD"

[registry]
url = "https://api.apr.dev"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// single deploy script that's invoked from the CLI, injecting a provider
// configured from the workspace's Anchor.toml.

const anchor = require("@coral-xyz/anchor");
const anchor = require('@coral-xyz/anchor');

module.exports = async function (provider) {
module.exports = async (provider) => {
// Configure client to use the provider.
anchor.setProvider(provider);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
use anchor_lang::prelude::*;
use anchor_spl::{
token::Mint,
token::{Mint, TokenAccount, Token},
associated_token::AssociatedToken,
};
declare_id!("EWEURHBPCLgFnxMV6yKmmj2xS9386Rcr2ixBah8Pyjjv");
declare_id!("AMXNdYTyDpcLLJ9CzVJQ1kw5gqE4JeZxjtUbH2MwntdD");
#[program]
pub mod token_minter {
use super::*;
pub fn mint_token(ctx: Context<MintTokenContext>, amount: u64) -> Result<()> {
pub fn create_token(
ctx: Context<CreateTokenContext>,
token_name: String,
token_symbol: String,
token_uri: String,
) -> Result<()> {
Ok(())
}
pub fn mint(ctx: Context<MintContext>) -> Result<()> {
Ok(())
}
}
#[derive(Accounts)]
pub struct MintTokenContext<'info> {
pub struct CreateTokenContext<'info> {
#[account(mut)]
pub maker: Signer<'info>,
#[account()]
pub maker_associated_token_account: Account<'info, TokenAccount>,
#[account()]
/// CHECK: This acc is safe
pub auth: UncheckedAccount<'info>,
#[account(mut)]
pub maker: Signer<'info>,
#[account()]
pub maker_mint: Account<'info, Mint>,
pub associated_token_program: Program<'info, AssociatedToken>,
pub token_program: Program<'info, Token>,
}
#[derive(Accounts)]
pub struct MintContext<'info> {
#[account(seeds = [b"mint"], bump)]
pub maker_mint: Account<'info, Mint>,
#[account(
init_if_needed,
payer = maker,
associated_token::mint = maker_mint_account,
associated_token::authority = auth,
has_one = maker,
has_one = maker_mint_account,
payer = payer,
associated_token::mint = maker_mint,
associated_token::authority = payer,
)]
pub maker_associated_token_account: Account<'info, TokenAccount>,
#[account(seeds = [b"mint"], bump)]
pub maker_mint_account: Account<'info, Mint>,
pub maker_ata: Account<'info, TokenAccount>,
#[account(mut)]
pub payer: Signer<'info>,
pub associated_token_program: Program<'info, AssociatedToken>,
pub token_program: Program<'info, Token>,
pub system_program: Program<'info, System>,
Expand Down
Loading

0 comments on commit 09eb534

Please sign in to comment.