sharding/contract: add balance to notary struct

Former-commit-id: 81d73e4fe4675b370160bd7b391dfe6fed17aaab [formerly 734e43220a976da1a88e4d19b2ec42f77020e351]
Former-commit-id: a78e3fd7b345e8f032adc03aa567250b99c2aa1e
This commit is contained in:
Terence Tsao 2018-05-15 09:05:01 -07:00
parent 5359cf04a9
commit 56e90be294
2 changed files with 13 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,7 @@ contract SMC {
struct Notary {
uint deregisteredPeriod;
uint poolIndex;
uint balance;
bool deposited;
}
@ -110,6 +111,7 @@ contract SMC {
notaryRegistry[notaryAddress] = Notary({
deregisteredPeriod: 0,
poolIndex: index,
balance: msg.value,
deposited: true
});
@ -150,8 +152,9 @@ contract SMC {
require(notaryRegistry[notaryAddress].deregisteredPeriod != 0);
require((block.number / PERIOD_LENGTH) > (notaryRegistry[notaryAddress].deregisteredPeriod + NOTARY_LOCKUP_LENGTH));
uint balance = notaryRegistry[notaryAddress].balance;
delete notaryRegistry[notaryAddress];
notaryAddress.transfer(NOTARY_DEPOSIT);
notaryAddress.transfer(balance);
emit NotaryReleased(notaryAddress, index);
}