solidity – Using Payable Functions Effectively in Remix IDE

payableremixsoliditytestingtestnets

I created a simple solidity contract in the remix ide. I cannot figure out how to test the payable functions I created.

here is an example of a payable function:

function pay() payable {
}

here is a picture of a payable function buy() which does not accept ether or a value in remix

here is a picture of a payable function buy() which does not accept ether or a value in remix

how can i test payable functions on a test chain?

Best Answer

It is rather unintuitive on Remix, but there is a value input near the top of the panel (circled red). You can enter the value there before clicking on a function call. You'll need to do it for every call as the input field clears after a transaction.

Screenshot of Remix IDE

Related Topic