Removed arbiter abstraction. Won't work.

This commit is contained in:
Daniel A. Nagy 2015-05-07 15:50:35 +02:00
parent 3ecd80c8f1
commit 6f3857a8c8

View file

@ -11,7 +11,7 @@ contract Swarm
Status status; Status status;
} }
mapping (address => mapping (address => Bee)) swarm; mapping (address => Bee) swarm;
function max(uint a, uint b) private returns (uint c) { function max(uint a, uint b) private returns (uint c) {
if(a >= b) return a; if(a >= b) return a;
@ -25,10 +25,8 @@ contract Swarm
/// but all funds are added to deposite irrespective of status. /// but all funds are added to deposite irrespective of status.
/// ///
/// @param time term of Swarm membership in seconds from now. /// @param time term of Swarm membership in seconds from now.
/// function signup(uint time) {
/// @param arbiter address of arbiter contract (or external arbiter entity) Bee b = swarm[msg.sender];
function signup(uint time, address arbiter) {
Bee b = swarm[arbiter][msg.sender];
if(b.status == 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);
} }
@ -38,10 +36,8 @@ contract Swarm
/// @notice Withdraw from Swarm, refund deposit. /// @notice Withdraw from Swarm, refund deposit.
/// ///
/// @dev Only allowed with clean status and expired term. /// @dev Only allowed with clean status and expired term.
/// function withdraw() {
/// @param arbiter address of arbiter contract (or external arbiter entity) Bee b = swarm[msg.sender];
function withdraw(address arbiter) {
Bee b = swarm[arbiter][msg.sender];
if(now > b.expiry && b.status == 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;
@ -55,11 +51,9 @@ contract Swarm
/// ///
/// @param addr queried address. /// @param addr queried address.
/// ///
/// @param arbiter address of arbiter contract (or external arbiter entity)
///
/// @return balance of queried address. /// @return balance of queried address.
function balance(address addr, address arbiter) returns (uint d) { function balance(address addr) returns (uint d) {
Bee b = swarm[arbiter][addr]; Bee b = swarm[addr];
return b.deposit; return b.deposit;
} }
@ -68,11 +62,9 @@ contract Swarm
/// ///
/// @param addr queried address. /// @param addr queried address.
/// ///
/// @param arbiter address of arbiter contract (or external arbiter entity)
///
/// @return true if status is "Clean". /// @return true if status is "Clean".
function isClean(address addr, address arbiter) returns (bool s) { function isClean(address addr) returns (bool s) {
Bee b = swarm[arbiter][addr]; Bee b = swarm[addr];
return b.status == Status.Clean; return b.status == Status.Clean;
} }
@ -81,11 +73,9 @@ contract Swarm
/// ///
/// @param addr queried address. /// @param addr queried address.
/// ///
/// @param arbiter address of arbiter contract (or external arbiter entity)
///
/// @return true if status is "Suspect". /// @return true if status is "Suspect".
function isSuspect(address addr, address arbiter) returns (bool s) { function isSuspect(address addr) returns (bool s) {
Bee b = swarm[arbiter][addr]; Bee b = swarm[addr];
return b.status == Status.Suspect; return b.status == Status.Suspect;
} }
@ -94,11 +84,9 @@ contract Swarm
/// ///
/// @param addr queried address. /// @param addr queried address.
/// ///
/// @param arbiter address of arbiter contract (or external arbiter entity)
///
/// @return true if status is "Guilty". /// @return true if status is "Guilty".
function isGuilty(address addr, address arbiter) returns (bool s) { function isGuilty(address addr) returns (bool s) {
Bee b = swarm[arbiter][addr]; Bee b = swarm[addr];
return b.status == Status.Guilty; return b.status == Status.Guilty;
} }
@ -109,11 +97,9 @@ contract Swarm
/// ///
/// @param time queried time. /// @param time queried time.
/// ///
/// @param arbiter address of arbiter contract (or external arbiter entity)
///
/// @return true if deposit expires after queried time. /// @return true if deposit expires after queried time.
function expiresAfter(address addr, uint time, address arbiter) returns (bool s) { function expiresAfter(address addr, uint time) returns (bool s) {
Bee b = swarm[arbiter][addr]; Bee b = swarm[addr];
return b.expiry > time; return b.expiry > time;
} }
} }