solidity, remix – How to Use Payable Functions with Browser Solidity

remixsolidity

How use payable function using interface of browser solidity IDE Remix ?
http://ethereum.github.io/browser-solidity/#version=soljson-v0.4.11+commit.68ef5810.js

enter image description here

Best Answer

A payable function like in the following contract

pragma solidity ^0.4.0;
contract testPay {
    function pay() payable {
    }
}

can be used just like a normal function call by clicking the button. Additionally, you can send Ether to the smart contract by filling out the Value field on the top, e.g. here I sent along 1 Ether enter image description here

Once you click the button, not only your function will be called but also the contract will receive 1 Ether. Note that the default units are Ether not Wei.

Related Topic