Skip to content

Commit

Permalink
feat: add WithdrawBalance script for withdrawing balance from TokenTr…
Browse files Browse the repository at this point in the history
…ansfer contract
  • Loading branch information
cqlyj committed Dec 3, 2024
1 parent 1673938 commit 4479eb2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions script/WithdrawBalance.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {Script, console} from "forge-std/Script.sol";
import {TokenTransfer} from "src/TokenTransfer.sol";
import {DevOpsTools} from "lib/foundry-devops/src/DevOpsTools.sol";

contract WithdrawBalance is Script {
TokenTransfer public tokenTransfer;
address public constant BENEFICIARY =
0xFB6a372F2F51a002b390D18693075157A459641F;

function withdrawBalance(address mostRecentlyDeployed) public {
tokenTransfer = TokenTransfer(payable(mostRecentlyDeployed));

vm.startBroadcast();
tokenTransfer.withdraw(BENEFICIARY);
vm.stopBroadcast();
}

function run() public {
address mostRecentlyDeployed = DevOpsTools.get_most_recent_deployment(
"TokenTransfer",
block.chainid
);

console.log("Most recently deployed address: ", mostRecentlyDeployed);
withdrawBalance(mostRecentlyDeployed);
}
}

0 comments on commit 4479eb2

Please sign in to comment.