harb/onchain/analysis/CSVHelper.sol
giteadmin 6a158150b1 Clean up test suite organization and eliminate duplicate code
- Remove duplicate test files with overlapping functionality:
  * Delete VWAPDoubleOverflowAnalysis.t.sol (155 lines) - functionality already covered by VWAPTracker.t.sol with proper assertions
  * Delete ModularComponentsTest.t.sol (57 lines) - meaningless tests redundant with build process

- Improve code organization:
  * Move CSVHelper.sol and CSVManager.sol from test/helpers/ to analysis/ folder to reflect actual usage
  * Update import path in SimpleAnalysis.s.sol from ../test/helpers/CSVManager.sol to ./CSVManager.sol
  * Remove deprecated uintToStr() and intToStr() wrapper functions from CSVHelper.sol

- Update documentation:
  * Mark completed cleanup tasks in testing_todos.md
  * Add code organization improvements section showing eliminated duplicate functionality

Result: Cleaner test suite with 92 meaningful tests (vs 95 with noise), better file organization reflecting actual usage patterns, and zero dead code remaining.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-19 19:58:41 +02:00

35 lines
1.3 KiB
Solidity

// 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));
}
}