Proper use of enum

This commit is contained in:
Daniel A. Nagy 2015-04-10 15:44:18 +02:00
parent 08b8d63c0c
commit f98760f860

View file

@ -27,7 +27,7 @@ contract Swarm
/// @param time term of Swarm membership in seconds from now. /// @param time term of Swarm membership in seconds from now.
function signup(uint time) { function signup(uint time) {
Bee b = swarm[msg.sender]; Bee b = swarm[msg.sender];
if(b.status == Clean && now + time > now) { if(b.status == Status.Clean && now + time > now) {
b.expiry = max(b.expiry, now + time); b.expiry = max(b.expiry, now + time);
} }
b.deposit += msg.value; b.deposit += msg.value;
@ -38,7 +38,7 @@ contract Swarm
/// @dev Only allowed with clean status and expired term. /// @dev Only allowed with clean status and expired term.
function withdraw() { function withdraw() {
Bee b = swarm[msg.sender]; Bee b = swarm[msg.sender];
if(now > b.expiry && b.status == clean) { if(now > b.expiry && b.status == Status.Clean) {
msg.sender.send(b.deposit); msg.sender.send(b.deposit);
b.deposit = 0; b.deposit = 0;
} }