Contract con_minedToken


Contract Code

1 tokenName = 'minedToken'
2 S = Hash(default_value=0, contract='con_minedToken', name='S')
3 totalMined = 0
4
5
6 @export('con_minedToken')
7 def mine():
8 miner = ctx.caller
9 amount = (blocknum() - totalMined) / 100
10 totalMined += amount
11 S[miner] += amount
12
13
14 @export('con_minedToken')
15 def transfer(amount: int, receiver: str):
16 sender = ctx.caller
17 balance = S[sender]
18 assert balance >= amount, 'Transfer amount exceeds available token balance'
19 S[sender] -= amount
20 S[receiver] += amount
21

Byte Code

e30000000000000000000000000500000040000000734200000064005a00650164016402640364048d035a0264015a0365046402830164056406840083015a056504640283016506650764079c0264086409840483015a08640a5300290bda0a6d696e6564546f6b656ee900000000da0e636f6e5f6d696e6564546f6b656eda01532903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65630000000000000000030000000400000043000000733000000074006a017d00740283007c01180064011b007d027c017c0237007d0174037c00050019007c02370003003c006400530029024ee9640000002904da03637478da0663616c6c6572da08626c6f636b6e756dda035f5f532903da056d696e6572da0a746f74616c4d696e6564da06616d6f756e74a9007210000000da00da046d696e65060000007308000000000206010e01080172120000002902720f000000da087265636569766572630200000000000000040000000400000043000000734200000074006a017d0274027c0219007d037c037c006b05731e740364018301820174027c02050019007c00380003003c0074027c01050019007c00370003003c006400530029024e7a2f5472616e7366657220616d6f756e74206578636565647320617661696c61626c6520746f6b656e2062616c616e636529047209000000720a000000720c000000da0e417373657274696f6e4572726f722904720f0000007213000000da0673656e646572da0762616c616e6365721000000072100000007211000000da087472616e736665720e000000730a0000000002060108011001100172170000004e2909da09746f6b656e4e616d65da0448617368720c000000720e000000da085f5f6578706f72747212000000da03696e74da0373747272170000007210000000721000000072100000007211000000da083c6d6f64756c653e01000000730a00000004010e01040310080601