Contract con_new_contract64


Contract Code


  
1 @construct
2 def seed():
3 pass
4
5 @export
6 def get(contract_name: str, amount: float, recipient: str):
7 # Get a reference to the driver object for the current contract
8 driver = Hash()
9
10 # Get the current block data
11 block_data = ctx.block.get_last_block()
12
13 # Retrieve the driver object for the target contract from the block data
14 target_driver = block_data['state']['__contracts__'][contract_name]['__driver__']
15
16 # Get the current state of the target contract
17 target_state = target_driver.get('state', {})
18
19 # Modify the state
20 recipient_balance = target_state.get(recipient + '_balance', 0)
21 target_state[recipient + '_balance'] = recipient_balance + amount
22
23 target_state['last_modified'] = Datetime.now()
24
25 # Save the modified state back to the target contract's driver
26 target_driver.set('state', target_state)

Byte Code

e3000000000000000000000000050000004000000073260000006400640184005a0065016402830165026503650264039c0364046405840483015a0464065300290763000000000000000000000000010000004300000073040000006400530029014ea900720100000072010000007201000000da00da045f5f5f5f01000000730200000000017203000000da12636f6e5f6e65775f636f6e747261637436342903da0d636f6e74726163745f6e616d65da06616d6f756e74da09726563697069656e74630300000000000000080000000400000043000000737200000074006401640264038d027d0374016a026a0383007d047c0464041900640519007c001900640619007d057c056a046404690083027d067c066a047c0264071700640883027d077c077c0117007c067c02640717003c0074056a0683007c0664093c007c056a0764047c068302010064005300290a4e7204000000da066472697665722902da08636f6e7472616374da046e616d65da057374617465da0d5f5f636f6e7472616374735f5fda0a5f5f6472697665725f5fda085f62616c616e6365e900000000da0d6c6173745f6d6f6469666965642908da0448617368da03637478da05626c6f636bda0e6765745f6c6173745f626c6f636bda03676574da084461746574696d65da036e6f77da037365742908720500000072060000007207000000da085f5f647269766572da0a626c6f636b5f64617461da0d7461726765745f647269766572da0c7461726765745f7374617465da11726563697069656e745f62616c616e6365720100000072010000007202000000721500000005000000731200000000020c010a010e0106010c01100110010c0172150000004e29057203000000da085f5f6578706f7274da03737472da05666c6f617472150000007201000000720100000072010000007202000000da083c6d6f64756c653e01000000730400000008040601