-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove unused contract (#241)
- Loading branch information
1 parent
bd7e239
commit 373600e
Showing
5 changed files
with
62 additions
and
79 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const { ethers, upgrades } = require("hardhat"); | ||
import upgradeHelper from "./helpers/upgrade"; | ||
import networkAddresses from "./address.json"; | ||
import proposeTransactions from "./helpers/proposeTransactions"; | ||
import { MetaTransactionData } from "@safe-global/safe-core-sdk-types"; | ||
|
||
|
||
async function main(networks: { [networkName: string]: { contracts: { name: string; address: string }[] } }) { | ||
const networkName = await hre.network.name; | ||
const networkContracts = networks[networkName].contracts; | ||
let targets = []; | ||
let values = []; | ||
let params = []; | ||
|
||
console.log(`Checking contracts on network "${networkName}":`, "\n"); | ||
|
||
for (let { name, address } of networkContracts) { | ||
const { to, value, data } = await upgradeHelper(address, name); | ||
targets.push(to) | ||
values.push(value) | ||
params.push(data) | ||
} | ||
const multisigData = await buildMultisigTx(targets,values, params); | ||
await proposeTransactions(multisigData); | ||
} | ||
|
||
|
||
|
||
async function buildMultisigTx(targets:string[], values:string[], params: string[]): Promise<MetaTransactionData[]> { | ||
const safeTransactionData: MetaTransactionData[] = []; | ||
for (let i = 0; i < targets.length; ++i) { | ||
const safeTxData: MetaTransactionData = { | ||
to: targets[i], | ||
data: params[i], | ||
value: values[i], | ||
operation: 0, | ||
}; | ||
safeTransactionData.push(safeTxData); | ||
} | ||
return safeTransactionData; | ||
} | ||
|
||
main(networkAddresses) | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |