2
pragma solidity ^0.4.0;

contract ZaPartnere {

address[] partneri = [0x118531D9C6C9114c8B999Ac1197778d1669Fc6c6, 0x029c2D637e193716246A55c62F2302a61FaC81dC, 0x36FFE679f923BdADd17E79Ce159DE80f779b512C, 0x78c426A0ABf24645d7e57267aFEe78688D86937d, 0xF7ffD689BFD99e03b7e1a6ebEc8Ee43877e49EEc];

uint TotalniIznos = 0;
    mapping (address => uint) PovuceniIznos;

    function ZaPartnerePodijela () payable {
        updateTotalniIznos();



    }

    function () payable {
        updateTotalniIznos();



    }

    function updateTotalniIznos() internal {

        TotalniIznos += msg.value;

    }

    modifier ProvjeraPartnera(){

        bool partner = false;

        for(uint i = 0; i < partneri.lenght; i++){

            if (partneri[i] == msg.sender){
                partner = true;

            }
        }

        require(partner);
        _;
    }

    function PovlacenjeSredstva(){

        uint SkupljeniIznos = TotalniIznos/partneri.lenght;
        uint KolicinaPovucena = PovuceniIznos[msg.sender];
        uint kolicina = SkupljeniIznos - KolicinaPovucena;
        PovuceniIznos[msg.sender] = KolicinaPovucena + kolicina;

        if(kolicina > 0 ){

            msg.sender.transfer(kolicina);

        }
    }
}

//got error in remix - Member "lenght" not found or not visible after argument-dependent lookup in address[] storage ref for(uint i = 0; i < partneri.lenght; i++){

                                 ^-------------^
1

You simply spelt length incorrectly in your ProvjeraPartnera modifier. The loop should be:

for(uint i =0; i < partneri.length; i++)

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.