From 3cbf7a2e7d4a99c2c175770c21218de34d88aa67 Mon Sep 17 00:00:00 2001 From: MacroWang001 <96471386+MacroWang001@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:47:26 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A0=E6=8E=89=E4=B8=8D=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 23_Frontrun/frontrun.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/23_Frontrun/frontrun.js b/23_Frontrun/frontrun.js index 23cdfc0..5516490 100644 --- a/23_Frontrun/frontrun.js +++ b/23_Frontrun/frontrun.js @@ -67,7 +67,7 @@ const frontRun = async () => { console.log(`frontrun 交易成功,交易hash是:${receipt.transactionHash}`) console.log(`铸造发起的地址是:${tx.from}`) console.log(`编号${aimTokenId}NFT的持有者是${await contractFM.ownerOf(aimTokenId)}`)//刚刚mint的nft持有者并不是tx.from - console.log(`编号${aimTokenId.add(1)}的NFT的持有者是:${await contractFM.ownerOf(aimTokenId.add(1))}`)//tx.from被wallet.address抢跑,mint了下一个nft + console.log(`铸造发起的地址是不是对应NFT的持有者:${tx.from === await contractFM.ownerOf(aimTokenId)}`)//比对地址,tx.from被抢跑 //检验区块内数据结果 const block = await provider.getBlock(tx.blockNumber) From 8a3edcde2614e752552c37f7e4fac0c575a6242f Mon Sep 17 00:00:00 2001 From: MacroWang001 <96471386+MacroWang001@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:31:08 +0000 Subject: [PATCH 2/2] =?UTF-8?q?V6=E7=89=88=E6=9C=AC=E5=88=9B=E5=BB=BAInter?= =?UTF-8?q?face=E5=AE=9E=E4=BE=8B=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 23_Frontrun/frontrun.js | 1 + 1 file changed, 1 insertion(+) diff --git a/23_Frontrun/frontrun.js b/23_Frontrun/frontrun.js index 5516490..a233719 100644 --- a/23_Frontrun/frontrun.js +++ b/23_Frontrun/frontrun.js @@ -15,6 +15,7 @@ const contractAddress = '0xC76A71C4492c11bbaDC841342C4Cb470b5d12193' const contractFM = new ethers.Contract(contractAddress, contractABI, provider) //3.创建Interface对象,用于检索mint函数。 + //V6 版本 const iface = new ethers.Interface(contractABI) const iface = new ethers.utils.Interface(contractABI) function getSignature(fn) { // V6 版本 return iface.getFunction("mint").selector