Contract con_enviar_3


Contract Code


  
1 balances = Hash(default_value=0)
2
3 @export
4 def tranferir(amount: int, to: str):
5 assert amount > 0, 'Cannot send negative balances!'
6 sender = ctx.caller
7 assert balances[sender] >= amount, 'Not enough coins to send!'
8 balances[sender] -= amount
9 balances[to] += amount
10
11 @export
12 def approve(amount: float, to: str):
13 assert amount > 0, 'Cannot send negative balances!'
14 sender = ctx.caller
15 balances[sender, to] += amount
16 return balances[sender, to]
17
18 @export
19 def balance_of(account: str):
20 return balances[account]

Byte Code

e300000000000000000000000005000000400000007358000000650064006401640264038d035a016502640183016503650464049c0264056406840483015a056502640183016506650464049c0264076408840483015a07650264018301650464099c01640a640b840483015a08640c5300290de900000000da0c636f6e5f656e766961725f33da0862616c616e6365732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d652902da06616d6f756e74da02746f630200000000000000030000000400000043000000734e0000007c0064016b047310740064028301820174016a027d0274037c0219007c006b05732a740064038301820174037c02050019007c00380003003c0074037c01050019007c00370003003c006400530029044e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636f696e7320746f2073656e64212904da0e417373657274696f6e4572726f72da03637478da0663616c6c6572da0a5f5f62616c616e636573290372070000007208000000da0673656e646572a900720e000000da00da097472616e666572697204000000730a00000000021001060114011001721000000063020000000000000003000000040000004300000073360000007c0064016b047310740064028301820174016a027d0274037c027c016602050019007c00370003003c0074037c027c0166021900530029034e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e6365732129047209000000720a000000720b000000720c000000290372070000007208000000720d000000720e000000720e000000720f000000da07617070726f76650d0000007308000000000210010601140172110000002901da076163636f756e74630100000000000000010000000200000043000000730800000074007c001900530029014e2901720c00000029017212000000720e000000720e000000720f000000da0a62616c616e63655f6f66150000007302000000000272130000004e2909da0448617368720c000000da085f5f6578706f7274da03696e74da037374727210000000da05666c6f617472110000007213000000720e000000720e000000720e000000720f000000da083c6d6f64756c653e01000000730c0000000e0306011208060112070601