44 lines
1.5 KiB
Solidity
44 lines
1.5 KiB
Solidity
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
|
pragma solidity ^0.8.19;
|
||
|
|
|
||
|
|
import "forge-std/Test.sol";
|
||
|
|
import "../../src/abstracts/ThreePositionStrategy.sol";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @title TestBase
|
||
|
|
* @notice Base contract providing shared utilities and default parameters for tests
|
||
|
|
* @dev Consolidates common test functionality to reduce code duplication
|
||
|
|
*/
|
||
|
|
abstract contract TestUtilities is Test {
|
||
|
|
/**
|
||
|
|
* @notice Returns default parameters for ThreePositionStrategy testing
|
||
|
|
* @return Default PositionParams structure with standard values
|
||
|
|
* @dev Used across multiple test files to ensure consistency
|
||
|
|
*/
|
||
|
|
function getDefaultParams() internal pure returns (ThreePositionStrategy.PositionParams memory) {
|
||
|
|
return ThreePositionStrategy.PositionParams({
|
||
|
|
capitalInefficiency: 5 * 10 ** 17, // 50%
|
||
|
|
anchorShare: 5 * 10 ** 17, // 50%
|
||
|
|
anchorWidth: 50, // 50%
|
||
|
|
discoveryDepth: 5 * 10 ** 17 // 50%
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @notice Helper function to convert value to basis points
|
||
|
|
* @param val Value to convert
|
||
|
|
* @return Value in basis points
|
||
|
|
*/
|
||
|
|
function bp(uint256 val) internal pure returns (uint256) {
|
||
|
|
return val / 1e15;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @notice Helper function to denormalize tax rate
|
||
|
|
* @param normalizedTaxRate Normalized tax rate
|
||
|
|
* @return Denormalized tax rate
|
||
|
|
*/
|
||
|
|
function denormTR(uint256 normalizedTaxRate) internal pure returns (uint256) {
|
||
|
|
return normalizedTaxRate * 97;
|
||
|
|
}
|
||
|
|
}
|