From f8abe7c6414c07a385ac62954346820da2188ae6 Mon Sep 17 00:00:00 2001 From: Arr00 <13561405+arr00@users.noreply.github.com> Date: Thu, 25 Jul 2024 22:29:24 +0300 Subject: [PATCH] feat: comment on order (#5) * feat: comment on order * bump version --- src/MintERC1155.sol | 2 +- src/NFTMint.sol | 16 ++++++++++++---- test/NFTMint.t.sol | 6 +++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/MintERC1155.sol b/src/MintERC1155.sol index 2e89076..33fe6e4 100644 --- a/src/MintERC1155.sol +++ b/src/MintERC1155.sol @@ -162,6 +162,6 @@ contract MintERC1155 is ERC1155Upgradeable, OwnableUpgradeable, ERC2981Upgradeab } function VERSION() external pure returns (string memory) { - return "0.1.1"; + return "0.1.2"; } } diff --git a/src/NFTMint.sol b/src/NFTMint.sol index 8610a5c..5042aa6 100644 --- a/src/NFTMint.sol +++ b/src/NFTMint.sol @@ -9,7 +9,7 @@ import { MintERC1155 } from "./MintERC1155.sol"; contract NFTMint is Ownable { event MintCreated(MintERC1155 indexed mint, MintArgs args); - event OrderPlaced(MintERC1155 indexed mint, address indexed to, uint256 amount); + event OrderPlaced(MintERC1155 indexed mint, address indexed to, uint256 amount, string comment); event OrderFilled(MintERC1155 indexed mint, address indexed to, uint256 amount, uint256[] amounts); struct MintArgs { @@ -67,7 +67,15 @@ contract NFTMint is Ownable { return newMint; } - function order(MintERC1155 mint, uint256 amount, bytes32[] calldata merkleProof) external payable { + function order( + MintERC1155 mint, + uint256 amount, + string memory comment, + bytes32[] calldata merkleProof + ) + external + payable + { if (amount > 100) { revert("Exceeds max order amount per tx"); } @@ -105,7 +113,7 @@ contract NFTMint is Ownable { revert("Failed to transfer funds"); } - emit OrderPlaced(mint, msg.sender, modifiedAmount); + emit OrderPlaced(mint, msg.sender, modifiedAmount, comment); } function fillOrders(uint256 numOrdersToFill) external onlyOwner { @@ -150,6 +158,6 @@ contract NFTMint is Ownable { } function VERSION() external pure returns (string memory) { - return "0.1.1"; + return "0.1.2"; } } diff --git a/test/NFTMint.t.sol b/test/NFTMint.t.sol index 8151f9f..92e2014 100644 --- a/test/NFTMint.t.sol +++ b/test/NFTMint.t.sol @@ -44,7 +44,7 @@ contract NFTMintTest is TestBase { return nftMint.createMint(mintArgs); } - event OrderPlaced(MintERC1155 indexed mint, address indexed to, uint256 amount); + event OrderPlaced(MintERC1155 indexed mint, address indexed to, uint256 amount, string comment); function test_order() public returns (MintERC1155, address) { MintERC1155 mint = test_createMint(); @@ -53,9 +53,9 @@ contract NFTMintTest is TestBase { vm.deal(minter, 10 ether); vm.prank(minter); vm.expectEmit(true, true, true, true); - emit OrderPlaced(mint, minter, 100); + emit OrderPlaced(mint, minter, 100, "Fist order!"); - nftMint.order{ value: 1.1 ether }(mint, 100, new bytes32[](0)); + nftMint.order{ value: 1.1 ether }(mint, 100, "Fist order!", new bytes32[](0)); return (mint, minter); }