Example #1
0
 def test_ether_drops(self):
     block = Block(timestamp=self.ts_zero + 30 * 86400 + 1)
     block.contract_storage(self.contract.D)[self.contract.I] = 400
     tx = Tx(sender='bob', value=200)
     self.run(tx, self.contract, block)
     assert len(self.contract.txs) == 1
     assert self.contract.txs == [('bob', 5000 * 10 ** 18, 0, 0)]
Example #2
0
 def test_ether_rises(self):
     block = Block(timestamp=self.ts_zero + 30 * 86400 + 1)
     block.contract_storage(self.contract.D)[self.contract.I] = 4000
     tx = Tx(sender='bob', value=200)
     self.run(tx, self.contract, block)
     assert len(self.contract.txs) == 2
     assert self.contract.txs == [('bob', 623 * 10 ** 18, 0, 0), ('alice', 4377 * 10 ** 18, 0, 0)]
Example #3
0
 def test_creation(self):
     block = Block(timestamp=self.ts_zero)
     block.contract_storage(self.contract.D)[self.contract.I] = 2500
     tx = Tx(sender='bob', value=1000 * 10 ** 18)
     self.run(tx, self.contract, block)
     assert self.contract.storage[1000] == 1
     assert self.contract.storage[1001] == 2495000
     assert self.contract.storage[1002] == self.ts_zero + 30 * 86400
     assert self.contract.storage[1003] == tx.sender
     assert len(self.contract.txs) == 0