2023-09-12 14:21:51 +00:00
|
|
|
//// SPDX-License-Identifier: UNLICENSED
|
|
|
|
|
|
|
|
pragma solidity >=0.8.19 <=0.9.0;
|
|
|
|
|
|
|
|
import { Script } from "forge-std/Script.sol";
|
|
|
|
|
|
|
|
contract DeploymentConfig is Script {
|
|
|
|
error DeploymentConfig_InvalidDeployerAddress();
|
|
|
|
error DeploymentConfig_NoConfigForChain(uint256);
|
|
|
|
|
|
|
|
struct NetworkConfig {
|
|
|
|
address deployer;
|
2023-09-12 15:08:59 +00:00
|
|
|
address parentToken;
|
|
|
|
uint256 parentSnapShotBlock;
|
|
|
|
string name;
|
|
|
|
uint8 decimals;
|
|
|
|
string symbol;
|
|
|
|
bool transferEnabled;
|
2023-09-12 14:21:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NetworkConfig public activeNetworkConfig;
|
|
|
|
|
|
|
|
address private deployer;
|
|
|
|
|
|
|
|
constructor(address _broadcaster) {
|
2023-09-12 15:08:59 +00:00
|
|
|
deployer = _broadcaster;
|
2023-09-12 14:21:51 +00:00
|
|
|
if (block.chainid == 31_337) {
|
|
|
|
activeNetworkConfig = getOrCreateAnvilEthConfig();
|
|
|
|
} else {
|
|
|
|
revert DeploymentConfig_NoConfigForChain(block.chainid);
|
|
|
|
}
|
|
|
|
if (_broadcaster == address(0)) revert DeploymentConfig_InvalidDeployerAddress();
|
|
|
|
}
|
|
|
|
|
|
|
|
function getOrCreateAnvilEthConfig() public view returns (NetworkConfig memory) {
|
2023-09-12 15:08:59 +00:00
|
|
|
return NetworkConfig({
|
|
|
|
deployer: deployer,
|
|
|
|
parentToken: address(0),
|
|
|
|
parentSnapShotBlock: 0,
|
|
|
|
name: "MiniMe Test Token",
|
|
|
|
decimals: 18,
|
|
|
|
symbol: "MMT",
|
|
|
|
transferEnabled: true
|
|
|
|
});
|
2023-09-12 14:21:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This function is a hack to have it excluded by `forge coverage` until
|
|
|
|
// https://github.com/foundry-rs/foundry/issues/2988 is fixed.
|
|
|
|
// See: https://github.com/foundry-rs/foundry/issues/2988#issuecomment-1437784542
|
|
|
|
// for more info.
|
|
|
|
// solhint-disable-next-line
|
|
|
|
function test() public { }
|
|
|
|
}
|