Skip to content

Commit

Permalink
feat: adding deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
wei3erHase committed May 16, 2024
1 parent 8e36663 commit c382f96
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sort_imports = true
[profile.default]
solc_version = '0.8.23'
libs = ["node_modules", "lib"]
optimizer_runs = 10_000
optimizer_runs = 50 # TODO: increase for production and add via-ir

[profile.optimized]
via_ir = true
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"build": "forge build",
"build:optimized": "FOUNDRY_PROFILE=optimized forge build",
"coverage": "forge coverage --match-contract Unit",
"deploy:mainnet": "bash -c 'source .env && forge script Deploy --broadcast --chain mainnet --private-key $MAINNET_DEPLOYER_PK'",
"deploy:sepolia": "bash -c 'source .env && forge script Deploy --broadcast --chain sepolia --private-key $SEPOLIA_DEPLOYER_PK'",
"deploy:mainnet": "bash -c 'source .env && forge script Deploy -vvvvv --rpc-url $MAINNET_RPC --broadcast --chain mainnet --private-key $MAINNET_DEPLOYER_PK --verify --etherscan-api-key $ETHERSCAN_API_KEY'",
"deploy:testnet": "bash -c 'source .env && forge script Deploy -vvvvv --rpc-url $SEPOLIA_RPC --broadcast --chain sepolia --private-key $SEPOLIA_DEPLOYER_PK --verify --etherscan-api-key $ETHERSCAN_API_KEY'",
"lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check",
"lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix",
"lint:natspec": "npx @defi-wonderland/natspec-smells --config natspec-smells.config.js",
Expand Down
19 changes: 19 additions & 0 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

import {BFactory} from 'contracts/BFactory.sol';
import {Params} from 'script/Params.s.sol';

import {Script} from 'forge-std/Script.sol';
import {IERC20} from 'forge-std/interfaces/IERC20.sol';

contract Deploy is Script, Params {
function run() public {
DeploymentParams memory _params = _deploymentParams[block.chainid];

vm.startBroadcast();
BFactory bFactory = new BFactory();
bFactory.setBLabs(_params.bLabs);
vm.stopBroadcast();
}
}
19 changes: 19 additions & 0 deletions script/Params.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

contract Params {
struct DeploymentParams {
address bLabs;
}

/// @notice Deployment parameters for each chain
mapping(uint256 _chainId => DeploymentParams _params) internal _deploymentParams;

constructor() {
// Mainnet
_deploymentParams[1] = DeploymentParams(address(this));

// Sepolia
_deploymentParams[11_155_111] = DeploymentParams(address(this));
}
}

0 comments on commit c382f96

Please sign in to comment.