Commit 153e5781 authored by Maurelian's avatar Maurelian

feat(ctb): Change json tx getter func to printer

parent 02b5d60b
...@@ -12,7 +12,7 @@ import { ...@@ -12,7 +12,7 @@ import {
getContractsFromArtifacts, getContractsFromArtifacts,
getDeploymentAddress, getDeploymentAddress,
doPhase, doPhase,
jsonifyTransaction, printJsonTransaction,
printTenderlySimulationLink, printTenderlySimulationLink,
printCastCommand, printCastCommand,
} from '../src/deploy-utils' } from '../src/deploy-utils'
...@@ -99,8 +99,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -99,8 +99,7 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`Please transfer AddressManager owner to MSD`) console.log(`Please transfer AddressManager owner to MSD`)
console.log(`AddressManager address: ${AddressManager.address}`) console.log(`AddressManager address: ${AddressManager.address}`)
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) printJsonTransaction(tx)
console.log(jsonifyTransaction(tx))
printCastCommand(tx) printCastCommand(tx)
await printTenderlySimulationLink(SystemDictator.provider, tx) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
...@@ -137,8 +136,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -137,8 +136,7 @@ const deployFn: DeployFunction = async (hre) => {
`L1StandardBridgeProxy address: ${L1StandardBridgeProxy.address}` `L1StandardBridgeProxy address: ${L1StandardBridgeProxy.address}`
) )
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) printJsonTransaction(tx)
console.log(jsonifyTransaction(tx))
printCastCommand(tx) printCastCommand(tx)
await printTenderlySimulationLink(SystemDictator.provider, tx) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
...@@ -175,8 +173,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -175,8 +173,7 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`Please transfer L1ERC721Bridge (proxy) owner to MSD`) console.log(`Please transfer L1ERC721Bridge (proxy) owner to MSD`)
console.log(`L1ERC721BridgeProxy address: ${L1ERC721BridgeProxy.address}`) console.log(`L1ERC721BridgeProxy address: ${L1ERC721BridgeProxy.address}`)
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) printJsonTransaction(tx)
console.log(jsonifyTransaction(tx))
printCastCommand(tx) printCastCommand(tx)
await printTenderlySimulationLink(SystemDictator.provider, tx) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
......
...@@ -10,7 +10,7 @@ import '@nomiclabs/hardhat-ethers' ...@@ -10,7 +10,7 @@ import '@nomiclabs/hardhat-ethers'
import { import {
assertContractVariable, assertContractVariable,
getContractsFromArtifacts, getContractsFromArtifacts,
jsonifyTransaction, printJsonTransaction,
isStep, isStep,
doStep, doStep,
printTenderlySimulationLink, printTenderlySimulationLink,
...@@ -206,8 +206,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -206,8 +206,7 @@ const deployFn: DeployFunction = async (hre) => {
) )
) )
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) printJsonTransaction(tx)
console.log(jsonifyTransaction(tx))
printCastCommand(tx) printCastCommand(tx)
await printTenderlySimulationLink(SystemDictator.provider, tx) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
...@@ -318,8 +317,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -318,8 +317,7 @@ const deployFn: DeployFunction = async (hre) => {
const tx = await OptimismPortal.populateTransaction.unpause() const tx = await OptimismPortal.populateTransaction.unpause()
console.log(`Please unpause the OptimismPortal...`) console.log(`Please unpause the OptimismPortal...`)
console.log(`OptimismPortal address: ${OptimismPortal.address}`) console.log(`OptimismPortal address: ${OptimismPortal.address}`)
console.log(`JSON:`) printJsonTransaction(tx)
console.log(jsonifyTransaction(tx))
printCastCommand(tx) printCastCommand(tx)
await printTenderlySimulationLink(SystemDictator.provider, tx) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
...@@ -348,8 +346,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -348,8 +346,7 @@ const deployFn: DeployFunction = async (hre) => {
const tx = await SystemDictator.populateTransaction.finalize() const tx = await SystemDictator.populateTransaction.finalize()
console.log(`Please finalize deployment...`) console.log(`Please finalize deployment...`)
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) printJsonTransaction(tx)
console.log(jsonifyTransaction(tx))
printCastCommand(tx) printCastCommand(tx)
await printTenderlySimulationLink(SystemDictator.provider, tx) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
......
...@@ -305,8 +305,10 @@ export const getDeploymentAddress = async ( ...@@ -305,8 +305,10 @@ export const getDeploymentAddress = async (
* @param tx Ethers transaction object. * @param tx Ethers transaction object.
* @returns JSON-ified transaction object. * @returns JSON-ified transaction object.
*/ */
export const jsonifyTransaction = (tx: ethers.PopulatedTransaction): string => { export const printJsonTransaction = (tx: ethers.PopulatedTransaction): void => {
return JSON.stringify( console.log(
'JSON transaction parameters:\n' +
JSON.stringify(
{ {
from: tx.from, from: tx.from,
to: tx.to, to: tx.to,
...@@ -317,6 +319,7 @@ export const jsonifyTransaction = (tx: ethers.PopulatedTransaction): string => { ...@@ -317,6 +319,7 @@ export const jsonifyTransaction = (tx: ethers.PopulatedTransaction): string => {
null, null,
2 2
) )
)
} }
/** /**
...@@ -388,11 +391,8 @@ export const doStep = async (opts: { ...@@ -388,11 +391,8 @@ export const doStep = async (opts: {
]() ]()
console.log(`Please execute step ${opts.step}...`) console.log(`Please execute step ${opts.step}...`)
console.log(`MSD address: ${opts.SystemDictator.address}`) console.log(`MSD address: ${opts.SystemDictator.address}`)
console.log(`JSON:`) printJsonTransaction(tx)
console.log(jsonifyTransaction(tx))
console.log(
await printTenderlySimulationLink(opts.SystemDictator.provider, tx) await printTenderlySimulationLink(opts.SystemDictator.provider, tx)
)
} }
// Wait for the step to complete. // Wait for the step to complete.
...@@ -444,11 +444,8 @@ export const doPhase = async (opts: { ...@@ -444,11 +444,8 @@ export const doPhase = async (opts: {
]() ]()
console.log(`Please execute phase ${opts.phase}...`) console.log(`Please execute phase ${opts.phase}...`)
console.log(`MSD address: ${opts.SystemDictator.address}`) console.log(`MSD address: ${opts.SystemDictator.address}`)
console.log(`JSON:`) printJsonTransaction(tx)
console.log(jsonifyTransaction(tx))
console.log(
await printTenderlySimulationLink(opts.SystemDictator.provider, tx) await printTenderlySimulationLink(opts.SystemDictator.provider, tx)
)
} }
// Wait for the step to complete. // Wait for the step to complete.
...@@ -495,6 +492,8 @@ export const printTenderlySimulationLink = async ( ...@@ -495,6 +492,8 @@ export const printTenderlySimulationLink = async (
*/ */
export const printCastCommand = (tx: ethers.PopulatedTransaction): void => { export const printCastCommand = (tx: ethers.PopulatedTransaction): void => {
if (process.env.CAST_COMMANDS) { if (process.env.CAST_COMMANDS) {
console.log(`cast send ${tx.to} ${tx.data} --from ${tx.from} --value ${tx.value}`) console.log(
`cast send ${tx.to} ${tx.data} --from ${tx.from} --value ${tx.value}`
)
} }
} }
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