From 1e797518093ed58ed693b870825e8802d7bf7d96 Mon Sep 17 00:00:00 2001 From: han Date: Thu, 16 Jan 2025 19:32:17 +0700 Subject: [PATCH] fix remapping and add base nft contract --- foundry.toml | 4 ++-- src/NFT.sol | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/NFT.sol diff --git a/foundry.toml b/foundry.toml index ef0f7c8..04a64e7 100644 --- a/foundry.toml +++ b/foundry.toml @@ -3,8 +3,8 @@ src = "src" out = "out" libs = ["lib", "dependencies"] remappings = [ - "@openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.2.0/", - "solmate/=dependencies/solmate-6.8.0/", + "openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.2.0/", + "solmate/=dependencies/solmate-6.8.0/src/", ] [dependencies] diff --git a/src/NFT.sol b/src/NFT.sol new file mode 100644 index 0000000..7420773 --- /dev/null +++ b/src/NFT.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.28; + +import {ERC721} from "solmate/tokens/ERC721.sol"; +import {Strings} from "openzeppelin-contracts/utils/Strings.sol"; + +contract NFT is ERC721 { + uint256 public currentTokenId; + + constructor( + string memory _name, + string memory _symbol + ) ERC721(_name, _symbol) {} + + function mintTo(address recipient) public payable returns (uint256) { + uint256 newItemId = ++currentTokenId; + _safeMint(recipient, newItemId); + return newItemId; + } + + function tokenURI(uint256 id) public view virtual override returns (string memory) { + return Strings.toString(id); + } +}