Transaction #71976

Hash 491d06343bb51d47001e11c8e02983fad82301af8ad15a497751db67470aff33
Status Success
Timestamp 1103 days ago - 5/11/2021, 12:23:09 AM UTC+0
Block 71616
Stamps Used 201
Burned Fee 0.03092308 TAU
From 3fa3da8a3dc59e712c3039f3811bfae52ed2fcb17dbeef62f555bd993ef9cfc2 
Contract Name submission
Function Name submit_contract

Additional Info
SubBlock Number 0
Nonce 161
Processor 5b09493df6c18d17cc883ebce54fcb1f5afbd507533417fe32c006009a9c3c4a
Signature 672106a14cefbd3dd5ddb6b1d3a8398ad4f8381b66150a397aad5910f7f8040a743ec20ffd1a08018125c6ae17d5747f113e1d3bab4d02209ee08a68525b4702
Stamps Supplied 3250
Stamps per TAU 65

Kwargs

code random.seed() # LST001 balances = Hash(default_value=0) # LST002 metadata = Hash() pot = Variable() @construct def seed(supply=10_000): # LST001 - MINT SUPPLY to wallet that submits the contract balances[ctx.caller] = supply # LST002 metadata['token_name'] = "Stubucks" metadata['token_symbol'] = "SBUX" metadata['operator'] = ctx.caller pot.set(0) # LST002 @export def change_metadata(key: str, value: Any): assert ctx.caller == metadata['operator'], 'Only operator can set metadata!' metadata[key] = value def calc_skim(amount: float): skim = amount * 0.02 p = pot.get() pot.set(p + skim) return skim def draw_lotto(): draw = random.randint(0, 99) if draw == 0 or draw == 1: # win! return True # lose return False # LST001 @export def transfer(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' assert balances[ctx.caller] >= amount, 'Not enough coins to send!' # Take 1% from the transfer and put it into the pot skim = calc_skim(amount) balances[ctx.caller] -= amount balances[to] += (amount - skim) draw = draw_lotto() if draw: balances[to] += pot.get() pot.set(0) # LST001 @export def approve(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' balances[ctx.caller, to] += amount # LST001 @export def transfer_from(amount: float, to: str, main_account: str): assert amount > 0, 'Cannot send negative balances!' assert balances[ main_account, ctx.caller] >= amount, 'Not enough coins approved to send! You have {} and are trying to spend {}' \ .format(balances[main_account, ctx.caller], amount) assert balances[main_account] >= amount, 'Not enough coins to send!' skim = calc_skim(amount) balances[main_account, ctx.caller] -= amount balances[main_account] -= amount balances[to] += (amount - skim) draw = draw_lotto() if draw: balances[to] += pot.get() pot.set(0)
name con_stubucks

State Changes

Contract con_stubucks
Variable balances
Key 3fa3da8a3dc59e712c3039f3811bfae52ed2fcb17dbeef62f555bd993ef9cfc2
New Value 10000
 
Contract con_stubucks
Variable metadata
Key token_name
New Value Stubucks
 
Contract con_stubucks
Variable metadata
Key token_symbol
New Value SBUX
 
Contract con_stubucks
Variable metadata
Key operator
New Value 3fa3da8a3dc59e712c3039f3811bfae52ed2fcb17dbeef62f555bd993ef9cfc2
 
Contract con_stubucks
Variable pot
New Value 0
 
