Skip to content

Commit

Permalink
feat: add FundContractWithNativeEth script for funding TokenTransfer …
Browse files Browse the repository at this point in the history
…contract with native ETH
  • Loading branch information
cqlyj committed Dec 2, 2024
1 parent 4b6eaba commit fe58b9b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions script/FundContractWithNativeEth.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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 FundContractWithNativeEth is Script {
TokenTransfer public tokenTransfer;
uint256 public constant AMOUNT = 1e16; // 0.01

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

vm.startBroadcast();
payable(address(tokenTransfer)).transfer(AMOUNT);
vm.stopBroadcast();
}

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

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

0 comments on commit fe58b9b

Please sign in to comment.