I am currently using Truffle framework to call Etherum block chain (testing with Ganache).

When I call public variables on a contract instance...is it possible to return multiple variables in one call?


Looking to get started and ended public variables.

My current approach:

const started = await instance.started.call({ from: account })
const ended = await instance.ended.call({ from: account })

Can I get these 2 variables in one call?

If I am mistaken on the architecture, please let me know.

Thank you!


You can create a method that return a tuple

pragma solidity ^0.4.20;

contract C {
    uint started;
    uint ended;

    // some stuff

    function method() view returns (uint, uint)
        return (started, ended)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.