From 54592291728246ac15ba534a23a33e97b4364fc5 Mon Sep 17 00:00:00 2001 From: teddy Date: Thu, 1 Aug 2024 19:22:37 -0300 Subject: [PATCH] test: deal with previously commented code --- test/invariants/fuzz/Protocol.t.sol | 79 ----------------------------- 1 file changed, 79 deletions(-) diff --git a/test/invariants/fuzz/Protocol.t.sol b/test/invariants/fuzz/Protocol.t.sol index 8a389a1a..e7c1bbb9 100644 --- a/test/invariants/fuzz/Protocol.t.sol +++ b/test/invariants/fuzz/Protocol.t.sol @@ -147,7 +147,6 @@ contract FuzzProtocol is EchidnaTest { } } - /* TODO: re-enable this test after fixing the hevm issue with SafeTransfer library /// @custom:property-id 3 /// @custom:property BFactory should always be able to transfer the BToken to the BDao, if called by it function fuzz_alwaysCollect() public agentOrDeployer { @@ -168,7 +167,6 @@ contract FuzzProtocol is EchidnaTest { assert(_currentBDao != currentCaller); } } - */ /// @custom:property-id 4 /// @custom:property the amount received can never be less than min amount out @@ -419,83 +417,6 @@ contract FuzzProtocol is EchidnaTest { assert(ghost_bptMinted - ghost_bptBurned == pool.totalSupply()); } - /* NOTE: deprecated calcSingleOutGivenPoolIn - /// @custom:property-id 17 - /// @custom:property a direct token transfer can never reduce the underlying amount of a given token per BPT - function fuzz_directTransfer( - uint256 _amountPoolToken, - uint256 _amountToTransfer, - uint256 _tokenIdx - ) public agentOrDeployer { - _tokenIdx = clamp(_tokenIdx, 0, tokens.length - 1); - FuzzERC20 _token = tokens[_tokenIdx]; - - uint256 _redeemedAmountBeforeTransfer = bmath.calcSingleOutGivenPoolIn( - _token.balanceOf(address(pool)), - pool.getDenormalizedWeight(address(_token)), - pool.totalSupply(), - pool.getTotalDenormalizedWeight(), - _amountPoolToken, - bconst.MIN_FEE() - ); - - _token.mint(address(this), _amountToTransfer); - // Action - _token.transfer(address(pool), _amountToTransfer); - - // Postcondition - uint256 _redeemedAmountAfter = bmath.calcSingleOutGivenPoolIn( - _token.balanceOf(address(pool)), - pool.getDenormalizedWeight(address(_token)), - pool.totalSupply(), - pool.getTotalDenormalizedWeight(), - _amountPoolToken, - bconst.MIN_FEE() - ); - - assert(_redeemedAmountAfter >= _redeemedAmountBeforeTransfer); - - ghost_amountDirectlyTransfered[_token] += _amountToTransfer; - } - - /// @custom:property-id 18 - /// @custom:property the amount of underlying token when exiting should always be the amount calculated in bmath - function fuzz_correctBPTBurnAmount(uint256 _amountPoolToken) public agentOrDeployer { - _amountPoolToken = clamp(_amountPoolToken, 0, pool.balanceOf(currentCaller)); - - uint256[] memory _amountsToReceive = new uint256[](4); - uint256[] memory _previousBalances = new uint256[](4); - - for (uint256 i; i < tokens.length; i++) { - FuzzERC20 _token = tokens[i]; - - _amountsToReceive[i] = bmath.calcSingleOutGivenPoolIn( - _token.balanceOf(address(pool)), - pool.getDenormalizedWeight(address(_token)), - pool.totalSupply(), - pool.getTotalDenormalizedWeight(), - _amountPoolToken, - bconst.MIN_FEE() - ); - - _previousBalances[i] = _token.balanceOf(currentCaller); - } - - hevm.prank(currentCaller); - pool.approve(address(pool), _amountPoolToken); - - hevm.prank(currentCaller); - - // Action - pool.exitPool(_amountPoolToken, new uint256[](4)); - - // PostCondition - for (uint256 i; i < tokens.length; i++) { - assert(tokens[i].balanceOf(currentCaller) == _previousBalances[i] + _amountsToReceive[i]); - } - } - */ - /// @custom:property-id 20 /// @custom:property bounding and unbounding token can only be done on a non-finalized pool, by the controller function fuzz_boundOnlyNotFinalized() public agentOrDeployer {