Compare commits
2 Commits
247dfad12d
...
1e79751809
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e79751809 | |||
| cb790629ba |
@ -3,8 +3,8 @@ src = "src"
|
|||||||
out = "out"
|
out = "out"
|
||||||
libs = ["lib", "dependencies"]
|
libs = ["lib", "dependencies"]
|
||||||
remappings = [
|
remappings = [
|
||||||
"@openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.2.0/",
|
"openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.2.0/",
|
||||||
"solmate/=dependencies/solmate-6.8.0/",
|
"solmate/=dependencies/solmate-6.8.0/src/",
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
pragma solidity ^0.8.13;
|
|
||||||
|
|
||||||
import {Script, console} from "forge-std/Script.sol";
|
|
||||||
import {Counter} from "../src/Counter.sol";
|
|
||||||
|
|
||||||
contract CounterScript is Script {
|
|
||||||
Counter public counter;
|
|
||||||
|
|
||||||
function setUp() public {}
|
|
||||||
|
|
||||||
function run() public {
|
|
||||||
vm.startBroadcast();
|
|
||||||
|
|
||||||
counter = new Counter();
|
|
||||||
|
|
||||||
vm.stopBroadcast();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
pragma solidity ^0.8.13;
|
|
||||||
|
|
||||||
contract Counter {
|
|
||||||
uint256 public number;
|
|
||||||
|
|
||||||
function setNumber(uint256 newNumber) public {
|
|
||||||
number = newNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
function increment() public {
|
|
||||||
number++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
24
src/NFT.sol
Normal file
24
src/NFT.sol
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,24 +0,0 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
|
||||||
pragma solidity ^0.8.13;
|
|
||||||
|
|
||||||
import {Test, console} from "forge-std/Test.sol";
|
|
||||||
import {Counter} from "../src/Counter.sol";
|
|
||||||
|
|
||||||
contract CounterTest is Test {
|
|
||||||
Counter public counter;
|
|
||||||
|
|
||||||
function setUp() public {
|
|
||||||
counter = new Counter();
|
|
||||||
counter.setNumber(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_Increment() public {
|
|
||||||
counter.increment();
|
|
||||||
assertEq(counter.number(), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testFuzz_SetNumber(uint256 x) public {
|
|
||||||
counter.setNumber(x);
|
|
||||||
assertEq(counter.number(), x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user