Skip to content

Instantly share code, notes, and snippets.

View pouyapayandeh's full-sized avatar

Pouya Payandeh pouyapayandeh

  • Shahid Beheshti university - CE
  • Tehran
View GitHub Profile
@caffeinum
caffeinum / deploy.js
Last active September 20, 2022 17:38
How to use Truffle to replace pending transaction when you deploy new contract
const Greeter = artifacts.require("Greeter");
module.exports = async function (deployer, network, accounts) {
// await deployer.deploy(Greeter);
// replace with:
const [ owner ] = accounts;
const lastNonce = await web3.eth.getTransactionCount(owner);
// this DOESN'T include pending transactions, so lastNonce + 1 always replaces pending