-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f11e048
commit 20e90ff
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
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,30 @@ | ||
import { task } from 'hardhat/config'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
task('contracts', 'Display contract deployment information') | ||
.addParam('target', 'Network type (main or test)') | ||
.setAction(async (taskArgs: { target: string }) => { | ||
const networkType = taskArgs.target.toLowerCase(); | ||
|
||
if (networkType !== 'main' && networkType !== 'test') { | ||
throw new Error('Network parameter must be either "main" or "test"'); | ||
} | ||
|
||
const fileName = networkType === 'main' ? 'mainnet_deployed.json' : 'testnet_deployed.json'; | ||
|
||
// Read JSON file | ||
const filePath = path.join(__dirname, '..', fileName); | ||
const fileContent = fs.readFileSync(filePath, 'utf8'); | ||
const deploymentData = JSON.parse(fileContent); | ||
|
||
// Extract and display contract information | ||
console.log(`\nDeployed Contracts (${networkType})`); | ||
console.log('========================'); | ||
|
||
Object.entries(deploymentData.contracts).forEach(([name, data]: [string, any]) => { | ||
console.log(`\n${name}:`); | ||
console.log(`Address: ${data.address}`); | ||
console.log(`Explorer: ${data.url}`); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './signatures'; | ||
export * from './copybatch'; | ||
export * from './contracts'; |