Contract con_stubucks
Variable __code__
New Value random.seed() __balances = Hash(default_value=0, contract='con_stubucks', name='balances') __metadata = Hash(contract='con_stubucks', name='metadata') __pot = Variable(contract='con_stubucks', name='pot') def ____(supply=10000): __balances[ctx.caller] = supply __metadata['token_name'] = 'Stubucks' __metadata['token_symbol'] = 'SBUX' __metadata['operator'] = ctx.caller __pot.set(0) @__export('con_stubucks') def change_metadata(key: str, value: Any): assert ctx.caller == __metadata['operator' ], 'Only operator can set metadata!' __metadata[key] = value def __calc_skim(amount: float): skim = amount * decimal('0.02') p = __pot.get() __pot.set(p + skim) return skim def __draw_lotto(): draw = random.randint(0, 99) if draw == 0 or draw == 1: return True return False @__export('con_stubucks') def transfer(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' assert __balances[ctx.caller] >= amount, 'Not enough coins to send!' skim = __calc_skim(amount) __balances[ctx.caller] -= amount __balances[to] += amount - skim draw = __draw_lotto() if draw: __balances[to] += __pot.get() __pot.set(0) @__export('con_stubucks') def approve(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' __balances[ctx.caller, to] += amount @__export('con_stubucks') def transfer_from(amount: float, to: str, main_account: str): assert amount > 0, 'Cannot send negative balances!' assert __balances[main_account, ctx.caller ] >= amount, 'Not enough coins approved to send! You have {} and are trying to spend {}'.format( __balances[main_account, ctx.caller], amount) assert __balances[main_account] >= amount, 'Not enough coins to send!' skim = __calc_skim(amount) __balances[main_account, ctx.caller] -= amount __balances[main_account] -= amount __balances[to] += amount - skim draw = __draw_lotto() if draw: __balances[to] += __pot.get() __pot.set(0)
 
Contract con_stubucks
Variable __compiled__
New Value e3000000000000000000000000050000004000000073b400000065006a0183000100650264006401640264038d035a0365026401640464058d025a0465056401640664058d025a06641b6408640984015a076508640183016509650a640a9c02640b640c840483015a0b650c640d9c01640e640f84045a0d6410641184005a0e650864018301650c650964129c0264136414840483015a0f650864018301650c650964129c0264156416840483015a10650864018301650c6509650964179c0364186419840483015a11641a5300291ce900000000da0c636f6e5f7374756275636b73da0862616c616e6365732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da086d65746164617461290272050000007206000000da03706f74e91027000063010000000000000001000000030000004300000073320000007c00740074016a023c006401740364023c006403740364043c0074016a02740364053c0074046a056406830101006400530029074eda085374756275636b73da0a746f6b656e5f6e616d65da0453425558da0c746f6b656e5f73796d626f6cda086f70657261746f7272010000002906da0a5f5f62616c616e636573da03637478da0663616c6c6572da0a5f5f6d65746164617461da055f5f706f74da037365742901da06737570706c79a9007216000000da00da045f5f5f5f07000000730a00000000010a01080108010a0172180000002902da036b6579da0576616c7565630200000000000000020000000300000043000000732200000074006a017402640119006b02731674036402830182017c0174027c003c006400530029034e720e0000007a1f4f6e6c79206f70657261746f722063616e20736574206d65746164617461212904721000000072110000007212000000da0e417373657274696f6e4572726f7229027219000000721a000000721600000072160000007217000000da0f6368616e67655f6d657461646174610f0000007306000000000210010601721c0000002901da06616d6f756e7463010000000000000003000000030000004300000073260000007c0074006401830114007d0174016a0283007d0274016a037c027c011700830101007c01530029024e7a04302e30322904da07646563696d616c7213000000da0367657472140000002903721d000000da04736b696dda0170721600000072160000007217000000da0b5f5f63616c635f736b696d16000000730800000000010c0108010e017222000000630000000000000000010000000300000043000000732400000074006a016401640283027d007c0064016b02731c7c0064036b027220640453006405530029064e7201000000e963000000e90100000054462902da0672616e646f6dda0772616e64696e742901da0464726177721600000072160000007217000000da0c5f5f647261775f6c6f74746f1d000000730800000000010c011001040172280000002902721d000000da02746f63020000000000000004000000050000004300000073800000007c0064016b0473107400640283018201740174026a0319007c006b057326740064038301820174047c0083017d02740174026a03050019007c00380003003c0074017c01050019007c007c021800370003003c00740583007d037c03727c74017c010500190074066a078300370003003c0074066a086401830101006400530029044e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636f696e7320746f2073656e64212909721b000000720f00000072100000007211000000722200000072280000007213000000721f00000072140000002904721d000000722900000072200000007227000000721600000072160000007217000000da087472616e73666572240000007312000000000210011601080112011401060104011401722a000000630200000000000000020000000400000043000000732a0000007c0064016b0473107400640283018201740174026a037c016602050019007c00370003003c006400530029034e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573212904721b000000720f000000721000000072110000002902721d0000007229000000721600000072160000007217000000da07617070726f766531000000730400000000021001722b0000002903721d0000007229000000da0c6d61696e5f6163636f756e7463030000000000000005000000050000004300000073be0000007c0064016b047310740064028301820174017c0274026a03660219007c006b05733c740064036a0474017c0274026a03660219007c0083028301820174017c0219007c006b057350740064048301820174057c0083017d0374017c0274026a036602050019007c00380003003c0074017c02050019007c00380003003c0074017c01050019007c007c031800370003003c00740683007d047c0472ba74017c010500190074076a088300370003003c0074076a096401830101006400530029054e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a494e6f7420656e6f75676820636f696e7320617070726f76656420746f2073656e642120596f752068617665207b7d20616e642061726520747279696e6720746f207370656e64207b7d7a194e6f7420656e6f75676820636f696e7320746f2073656e6421290a721b000000720f00000072100000007211000000da06666f726d6174722200000072280000007213000000721f00000072140000002905721d0000007229000000722c00000072200000007227000000721600000072160000007217000000da0d7472616e736665725f66726f6d37000000731a000000000210010c010c01140114010801160110011401060104011401722e0000004e2901720900000029127225000000da0473656564da0448617368720f0000007212000000da085661726961626c6572130000007218000000da085f5f6578706f7274da03737472da03416e79721c000000da05666c6f617472220000007228000000722a000000722b000000722e0000007216000000721600000072160000007217000000da083c6d6f64756c653e01000000731c00000008010e010c010c030a08060112060e0708070601120c060112050601
 
Contract con_stubucks
Variable __owner__
New Value null
 
Contract con_stubucks
Variable __submitted__
New Value 2021,5,11,0,23,12,0
 
Contract con_stubucks
Variable __developer__
New Value 3fa3da8a3dc59e712c3039f3811bfae52ed2fcb17dbeef62f555bd993ef9cfc2
 
Contract currency
Variable balances
Key 3fa3da8a3dc59e712c3039f3811bfae52ed2fcb17dbeef62f555bd993ef9cfc2
New Value 497.868919131656672160