Describe the bug
Returning from a fake function reverts with
Error: Transaction reverted: function returned an unexpected amount of data.
If the sendTransaction is left out, it works as expected
Reproduction steps
// test for userWithdraw method
await fakeStrategy.withdraw.returns(async() => {
await owner.sendTransaction({
to: yieldFarm.address,
value: TEN_ETH,
});
return TEN_ETH;
})
// contract
contract YieldFarm{
function userWithdraw() {
/// ... custom logic
amountReceived = strategy.withdraw(); // this function moves funds from strategy to yieldFarm, ETH in this case
}
}
Expected behavior
TEN_ETH value should be transferred to the yieldFarm contract. and this function withdraw should return the value TEN_ETH as well
Describe the bug Returning from a fake function reverts with
Error: Transaction reverted: function returned an unexpected amount of data
.If the sendTransaction is left out, it works as expected
Reproduction steps
Expected behavior TEN_ETH value should be transferred to the yieldFarm contract. and this function withdraw should return the value TEN_ETH as well