The Contract Read&Write Tool allows users to interact with smart contracts. Any verified contract on ConfluxScan can utilize this tool to read or write data.
- Install the Fluent wallet and switch to the Conflux Testnet network.
- Acquire some test tokens from the Conflux Testnet Faucet.
- Have a contract address ready, for example:
Query Sponsor Info
In the Read Contract tab, all the contract's view methods are listed. Open any of them, input the parameter (if any), and click the Query button to obtain the result.
For instance, using
If a Zero Address is returned, it signifies that the contract is not sponsored.
In the Write Contract tab, all the contract's write methods are listed. Before using it, connect your wallet.
If a write method includes a payable modifier, the first input box can be used to set the amount of CFX to be transferred to the contract when calling the method.
For example, inputting 50 means transferring 50 CFX to the contract.
Then click the Write button. A popup will appear; click Confirm to approve the transaction.
After transaction execution, you can query the contract's sponsor info again.
Half of the CFX will be converted into storage points.
We will set 10 CFX for the gas sponsor balance, with an upper bound of 1000000000000000 Drip (
After the transaction execution, you can query the contract's sponsor info again.
Finally, add the zero address to the whitelist to use the contract without paying a gas fee.
For the second parameter, which is an array, pass ["0x0000000000000000000000000000000000000000"].
Check Contract Storage Usage Info on ConfluxScan
You can check the contract's storage usage and sponsor balance info on the ConfluxScan contract detail page.
Check Transactions Sponsored on ConfluxScan
After setting up the sponsor, you can interact with the contract without paying gas fee. The transaction will be marked as Sponsored on ConfluxScan in the detail page.
Other Sponsor Methods
Developers can use SDKs to call the
SponsorWhitelistControl methods to sponsor a contract. For an example, see here.
I sponsored a contract, but the transaction still failed. Why?
Several reasons might cause the transaction to fail:
- The upper bound is too small.
- The sponsor balance is insufficient.
- The whitelist is not set correctly.