Contract con_withdraw2


Contract Code


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

Byte Code

e30000000000000000000000000500000040000000734e00000065005a01650264006401640264038d035a036404640584005a046505640183016506650764069c0264076408840483015a086505640183016507650664099c02640a640b840483015a09640c5300290de900000000da0d636f6e5f776974686472617732da0862616c616e6365732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65630000000000000000000000000300000043000000730c0000006401740064023c006400530029034ee96400000072020000002901da0a5f5f62616c616e636573a90072090000007209000000da00da045f5f5f5f0500000073020000000001720b0000002902da06616d6f756e74da02746f630200000000000000020000000400000043000000734c0000007c0064016b0473107400640283018201740174026a0319007c006b0573267400640383018201740174026a03050019007c00380003003c0074017c01050019007c00370003003c006400530029044e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a1a4e6f7420656e6f75676820746f6b656e7320746f2073656e64212904da0e417373657274696f6e4572726f727208000000da03637478da0663616c6c65722902720c000000720d00000072090000007209000000720a000000da087472616e73666572090000007308000000000210011601120172110000002902da0e746f6b656e5f636f6e7472616374720c000000630200000000000000020000000300000043000000731800000074006a017c0083016a027c0174036a04830201006400530029014e2905da0149da0d696d706f72745f6d6f64756c657211000000720f000000721000000029027212000000720c00000072090000007209000000720a000000da087769746864726177110000007302000000000272150000004e290ada09696d706f72746c69627213000000da04486173687208000000720b000000da085f5f6578706f7274da05666c6f6174da0373747272110000007215000000720900000072090000007209000000720a000000da083c6d6f64756c653e01000000730c00000004010e030804060112070601