File tree 4 files changed +25
-11
lines changed
4 files changed +25
-11
lines changed Original file line number Diff line number Diff line change 1
1
[submodule "lib/forge-std "]
2
2
path = lib/forge-std
3
3
url = https://github.com/foundry-rs/forge-std
4
- [submodule "lib/foundry-devops "]
5
- path = lib/foundry-devops
6
- url = https://github.com/ChainAccelOrg/foundry-devops
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -29,13 +29,18 @@ files=$(find $path -name "run-latest.json" -type f)
29
29
for file in $files ; do
30
30
if [[ $file == * " /$chainId /" * ]]; then
31
31
timestamp=$( jq ' .timestamp' " $file " )
32
- currentTransactionType=$( jq -r ' .transactions[0].transactionType' " $file " )
33
- currentContractName=$( jq -r ' .transactions[0].contractName' " $file " )
34
-
35
- if [ " $currentTransactionType " == " CREATE" ] && [ " $currentContractName " == " $contractName " ] && [ $timestamp -gt $latestTimestamp ]; then
36
- latestTimestamp=$timestamp
37
- latestContractAddress=$( jq -r ' .transactions[0].contractAddress' " $file " )
38
- fi
32
+
33
+ transactions_length=$( jq ' .transactions | length' " $file " )
34
+
35
+ for (( i= 0 ; i< $transactions_length ; i++ )) ; do
36
+ currentTransactionType=$( jq -r " .transactions[$i ].transactionType" " $file " )
37
+ currentContractName=$( jq -r " .transactions[$i ].contractName" " $file " )
38
+
39
+ if [ " $currentTransactionType " == " CREATE" ] && [ " $currentContractName " == " $contractName " ] && [ $timestamp -gt $latestTimestamp ]; then
40
+ latestTimestamp=$timestamp
41
+ latestContractAddress=$( jq -r " .transactions[$i ].contractAddress" " $file " )
42
+ fi
43
+ done
39
44
fi
40
45
done
41
46
Original file line number Diff line number Diff line change @@ -21,4 +21,17 @@ contract DevOpsToolsTest is Test {
21
21
);
22
22
assertEq (mostRecentDeployment, EXPECTED_ADDRESS);
23
23
}
24
+
25
+ function testGetMostRecentlyDeployedEvenWhenMultipleAreDeployed () public {
26
+ string memory contractName = "FundMe " ;
27
+ uint256 chainId = 1234 ;
28
+ address expectedAddress = 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 ;
29
+ address mostRecentDeployment = DevOpsTools.get_most_recent_deployment (
30
+ contractName,
31
+ chainId,
32
+ SEARCH_PATH,
33
+ SCRIPT_PATH
34
+ );
35
+ assertEq (mostRecentDeployment, expectedAddress);
36
+ }
24
37
}
You can’t perform that action at this time.
0 commit comments