Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mint tokens #138

Open
aleeusgr opened this issue Nov 27, 2024 · 1 comment
Open

mint tokens #138

aleeusgr opened this issue Nov 27, 2024 · 1 comment

Comments

@aleeusgr
Copy link
Owner

aleeusgr commented Nov 27, 2024

As a developer, I want to mint a custom token using the Cardano network, Plutus Platform, and Helios, so that I can create a unique digital asset that can be used for various purposes such as decentralized finance (DeFi) applications or gaming.

@aleeusgr
Copy link
Owner Author

aleeusgr commented Nov 27, 2024

see Cardano Smart Contracts with Helios Page 41.

minting nft
const TX_ID: ByteArray = #6e1...996
const txId: TxId = TxId::new(TX_ID)
const outputId: TxOutputId = TxOutputId::new(txId, 0)
func main(ctx: ScriptContext) -> Bool {
tx: Tx = ctx.tx;
mph: MintingPolicyHash = ctx.get_current_minting_policy_hash();
assetclass: AssetClass = AssetClass::new(
mph,
"NTF Token Name".encode_utf8()
);
value_minted: Value = tx.minted;
// Validator logic starts
(value_minted == Value::new(assetclass, 1)).trace("NFT1: ") &&
tx.inputs.any((input: TxInput) -> Bool {
(input.output_id == outputId).trace("NFT2: ")
}
)
}

@aleeusgr aleeusgr added good first issue Good for newcomers and removed good first issue Good for newcomers labels Nov 27, 2024
@aleeusgr aleeusgr changed the title minting tokens mint tokens Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant