-
Notifications
You must be signed in to change notification settings - Fork 0
/
Integrations.s.sol
37 lines (29 loc) · 1.16 KB
/
Integrations.s.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
import {Script, console} from "forge-std/Script.sol";
import {FundMe} from "../src/FundMe.sol";
import {DevOpsTools} from "foundry-devops/src/DevOpsTools.sol";
contract FundFundMe is Script {
uint256 constant SEND_VALUE = 0.1 ether;
function fundFundMe(address mostRecentlyDeployed) public {
FundMe(payable(mostRecentlyDeployed)).fund{value: SEND_VALUE}();
console.log("Funded FundMe with %s", SEND_VALUE);
}
function run() external {
address mostRecentlyDeployed = DevOpsTools.get_most_recent_deployment("FundMe", block.chainid);
vm.startBroadcast();
fundFundMe(mostRecentlyDeployed);
}
}
contract WithdrawFundMe is Script {
function withdrawFundMe(address mostRecentlyDeployed) public {
FundMe(payable(mostRecentlyDeployed)).withdraw();
console.log("Withdraw FundMe balance!");
}
function run() external {
address mostRecentlyDeployed = DevOpsTools.get_most_recent_deployment("FundMe", block.chainid);
vm.startBroadcast();
withdrawFundMe(mostRecentlyDeployed);
vm.stopBroadcast();
}
}