my-cyber-diary

my logs

View on GitHub

mapping dont have key

0 -> a
a -> b
b -> c
c -> 0
struct Customer {
  string name;
  string email;
}

mapping(address => Customer) customer;
mapping(address => address) IDs; // this is the map that make a link address by address or (foo by foo)

function addCustomer(string memory _name, string memory _email) public {
  address tmp;
  tmp = IDs[0x0000000000000000000000000000000000000000];
  do{
    if(IDs[tmp] == 0x0000000000000000000000000000000000000000){
      IDs[tmp] == msg.sender;
      customer[msg.sender] =  Customer({name:_name, email:_email});
      break;
    }
    tmp = IDs[tmp];
  }while (true);
}