I'm trying to make a smart contract in where anybody can donate to the specific center/ account. And after that they will get some points. Like points will be add according to their sending time. If someone send 2 times this person will get 20 points. But I'm unable to do that. Because whenever I tried to send from different address the points does not changed. In fact, it's added to the previous points which was achieved by someone else. something like , person 'A' donate 3 times and 'A' got 30 points. Then person 'B' donate 1 time . 'B' should get 10 points. But 'B' got 40 points.That means 30+10 = 40.
Here is my smart contract
pragma solidity ^0.5.1;
contract MyContract{
struct Center{
uint id;
uint balance;
}
mapping(uint => Center) public center;
uint count;
address[100] public sender;
uint countDown;
uint public bonus;
uint checkAddress;
uint public a;
constructor() public{
addCenter(1,0);
addCenter(2,0);
}
function addCenter(uint _id,uint amount) private{
count++;
center[count] = Center(_id, amount);
}
function sendMoney(uint centerId, uint _amount) payable public{
require(centerId >0 && centerId <= count);
countDown++;
bonus+=10;
sender[countDown] = msg.sender;
if(centerId == 1){
center[centerId].balance += _amount;
}
if(centerId == 2){
center[centerId].balance += _amount;
}
}
}