Platform: Code4rena
Start Date: 05/10/2022
Pot Size: $50,000 USDC
Total HM: 2
Participants: 80
Period: 5 days
Judge: GalloDaSballo
Id: 168
League: ETH
Rank: 49/80
Findings: 1
Award: $114.82
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: dipp
Also found by: 0x4non, 0x52, 0xRobocop, 0xc0ffEE, 8olidity, Ch_301, Jeiwan, Junnon, KIntern_NA, Lambda, M4TZ1P, MiloTruck, Nyx, PaludoX0, Ruhum, RustyRabbit, Soosh, TomJ, Trust, arcoun, aviggiano, bardamu, cryptonue, csanuragjain, d3e4, enckrish, exd0tpy, hansfriese, jayphbee, joestakey, ladboy233, minhquanym, minhtrng, nicobevi, obront, polymorphism, rokinot, romand, rotcivegaf, rvierdiiev, saian, serial-coder, trustindistrust, zzykxx
114.8239 USDC - $114.82
Assuming there is a user who tries to buy two tokens with the same tokenId(ERC1155). After executing, the seller gets all the funds, but the buyer only takes one token.
it("testing multiple erc1155 ", async () => { await mockERC1155.mint(alice.address, tokenId, 2); expect(await mockERC1155.balanceOf(alice.address, tokenId)).to.be.equal( 2 ); sell = generateOrder(alice, { side: Side.Sell, tokenId, amount: 2, price: anotherPrice, // eth("2"); collection: mockERC1155.address, matchingPolicy: matchingPolicies.standardPolicyERC1155.address, }); buy = generateOrder(bob, { side: Side.Buy, tokenId, amount: 2, collection: mockERC1155.address, price: anotherPrice, // eth("2"); matchingPolicy: matchingPolicies.standardPolicyERC1155.address, }); sellInput = await sell.pack(); buyInput = await buy.pack(); fee = anotherPrice.mul(feeRate).div(INVERSE_BASIS_POINT); priceMinusFee = anotherPrice.sub(fee); await waitForTx(exchange.execute(sellInput, buyInput)); expect(await mockERC1155.balanceOf(bob.address, tokenId)).to.be.equal(1); expect(await mockERC1155.balanceOf(alice.address, tokenId)).to.be.equal( 1 ); await checkBalances( aliceBalance, aliceBalanceWeth.add(priceMinusFee), bobBalance, bobBalanceWeth.sub(anotherPrice), feeRecipientBalance, feeRecipientBalanceWeth.add(fee) ); });
#0 - GalloDaSballo
2022-10-13T22:28:00Z