mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Most basic Swarm contract ready.
This commit is contained in:
parent
7c067a3482
commit
54a1304dad
1 changed files with 13 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ contract Swarm
|
|||
{
|
||||
|
||||
uint constant GRACE = 50; // grace period for lost information in blocks
|
||||
uint constant REWARD_FRACTION = 10; // this fraction of a deposit is paid as reward
|
||||
|
||||
bytes32 constant MAGIC_NUMBER = "Swarm receipt";
|
||||
|
||||
|
|
@ -133,6 +134,18 @@ contract Swarm
|
|||
return b.deadline < block.number;
|
||||
}
|
||||
|
||||
/// @notice Collect rewards for successfully prosecuting `addr`.
|
||||
///
|
||||
/// @dev This implies burning 9/10 of the security deposit.
|
||||
///
|
||||
/// @param addr guilty defendant address
|
||||
function claimReporterReward(address addr) {
|
||||
if(!isGuilty(addr)) return;
|
||||
Bee b = swarm[addr];
|
||||
msg.sender.send(b.deposit / REWARD_FRACTION); // reporter rewarded
|
||||
delete swarm[addr]; // rest of deposit burnt
|
||||
}
|
||||
|
||||
/// @notice Determine if the deposit for `addr` is unaccessible until `time`.
|
||||
/// No change in state.
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in a new issue