openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

How to understand the code "vault.deposit.value(msg.value)(msg.sender);"

Open lisuyong opened this issue 9 years ago • 3 comments

Hi, there

I don't understand why this code use ".value(x)" here. I know it's setting the ether value, but why use here?

Thanks, I'm very curious :)

Justin

lisuyong avatar Nov 09 '17 09:11 lisuyong

That's a way of calling the RefundVault#deposit function, which is payable, with a specific msg.value amount. See: https://ethereum.stackexchange.com/a/9722/3054

maraoz avatar Nov 10 '17 20:11 maraoz

@maraoz how can I call Crowdsale's fallback(the payable method without name) function in another contract, say Presale.sol? Thanks.

jacktang avatar Mar 19 '18 16:03 jacktang

@jacktang http://solidity.readthedocs.io/en/v0.4.21/units-and-global-variables.html?highlight=message%20call#address-related

shrugs avatar Mar 22 '18 04:03 shrugs