Import sibling archive WIP: keeper stack, CCIP scripts, and CCIP docs
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
80
script/DeployCCIPLoggerChain138.s.sol
Normal file
80
script/DeployCCIPLoggerChain138.s.sol
Normal file
@@ -0,0 +1,80 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
|
||||
/**
|
||||
* @title DeployCCIPLoggerChain138 - Deploy CCIPLogger to ChainID 138
|
||||
* @notice This script deploys CCIPLogger to ChainID 138
|
||||
* @dev CCIPLogger logs CCIP messages for monitoring and debugging
|
||||
*/
|
||||
contract DeployCCIPLoggerChain138 is Script {
|
||||
uint256 constant CHAIN138 = 138;
|
||||
|
||||
function run() external {
|
||||
uint256 chainId = block.chainid;
|
||||
require(chainId == CHAIN138, "This script is only for ChainID 138");
|
||||
|
||||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
|
||||
address deployer = vm.addr(deployerPrivateKey);
|
||||
|
||||
// Load CCIP Router address
|
||||
address ccipRouter = vm.envAddress("CCIP_ROUTER_ADDRESS");
|
||||
require(ccipRouter != address(0), "CCIP_ROUTER_ADDRESS not set");
|
||||
|
||||
console.log("==========================================");
|
||||
console.log("CCIPLogger Deployment - ChainID 138");
|
||||
console.log("==========================================");
|
||||
console.log("Chain ID:", chainId);
|
||||
console.log("Deployer:", deployer);
|
||||
console.log("Deployer Balance:", deployer.balance / 1e18, "ETH");
|
||||
console.log("CCIP Router:", ccipRouter);
|
||||
console.log("");
|
||||
|
||||
vm.startBroadcast(deployerPrivateKey);
|
||||
|
||||
// Note: CCIPLogger contract needs to be available
|
||||
// If CCIPLogger.sol doesn't exist, this will fail at compilation
|
||||
// For now, we'll create a simple logger contract inline
|
||||
|
||||
// Deploy a simple CCIP Logger contract
|
||||
CCIPLogger logger = new CCIPLogger(ccipRouter);
|
||||
|
||||
console.log("CCIPLogger deployed at:", address(logger));
|
||||
console.log("CCIP Router:", ccipRouter);
|
||||
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("\n=== Deployment Summary ===");
|
||||
console.log("CCIPLogger:", address(logger));
|
||||
console.log("CCIP Router:", ccipRouter);
|
||||
}
|
||||
}
|
||||
|
||||
// Simple CCIP Logger contract
|
||||
contract CCIPLogger {
|
||||
address public immutable router;
|
||||
|
||||
event MessageLogged(
|
||||
bytes32 indexed messageId,
|
||||
uint64 indexed sourceChainSelector,
|
||||
address sender,
|
||||
bytes data,
|
||||
uint256 timestamp
|
||||
);
|
||||
|
||||
constructor(address _router) {
|
||||
require(_router != address(0), "CCIPLogger: zero router");
|
||||
router = _router;
|
||||
}
|
||||
|
||||
function logMessage(
|
||||
bytes32 messageId,
|
||||
uint64 sourceChainSelector,
|
||||
address sender,
|
||||
bytes calldata data
|
||||
) external {
|
||||
emit MessageLogged(messageId, sourceChainSelector, sender, data, block.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
115
script/DeployGovernanceToken.s.sol
Normal file
115
script/DeployGovernanceToken.s.sol
Normal file
@@ -0,0 +1,115 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import {Script} from "forge-std/Script.sol";
|
||||
import {console} from "forge-std/console.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import "@openzeppelin/contracts/security/Pausable.sol";
|
||||
|
||||
/**
|
||||
* @title Governance Token
|
||||
* @notice ERC20 token for DAO governance and protocol incentives
|
||||
* @dev Supports minting for rewards and burning for deflation
|
||||
*/
|
||||
contract GovernanceToken is ERC20, Ownable, Pausable {
|
||||
uint256 public constant MAX_SUPPLY = 1_000_000_000 * 10**18; // 1 billion tokens
|
||||
uint256 public totalMinted;
|
||||
|
||||
constructor(
|
||||
address initialOwner,
|
||||
string memory name,
|
||||
string memory symbol
|
||||
) ERC20(name, symbol) {
|
||||
_transferOwnership(initialOwner);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Mint new tokens (only owner)
|
||||
* @param to Address to mint to
|
||||
* @param amount Amount to mint
|
||||
*/
|
||||
function mint(address to, uint256 amount) external onlyOwner {
|
||||
require(totalMinted + amount <= MAX_SUPPLY, "GovernanceToken: exceeds max supply");
|
||||
totalMinted += amount;
|
||||
_mint(to, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Burn tokens from caller
|
||||
* @param amount Amount to burn
|
||||
*/
|
||||
function burn(uint256 amount) external {
|
||||
_burn(msg.sender, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Burn tokens from specified address (only owner)
|
||||
* @param from Address to burn from
|
||||
* @param amount Amount to burn
|
||||
*/
|
||||
function burnFrom(address from, uint256 amount) external onlyOwner {
|
||||
_burn(from, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Pause token transfers (only owner)
|
||||
*/
|
||||
function pause() external onlyOwner {
|
||||
_pause();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Unpause token transfers (only owner)
|
||||
*/
|
||||
function unpause() external onlyOwner {
|
||||
_unpause();
|
||||
}
|
||||
|
||||
function _beforeTokenTransfer(
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount
|
||||
) internal override whenNotPaused {
|
||||
super._beforeTokenTransfer(from, to, amount);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title DeployGovernanceToken
|
||||
* @notice Deployment script for governance token
|
||||
*/
|
||||
contract DeployGovernanceToken is Script {
|
||||
function run() external {
|
||||
address deployer = msg.sender;
|
||||
address owner = vm.envOr("GOV_TOKEN_OWNER", deployer);
|
||||
string memory name = vm.envOr("GOV_TOKEN_NAME", string("DBIS Token"));
|
||||
string memory symbol = vm.envOr("GOV_TOKEN_SYMBOL", string("DBIS"));
|
||||
uint256 initialSupply = vm.envOr("GOV_TOKEN_INITIAL_SUPPLY", uint256(0));
|
||||
|
||||
console.log("Deploying Governance Token...");
|
||||
console.log("Deployer:", vm.toString(deployer));
|
||||
console.log("Owner:", vm.toString(owner));
|
||||
console.log("Name:", name);
|
||||
console.log("Symbol:", symbol);
|
||||
console.log("Initial Supply:", initialSupply);
|
||||
|
||||
vm.startBroadcast();
|
||||
|
||||
GovernanceToken token = new GovernanceToken(owner, name, symbol);
|
||||
|
||||
if (initialSupply > 0) {
|
||||
token.mint(owner, initialSupply);
|
||||
}
|
||||
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("Governance Token deployed at:", vm.toString(address(token)));
|
||||
console.log("Name:", token.name());
|
||||
console.log("Symbol:", token.symbol());
|
||||
console.log("Decimals:", token.decimals());
|
||||
console.log("Total Supply:", token.totalSupply());
|
||||
console.log("Max Supply:", token.MAX_SUPPLY());
|
||||
}
|
||||
}
|
||||
|
||||
101
script/DeployUSDC.s.sol
Normal file
101
script/DeployUSDC.s.sol
Normal file
@@ -0,0 +1,101 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import {Script} from "forge-std/Script.sol";
|
||||
import {console} from "forge-std/console.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import "@openzeppelin/contracts/security/Pausable.sol";
|
||||
|
||||
/**
|
||||
* @title Standard USDC Token
|
||||
* @notice ERC20 token with pausable and ownable features
|
||||
* @dev Can be used as native USDC or wrapped USDC depending on deployment strategy
|
||||
*/
|
||||
contract StandardUSDC is ERC20, Ownable, Pausable {
|
||||
uint8 private constant DECIMALS = 6; // USDC standard decimals
|
||||
|
||||
constructor(
|
||||
address initialOwner,
|
||||
uint256 initialSupply
|
||||
) ERC20("USD Coin", "USDC") {
|
||||
_transferOwnership(initialOwner);
|
||||
if (initialSupply > 0) {
|
||||
_mint(initialOwner, initialSupply);
|
||||
}
|
||||
}
|
||||
|
||||
function decimals() public pure override returns (uint8) {
|
||||
return DECIMALS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Mint new tokens (only owner)
|
||||
* @param to Address to mint to
|
||||
* @param amount Amount to mint
|
||||
*/
|
||||
function mint(address to, uint256 amount) external onlyOwner {
|
||||
_mint(to, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Burn tokens (only owner)
|
||||
* @param from Address to burn from
|
||||
* @param amount Amount to burn
|
||||
*/
|
||||
function burn(address from, uint256 amount) external onlyOwner {
|
||||
_burn(from, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Pause token transfers (only owner)
|
||||
*/
|
||||
function pause() external onlyOwner {
|
||||
_pause();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Unpause token transfers (only owner)
|
||||
*/
|
||||
function unpause() external onlyOwner {
|
||||
_unpause();
|
||||
}
|
||||
|
||||
function _beforeTokenTransfer(
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount
|
||||
) internal override whenNotPaused {
|
||||
super._beforeTokenTransfer(from, to, amount);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title DeployUSDC
|
||||
* @notice Deployment script for USDC token
|
||||
*/
|
||||
contract DeployUSDC is Script {
|
||||
function run() external {
|
||||
address deployer = msg.sender;
|
||||
address owner = vm.envOr("USDC_OWNER", deployer);
|
||||
uint256 initialSupply = vm.envOr("USDC_INITIAL_SUPPLY", uint256(0));
|
||||
|
||||
console.log("Deploying USDC Token...");
|
||||
console.log("Deployer:", vm.toString(deployer));
|
||||
console.log("Owner:", vm.toString(owner));
|
||||
console.log("Initial Supply:", initialSupply);
|
||||
|
||||
vm.startBroadcast();
|
||||
|
||||
StandardUSDC usdc = new StandardUSDC(owner, initialSupply);
|
||||
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("USDC Token deployed at:", vm.toString(address(usdc)));
|
||||
console.log("Name:", usdc.name());
|
||||
console.log("Symbol:", usdc.symbol());
|
||||
console.log("Decimals:", usdc.decimals());
|
||||
console.log("Total Supply:", usdc.totalSupply());
|
||||
}
|
||||
}
|
||||
|
||||
101
script/DeployUSDT.s.sol
Normal file
101
script/DeployUSDT.s.sol
Normal file
@@ -0,0 +1,101 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import {Script} from "forge-std/Script.sol";
|
||||
import {console} from "forge-std/console.sol";
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import "@openzeppelin/contracts/security/Pausable.sol";
|
||||
|
||||
/**
|
||||
* @title Standard USDT Token
|
||||
* @notice ERC20 token with pausable and ownable features
|
||||
* @dev Can be used as native USDT or wrapped USDT depending on deployment strategy
|
||||
*/
|
||||
contract StandardUSDT is ERC20, Ownable, Pausable {
|
||||
uint8 private constant DECIMALS = 6; // USDT standard decimals
|
||||
|
||||
constructor(
|
||||
address initialOwner,
|
||||
uint256 initialSupply
|
||||
) ERC20("Tether USD", "USDT") {
|
||||
_transferOwnership(initialOwner);
|
||||
if (initialSupply > 0) {
|
||||
_mint(initialOwner, initialSupply);
|
||||
}
|
||||
}
|
||||
|
||||
function decimals() public pure override returns (uint8) {
|
||||
return DECIMALS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Mint new tokens (only owner)
|
||||
* @param to Address to mint to
|
||||
* @param amount Amount to mint
|
||||
*/
|
||||
function mint(address to, uint256 amount) external onlyOwner {
|
||||
_mint(to, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Burn tokens (only owner)
|
||||
* @param from Address to burn from
|
||||
* @param amount Amount to burn
|
||||
*/
|
||||
function burn(address from, uint256 amount) external onlyOwner {
|
||||
_burn(from, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Pause token transfers (only owner)
|
||||
*/
|
||||
function pause() external onlyOwner {
|
||||
_pause();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Unpause token transfers (only owner)
|
||||
*/
|
||||
function unpause() external onlyOwner {
|
||||
_unpause();
|
||||
}
|
||||
|
||||
function _beforeTokenTransfer(
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount
|
||||
) internal override whenNotPaused {
|
||||
super._beforeTokenTransfer(from, to, amount);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title DeployUSDT
|
||||
* @notice Deployment script for USDT token
|
||||
*/
|
||||
contract DeployUSDT is Script {
|
||||
function run() external {
|
||||
address deployer = msg.sender;
|
||||
address owner = vm.envOr("USDT_OWNER", deployer);
|
||||
uint256 initialSupply = vm.envOr("USDT_INITIAL_SUPPLY", uint256(0));
|
||||
|
||||
console.log("Deploying USDT Token...");
|
||||
console.log("Deployer:", vm.toString(deployer));
|
||||
console.log("Owner:", vm.toString(owner));
|
||||
console.log("Initial Supply:", initialSupply);
|
||||
|
||||
vm.startBroadcast();
|
||||
|
||||
StandardUSDT usdt = new StandardUSDT(owner, initialSupply);
|
||||
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("USDT Token deployed at:", vm.toString(address(usdt)));
|
||||
console.log("Name:", usdt.name());
|
||||
console.log("Symbol:", usdt.symbol());
|
||||
console.log("Decimals:", usdt.decimals());
|
||||
console.log("Total Supply:", usdt.totalSupply());
|
||||
}
|
||||
}
|
||||
|
||||
14
script/helpers/Roles.sol
Normal file
14
script/helpers/Roles.sol
Normal file
@@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
library Roles {
|
||||
bytes32 public constant GOVERNANCE_ADMIN_ROLE = keccak256("GOVERNANCE_ADMIN_ROLE");
|
||||
bytes32 public constant TOKEN_DEPLOYER_ROLE = keccak256("TOKEN_DEPLOYER_ROLE");
|
||||
bytes32 public constant POLICY_OPERATOR_ROLE = keccak256("POLICY_OPERATOR_ROLE");
|
||||
bytes32 public constant ISSUER_ROLE = keccak256("ISSUER_ROLE");
|
||||
bytes32 public constant ENFORCEMENT_ROLE = keccak256("ENFORCEMENT_ROLE");
|
||||
bytes32 public constant COMPLIANCE_ROLE = keccak256("COMPLIANCE_ROLE");
|
||||
bytes32 public constant DEBT_AUTHORITY_ROLE = keccak256("DEBT_AUTHORITY_ROLE");
|
||||
bytes32 public constant BRIDGE_OPERATOR_ROLE = keccak256("BRIDGE_OPERATOR_ROLE");
|
||||
}
|
||||
|
||||
48
script/reserve/DeployChainlinkKeeper.s.sol
Normal file
48
script/reserve/DeployChainlinkKeeper.s.sol
Normal file
@@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Script.sol";
|
||||
import "../../contracts/reserve/ChainlinkKeeperCompatible.sol";
|
||||
import "../../contracts/reserve/PriceFeedKeeper.sol";
|
||||
|
||||
/**
|
||||
* @title DeployChainlinkKeeper
|
||||
* @notice Deploy ChainlinkKeeperCompatible wrapper for PriceFeedKeeper
|
||||
*/
|
||||
contract DeployChainlinkKeeper 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 Chainlink Keeper Compatible (ChainID 138) ===");
|
||||
console.log("Deployer:", deployer);
|
||||
console.log("");
|
||||
|
||||
address keeperAddress = vm.envAddress("PRICE_FEED_KEEPER_ADDRESS");
|
||||
console.log("PriceFeedKeeper:", keeperAddress);
|
||||
|
||||
console.log("Deploying ChainlinkKeeperCompatible...");
|
||||
ChainlinkKeeperCompatible chainlinkKeeper = new ChainlinkKeeperCompatible(keeperAddress);
|
||||
console.log("ChainlinkKeeperCompatible deployed at:", address(chainlinkKeeper));
|
||||
|
||||
console.log("");
|
||||
console.log("=== Deployment Summary ===");
|
||||
console.log("ChainlinkKeeperCompatible:", address(chainlinkKeeper));
|
||||
console.log("PriceFeedKeeper:", keeperAddress);
|
||||
console.log("");
|
||||
console.log("=== Next Steps ===");
|
||||
console.log("1. Register upkeep with Chainlink KeeperRegistry:");
|
||||
console.log(" node scripts/reserve/chainlink-keeper-setup.js");
|
||||
console.log("2. Or use Chainlink UI: https://automation.chain.link");
|
||||
console.log("");
|
||||
console.log("=== Export to .env ===");
|
||||
console.log("export CHAINLINK_KEEPER_COMPATIBLE_ADDRESS=", vm.toString(address(chainlinkKeeper)));
|
||||
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
|
||||
52
script/reserve/DeployGelatoKeeper.s.sol
Normal file
52
script/reserve/DeployGelatoKeeper.s.sol
Normal file
@@ -0,0 +1,52 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Script.sol";
|
||||
import "../../contracts/reserve/GelatoKeeperCompatible.sol";
|
||||
import "../../contracts/reserve/PriceFeedKeeper.sol";
|
||||
|
||||
/**
|
||||
* @title DeployGelatoKeeper
|
||||
* @notice Deploy GelatoKeeperCompatible wrapper for PriceFeedKeeper
|
||||
*/
|
||||
contract DeployGelatoKeeper 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 Gelato Keeper Compatible (ChainID 138) ===");
|
||||
console.log("Deployer:", deployer);
|
||||
console.log("");
|
||||
|
||||
address keeperAddress = vm.envAddress("PRICE_FEED_KEEPER_ADDRESS");
|
||||
address gelato = vm.envOr("GELATO_OPS", address(0x527a819db1eb0e34426297b03bae11F2f8B3A19E)); // Default Gelato Ops
|
||||
|
||||
console.log("PriceFeedKeeper:", keeperAddress);
|
||||
console.log("Gelato Ops:", gelato);
|
||||
|
||||
console.log("Deploying GelatoKeeperCompatible...");
|
||||
GelatoKeeperCompatible gelatoKeeper = new GelatoKeeperCompatible(keeperAddress, gelato);
|
||||
console.log("GelatoKeeperCompatible deployed at:", address(gelatoKeeper));
|
||||
|
||||
console.log("");
|
||||
console.log("=== Deployment Summary ===");
|
||||
console.log("GelatoKeeperCompatible:", address(gelatoKeeper));
|
||||
console.log("PriceFeedKeeper:", keeperAddress);
|
||||
console.log("Gelato Ops:", gelato);
|
||||
console.log("");
|
||||
console.log("=== Next Steps ===");
|
||||
console.log("1. Create task with Gelato:");
|
||||
console.log(" node scripts/reserve/gelato-keeper-setup.js");
|
||||
console.log("2. Or use Gelato UI: https://app.gelato.network");
|
||||
console.log("");
|
||||
console.log("=== Export to .env ===");
|
||||
console.log("export GELATO_KEEPER_COMPATIBLE_ADDRESS=", vm.toString(address(gelatoKeeper)));
|
||||
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user