This solidity project shows how can invoke functions in deployed smart contract with the function hash.
The ContractParser.js javascript class helps to get the function hashes for a specific ABI.
- Download truffle v4.1.13 or up from here
npm install -g truffle
- Execute in the root folder
npm install
- Execute the test cases executing:
truffle test
Run npm install
at the root folder.
Once you are located at the root folder, you can execute any truffle command, for instance truffle compile
.
In order to can run the tests with Truffle, execute the below command in your project root folder:
truffle test
Calls the balanceOf function in the ERC20 injected by constructor.
Arguments:
- _hash function hash to invoke.
- owner address to get the balance of.
Call the transfer function in the ERC20 instance injected by constructor.
Arguments:
- _hash function hash to invoke.
- _to destination address.
- _value amount of tokens to be transfered.
Call the myFunction function in the smart contract injected by constructor.
Arguments:
- _functionSignature function hash to invoke.
Call the myOtherFunction function in the smart contract injected by constructor.
Arguments:
- _functionSignature function hash to invoke.
- _value value to pass in the function to invoke.
This project uses some external smart contracts from OpenZeppelin.
- contracts/interface/ERC20.sol
- contracts/interface/ERC20Basic.sol
- contracts/mock/BasicToken.sol
- contracts/mock/StandardToken.sol
- contracts/mock/StandardTokenMock.sol
- contracts/util/SafeMath.sol
You can take the latest version from the URL below:
https://github.com/OpenZeppelin/openzeppelin-solidity
You can send me an email to guillesalazar@gmail.com
.