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);
    }
  }
}
  • 1
    Is Transfer supposed to be an event? You probably need to declare it with "event Transfer(...);". – sfmiller940 May 2 '18 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 '18 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. – Lauri Peltonen May 2 '18 at 6:18
2

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, privacy policy and cookie policy

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