Commit 94aeeb2c authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #5078 from ethereum-optimism/jm/tenderly

feat(ctb): Print tenderly simulation URLs during deployment
parents aa4699aa f52c0752
---
'@eth-optimism/contracts-bedrock': patch
---
Print tenderly simulation links during deployment
......@@ -3,3 +3,7 @@ L1_RPC=
# Private key for the deployer account
PRIVATE_KEY_DEPLOYER=
# Optional Tenderly details for a simulation link during deployment
TENDERLY_PROJECT=
TENDERLY_USERNAME=
......@@ -13,6 +13,7 @@ import {
getDeploymentAddress,
doStep,
jsonifyTransaction,
getTenderlySimulationLink,
} from '../src/deploy-utils'
const deployFn: DeployFunction = async (hre) => {
......@@ -97,6 +98,7 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`)
console.log(jsonifyTransaction(tx))
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx))
}
// Wait for the ownership transfer to complete.
......@@ -133,6 +135,7 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`)
console.log(jsonifyTransaction(tx))
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx))
}
// Wait for the ownership transfer to complete.
......@@ -169,6 +172,7 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`)
console.log(jsonifyTransaction(tx))
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx))
}
// Wait for the ownership transfer to complete.
......
......@@ -13,6 +13,7 @@ import {
jsonifyTransaction,
isStep,
doStep,
getTenderlySimulationLink,
} from '../src/deploy-utils'
const deployFn: DeployFunction = async (hre) => {
......@@ -193,6 +194,7 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`)
console.log(jsonifyTransaction(tx))
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx))
}
await awaitCondition(
......@@ -303,6 +305,7 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`OptimismPortal address: ${OptimismPortal.address}`)
console.log(`JSON:`)
console.log(jsonifyTransaction(tx))
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx))
}
await awaitCondition(
......@@ -331,6 +334,7 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`)
console.log(jsonifyTransaction(tx))
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx))
}
await awaitCondition(
......
import assert from 'assert'
import { URLSearchParams } from 'url'
import { ethers, Contract } from 'ethers'
import { Provider } from '@ethersproject/abstract-provider'
......@@ -293,6 +294,7 @@ export const getDeploymentAddress = async (
export const jsonifyTransaction = (tx: ethers.PopulatedTransaction): string => {
return JSON.stringify(
{
from: tx.from,
to: tx.to,
data: tx.data,
value: tx.value,
......@@ -354,6 +356,9 @@ export const doStep = async (opts: {
console.log(`MSD address: ${opts.SystemDictator.address}`)
console.log(`JSON:`)
console.log(jsonifyTransaction(tx))
console.log(
await getTenderlySimulationLink(opts.SystemDictator.provider, tx)
)
}
// Wait for the step to complete.
......@@ -368,3 +373,26 @@ export const doStep = async (opts: {
// Perform post-step checks.
await opts.checks()
}
/**
* Returns a direct link to a Tenderly simulation.
*
* @param provider Ethers Provider.
* @param tx Ethers transaction object.
* @returns the url of the tenderly simulation.
*/
export const getTenderlySimulationLink = async (
provider: ethers.providers.Provider,
tx: ethers.PopulatedTransaction
): Promise<string> => {
if (process.env.TENDERLY_PROJECT && process.env.TENDERLY_USERNAME) {
return `https://dashboard.tenderly.co/${process.env.TENDERLY_PROJECT}/${
process.env.TENDERLY_USERNAME
}/simulator/new?${new URLSearchParams({
network: (await provider.getNetwork()).chainId.toString(),
contractAddress: tx.to,
rawFunctionInput: tx.data,
from: tx.from,
}).toString()}`
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment