Update PhoneToAddress.sol
This commit is contained in:
parent
243ee3ecaa
commit
25592ca9ea
|
@ -1,4 +1,5 @@
|
|||
contract PhoneToAddress {
|
||||
address owner;
|
||||
bytes dataEmpty;
|
||||
struct PhonePayment {
|
||||
uint phone;
|
||||
|
@ -7,6 +8,9 @@ contract PhoneToAddress {
|
|||
}
|
||||
mapping(address => PhonePayment) addresses;
|
||||
mapping(uint => address) public phones;
|
||||
function PhoneToAddress() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
function () {
|
||||
addresses[msg.sender] = PhonePayment({phone: 0, payment: msg.value/100000000000000000, data: msg.data});
|
||||
}
|
||||
|
@ -14,6 +18,9 @@ contract PhoneToAddress {
|
|||
addresses[addr] = PhonePayment({phone: phone, payment: 0, data: dataEmpty});
|
||||
phones[phone] = addr;
|
||||
}
|
||||
function sendEtherToOwner() {
|
||||
owner.send(this.balance);
|
||||
}
|
||||
function getPhoneByAddress(address addr) constant returns(uint) {
|
||||
return addresses[addr].phone;
|
||||
}
|
||||
|
@ -30,4 +37,4 @@ contract PhoneToAddress {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue