Commit 02b5d60b authored by Maurelian's avatar Maurelian

feat(ctb): Change string getter funcs to printers

parent 8e76fac4
...@@ -13,8 +13,8 @@ import { ...@@ -13,8 +13,8 @@ import {
getDeploymentAddress, getDeploymentAddress,
doPhase, doPhase,
jsonifyTransaction, jsonifyTransaction,
getTenderlySimulationLink, printTenderlySimulationLink,
getCastCommand, printCastCommand,
} from '../src/deploy-utils' } from '../src/deploy-utils'
const uint128Max = ethers.BigNumber.from('0xffffffffffffffffffffffffffffffff') const uint128Max = ethers.BigNumber.from('0xffffffffffffffffffffffffffffffff')
...@@ -101,8 +101,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -101,8 +101,8 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) console.log(`JSON:`)
console.log(jsonifyTransaction(tx)) console.log(jsonifyTransaction(tx))
console.log(getCastCommand(tx)) printCastCommand(tx)
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx)) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
// Wait for the ownership transfer to complete. // Wait for the ownership transfer to complete.
...@@ -139,8 +139,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -139,8 +139,8 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) console.log(`JSON:`)
console.log(jsonifyTransaction(tx)) console.log(jsonifyTransaction(tx))
console.log(getCastCommand(tx)) printCastCommand(tx)
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx)) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
// Wait for the ownership transfer to complete. // Wait for the ownership transfer to complete.
...@@ -177,8 +177,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -177,8 +177,8 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) console.log(`JSON:`)
console.log(jsonifyTransaction(tx)) console.log(jsonifyTransaction(tx))
console.log(getCastCommand(tx)) printCastCommand(tx)
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx)) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
// Wait for the ownership transfer to complete. // Wait for the ownership transfer to complete.
......
...@@ -13,8 +13,8 @@ import { ...@@ -13,8 +13,8 @@ import {
jsonifyTransaction, jsonifyTransaction,
isStep, isStep,
doStep, doStep,
getTenderlySimulationLink, printTenderlySimulationLink,
getCastCommand, printCastCommand,
} from '../src/deploy-utils' } from '../src/deploy-utils'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
...@@ -208,8 +208,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -208,8 +208,8 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) console.log(`JSON:`)
console.log(jsonifyTransaction(tx)) console.log(jsonifyTransaction(tx))
console.log(getCastCommand(tx)) printCastCommand(tx)
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx)) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
await awaitCondition( await awaitCondition(
...@@ -320,8 +320,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -320,8 +320,8 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`OptimismPortal address: ${OptimismPortal.address}`) console.log(`OptimismPortal address: ${OptimismPortal.address}`)
console.log(`JSON:`) console.log(`JSON:`)
console.log(jsonifyTransaction(tx)) console.log(jsonifyTransaction(tx))
console.log(getCastCommand(tx)) printCastCommand(tx)
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx)) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
await awaitCondition( await awaitCondition(
...@@ -350,8 +350,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -350,8 +350,8 @@ const deployFn: DeployFunction = async (hre) => {
console.log(`MSD address: ${SystemDictator.address}`) console.log(`MSD address: ${SystemDictator.address}`)
console.log(`JSON:`) console.log(`JSON:`)
console.log(jsonifyTransaction(tx)) console.log(jsonifyTransaction(tx))
console.log(getCastCommand(tx)) printCastCommand(tx)
console.log(await getTenderlySimulationLink(SystemDictator.provider, tx)) await printTenderlySimulationLink(SystemDictator.provider, tx)
} }
await awaitCondition( await awaitCondition(
......
...@@ -391,7 +391,7 @@ export const doStep = async (opts: { ...@@ -391,7 +391,7 @@ export const doStep = async (opts: {
console.log(`JSON:`) console.log(`JSON:`)
console.log(jsonifyTransaction(tx)) console.log(jsonifyTransaction(tx))
console.log( console.log(
await getTenderlySimulationLink(opts.SystemDictator.provider, tx) await printTenderlySimulationLink(opts.SystemDictator.provider, tx)
) )
} }
...@@ -447,7 +447,7 @@ export const doPhase = async (opts: { ...@@ -447,7 +447,7 @@ export const doPhase = async (opts: {
console.log(`JSON:`) console.log(`JSON:`)
console.log(jsonifyTransaction(tx)) console.log(jsonifyTransaction(tx))
console.log( console.log(
await getTenderlySimulationLink(opts.SystemDictator.provider, tx) await printTenderlySimulationLink(opts.SystemDictator.provider, tx)
) )
} }
...@@ -465,36 +465,36 @@ export const doPhase = async (opts: { ...@@ -465,36 +465,36 @@ export const doPhase = async (opts: {
} }
/** /**
* Returns a direct link to a Tenderly simulation. * Prints a direct link to a Tenderly simulation.
* *
* @param provider Ethers Provider. * @param provider Ethers Provider.
* @param tx Ethers transaction object. * @param tx Ethers transaction object.
* @returns the url of the tenderly simulation.
*/ */
export const getTenderlySimulationLink = async ( export const printTenderlySimulationLink = async (
provider: ethers.providers.Provider, provider: ethers.providers.Provider,
tx: ethers.PopulatedTransaction tx: ethers.PopulatedTransaction
): Promise<string> => { ): Promise<void> => {
if (process.env.TENDERLY_PROJECT && process.env.TENDERLY_USERNAME) { if (process.env.TENDERLY_PROJECT && process.env.TENDERLY_USERNAME) {
return `https://dashboard.tenderly.co/${process.env.TENDERLY_PROJECT}/${ console.log(
process.env.TENDERLY_USERNAME `https://dashboard.tenderly.co/${process.env.TENDERLY_PROJECT}/${
}/simulator/new?${new URLSearchParams({ process.env.TENDERLY_USERNAME
network: (await provider.getNetwork()).chainId.toString(), }/simulator/new?${new URLSearchParams({
contractAddress: tx.to, network: (await provider.getNetwork()).chainId.toString(),
rawFunctionInput: tx.data, contractAddress: tx.to,
from: tx.from, rawFunctionInput: tx.data,
}).toString()}` from: tx.from,
}).toString()}`
)
} }
} }
/** /**
* Returns a cast commmand for submitting a given transaction. * Prints a cast commmand for submitting a given transaction.
* *
* @param tx Ethers transaction object. * @param tx Ethers transaction object.
* @returns the cast command
*/ */
export const getCastCommand = (tx: ethers.PopulatedTransaction): string => { export const printCastCommand = (tx: ethers.PopulatedTransaction): void => {
if (process.env.CAST_COMMANDS) { if (process.env.CAST_COMMANDS) {
return `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