|
| 1 | +// SPDX-License-Identifier: UNLICENSED |
| 2 | +pragma solidity ^0.8.13; |
| 3 | + |
| 4 | +import "forge-std/Script.sol"; |
| 5 | +import "../contracts/crossChainBurn/CrossChainBurn.sol"; |
| 6 | + |
| 7 | +/** |
| 8 | + Pro tip for testing! The private key can be whatever. This is what I did to test. |
| 9 | +
|
| 10 | + 1. Uncomment the lines below and follow the instructions there to change the code. |
| 11 | + 2. Run the script, like `forge script script/CrossChainBurn.s.sol --rpc-url https://eth-sepolia.g.alchemy.com/v2/xxx --broadcast` |
| 12 | + 3. It will print out the address, but give you an out of eth error. |
| 13 | + 4. Now you have the address, use your real wallet and send it some sepolia eth. |
| 14 | + 5. Now, run the script again. It will deploy and transfer the contract to your wallet. |
| 15 | +
|
| 16 | + In the end, you just basically used a random pk in the moment to deploy. You never had |
| 17 | + to expose your personal pk to your mac's environment variable or anything. |
| 18 | + */ |
| 19 | +contract DeployCrossChainBurn is Script { |
| 20 | + function run() external { |
| 21 | + // address initialOwner = <your wallet address>; // uncomment this and put in your wallet on sepolia |
| 22 | + address initialOwner = vm.envAddress("INITIAL_OWNER"); // comment this out on sepolia |
| 23 | + |
| 24 | + // uint pk = some combo of 6s and 9s; |
| 25 | + // address addr = vm.addr(pk); |
| 26 | + // console.log(addr); |
| 27 | + |
| 28 | + require(initialOwner != address(0), "Initial owner address not set. Please configure INITIAL_OWNER."); |
| 29 | + |
| 30 | + // uint256 deployerPrivateKey = pk; // uncomment this when testing on goerli |
| 31 | + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); // comment this out when testing on goerli |
| 32 | + vm.startBroadcast(deployerPrivateKey); |
| 33 | + // forge script script/CrossChainBurn.s.sol --optimizer-runs 1000 --rpc-url <YOUR_NODE> --broadcast |
| 34 | + // forge verify-contract --compiler-version 0.8.17 --optimizer-runs 1000 --chain sepolia <DEPLOYED_ADDRESS> contracts/physicalclaim/CrossChainBurn.sol:CrossChainBurn --constructor-args $(cast abi-encode "constructor(address,address)" "${INITIAL_OWNER}" "0x0000000000000000000000000000000000000000") --watch |
| 35 | + new CrossChainBurn{salt: 0x4c657427732067657420506879736963616c2000000000000000000000000000}(initialOwner, address(0)); |
| 36 | + vm.stopBroadcast(); |
| 37 | + } |
| 38 | +} |
0 commit comments