0

In solidity 0.6.x, this will work.

bentoBox.deposit{value: value}(token, msg.sender, to, uint256(amount), uint256(share));

I can call other contract's function with value. How can I do this in solidity 0.5.6

When I compile, error comes out. ParserError: Expected ';' but got '{'

Thank you

fd asdf
  • 73
  • 1
  • 3

1 Answers1

1

You need to use yourFunction.value(<wei>)(parameters).

This has been described here for example Using ".value(...)" is deprecated. Use "{value: ...}" instead

The easiest way to also check is to select a specific version in the Solidity docs (e.g. https://docs.soliditylang.org/en/v0.5.6/control-structures.html?highlight=Value#creating-contracts-via-new)

Richard
  • 4,934
  • 2
  • 7
  • 25