Skip to content

Commit

Permalink
add extra deployment checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ricott1 committed Jun 26, 2024
1 parent 1c48dbf commit 988ae0c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions script/swap_and_bridge/contracts/SwapAndBridge.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import { SwapAndBridge } from "src/L1/SwapAndBridge.sol";
/// @notice This contract is used to deploy SwapAndBridge contract.
contract SwapAndBridgeScript is Script {
/// @notice This function deploys the SwapAndBridge contract.
function run(address bridgeAddress, address l1Token, address l2Token) public {
function run(address _l1Bridge, address _l1Token, address _l2Token) public {
require(_l1Bridge != address(0), "Invalid L1 bridge address.");
require(_l1Token != address(0), "Invalid L1 token address.");
require(_l2Token != address(0), "Invalid L2 token address.");
// Deployer's private key. L1_SWAP_AND_BRIDGE_DEPLOYER_PRIVATE_KEY is set in .env file.
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

console2.log("Deploying SwapAndBridge contract...");
vm.startBroadcast(deployerPrivateKey);
SwapAndBridge swapAndBridge = new SwapAndBridge(bridgeAddress, l1Token, l2Token);
SwapAndBridge swapAndBridge = new SwapAndBridge(_l1Bridge, _l1Token, _l2Token);
vm.stopBroadcast();
assert(address(swapAndBridge) != address(0));
console2.log("SwapAndBridge successfully deployed at address: %s", address(swapAndBridge));
Expand Down

0 comments on commit 988ae0c

Please sign in to comment.