telosnetwork / teloscan

Telos EVM block explorer for viewing blocks, transactions, contracts, staking, and more
https://teloscan.io
Apache License 2.0
22 stars 25 forks source link

#487 | teloscan read and write contract should handle tuple parameters for contracts that require them #863

Closed Viterbo closed 4 weeks ago

Viterbo commented 1 month ago

Fixes #487

Description

So far, we could only execute functions that had basic type parameters. With this PR, support is also added for functions with parameters of type tuple or tuple array, of variable or fixed size, using simple inputs where the user must enter a valid JSON format as an array.

For example, a function with an input parameter like the following:

    struct ComplexStruct {
        uint256 id;
        address user;
        bool isActive;
    }

Must be entered as:

[123, 0xA1F2aDC12cdB069406BFe51f31980324d757317C, false]

This PR includes the Solidity source code of an example contract with multiple functions featuring different parameter types to test various variants and combinations of simple to very complex parameters.

Test scenarios

check this Example Contract on Write section to see test all different types of parameters.

NOTE: The DEBUG button at the side of the Query button is temporal and is meant to help provide a valid input example for each case. So the reviewer doesn't have to deal with writing down a valid input on complex cases. After approval, this DEBUG button (and all associated debug functions) will be removed.

netlify[bot] commented 1 month ago

Deploy Preview for dev-mainnet-teloscan ready!

Name Link
Latest commit 20a536443f9516d40215737848cca3a4a9d09606
Latest deploy log https://app.netlify.com/sites/dev-mainnet-teloscan/deploys/671fc5a5af66d10008ef876f
Deploy Preview https://deploy-preview-863--dev-mainnet-teloscan.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 1 month ago

Deploy Preview for testnet-teloscan ready!

Name Link
Latest commit 20a536443f9516d40215737848cca3a4a9d09606
Latest deploy log https://app.netlify.com/sites/testnet-teloscan/deploys/671fc5a505fbf0000865b980
Deploy Preview https://deploy-preview-863--testnet-teloscan.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 1 month ago

Deploy Preview for teloscan-stage ready!

Name Link
Latest commit 20a536443f9516d40215737848cca3a4a9d09606
Latest deploy log https://app.netlify.com/sites/teloscan-stage/deploys/671fc5a5abc9aa00083ffcb6
Deploy Preview https://deploy-preview-863--teloscan-stage.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.