Contract con_withdraw_test


Contract Code


  
1 balances = Hash(default_value=0)
2
3 @construct
4 def seed():
5 balances[ctx.submission_name] = 100
6
7 @export
8 def transfer(amount: float, to: str):
9 assert amount > 0, 'Cannot send negative balances!'
10 assert balances[ctx.caller] >= amount, 'Not enough tokens to send!'
11
12 balances[ctx.caller] -= amount
13 balances[to] += amount
14
15 @export
16 def withdraw(token_contract: str, amount: float):
17 I.import_module(token_contract).transfer(amount, ctx.caller)
18

Byte Code

e30000000000000000000000000500000040000000734a000000650064006401640264038d035a016404640584005a026503640183016504650564069c0264076408840483015a066503640183016505650464099c02640a640b840483015a07640c5300290de900000000da11636f6e5f77697468647261775f74657374da0862616c616e6365732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65630000000000000000000000000300000043000000730e0000006401740074016a023c006400530029024ee9640000002903da0a5f5f62616c616e636573da03637478da0f7375626d697373696f6e5f6e616d65a900720b000000720b000000da00da045f5f5f5f0500000073020000000001720d0000002902da06616d6f756e74da02746f630200000000000000020000000400000043000000734c0000007c0064016b0473107400640283018201740174026a0319007c006b0573267400640383018201740174026a03050019007c00380003003c0074017c01050019007c00370003003c006400530029044e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a1a4e6f7420656e6f75676820746f6b656e7320746f2073656e64212904da0e417373657274696f6e4572726f7272080000007209000000da0663616c6c65722902720e000000720f000000720b000000720b000000720c000000da087472616e73666572090000007308000000000210011601120172120000002902da0e746f6b656e5f636f6e7472616374720e000000630200000000000000020000000300000043000000731800000074006a017c0083016a027c0174036a04830201006400530029014e2905da0149da0d696d706f72745f6d6f64756c6572120000007209000000721100000029027213000000720e000000720b000000720b000000720c000000da087769746864726177110000007302000000000272160000004e2908da04486173687208000000720d000000da085f5f6578706f7274da05666c6f6174da0373747272120000007216000000720b000000720b000000720b000000720c000000da083c6d6f64756c653e01000000730c000000060108030804060112070601