Spaces:
Building
Building
| // SPDX-License-Identifier: MIT OR Apache-2.0 | |
| pragma solidity >=0.8.13 <0.9.0; | |
| import {VmSafe} from "./Vm.sol"; | |
| library StdStyle { | |
| VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); | |
| string constant RED = "\u001b[91m"; | |
| string constant GREEN = "\u001b[92m"; | |
| string constant YELLOW = "\u001b[93m"; | |
| string constant BLUE = "\u001b[94m"; | |
| string constant MAGENTA = "\u001b[95m"; | |
| string constant CYAN = "\u001b[96m"; | |
| string constant BOLD = "\u001b[1m"; | |
| string constant DIM = "\u001b[2m"; | |
| string constant ITALIC = "\u001b[3m"; | |
| string constant UNDERLINE = "\u001b[4m"; | |
| string constant INVERSE = "\u001b[7m"; | |
| string constant RESET = "\u001b[0m"; | |
| function styleConcat(string memory style, string memory self) private pure returns (string memory) { | |
| return string(abi.encodePacked(style, self, RESET)); | |
| } | |
| function red(string memory self) internal pure returns (string memory) { | |
| return styleConcat(RED, self); | |
| } | |
| function red(uint256 self) internal pure returns (string memory) { | |
| return red(vm.toString(self)); | |
| } | |
| function red(int256 self) internal pure returns (string memory) { | |
| return red(vm.toString(self)); | |
| } | |
| function red(address self) internal pure returns (string memory) { | |
| return red(vm.toString(self)); | |
| } | |
| function red(bool self) internal pure returns (string memory) { | |
| return red(vm.toString(self)); | |
| } | |
| function redBytes(bytes memory self) internal pure returns (string memory) { | |
| return red(vm.toString(self)); | |
| } | |
| function redBytes32(bytes32 self) internal pure returns (string memory) { | |
| return red(vm.toString(self)); | |
| } | |
| function green(string memory self) internal pure returns (string memory) { | |
| return styleConcat(GREEN, self); | |
| } | |
| function green(uint256 self) internal pure returns (string memory) { | |
| return green(vm.toString(self)); | |
| } | |
| function green(int256 self) internal pure returns (string memory) { | |
| return green(vm.toString(self)); | |
| } | |
| function green(address self) internal pure returns (string memory) { | |
| return green(vm.toString(self)); | |
| } | |
| function green(bool self) internal pure returns (string memory) { | |
| return green(vm.toString(self)); | |
| } | |
| function greenBytes(bytes memory self) internal pure returns (string memory) { | |
| return green(vm.toString(self)); | |
| } | |
| function greenBytes32(bytes32 self) internal pure returns (string memory) { | |
| return green(vm.toString(self)); | |
| } | |
| function yellow(string memory self) internal pure returns (string memory) { | |
| return styleConcat(YELLOW, self); | |
| } | |
| function yellow(uint256 self) internal pure returns (string memory) { | |
| return yellow(vm.toString(self)); | |
| } | |
| function yellow(int256 self) internal pure returns (string memory) { | |
| return yellow(vm.toString(self)); | |
| } | |
| function yellow(address self) internal pure returns (string memory) { | |
| return yellow(vm.toString(self)); | |
| } | |
| function yellow(bool self) internal pure returns (string memory) { | |
| return yellow(vm.toString(self)); | |
| } | |
| function yellowBytes(bytes memory self) internal pure returns (string memory) { | |
| return yellow(vm.toString(self)); | |
| } | |
| function yellowBytes32(bytes32 self) internal pure returns (string memory) { | |
| return yellow(vm.toString(self)); | |
| } | |
| function blue(string memory self) internal pure returns (string memory) { | |
| return styleConcat(BLUE, self); | |
| } | |
| function blue(uint256 self) internal pure returns (string memory) { | |
| return blue(vm.toString(self)); | |
| } | |
| function blue(int256 self) internal pure returns (string memory) { | |
| return blue(vm.toString(self)); | |
| } | |
| function blue(address self) internal pure returns (string memory) { | |
| return blue(vm.toString(self)); | |
| } | |
| function blue(bool self) internal pure returns (string memory) { | |
| return blue(vm.toString(self)); | |
| } | |
| function blueBytes(bytes memory self) internal pure returns (string memory) { | |
| return blue(vm.toString(self)); | |
| } | |
| function blueBytes32(bytes32 self) internal pure returns (string memory) { | |
| return blue(vm.toString(self)); | |
| } | |
| function magenta(string memory self) internal pure returns (string memory) { | |
| return styleConcat(MAGENTA, self); | |
| } | |
| function magenta(uint256 self) internal pure returns (string memory) { | |
| return magenta(vm.toString(self)); | |
| } | |
| function magenta(int256 self) internal pure returns (string memory) { | |
| return magenta(vm.toString(self)); | |
| } | |
| function magenta(address self) internal pure returns (string memory) { | |
| return magenta(vm.toString(self)); | |
| } | |
| function magenta(bool self) internal pure returns (string memory) { | |
| return magenta(vm.toString(self)); | |
| } | |
| function magentaBytes(bytes memory self) internal pure returns (string memory) { | |
| return magenta(vm.toString(self)); | |
| } | |
| function magentaBytes32(bytes32 self) internal pure returns (string memory) { | |
| return magenta(vm.toString(self)); | |
| } | |
| function cyan(string memory self) internal pure returns (string memory) { | |
| return styleConcat(CYAN, self); | |
| } | |
| function cyan(uint256 self) internal pure returns (string memory) { | |
| return cyan(vm.toString(self)); | |
| } | |
| function cyan(int256 self) internal pure returns (string memory) { | |
| return cyan(vm.toString(self)); | |
| } | |
| function cyan(address self) internal pure returns (string memory) { | |
| return cyan(vm.toString(self)); | |
| } | |
| function cyan(bool self) internal pure returns (string memory) { | |
| return cyan(vm.toString(self)); | |
| } | |
| function cyanBytes(bytes memory self) internal pure returns (string memory) { | |
| return cyan(vm.toString(self)); | |
| } | |
| function cyanBytes32(bytes32 self) internal pure returns (string memory) { | |
| return cyan(vm.toString(self)); | |
| } | |
| function bold(string memory self) internal pure returns (string memory) { | |
| return styleConcat(BOLD, self); | |
| } | |
| function bold(uint256 self) internal pure returns (string memory) { | |
| return bold(vm.toString(self)); | |
| } | |
| function bold(int256 self) internal pure returns (string memory) { | |
| return bold(vm.toString(self)); | |
| } | |
| function bold(address self) internal pure returns (string memory) { | |
| return bold(vm.toString(self)); | |
| } | |
| function bold(bool self) internal pure returns (string memory) { | |
| return bold(vm.toString(self)); | |
| } | |
| function boldBytes(bytes memory self) internal pure returns (string memory) { | |
| return bold(vm.toString(self)); | |
| } | |
| function boldBytes32(bytes32 self) internal pure returns (string memory) { | |
| return bold(vm.toString(self)); | |
| } | |
| function dim(string memory self) internal pure returns (string memory) { | |
| return styleConcat(DIM, self); | |
| } | |
| function dim(uint256 self) internal pure returns (string memory) { | |
| return dim(vm.toString(self)); | |
| } | |
| function dim(int256 self) internal pure returns (string memory) { | |
| return dim(vm.toString(self)); | |
| } | |
| function dim(address self) internal pure returns (string memory) { | |
| return dim(vm.toString(self)); | |
| } | |
| function dim(bool self) internal pure returns (string memory) { | |
| return dim(vm.toString(self)); | |
| } | |
| function dimBytes(bytes memory self) internal pure returns (string memory) { | |
| return dim(vm.toString(self)); | |
| } | |
| function dimBytes32(bytes32 self) internal pure returns (string memory) { | |
| return dim(vm.toString(self)); | |
| } | |
| function italic(string memory self) internal pure returns (string memory) { | |
| return styleConcat(ITALIC, self); | |
| } | |
| function italic(uint256 self) internal pure returns (string memory) { | |
| return italic(vm.toString(self)); | |
| } | |
| function italic(int256 self) internal pure returns (string memory) { | |
| return italic(vm.toString(self)); | |
| } | |
| function italic(address self) internal pure returns (string memory) { | |
| return italic(vm.toString(self)); | |
| } | |
| function italic(bool self) internal pure returns (string memory) { | |
| return italic(vm.toString(self)); | |
| } | |
| function italicBytes(bytes memory self) internal pure returns (string memory) { | |
| return italic(vm.toString(self)); | |
| } | |
| function italicBytes32(bytes32 self) internal pure returns (string memory) { | |
| return italic(vm.toString(self)); | |
| } | |
| function underline(string memory self) internal pure returns (string memory) { | |
| return styleConcat(UNDERLINE, self); | |
| } | |
| function underline(uint256 self) internal pure returns (string memory) { | |
| return underline(vm.toString(self)); | |
| } | |
| function underline(int256 self) internal pure returns (string memory) { | |
| return underline(vm.toString(self)); | |
| } | |
| function underline(address self) internal pure returns (string memory) { | |
| return underline(vm.toString(self)); | |
| } | |
| function underline(bool self) internal pure returns (string memory) { | |
| return underline(vm.toString(self)); | |
| } | |
| function underlineBytes(bytes memory self) internal pure returns (string memory) { | |
| return underline(vm.toString(self)); | |
| } | |
| function underlineBytes32(bytes32 self) internal pure returns (string memory) { | |
| return underline(vm.toString(self)); | |
| } | |
| function inverse(string memory self) internal pure returns (string memory) { | |
| return styleConcat(INVERSE, self); | |
| } | |
| function inverse(uint256 self) internal pure returns (string memory) { | |
| return inverse(vm.toString(self)); | |
| } | |
| function inverse(int256 self) internal pure returns (string memory) { | |
| return inverse(vm.toString(self)); | |
| } | |
| function inverse(address self) internal pure returns (string memory) { | |
| return inverse(vm.toString(self)); | |
| } | |
| function inverse(bool self) internal pure returns (string memory) { | |
| return inverse(vm.toString(self)); | |
| } | |
| function inverseBytes(bytes memory self) internal pure returns (string memory) { | |
| return inverse(vm.toString(self)); | |
| } | |
| function inverseBytes32(bytes32 self) internal pure returns (string memory) { | |
| return inverse(vm.toString(self)); | |
| } | |
| } | |