Created
September 7, 2016 16:08
-
-
Save janx/fa726788388a35b2c88b8b0c562ac425 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deposit(validation_code:str, randao, address): | |
validation_code_hash = sha3(validation_code:str) | |
i = 0 | |
success = 0 | |
while i < len(validatorSizes) and not success: | |
if msg.value <= validatorSizes[i] * 10**18: | |
success = 1 | |
else: | |
i += 1 | |
if self.validatorSlotQueueLength[i]: | |
j = self.validatorSlotQueue[i][self.validatorSlotQueueLength[i] - 1] | |
self.validatorSlotQueueLength[i] -= 1 | |
else: | |
j = self.validatorCounts[i] | |
self.validatorCounts[i] += 1 | |
self.validators[i][j].vchash = sha3(validation_code:str) | |
~sstorebytes(ref(self.validators[i][j].validation_code), validation_code, len(validation_code)) | |
self.validators[i][j].deposit = msg.value | |
self.validators[i][j].start_epoch = self.currentEpoch + 2 | |
self.validators[i][j].end_epoch = NO_END_EPOCH | |
self.validators[i][j].address = address | |
self.validators[i][j].randao = randao | |
self.validators[i][j].lock_duration = self.getCurrentLockDuration() | |
~sstorebytes(ref(self.vchashToIndices[validation_code_hash]), [i, j], 64) | |
log(type=NewValidator) | |
return(1:bool) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok, so this is the code on the DevCON2 black t-shirts :-)