File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ require("./scripts/simulations/tasks");
17
17
require ( "./scripts/populatePolicyRegistry" ) ;
18
18
require ( "./scripts/populateCourts" ) ;
19
19
require ( "./scripts/changeGovernor" ) ;
20
+ require ( "./scripts/getDisputeTemplate" ) ;
20
21
21
22
dotenv . config ( ) ;
22
23
Original file line number Diff line number Diff line change
1
+ import { task } from "hardhat/config" ;
2
+ import { HardhatRuntimeEnvironment } from "hardhat/types" ;
3
+ import { IDisputeTemplateRegistry } from "../typechain-types" ;
4
+
5
+ task ( "get-dispute-template" , "Gets a dispute template by ID" )
6
+ . addPositionalParam ( "templateId" , "The ID of the template to query" )
7
+ . setAction ( async function ( { templateId } : { templateId : string } , hre : HardhatRuntimeEnvironment ) {
8
+ const { ethers } = hre ;
9
+
10
+ // Get the contract instance
11
+ const disputeTemplateRegistry = await ethers . getContract < IDisputeTemplateRegistry > ( "DisputeTemplateRegistry" ) ;
12
+
13
+ // Query the events
14
+ const filter = disputeTemplateRegistry . filters . DisputeTemplate ( BigInt ( templateId ) ) ;
15
+ const events = await disputeTemplateRegistry . queryFilter ( filter ) ;
16
+
17
+ if ( events . length === 0 ) {
18
+ console . log ( `No template found with ID ${ templateId } ` ) ;
19
+ return ;
20
+ }
21
+
22
+ // Get the most recent event
23
+ const event = events [ events . length - 1 ] ;
24
+
25
+ console . log ( "Template Details:" ) ;
26
+ console . log ( "----------------" ) ;
27
+ console . log ( `Template ID: ${ event . args . _templateId } ` ) ;
28
+ console . log ( `Template Tag: ${ event . args . _templateTag } ` ) ;
29
+ console . log ( `Template Data: ${ event . args . _templateData } ` ) ;
30
+ console . log ( `Template Data Mappings: ${ event . args . _templateDataMappings } ` ) ;
31
+ } ) ;
You can’t perform that action at this time.
0 commit comments