54 lines
2.0 KiB
Solidity
54 lines
2.0 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {Script, console} from "forge-std/Script.sol";
|
|
import {ReserveSystem} from "../../contracts/reserve/ReserveSystem.sol";
|
|
import {ReserveTokenIntegration} from "../../contracts/reserve/ReserveTokenIntegration.sol";
|
|
|
|
/**
|
|
* @title DeployReserveSystem
|
|
* @notice Deployment script for Reserve System on ChainID 138
|
|
*/
|
|
contract DeployReserveSystem is Script {
|
|
function run() external {
|
|
uint256 chainId = block.chainid;
|
|
require(chainId == 138, "This script is for ChainID 138 only");
|
|
|
|
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
|
|
vm.startBroadcast(deployerPrivateKey);
|
|
|
|
address deployer = vm.addr(deployerPrivateKey);
|
|
console.log("=== Reserve System Deployment (ChainID 138) ===");
|
|
console.log("Deployer:", deployer);
|
|
console.log("");
|
|
|
|
// Load addresses from environment
|
|
address admin = vm.envOr("RESERVE_ADMIN", deployer);
|
|
address tokenFactory = vm.envAddress("TOKEN_FACTORY");
|
|
|
|
console.log("Deploying ReserveSystem...");
|
|
ReserveSystem reserveSystem = new ReserveSystem(admin);
|
|
console.log("ReserveSystem deployed at:", address(reserveSystem));
|
|
|
|
console.log("Deploying ReserveTokenIntegration...");
|
|
ReserveTokenIntegration integration = new ReserveTokenIntegration(
|
|
admin,
|
|
address(reserveSystem),
|
|
tokenFactory
|
|
);
|
|
console.log("ReserveTokenIntegration deployed at:", address(integration));
|
|
|
|
console.log("");
|
|
console.log("=== Deployment Summary ===");
|
|
console.log("ReserveSystem:", address(reserveSystem));
|
|
console.log("ReserveTokenIntegration:", address(integration));
|
|
console.log("");
|
|
console.log("=== Export to .env ===");
|
|
console.log("export RESERVE_SYSTEM=", vm.toString(address(reserveSystem)));
|
|
console.log("export RESERVE_INTEGRATION=", vm.toString(address(integration)));
|
|
|
|
vm.stopBroadcast();
|
|
}
|
|
}
|
|
|