Created
March 12, 2020 12:47
-
-
Save Magicking/0b21c8f93ea1284349dc32283eacca35 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 get_deposit_root() -> bytes32: | |
zero_bytes32: bytes32 = 0x0000000000000000000000000000000000000000000000000000000000000000 | |
node: bytes32 = zero_bytes32 | |
size: uint256 = self.deposit_count | |
for height in range(DEPOSIT_CONTRACT_TREE_DEPTH): | |
if bitwise_and(size, 1) == 1: # More gas efficient than `size % 2 == 1` | |
node = sha256(concat(self.branch[height], node)) | |
else: | |
node = sha256(concat(node, self.zero_hashes[height])) | |
size /= 2 | |
return sha256(concat(node, self.to_little_endian_64(self.deposit_count), slice(zero_bytes32, start=0, len=24))) | |
@public | |
@constant | |
def get_deposit_count() -> bytes[8]: | |
return self.to_little_endian_64(self.deposit_count) | |
@payable | |
@public | |
def deposit(pubkey: bytes[PUBKEY_LENGTH], | |
withdrawal_credentials: bytes[WITHDRAWAL_CREDENTIALS_LENGTH], | |
signature: bytes[SIGNATURE_LENGTH], | |
deposit_data_root: bytes32): | |
*/ | |
pragma solidity >=0.4.22 <0.7.0; | |
interface DepositContractI { | |
function get_deposit_root() returns (bytes32); | |
function get_deposit_count() returns (bytes); | |
function deposit(bytes pubkey, bytes withdrawal_credentials, bytes signature, bytes32 deposit_data_root) public payable; | |
} | |
contract MD { | |
constructor | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment