diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-11 01:19:21 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-14 17:42:34 +0800 |
commit | 06b7edfdcfd960e5d4012c7d20913efab0516ca1 (patch) | |
tree | bc1364f3bc8687c26d3e7d6c7a101e4af64bc9bd /test/ExecutionFramework.cpp | |
parent | 3dd31b704af6c50bc56217fd07266f7872daaa44 (diff) | |
download | dexon-solidity-06b7edfdcfd960e5d4012c7d20913efab0516ca1.tar.gz dexon-solidity-06b7edfdcfd960e5d4012c7d20913efab0516ca1.tar.zst dexon-solidity-06b7edfdcfd960e5d4012c7d20913efab0516ca1.zip |
Add missing tests for ``gasleft()``, ``blockhash()`` ``tx.gasprice`` and ``block.gaslimit``.
Diffstat (limited to 'test/ExecutionFramework.cpp')
-rw-r--r-- | test/ExecutionFramework.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index 00f5e697..ea624735 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -85,6 +85,22 @@ std::pair<bool, string> ExecutionFramework::compareAndCreateMessage( return make_pair(false, message); } +u256 ExecutionFramework::gasLimit() const +{ + auto latestBlock = m_rpc.eth_getBlockByNumber("latest", false); + return u256(latestBlock["gasLimit"].asString()); +} + +u256 ExecutionFramework::gasPrice() const +{ + return u256(m_rpc.eth_gasPrice()); +} + +u256 ExecutionFramework::blockHash(u256 const& _blockNumber) const +{ + return u256(m_rpc.eth_getBlockByNumber(toHex(_blockNumber, HexPrefix::Add), false)["hash"].asString()); +} + void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 const& _value) { if (m_showMessages) |