Files
smom-dbis-138/script/reserve/DeployKeeper.s.sol
defiQUG e254f81a83
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m4s
CI/CD Pipeline / Security Scanning (push) Successful in 2m13s
CI/CD Pipeline / Lint and Format (push) Failing after 34s
CI/CD Pipeline / Terraform Validation (push) Failing after 21s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 22s
Validation / validate-genesis (push) Successful in 26s
Validation / validate-terraform (push) Failing after 24s
Validation / validate-kubernetes (push) Failing after 8s
Validation / validate-smart-contracts (push) Failing after 8s
Validation / validate-security (push) Failing after 1m10s
Validation / validate-documentation (push) Failing after 15s
Complete archive manual merge follow-ups and secure relay env handling
Apply clean archive patches (WETH CREATE2 doc, DeployKeeper script),
restore emoney unit tests from .bak, add keeper npm scripts without
replacing the Hardhat package.json, untrack relay lane secret env files,
and document superseded patch hunks in SIBLING_WIP_IMPORT.md.
2026-06-02 06:40:12 -07:00

86 lines
3.5 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Script, console} from "forge-std/Script.sol";
import {PriceFeedKeeper} from "../../contracts/reserve/PriceFeedKeeper.sol";
import {OraclePriceFeed} from "../../contracts/reserve/OraclePriceFeed.sol";
/**
* @title DeployKeeper
* @notice Deployment script for PriceFeedKeeper contract
*/
contract DeployKeeper 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");
address deployer = vm.addr(deployerPrivateKey);
console.log("=== Deploy Price Feed Keeper (ChainID 138) ===");
console.log("Deployer:", deployer);
console.log("");
// Load addresses from environment
address admin = vm.envOr("RESERVE_ADMIN", deployer);
address oraclePriceFeed = vm.envOr("ORACLE_PRICE_FEED", address(0));
if (oraclePriceFeed == address(0)) {
console.log("ORACLE_PRICE_FEED not set in .env. Skipping keeper deployment.");
console.log("Set ORACLE_PRICE_FEED (from SetupPriceFeeds.s.sol) or RESERVE_KEEPER (existing keeper) in .env.");
return;
}
vm.startBroadcast(deployerPrivateKey);
console.log("Deploying PriceFeedKeeper...");
PriceFeedKeeper keeper = new PriceFeedKeeper(admin, oraclePriceFeed);
console.log("PriceFeedKeeper deployed at:", address(keeper));
// Track assets if provided
address xauAsset = vm.envOr("XAU_ASSET", address(0));
address usdcAsset = vm.envOr("USDC_ASSET", address(0));
address ethAsset = vm.envOr("ETH_ASSET", address(0));
// Note: Asset tracking and role granting should be done after deployment
// via separate transactions to avoid prank issues in broadcast mode
address keeperAddress = vm.envOr("KEEPER_ADDRESS", deployer);
// Grant keeper role (admin is deployer, so we can call directly)
if (admin == deployer) {
keeper.grantRole(keeper.KEEPER_ROLE(), keeperAddress);
console.log("Keeper role granted to:", keeperAddress);
} else {
console.log("Note: Grant keeper role manually to:", keeperAddress);
}
// Note: Track assets after deployment via separate script or manual calls
if (xauAsset != address(0) || usdcAsset != address(0) || ethAsset != address(0)) {
console.log("");
console.log("Note: Track assets after deployment:");
if (xauAsset != address(0)) {
console.log(" keeper.trackAsset(", xauAsset, ")");
}
if (usdcAsset != address(0)) {
console.log(" keeper.trackAsset(", usdcAsset, ")");
}
if (ethAsset != address(0)) {
console.log(" keeper.trackAsset(", ethAsset, ")");
}
}
console.log("");
console.log("Keeper role granted to:", keeperAddress);
console.log("");
console.log("=== Deployment Summary ===");
console.log("PriceFeedKeeper:", address(keeper));
console.log("OraclePriceFeed:", oraclePriceFeed);
console.log("Admin:", admin);
console.log("Keeper Address:", keeperAddress);
console.log("");
console.log("=== Export to .env ===");
console.log("export PRICE_FEED_KEEPER_ADDRESS=", vm.toString(address(keeper)));
vm.stopBroadcast();
}
}