Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
bokkypoobah committed Dec 15, 2021
1 parent f0d161f commit 075d21a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
8 changes: 3 additions & 5 deletions contracts/Nix.sol
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,9 @@ contract Nix is Owned, ReentrancyGuard, ERC721TokenReceiver {
if (tokenIds.length > 0) {
tokenIdsKey = keccak256(abi.encodePacked(tokenIds));
if (tokenIdsData[tokenIdsKey].length == 0) {
if (tokenIds.length > 1) {
for (uint i = 1; i < tokenIds.length; i++) {
if (tokenIds[i - 1] >= tokenIds[i]) {
revert TokenIdsMustBeSortedWithNoDuplicates();
}
for (uint i = 1; i < tokenIds.length; i++) {
if (tokenIds[i - 1] >= tokenIds[i]) {
revert TokenIdsMustBeSortedWithNoDuplicates();
}
}
tokenIdsData[tokenIdsKey] = tokenIds;
Expand Down
2 changes: 1 addition & 1 deletion test/00_test_0.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe("Nix", function () {
const addOrder1Tx = await data.nix.connect(data.maker0Signer).addOrder(data.nftA.address, ZERO_ADDRESS, BUYORSELL.BUY, ANYORALL.ANY, [ 3, 4, 5 ], ethers.utils.parseEther("11"), 0, 5, 100, data.integrator, { value: ethers.utils.parseEther("0.000001") });
await data.printEvents("txFee Maker Added Order #0 - BuyAny Max 2 NFTA:{3|4|5} for 11e", await addOrder1Tx.wait());
const expiry2 = parseInt(new Date() / 1000) + (60 * 60 * 24);
const addOrder2Tx = await data.nix.connect(data.maker0Signer).addOrder(data.nftA.address, ZERO_ADDRESS, BUYORSELL.BUY, ANYORALL.ANY, [ 3, 4, 5 ], ethers.utils.parseEther("0.0011"), expiry2, 5, 100, data.integrator, { value: ethers.utils.parseEther("0.000001") });
const addOrder2Tx = await data.nix.connect(data.maker0Signer).addOrder(data.nftA.address, ZERO_ADDRESS, BUYORSELL.BUY, ANYORALL.ANY, [ ], ethers.utils.parseEther("0.0011"), expiry2, 5, 100, data.integrator, { value: ethers.utils.parseEther("0.000001") });
await data.printEvents("Maker Added Order #1 - BuyAny Max 2 NFTA:* for 0.0011e", await addOrder2Tx.wait());
const addOrder3Tx = await data.nix.connect(data.maker0Signer).addOrder(data.nftB.address, ZERO_ADDRESS, BUYORSELL.BUY, ANYORALL.ANY, [ 3, 4, 5 ], ethers.utils.parseEther("22"), 0, 50, 75, data.integrator, { value: ethers.utils.parseEther("0.000001") });
await data.printEvents("txFee Maker Added Order #0 - BuyAny Max 2 NFTB:{3|4|5} for 22e", await addOrder3Tx.wait());
Expand Down
28 changes: 14 additions & 14 deletions testIt.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Nix
--- Setup Accounts, WETH, NFT and Nix Contracts ---
> txFee Deployed Nix - gasUsed: 5235477 ~ ETH 0.439780068 ~ USD 1917
> txFee Deployed Nix - gasUsed: 5233104 ~ ETH 0.439580736 ~ USD 1916
> txFee Deployed NixHelper - gasUsed: 2466135 ~ ETH 0.20715534 ~ USD 903
--- Setup Completed. Nix bytecode ~24323, NixHelper bytecode ~11691 ---
--- Setup Completed. Nix bytecode ~24312, NixHelper bytecode ~11691 ---
Account ETH WETH NFTA (6) NFTB (6)
-------------------- -------------------- -------------------- ------------------------- -------------------------
deployer:0xf39F 9999.760712128 100.0 [] []
deployer:0xf39F 9999.760731112 100.0 [] []
maker0:0x7099 9999.99925244 100.0 [0,1,2] [0,1,2]
maker1:0x3C44 9999.99925244 100.0 [] []
taker0:0x90F7 9999.99925244 100.0 [3,4,5] [3,4,5]
Expand All @@ -19,11 +19,11 @@
NixHelper:0x0165 0.0 0.0 [] []

--- Maker Add Orders ---
> txFee Maker Added Order #0 - BuyAny Max 2 NFTA:{3|4|5} for 11e - gasUsed: 368345 ~ ETH 0.03094098 ~ USD 134
> txFee Maker Added Order #0 - BuyAny Max 2 NFTA:{3|4|5} for 11e - gasUsed: 368316 ~ ETH 0.030938544 ~ USD 134
+ Nix:0x5FC8 34.0 TokenAdded(token: NFTA:0xCf7E, tokenIndex: 0)
+ Nix:0x5FC8 34.1 OrderAdded(token: NFTA:0xCf7E, orderIndex: 0)
+ Nix:0x5FC8 34.2 ThankYou(tip: 0.000001)
> Maker Added Order #1 - BuyAny Max 2 NFTA:* for 0.0011e - gasUsed: 172935 ~ ETH 0.01452654 ~ USD 63
> Maker Added Order #1 - BuyAny Max 2 NFTA:* for 0.0011e - gasUsed: 148471 ~ ETH 0.012471564 ~ USD 54
+ Nix:0x5FC8 35.0 OrderAdded(token: NFTA:0xCf7E, orderIndex: 1)
+ Nix:0x5FC8 35.1 ThankYou(tip: 0.000001)
> txFee Maker Added Order #0 - BuyAny Max 2 NFTB:{3|4|5} for 22e - gasUsed: 243328 ~ ETH 0.020439552 ~ USD 89
Expand All @@ -33,8 +33,8 @@
--- After Maker Added Orders ---
Account ETH WETH NFTA (6) NFTB (6)
-------------------- -------------------- -------------------- ------------------------- -------------------------
deployer:0xf39F 9999.760712128 100.0 [] []
maker0:0x7099 9999.992972576 100.0 [0,1,2] [0,1,2]
deployer:0xf39F 9999.760731112 100.0 [] []
maker0:0x7099 9999.99316852 100.0 [0,1,2] [0,1,2]
maker1:0x3C44 9999.99925244 100.0 [] []
taker0:0x90F7 9999.99925244 100.0 [3,4,5] [3,4,5]
taker1:0x15d3 9999.99925244 100.0 [] []
Expand All @@ -48,15 +48,15 @@
# Maker Taker Price B/S Any/All Expiry Tx Count Tx Max RoyFac% Status TokenIds
--- -------------- -------------- -------------------- ---- ------- ------------------------ -------- -------- -------- -------------------- -----------------------
0 maker0:0x7099 null:0x0000 11.0 Buy Any (none) 0 5 100 Executable [3,4,5]
1 maker0:0x7099 null:0x0000 0.0011 Buy Any 2021-12-16T23:29:30.000Z 0 5 100 Executable [3,4,5]
1 maker0:0x7099 null:0x0000 0.0011 Buy Any 2021-12-16T23:39:31.000Z 0 5 100 Executable []

Orders for NFTB:0xDc64, ordersLength: 1, executed: 0, volumeToken: 0, volumeWeth: 0.0
# Maker Taker Price B/S Any/All Expiry Tx Count Tx Max RoyFac% Status TokenIds
--- -------------- -------------- -------------------- ---- ------- ------------------------ -------- -------- -------- -------------------- -----------------------
0 maker0:0x7099 null:0x0000 22.0 Buy Any (none) 0 50 75 Executable [3,4,5]

--- Taker Execute Against Orders ---
> txFee Taker Sold #3 against BuyAny Max 2 NFTA:{3|4|5} for 11e - gasUsed: 605934 ~ ETH 0.050898456 ~ USD 221
> txFee Taker Sold #3 against BuyAny Max 2 NFTA:{3|4|5} for 11e - gasUsed: 604385 ~ ETH 0.05076834 ~ USD 221
+ Nix:0x5FC8 37.0 OrderExecuted(token: NFTA:0xCf7E, orderIndex: 0, tradeIndex: 0, tokenIds: 3,5)
+ NFTA:0xCf7E 37.1 Approval(owner: taker0:0x90F7, approved: null:0x0000, tokenId: 3)
+ NFTA:0xCf7E 37.2 Transfer(from: taker0:0x90F7, to: maker0:0x7099, tokenId: 3)
Expand All @@ -73,10 +73,10 @@
--- After Taker Executed Orders ---
Account ETH WETH NFTA (6) NFTB (6)
-------------------- -------------------- -------------------- ------------------------- -------------------------
deployer:0xf39F 9999.760712128 100.0 [] []
maker0:0x7099 9999.992972576 77.9989 [0,1,2,3,4,5] [0,1,2]
deployer:0xf39F 9999.760731112 100.0 [] []
maker0:0x7099 9999.99316852 77.9989 [0,1,2,3,4,5] [0,1,2]
maker1:0x3C44 9999.99925244 100.0 [] []
taker0:0x90F7 9999.994403968 115.40077 [] [3,4,5]
taker0:0x90F7 9999.99441636 115.40077 [] [3,4,5]
taker1:0x15d3 9999.99925244 100.0 [] []
royalty1:0x9965 10000.0 2.20011 [] []
royalty2:0x976E 10000.0 4.40022 [] []
Expand All @@ -88,7 +88,7 @@
# Maker Taker Price B/S Any/All Expiry Tx Count Tx Max RoyFac% Status TokenIds
--- -------------- -------------- -------------------- ---- ------- ------------------------ -------- -------- -------- -------------------- -----------------------
0 maker0:0x7099 null:0x0000 11.0 Buy Any (none) 2 5 100 Executable [3,4,5]
1 maker0:0x7099 null:0x0000 0.0011 Buy Any 2021-12-16T23:29:30.000Z 1 5 100 Executable [3,4,5]
1 maker0:0x7099 null:0x0000 0.0011 Buy Any 2021-12-16T23:39:31.000Z 1 5 100 Executable []

Orders for NFTB:0xDc64, ordersLength: 1, executed: 0, volumeToken: 0, volumeWeth: 0.0
# Maker Taker Price B/S Any/All Expiry Tx Count Tx Max RoyFac% Status TokenIds
Expand All @@ -97,7 +97,7 @@

tradesLength: 1
trades: ["0x90F79bf6EB2c4f870365E785982E1f101E93b906","100","37","0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9,0,0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9,1"]
✓ 00. Maker BuyAny Test (703ms)
✓ 00. Maker BuyAny Test (642ms)


1 passing (3s)
Expand Down

0 comments on commit 075d21a

Please sign in to comment.