This is a tool for interacting with arbitrary contracts on any EVM (Ethereum Virtual Machine) based blockchain, with or without an ABI. Defined contracts can be shared via URL, so this can be utilized as a contract dashboard. The tool utilizes your installed browser wallet (MetaMask).
EVM-based blockchains are for example:
- Ethereum
- Binance Smart Chain
- Tron
- Layer 2 / sidechain solutions, such as Optimism
The app is deployed at https://evmconnector.dev .
An example where the tool is used to check the ERC20 balance of an address
You can import functions either with an ABI or from a known contract standard (such as ERC-20). The tool will tell you if the import succeeded. Notes about the import:
- Not all legacy ABI formats are supported
- Not all parameter types are (yet) supported. Only functions with supported parameter types will be imported.
Each function has zero or more input and output parameters. Input parameters are data you input to the function. Output parameters are data that comes out of the function, once it's executed. Both of these are part of the function signature.
Defining function parameters:
- Add a new input or output parameter, depending on which one you want to define
- Select its
base type
- If you need to define the type further, click Details
- Choose the desired parameter type definitions in the details view
- If this is an input function, add input value(s) for it
You can always check the function signature to see if your function definition looks correct.
The blockchain network to use is determined by your browser wallet.
In order to interact with a function, at least the following need to be correctly configured:
- Your browser wallet connected to the correct network
- Contract address
- Function name
- If the function has input parameters, define their types and values
Once you have defined a contract with functions, you can share the page with others via a URL. You can generate a URL for any contract you have defined in this tool and others will be able to load the same contract functionality via the URL. Click the "Generate shareable URL" button to generate a contract URL.
Sharing a contract through URL includes the following information:
- Contract address
- Contract functions:
- Name of the function
- Function type
- Function input and output parameters without values
Once another user opens the site through such contract URL, the data is populated for him/her. In order to interact with the contract, the user needs to:
- Connect his wallet and connect to the correct network
- Choose which function he wants to interact with
- Enter needed input values for the possible input parameters
- Execute the function
Answers to some common questions:
Q: Where are types `uint` and `int`? A: Those are just alias names for `uint256` and `int256`, respectively. So use the types with the bit amount specified.
Q: What is the "default" function type? A: It means there is no explicit function type specified in the function signature. It implies a "nonpayable" function which can do state changes but has no special properties.
Q: Why can't I sometimes see the result of the function execution? A: There is no way to get function result data if the call is in a real transaction.
Q: Why is there an option to specify the execution type? A: Normally you can just leave this to be the default value. But if you need, for example, the return value from a state-changing function, you can change this to "Local call" to simulate calling the function as type `view` even if really isn't a `view` function. This way you can get the resulting data (although no state changes are performed).
Some future development is considered and issues are created for those this repo. Please feel free to leave feedback!
- There is no backend. There is only the frontend you see
- There is no external web3 connection. The only connection to the blockchain is through your wallet
- No cookies or other persistent storage is utilized. This also means no tracking of any kind
- Considering the above facts, it's rather difficult to abuse the system, since you can only hurt your own browser and/or the node your wallet uses.
- Node
- Solidity 0.7.5 and Hardhat (only for some local testing)
- Ethers.js
- ReactJS
- TypeScript
- ESLint / Prettier
Make sure you have yarn
installed.
You can run the project fully locally with the following instructions.
To run local blockchain:
yarn run localchain
To deploy the example contract locally:
yarn run deploy-local
To run the frontend locally:
yarn run serve-frontend
If you have any questions or comments, feel free to poke me at http://t .me/Lauri_P . Hope you find the tool useful!