Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function trace is missing inline-instantiated function calls #154

Open
dmuhs opened this issue Jun 15, 2021 · 0 comments
Open

Function trace is missing inline-instantiated function calls #154

dmuhs opened this issue Jun 15, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@dmuhs
Copy link

dmuhs commented Jun 15, 2021

Given the following code:

	function gulp(uint256 _minRewardAmount) external onlyEOAorWhitelist nonReentrant
	{
		uint256 _pendingReward = _getPendingReward();
		if (_pendingReward > 0) {
			_withdraw(0);
		}
		uint256 __totalReward = Transfers._getBalance(rewardToken);
		(uint256 _feeReward, uint256 _retainedReward) = _capFeeAmount(__totalReward.mul(performanceFee) / 1e18);
		Transfers._pushFunds(rewardToken, buyback, _feeReward);
		if (rewardToken != routingToken) {
			require(exchange != address(0), "exchange not set");
			uint256 _totalReward = Transfers._getBalance(rewardToken);
			_totalReward = _capTransferAmount(rewardToken, _totalReward, _retainedReward);
			Transfers._approveFunds(rewardToken, exchange, _totalReward);
			IExchange(exchange).convertFundsFromInput(rewardToken, routingToken, _totalReward, 1);
		}
		if (routingToken != reserveToken) {
			require(exchange != address(0), "exchange not set");
			uint256 _totalRouting = Transfers._getBalance(routingToken);
			_totalRouting = _capTransferAmount(routingToken, _totalRouting, _retainedReward);
			Transfers._approveFunds(routingToken, exchange, _totalRouting);
			IExchange(exchange).joinPoolFromInput(reserveToken, routingToken, _totalRouting, 1);
		}
		uint256 _totalBalance = Transfers._getBalance(reserveToken);
		_totalBalance = _capTransferAmount(reserveToken, _totalBalance, _retainedReward);
		require(_totalBalance >= _minRewardAmount, "high slippage");
		_deposit(_totalBalance);
	}

Surya returns the following function trace:

└─ PantherSwapCompoundingStrategyToken::gulp
   ├─ PantherSwapCompoundingStrategyToken::_getPendingReward | [Int] 🔒   
   ├─ PantherSwapCompoundingStrategyToken::_withdraw | [Int] 🔒  🛑 
   ├─ Transfers::_getBalance | [Int] 🔒   
   ├─ PantherSwapCompoundingStrategyToken::_capFeeAmount | [Int] 🔒   
   │  ├─ PantherSwapCompoundingStrategyToken::_calcMaxRewardTransferAmount | [Int] 🔒   
   │  └─ _amount::sub | [Int] 🔒   
   ├─ __totalReward::mul | [Int] 🔒   
   ├─ Transfers::_pushFunds | [Int] 🔒  🛑 
   ├─ PantherSwapCompoundingStrategyToken::_capTransferAmount | [Int] 🔒   
   │  ├─ _amount::sub | [Int] 🔒   
   │  └─ PantherSwapCompoundingStrategyToken::_calcMaxRewardTransferAmount | [Int] 🔒   
   ├─ Transfers::_approveFunds | [Int] 🔒  🛑 
   ├─ PantherSwapCompoundingStrategyToken::_deposit | [Int] 🔒  🛑 
   │  └─ Transfers::_approveFunds | [Int] 🔒  🛑 
   ├─ Context::_msgSender | [Int] 🔒   
   └─ EnumerableSet.AddressSet::contains | [Int] 🔒  

In the output, the convertFundsFromInput and joinPoolFromInput function calls are missing.
A potential reason may be the IExchange instantiation and the function call being part of the same statement.

@dmuhs dmuhs added the bug Something isn't working label Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant