From Anchor's tutorial https://project-serum.github.io/anchor/tutorials/tutorial-3.html#return-values, I know currently Solana has no way to return values from CPI...
But for porting this code from Solidity:
uint256 sharesAdded = IStrategy(addr1).deposit(sender, wantAmt);
uint256 sharesRemoved = IStrategy(addr1).withdraw(pid, wantAmt);
I need to get the return values "sharesAdded" and "sharesRemoved" from another Solana program and that value is specific to current function call, then save this value into another account... Do I have to break the above Solidity code into two function calls in Solana?
Is this approach / workaround correct?
one workaround:
Step1: Fetch data from the target account where the target sol program saves its state variables
Step2: Calculate the return values in your own sol program, assuming the data from step1 have not been changed