Skip to content

Instantly share code, notes, and snippets.

@dcb9
Last active October 7, 2023 13:51
Show Gist options
  • Select an option

  • Save dcb9/ec6cd7f58a8af2941955114971ac0f23 to your computer and use it in GitHub Desktop.

Select an option

Save dcb9/ec6cd7f58a8af2941955114971ac0f23 to your computer and use it in GitHub Desktop.

Revisions

  1. Du, Chengbin revised this gist Oct 7, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion parseCustomError.js
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,10 @@
    const txHash = '0x...';
    const contract = await hre.ethers.getContractAt(FIXME);
    const tx = await hre.ethers.provider.getTransaction(txHash)
    try {
    let code = await hre.ethers.provider.call(tx, tx.blockNumber)
    } catch (err) {
    const code = err.data.replace('Reverted ','');
    console.log(code);
    console.log(manager.interface.parseError(code));
    console.log(contract.interface.parseError(code));
    }
  2. Du, Chengbin created this gist Oct 7, 2023.
    9 changes: 9 additions & 0 deletions parseCustomError.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    const txHash = '0x...';
    const tx = await hre.ethers.provider.getTransaction(txHash)
    try {
    let code = await hre.ethers.provider.call(tx, tx.blockNumber)
    } catch (err) {
    const code = err.data.replace('Reverted ','');
    console.log(code);
    console.log(manager.interface.parseError(code));
    }