Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of call #16

Open
wanderingstan opened this issue Sep 7, 2018 · 3 comments
Open

Use of call #16

wanderingstan opened this issue Sep 7, 2018 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@wanderingstan
Copy link
Contributor

wanderingstan commented Sep 7, 2018

At ERC725-alliance talk in Berlin, @ali2251 mentioned we're using call in our contracts, which is not reccomended:

I think this is the only case here:

success = executions[_id].to.call(executions[_id].data, 0);

@nick , I recall you explaining once why we had to do that. Does that still hold, or have improvements to solidity fixed it?

@wanderingstan wanderingstan added the question Further information is requested label Sep 7, 2018
@cuongdo
Copy link

cuongdo commented Sep 7, 2018

It looks like call was considered "ancient" as of 1 year ago:

ethereum/solidity#2884 (comment)

@wanderingstan
Copy link
Contributor Author

@ali2251 ☝️ (Sorry had your username wrong at first)

@junaid02012
Copy link

Hi,

This is Junaid. I have been working on ERC725. I have upgraded the contracts to 0.5.12 version but i'm facing error in following line.

bool success = executions[_id].to.call(executions[_id].data, 0);

TypeError: Wrong argument count for function call.

Please tell me how can i handle this error. Thanks

    struct Execution {
        address to;
        uint256 value;
        bytes data;
        bool approved;
        bool executed;
    }

    mapping (bytes32 => Key) keys;
    mapping (uint256 => bytes32[]) keysByPurpose;
    mapping (uint256 => Execution) executions;

    function approve(uint256 _id, bool _approve)
        public
        returns (bool s)
    {
        require(keyHasPurpose(keccak256(abi.encodePacked(msg.sender)), 2), "Sender does not have action key");

        emit Approved(_id, _approve);

        if (_approve == true) {
            executions[_id].approved = true;
            uint count = 0;
            bool success = executions[_id].to.call(executions[_id].data, 0);
            if (success) {
                executions[_id].executed = true;
                emit Executed(
                    _id,
                    executions[_id].to,
                    executions[_id].value,
                    executions[_id].data
                );
                return true;
            } else {
                emit ExecutionFailed(
                    _id,
                    executions[_id].to,
                    executions[_id].value,
                    executions[_id].data
                );
                return false;
            }
        } else {
            executions[_id].approved = false;
        }
        return true;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants