From 0d1b63bca378c314094d3792af45895bf0eee1b8 Mon Sep 17 00:00:00 2001 From: vbuterin Date: Tue, 27 Nov 2018 10:07:21 -0500 Subject: [PATCH] Added min and max deposit sizes to Vyper contract --- specs/core/0_beacon-chain.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 78a56966b..9376b95b3 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -586,6 +586,7 @@ The beacon chain is initialized when a condition is met inside a contract on the ```python DEPOSITS_FOR_CHAIN_START: constant(uint256) = 2**14 DEPOSIT_SIZE: constant(wei_value) = 32 +MIN_TOPUP_SIZE: constant(wei_value) = 1 GWEI_PER_ETH: constant(uint256) = 10**9 POW_CONTRACT_MERKLE_TREE_DEPTH: constant(uint256) = 32 SECONDS_PER_DAY: constant(uint256) = 86400 @@ -611,7 +612,9 @@ def deposit(deposit_params: bytes[2048]): index /= 2 self.receipt_tree[index] = sha3(concat(self.receipt_tree[index * 2], self.receipt_tree[index * 2 + 1])) - if msg.value >= as_wei_value(DEPOSIT_SIZE, "ether"): + assert msg.value >= as_wei_value(MIN_TOPUP_SIZE, "ether") + assert msg.value <= as_wei_value(DEPOSIT_SIZE, "ether") + if msg.value == as_wei_value(DEPOSIT_SIZE, "ether"): self.total_deposit_count += 1 if self.total_deposit_count == DEPOSITS_FOR_CHAIN_START: timestamp_day_boundary: uint256 = as_unitless_number(block.timestamp) - as_unitless_number(block.timestamp) % SECONDS_PER_DAY + SECONDS_PER_DAY