11
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
    internal
    returns (uint transactionId)
{
    transactionId = transactionCount;
    transactions[transactionId] = Transaction({
        destination: destination,
        value: value,
        data: data,
        executed: false
    });
    transactionCount += 1;
    Submission(transactionId);
}

In In function addTransaction(address destination, uint value, bytes data)

With underlined the byte data parameter

12

As of Solidity 0.5.0. https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html

Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function parameters and return variables. For example, change uint[] x = m_x to uint[] storage x = m_x, and function f(uint[][] x) to function f(uint[][] memory x) where memory is the data location and might be replaced by storage or calldata accordingly. Note that external functions require parameters with a data location of calldata.

You can fix it by saying memory for the bytes argument which is an array of byte.

pragma solidity 0.5.0;

contract Memory {
    function addTransaction(address destination, uint value, bytes memory data)
        internal
        returns (uint transactionId)
    {
        return 0;
    }
}

Warnings are safe to ignore. I wanted to keep this example as close as possible to the original and confirm it compiles.

0

For function parameter and return variables explicit data location for all variables (struct, array of mappings, string) are mandatory. You can also fix by saying string memory for he bytes argument.

pragma solidity ^0.5.7;

contract MyContract {
   function addTransaction(address destination, uint value, string memory data) 
   public 
{
    /* My Code ...*/
}

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.