Skip to content

Commit a1e456a

Browse files
committed
add GetResponse script to retrieve and log response from CheckBalance contract
1 parent 4917f0e commit a1e456a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

script/GetResponse.s.sol

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.26;
3+
4+
import {Script, console} from "forge-std/Script.sol";
5+
import {CheckBalance} from "../src/CheckBalance.sol";
6+
import {DevOpsTools} from "lib/foundry-devops/src/DevOpsTools.sol";
7+
8+
contract GetResponse is Script {
9+
CheckBalance public checkBalance;
10+
11+
function getResponse(address checkBalanceAddress) public {
12+
checkBalance = CheckBalance(checkBalanceAddress);
13+
vm.startBroadcast();
14+
uint256 response = checkBalance.getResponse();
15+
vm.stopBroadcast();
16+
console.log("Response: ", response);
17+
}
18+
19+
function run() public {
20+
address mostRecentlyDeployed = DevOpsTools.get_most_recent_deployment(
21+
"CheckBalance",
22+
block.chainid
23+
);
24+
console.log("Most recently deployed address: ", mostRecentlyDeployed);
25+
26+
getResponse(mostRecentlyDeployed);
27+
}
28+
}

0 commit comments

Comments
 (0)