Skip to content

Commit

Permalink
feat: comment on order (#5)
Browse files Browse the repository at this point in the history
* feat: comment on order

* bump version
  • Loading branch information
arr00 authored Jul 25, 2024
1 parent 82fe48a commit f8abe7c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/MintERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
16 changes: 12 additions & 4 deletions src/NFTMint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -150,6 +158,6 @@ contract NFTMint is Ownable {
}

function VERSION() external pure returns (string memory) {
return "0.1.1";
return "0.1.2";
}
}
6 changes: 3 additions & 3 deletions test/NFTMint.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
Expand Down

0 comments on commit f8abe7c

Please sign in to comment.