Bitcoin Forum
September 23, 2018, 07:29:39 AM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: My Smart Contract Code Doesn't work  (Read 32 times)
CryptoneumLIFE
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
August 27, 2018, 12:09:02 PM
 #1

any one can help me fix this? contract doesn't pay dividend 3% to deposit account, the code as follow:

contract BrokerBot {

    struct _Tx {
        address txuser;
        uint txvalue;
    }
    _Tx[] public Tx;
    uint public counter;
    
    address owner;
    
    
    modifier onlyowner
    {
        if (msg.sender == owner)
        _
    }
    function BrokerBot() {
        owner = msg.sender;
        
    }
    
    function() {
        Sort();
        if (msg.sender == owner )
        {
            Count();
        }
    }
    
    function Sort() internal
    {
        uint feecounter;
            feecounter+=msg.value/5;
           owner.send(feecounter);
     
           feecounter=0;
      uint txcounter=Tx.length;    
      counter=Tx.length;
      Tx.length++;
      Tx[txcounter].txuser=msg.sender;
      Tx[txcounter].txvalue=msg.value;  
    }
    
    function Count() onlyowner {
        while (counter>0) {
            Tx[counter].txuser.send((Tx[counter].txvalue/100)*3);
            counter-=1;
        }
    }
      
}

the contract was published on testnet link below:

https://rinkeby.etherscan.io/address/0x4dea7091e169efcf9864da0da0c61feb760c5ffa#code
1537687779
Hero Member
*
Offline Offline

Posts: 1537687779

View Profile Personal Message (Offline)

Ignore
1537687779
Reply with quote  #2

1537687779
Report to moderator
1537687779
Hero Member
*
Offline Offline

Posts: 1537687779

View Profile Personal Message (Offline)

Ignore
1537687779
Reply with quote  #2

1537687779
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1537687779
Hero Member
*
Offline Offline

Posts: 1537687779

View Profile Personal Message (Offline)

Ignore
1537687779
Reply with quote  #2

1537687779
Report to moderator
1537687779
Hero Member
*
Offline Offline

Posts: 1537687779

View Profile Personal Message (Offline)

Ignore
1537687779
Reply with quote  #2

1537687779
Report to moderator
1537687779
Hero Member
*
Offline Offline

Posts: 1537687779

View Profile Personal Message (Offline)

Ignore
1537687779
Reply with quote  #2

1537687779
Report to moderator
delpiero10
Full Member
***
Offline Offline

Activity: 264
Merit: 100


View Profile
August 30, 2018, 06:26:07 PM
 #2

just pasted your code into remix and I can see many warning, one of them is:

Warning: Failure condition of 'send' ignored. Consider using 'transfer' instead.
            Tx[counter].txuser.send((Tx[counter].txvalue/100)*3);

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!