defi-wonderland / smock

The Solidity mocking library
MIT License
321 stars 39 forks source link

Option to return ether on a contract call within a function #192

Open ghost opened 6 months ago

ghost commented 6 months ago

Is your feature request related to a problem? Please describe. Consider a function:

function swap() external {
    // this function would transfer eth from somewhere to this contract.
    Interface(myAddress).getEthForMyTokenViaDex(....);
}

I want to mock incoming funds in such situations.

Describe the solution you'd like

await myAddress.getEthForMyTokenViaDex.returns(, {value:amount});
// OR 
await myAddress.getEthForMyTokenViaDex.returns().withValue(amount);