datahaven/contracts/script/utils/Logging.sol
Tobi Demeco a205b22532
feat: set rewards info as parameters in runtime (#99)
This PR improves the CLI to get from the deployments the
`RewardsRegistryAddress` (address of the RewardsRegistry contract
deployed), `RewardsAgentOrigin` (origin used for the agent in charge of
updating the rewards merkle root in the RewardsRegistry contract) and
`RewardsUpdateSelector` (function selector of the function that the
agent must execute to do the aforementioned update) and then set these
values in the `parameters` pallet of the runtime.

After these changes the rewards merkle root is being updated on the
Ethereum side. 🎉
2025-06-16 12:20:18 +02:00

67 lines
2 KiB
Solidity

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.27;
import {console} from "forge-std/console.sol";
library Logging {
// Logging helper constants
string private constant HEADER1 = "============================================================";
string private constant HEADER2 = " ";
string private constant FOOTER = "============================================================";
string private constant SEPARATOR =
"------------------------------------------------------------";
function logHeader(
string memory title
) internal pure {
console.log("");
console.log(HEADER1);
console.log("| %s |", title);
console.log(SEPARATOR);
}
function logSection(
string memory title
) internal pure {
console.log("");
console.log("| %s:", title);
console.log(SEPARATOR);
}
function logContractDeployed(string memory name, address contractAddress) internal pure {
console.log("| [+] %s: %s", name, contractAddress);
}
function logAgentOrigin(string memory name, string memory agentOrigin) internal pure {
console.log("| [+] %s: %s", name, agentOrigin);
}
function logFunctionSelector(string memory name, string memory selector) internal pure {
console.log("| [+] %s: %s", name, selector);
}
function logStep(
string memory message
) internal pure {
console.log("| >>> %s", message);
}
function logInfo(
string memory message
) internal pure {
console.log("| [i] %s", message);
}
function logFooter() internal pure {
console.log(FOOTER);
console.log("");
}
function logProgress(uint16 step, uint16 totalSteps) internal pure {
console.log("");
console.log(
"Progress: Step %d/%d completed (%d%%)", step, totalSteps, (step * 100) / totalSteps
);
console.log("");
}
}