Some checks failed
Verify Deployment / Verify Deployment (push) Has been cancelled
CI/CD Pipeline / Solidity Contracts (push) Has been cancelled
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
82 lines
2.9 KiB
Solidity
82 lines
2.9 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import "forge-std/Script.sol";
|
|
import "../../contracts/reserve/PriceFeedKeeper.sol";
|
|
import "../../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");
|
|
vm.startBroadcast(deployerPrivateKey);
|
|
|
|
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.envAddress("ORACLE_PRICE_FEED");
|
|
|
|
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));
|
|
|
|
if (xauAsset != address(0) || usdcAsset != address(0) || ethAsset != address(0)) {
|
|
console.log("");
|
|
console.log("Tracking assets...");
|
|
|
|
if (xauAsset != address(0)) {
|
|
vm.prank(admin);
|
|
keeper.trackAsset(xauAsset);
|
|
console.log("XAU tracked:", xauAsset);
|
|
}
|
|
|
|
if (usdcAsset != address(0)) {
|
|
vm.prank(admin);
|
|
keeper.trackAsset(usdcAsset);
|
|
console.log("USDC tracked:", usdcAsset);
|
|
}
|
|
|
|
if (ethAsset != address(0)) {
|
|
vm.prank(admin);
|
|
keeper.trackAsset(ethAsset);
|
|
console.log("ETH tracked:", ethAsset);
|
|
}
|
|
}
|
|
|
|
// Grant keeper role to deployer (or specified keeper address)
|
|
address keeperAddress = vm.envOr("KEEPER_ADDRESS", deployer);
|
|
vm.prank(admin);
|
|
keeper.grantRole(keeper.KEEPER_ROLE(), keeperAddress);
|
|
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();
|
|
}
|
|
}
|
|
|