Skip to content

Instantly share code, notes, and snippets.

@janx
Created September 7, 2016 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janx/fa726788388a35b2c88b8b0c562ac425 to your computer and use it in GitHub Desktop.
Save janx/fa726788388a35b2c88b8b0c562ac425 to your computer and use it in GitHub Desktop.
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)
@ericfish
Copy link

ok, so this is the code on the DevCON2 black t-shirts :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment