2025-07-19 19:58:41 +02:00
|
|
|
// 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
|
2025-08-19 14:57:49 +02:00
|
|
|
"precedingAction, currentTick, floorTickLower, floorTickUpper, floorLiquidity, anchorTickLower, anchorTickUpper, anchorLiquidity, discoveryTickLower, discoveryTickUpper, discoveryLiquidity, token0isWeth, percentageStaked, avgTaxRate";
|
2025-07-19 19:58:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|