1

DeclarationError: Undeclared Identifier, on Transfer(owner, addresses[i], _value; << for the word "Transfer" >>

pragma solidity ^0.4.18;

contract distribution { 

mapping(address => uint) balances;

address private owner;

function distributeBlox(address[] addresses, uint256 _value) owner {
    for (uint i = 0; i < addresses.length; i++) {
        balances[owner] -= _value;
        balances[addresses[i]] += _value;
        Transfer(owner, addresses[i], _value);
    }
  }
}
3
  • 1
    Is Transfer supposed to be an event? You probably need to declare it with "event Transfer(...);". May 2, 2018 at 3:51
  • Yep it works I added event Transfer( address owner, address addresses, uint _value ); Now is giving me an issue saying that the gas requirement is infinite, but I will ask that on another question. Thank you
    – Mr.Blonde
    May 2, 2018 at 4:13
  • It's warning you about the gas because it has no idea how many addresses are in the array. If there are too many addresses you will reach maximum gas limit and it will fail. May 2, 2018 at 6:18

1 Answer 1

3

It works just add.

event Transfer(
        address owner,
        address addresses,
        uint _value
        );

Thanks guys!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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