Skip to content

Instantly share code, notes, and snippets.

View tina1998612's full-sized avatar
:octocat:
DigitalNomad

李婷婷 Lee Ting Ting tina1998612

:octocat:
DigitalNomad
View GitHub Profile
{"name":"TinaNFT","description":"lalala","image":"your_photo_url"}
@tina1998612
tina1998612 / nft_tutorial.sol
Created October 17, 2023 11:31
NFT Tutorial Lee Ting Ting
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts@4.9.3/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts@4.9.3/access/Ownable.sol";
contract MyToken is ERC721, Ownable {
constructor() ERC721("MyToken", "MTK") {}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
let abi = [
{
inputs: [
{
internalType: "string",
name: "_name",
type: "string",
},
{
internalType: "string",
let WHITELIST = {
"0x3dff349dae1d088f338cf3be70b801e5eeb65056": {
"voucher": {
"redeemer": "0x3Dff349dAE1d088f338cF3Be70B801E5EEb65056",
"stageId": 1,
"amount": 26,
"priceIndex": 0
},
"signature": "0x3e635e39db49eea29b0e3f927fcede66fe928f73641ce0e130cc623a3557d179766720364bfd5076682a0c69ab07e3167e7465e84a63e50c9e417d64da6e30681b"
},
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import qualified Data.Text as T
import Language.Plutus.Contract hiding (when)
import Language.PlutusTx.Prelude
import Playground.Contract
-- | A 'Contract' that logs a message.
hello :: Contract BlockchainActions T.Text ()
hello = logInfo @String "Hello, world"
endpoints :: Contract BlockchainActions T.Text ()
address 0x2 {
module Coin {
struct Coin {
value: u64,
}
}
}
;; sip009-nft
;; A SIP009-compliant NFT with a mint function.
(impl-trait .sip009-nft-trait.nft-trait)
(define-constant contract-owner tx-sender)
(define-constant err-owner-only (err u100))
(define-constant err-token-id-failure (err u101))
(define-constant err-not-token-owner (err u102))
;; use the SIP090 interface (testnet)
(impl-trait 'ST1HTBVD3JG9C05J7HBJTHGR0GGW7KXW28M5JS8QE.nft-trait.nft-trait)
;; define a new NFT. Make sure to replace MY-OWN-NFT
(define-non-fungible-token MY-OWN-NFT uint)
;; Store the last issues token ID
(define-data-var last-id uint u0)
;; Claim a new NFT
scriptPubKey: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig: <sig> <pubKey>