From a1d6069ee212bef50622da790fede5988b2a11cc Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Mon, 12 Aug 2024 16:26:34 +0300 Subject: [PATCH] remove tests for orderExecuted --- test/unit/datatokens/ERC20Template4.test.js | 71 --------------------- 1 file changed, 71 deletions(-) diff --git a/test/unit/datatokens/ERC20Template4.test.js b/test/unit/datatokens/ERC20Template4.test.js index b321c65d..de6cee9c 100644 --- a/test/unit/datatokens/ERC20Template4.test.js +++ b/test/unit/datatokens/ERC20Template4.test.js @@ -1564,77 +1564,6 @@ describe("ERC20Template4", () => { }) - it("#orderExecuted - provider should succeed to call orderExecuted on a ERC20", async () => { - const orderTxId = '0x826e9781f191ef2b4cee95eac10cfeced2bd1bd340e3f079304e3bfdd6a56106' - const providerData="some provider data" - const providerAddress = user5.address - const providerMessage = ethers.utils.solidityKeccak256(["bytes32", "bytes"], [orderTxId, ethers.utils.hexlify(ethers.utils.toUtf8Bytes(providerData))]); - const providerSignature = await web3.eth.sign(providerMessage, providerAddress); - const consumerData="12345"; - const consumerAddress = user2.address - const consumerMessage = ethers.utils.solidityKeccak256(['bytes'],[ethers.utils.hexlify(ethers.utils.toUtf8Bytes(consumerData))]); - const consumerSignature = await web3.eth.sign(consumerMessage, consumerAddress); - const tx = await erc20Token - .connect(user5) - .orderExecuted(orderTxId, - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(providerData)), providerSignature, - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(consumerData)), consumerSignature, consumerAddress); - const txReceipt = await tx.wait(); - let event = getEventFromTx(txReceipt, 'OrderExecuted') - assert(event, "Cannot find OrderExecuted event") - }); - - it("#orderExecuted - provider should fail to call orderExecuted on a ERC20 if consumerAddress == providerAddress", async () => { - const orderTxId = '0x826e9781f191ef2b4cee95eac10cfeced2bd1bd340e3f079304e3bfdd6a56106' - const providerData="some provider data" - const providerAddress = user5.address - const providerMessage = ethers.utils.solidityKeccak256(["bytes32", "bytes"], [orderTxId, ethers.utils.hexlify(ethers.utils.toUtf8Bytes(providerData))]); - const providerSignature = await web3.eth.sign(providerMessage, providerAddress); - const consumerData="12345"; - const consumerAddress = user5.address - const consumerMessage = ethers.utils.solidityKeccak256(['bytes'],[ethers.utils.hexlify(ethers.utils.toUtf8Bytes(consumerData))]); - const consumerSignature = await web3.eth.sign(consumerMessage, consumerAddress); - await expectRevert( - erc20Token.connect(user5).orderExecuted(orderTxId, - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(providerData)), providerSignature, - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(consumerData)), consumerSignature, consumerAddress), - 'Provider cannot be the consumer') - }); - it("#orderExecuted - provider should fail to call orderExecuted on a ERC20 if consumerAddress is not the signer of consumerData", async () => { - const orderTxId = '0x826e9781f191ef2b4cee95eac10cfeced2bd1bd340e3f079304e3bfdd6a56106' - const providerData="some provider data" - const providerAddress = user5.address - const providerMessage = ethers.utils.solidityKeccak256(["bytes32", "bytes"], [orderTxId, ethers.utils.hexlify(ethers.utils.toUtf8Bytes(providerData))]); - const providerSignature = await web3.eth.sign(providerMessage, providerAddress); - const consumerData="12345"; - const consumerAddress = user2.address - const consumerMessage = ethers.utils.solidityKeccak256(['bytes'],[ethers.utils.hexlify(ethers.utils.toUtf8Bytes(consumerData))]); - const consumerSignature = await web3.eth.sign(consumerMessage, user3.address); - await expectRevert(erc20Token - .connect(user5) - .orderExecuted(orderTxId, - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(providerData)), providerSignature, - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(consumerData)), consumerSignature, consumerAddress), - 'Consumer signature check failed') - }); - it("#orderExecuted - provider should fail to call orderExecuted on a ERC20 if msg.sender is not the signer of providerData", async () => { - const orderTxId = '0x826e9781f191ef2b4cee95eac10cfeced2bd1bd340e3f079304e3bfdd6a56106' - const providerData="some provider data" - const providerAddress = user5.address - const providerMessage = ethers.utils.solidityKeccak256(["bytes32", "bytes"], [orderTxId, ethers.utils.hexlify(ethers.utils.toUtf8Bytes(providerData))]); - const providerSignature = await web3.eth.sign(providerMessage, providerAddress); - const consumerData="12345"; - const consumerAddress = user2.address - const consumerMessage = ethers.utils.solidityKeccak256(['bytes'],[ethers.utils.hexlify(ethers.utils.toUtf8Bytes(consumerData))]); - const consumerSignature = await web3.eth.sign(consumerMessage, consumerAddress); - await expectRevert(erc20Token - .connect(user3) - .orderExecuted(orderTxId, - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(providerData)), providerSignature, - ethers.utils.hexlify(ethers.utils.toUtf8Bytes(consumerData)), consumerSignature, consumerAddress), - 'Provider signature check failed') - }); - // sapphire specific tests it("#getFilesObject - should be able to get the files object if there is no allow/deny list list and we have valid order", async () => {