caliper-benchmarks
caliper-benchmarks copied to clipboard
Caliper Benchmark Ethereum: Payable functions
One of my Ethereum smart contract functions is of type payable. Thus, I need to send a certain amount of ether to the function so it executes its logic. I could not find such a field provided by your Blockchain call function blockchain.invokeSmartContract(), I also looked at caliper/packages/caliper-ethereum/lib/ethereum.js trying to find a field or function to specify but still have no clue.
Appreciate any hint or idea on what I could do to test my payable function through Caliper.
@benjamincburns Can you help with this question/request?
Just to reiterate over my question, because maybe it was too ambiguous:
For example: I have a function of this format in my smart contract:
function sendMeEther() payable public { contractValue += msg.value }
And would like to send ether by setting the value field in my transaction call to this function. Otherwise, my function will not compute correctly. With web3js I would do it like this e.g:
web3.eth.sendTransaction({ from: '0x.....', to: '0x....', value: myValue.asHex() })
Thus, how can I access this through the Caliper Blockchain class inside my benchmark js? Suggestions on how to access it not through the Blockchain class but through other ways, is also appreciated! :)
Any answer to this question yet?
Following the question.
Following the question.
If anyone is still looking for the solution, I created a PR #1122 and #1124 for this. For usage, check caliper documentation for version vNext. Also, you can have a look at integration tests about how to use value parameter.
https://github.com/hyperledger/caliper/blob/master/packages/caliper-tests-integration/ethereum_tests/open.js