// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "forge-std/Test.sol"; import "forge-std/Vm.sol"; /** * @title CSVHelper * @dev Library for managing CSV data in Solidity, including converting values to strings and writing CSV data. */ library CSVHelper { /** * @notice Creates a standard CSV header for liquidity position data. * @return The CSV header as a string. */ function createPositionsHeader() internal pure returns (string memory) { return "precedingAction, currentTick, floorTickLower, floorTickUpper, floorEth, floorHarb, anchorTickLower, anchorTickUpper, anchorEth, anchorHarb, discoveryTickLower, discoveryTickUpper, discoveryEth, discoveryHarb, token0isWeth"; } function createTimeSeriesHeader() internal pure returns (string memory) { return "time, price, harbTotalSupply, supplyChange, stakeOutstandingShares, avgTaxRate, sentiment, taxCollected"; } /** * @notice Appends new CSV data to the existing CSV string. * @param csv The current CSV string. * @param newRow The new row to append. * @return The updated CSV string. */ function appendRow(string memory csv, string memory newRow) internal pure returns (string memory) { return string(abi.encodePacked(csv, "\n", newRow)); } }