diff --git a/onchain/src/BaseLineLP.sol b/onchain/src/BaseLineLP.sol index c78318a..e8ee600 100644 --- a/onchain/src/BaseLineLP.sol +++ b/onchain/src/BaseLineLP.sol @@ -149,7 +149,7 @@ contract BaseLineLP { uint160 internal constant MIN_SQRT_RATIO = 4295128739; - function tickAtPrice(uint256 tokenAmount, uint256 ethAmount) internal returns (int24 tick_) { + function tickAtPrice(uint256 tokenAmount, uint256 ethAmount) internal view returns (int24 tick_) { require(ethAmount > 0, "ETH amount cannot be zero"); uint160 sqrtPriceX96; if (tokenAmount == 0) { diff --git a/onchain/src/Harb.sol b/onchain/src/Harb.sol index 430c2f4..a6f8b70 100644 --- a/onchain/src/Harb.sol +++ b/onchain/src/Harb.sol @@ -49,6 +49,8 @@ contract Harb is ERC20, ERC20Permit { /// @notice Thrown if the some address is unexpectedly the zero address. error ZeroAddressInConstructor(); + event UbiClaimed(address indexed owner, uint256 ubiAmount); + /// @dev Function modifier to ensure that the caller is the liquidityManager modifier onlyLiquidityManager() { require(msg.sender == address(liquidityManager), "Harb/only-lm"); @@ -200,6 +202,7 @@ contract Harb is ERC20, ERC20Permit { ubiTitles[_account].sumTaxCollected = sumTaxCollected; ubiTitles[_account].time = block.timestamp; twabController.transfer(TAX_POOL, _account, SafeCast.toUint96(ubiAmountDue)); + emit UbiClaimed(_account, ubiAmountDue); } } diff --git a/onchain/test/BaseLineLP.t.sol b/onchain/test/BaseLineLP.t.sol index ce0e2f6..40f03a8 100644 --- a/onchain/test/BaseLineLP.t.sol +++ b/onchain/test/BaseLineLP.t.sol @@ -42,7 +42,7 @@ contract BaseLineLPTest is Test { // z is now the integer square root of y, or the closest integer to the square root of y. } - function initializePoolFor1Cent(address pool) public { + function initializePoolFor1Cent(address _pool) public { uint256 price; if (token0isWeth) { // ETH as token0, so we are setting the price of 1 ETH in terms of token1 (USD cent) @@ -56,7 +56,7 @@ contract BaseLineLPTest is Test { uint160 sqrtPriceX96 = uint160(sqrt(price) * 2**96 / 10**9); // Adjust sqrt value to 96-bit precision // Initialize pool with the calculated sqrtPriceX96 - IUniswapV3Pool(pool).initialize(sqrtPriceX96); + IUniswapV3Pool(_pool).initialize(sqrtPriceX96); } function deployContract(bytes memory bytecode, bytes memory constructorArgs) internal returns (address addr) { @@ -120,7 +120,7 @@ contract BaseLineLPTest is Test { liquidityManager.shift(); // large buy into discovery - pool.swap( + pool.swap( account, // Recipient of the output tokens token0isWeth, int256(3 ether), @@ -131,9 +131,9 @@ contract BaseLineLPTest is Test { liquidityManager.shift(); + // sell into anchor vm.prank(account); harb.approve(address(this), 2000000 ether); - // sell into anchor pool.swap( account, // Recipient of the output tokens !token0isWeth, @@ -144,13 +144,12 @@ contract BaseLineLPTest is Test { liquidityManager.slide(); + // large sell into floor harb.setLiquidityManager(address(account)); vm.prank(account); harb.mint(900000 ether); harb.setLiquidityManager(address(liquidityManager)); - - // sell into floor - pool.swap( + pool.swap( account, // Recipient of the output tokens !token0isWeth, int256(900000 ether),