Transaction #1131044

Hash 07fe93130a6cc17a8d830b2e04f0ab6b136a0282441347a8856a7d0aaad40a5f
Status Success
Timestamp 564 days ago - 10/23/2022, 10:28:19 PM UTC+0
Block 1082172
Stamps Used 527
Burned Fee 0.03118343 TAU
From f0fc0db25cc1381a98052a2826cb905b78fb6ab4d7ef76f64054509bee070b07 
Contract Name submission
Function Name submit_contract

Additional Info
SubBlock Number 0
Nonce 3
Processor 5b09493df6c18d17cc883ebce54fcb1f5afbd507533417fe32c006009a9c3c4a
Signature 1d82314e59fbe8eecbf418f1bfe54520d412a341dbac819fdc5e226a5cda8de8fd4504983081ae23399b6aef997b0f26be80a0ffc364960f48f808c14360a305
Stamps Supplied 1500
Stamps per TAU 169

Kwargs

code tad_contract = importlib.import_module('con_october_tad') vault_contract = importlib.import_module('con_october_vault') rate = Hash() balances = Hash(default_value=0) metadata = Hash() total_minted = Variable() operator = Variable() temporary_var = Variable() @construct def seed(): operator.set(ctx.caller) rate['start_time'] = get_timestamp() rate['rate'] = 1.0000000015469297 # interest per second rate['start_price'] = 1 metadata['token_name'] = 'Staked tad' metadata['token_symbol'] = 'stad' metadata['token_logo_url'] = 'image.site' metadata['operator'] = ctx.caller total_minted.set(0) @export def get_timestamp(): # https://developers.lamden.io/docs/smart-contracts/datetime-module/ td = now - datetime.datetime(1970, 1, 1, 0, 0, 0) return fix_decimal(td.seconds) @export def stake(amount: float): assert amount > 0, 'Stake amount must be positive!' tad_contract.transfer_from( to=ctx.this, amount=amount, main_account=ctx.caller) amount_minted = amount / get_price() total = total_minted.get() + amount_minted total_minted.set(total) balances[ctx.caller] += amount_minted return amount_minted @export def withdraw_stake(amount: float): assert amount > 0, 'Stake amount must be positive!' assert balances[ctx.caller] >= amount, 'Not enough coins to withdraw!' balances[ctx.caller] -= amount current_price = get_price() return_amount = current_price * amount supply = total_minted.get() current_average = fix_decimal(supply / tad_contract.balance_of(ctx.this)) transfer_away_amount = amount * current_average total_minted.set(supply - amount) if return_amount - transfer_away_amount > 0: vault_contract.mint_rewards( amount=return_amount - transfer_away_amount) tad_contract.transfer(amount=return_amount, to=ctx.caller) return return_amount @export def change_rate(new_rate: float): # takes yearly interest as decimal assert_owner() assert new_rate >= 0, 'Cannot have negative staking!' current_price = get_price() rate['start_time'] = get_timestamp() rate['rate'] = new_rate # interest per second rate['start_price'] = current_price @export def transfer(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller assert balances[sender] >= amount, 'Not enough coins to send!' balances[sender] -= amount balances[to] += amount @export def balance_of(account: str): return balances[account] @export def allowance(owner: str, spender: str): return balances[owner, spender] @export def approve(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller assert balances[sender] >= amount, 'Cannot approve balance that exceeds total balance!' balances[sender, to] += amount return balances[sender, to] @export def transfer_from(amount: float, to: str, main_account: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller assert balances[main_account] >= amount, 'Not enough coins to send!' assert balances[main_account, sender] >= amount, 'Not enough coins approved to send! You have {} and are trying to spend {}'\ .format(balances[main_account, sender], amount) balances[main_account, sender] -= amount balances[main_account] -= amount balances[to] += amount @export def get_price(): return rate['start_price'] * rate['rate'] ** ( get_timestamp() - rate['start_time']) @export def change_metadata(key: str, value: Any): assert ctx.caller == metadata['operator'], 'Only operator can set metadata!' metadata[key] = value @export def change_owner(new_owner: str): assert_owner() operator.set(new_owner) def assert_owner(): assert ctx.caller == operator.get(), 'Only operator can call!' def fix_decimal(old_decimal: float): temporary_var.set(old_decimal) new_decimal = temporary_var.get() return new_decimal
name con_october_stake

State Changes

Contract con_october_stake
Variable operator
New Value f0fc0db25cc1381a98052a2826cb905b78fb6ab4d7ef76f64054509bee070b07
 
Contract con_october_stake
Variable temporary_var
New Value 1666564100
 
Contract con_october_stake
Variable rate
Key start_time
New Value 1666564100
 
Contract con_october_stake
Variable rate
Key rate
New Value 1.0000000015469297
 
Contract con_october_stake
Variable rate
Key start_price
New Value 1
 
Contract con_october_stake
Variable metadata
Key token_name
New Value Staked tad
 
Contract con_october_stake
Variable metadata
Key token_symbol
New Value stad
 
Contract con_october_stake
Variable metadata
Key token_logo_url
New Value image.site
 
Contract con_october_stake
Variable metadata
Key operator
New Value f0fc0db25cc1381a98052a2826cb905b78fb6ab4d7ef76f64054509bee070b07
 
Contract con_october_stake
Variable total_minted
New Value 0
 
Contract con_october_stake
Variable __code__
New Value tad_contract = importlib.import_module('con_october_tad') vault_contract = importlib.import_module('con_october_vault') __rate = Hash(contract='con_october_stake', name='rate') __balances = Hash(default_value=0, contract='con_october_stake', name= 'balances') __metadata = Hash(contract='con_october_stake', name='metadata') __total_minted = Variable(contract='con_october_stake', name='total_minted') __operator = Variable(contract='con_october_stake', name='operator') __temporary_var = Variable(contract='con_october_stake', name='temporary_var') def ____(): __operator.set(ctx.caller) __rate['start_time'] = get_timestamp() __rate['rate'] = decimal('1.0000000015469297') __rate['start_price'] = 1 __metadata['token_name'] = 'Staked tad' __metadata['token_symbol'] = 'stad' __metadata['token_logo_url'] = 'image.site' __metadata['operator'] = ctx.caller __total_minted.set(0) @__export('con_october_stake') def get_timestamp(): td = now - datetime.datetime(1970, 1, 1, 0, 0, 0) return __fix_decimal(td.seconds) @__export('con_october_stake') def stake(amount: float): assert amount > 0, 'Stake amount must be positive!' tad_contract.transfer_from(to=ctx.this, amount=amount, main_account=ctx .caller) amount_minted = amount / get_price() total = __total_minted.get() + amount_minted __total_minted.set(total) __balances[ctx.caller] += amount_minted return amount_minted @__export('con_october_stake') def withdraw_stake(amount: float): assert amount > 0, 'Stake amount must be positive!' assert __balances[ctx.caller] >= amount, 'Not enough coins to withdraw!' __balances[ctx.caller] -= amount current_price = get_price() return_amount = current_price * amount supply = __total_minted.get() current_average = __fix_decimal(supply / tad_contract.balance_of(ctx.this)) transfer_away_amount = amount * current_average __total_minted.set(supply - amount) if return_amount - transfer_away_amount > 0: vault_contract.mint_rewards(amount=return_amount - transfer_away_amount ) tad_contract.transfer(amount=return_amount, to=ctx.caller) return return_amount @__export('con_october_stake') def change_rate(new_rate: float): __assert_owner() assert new_rate >= 0, 'Cannot have negative staking!' current_price = get_price() __rate['start_time'] = get_timestamp() __rate['rate'] = new_rate __rate['start_price'] = current_price @__export('con_october_stake') def transfer(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller assert __balances[sender] >= amount, 'Not enough coins to send!' __balances[sender] -= amount __balances[to] += amount @__export('con_october_stake') def balance_of(account: str): return __balances[account] @__export('con_october_stake') def allowance(owner: str, spender: str): return __balances[owner, spender] @__export('con_october_stake') def approve(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller assert __balances[sender ] >= amount, 'Cannot approve balance that exceeds total balance!' __balances[sender, to] += amount return __balances[sender, to] @__export('con_october_stake') def transfer_from(amount: float, to: str, main_account: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller assert __balances[main_account] >= amount, 'Not enough coins to send!' assert __balances[main_account, sender ] >= amount, 'Not enough coins approved to send! You have {} and are trying to spend {}'.format( __balances[main_account, sender], amount) __balances[main_account, sender] -= amount __balances[main_account] -= amount __balances[to] += amount @__export('con_october_stake') def get_price(): return __rate['start_price'] * __rate['rate'] ** (get_timestamp() - __rate['start_time']) @__export('con_october_stake') def change_metadata(key: str, value: Any): assert ctx.caller == __metadata['operator' ], 'Only operator can set metadata!' __metadata[key] = value @__export('con_october_stake') def change_owner(new_owner: str): __assert_owner() __operator.set(new_owner) def __assert_owner(): assert ctx.caller == __operator.get(), 'Only operator can call!' def __fix_decimal(old_decimal: float): __temporary_var.set(old_decimal) new_decimal = __temporary_var.get() return new_decimal
 
Contract con_october_stake
Variable __compiled__
New Value e30000000000000000000000000500000040000000738801000065006a01640083015a0265006a01640183015a0365046402640364048d025a05650464056402640664078d035a0665046402640864048d025a0765086402640964048d025a0965086402640a64048d025a0a65086402640b64048d025a0b640c640d84005a0c650d64028301640e640f840083015a0e650d64028301650f64109c0164116412840483015a10650d64028301650f64109c0164136414840483015a11650d64028301650f64159c0164166417840483015a12650d64028301650f651364189c026419641a840483015a14650d640283016513641b9c01641c641d840483015a15650d6402830165136513641e9c02641f6420840483015a16650d64028301650f651364189c0264216422840483015a17650d64028301650f6513651364239c0364246425840483015a18650d6402830164266427840083015a19650d640283016513651a64289c026429642a840483015a1b650d640283016513642b9c01642c642d840483015a1c642e642f84005a1d650f64309c016431643284045a1e643353002934da0f636f6e5f6f63746f6265725f746164da11636f6e5f6f63746f6265725f7661756c74da11636f6e5f6f63746f6265725f7374616b65da04726174652902da08636f6e7472616374da046e616d65e900000000da0862616c616e6365732903da0d64656661756c745f76616c756572050000007206000000da086d65746164617461da0c746f74616c5f6d696e746564da086f70657261746f72da0d74656d706f726172795f766172630000000000000000000000000300000043000000735a00000074006a0174026a038301010074048300740564013c00740664028301740564033c006404740564053c006406740764073c006408740764093c00640a7407640b3c0074026a037407640c3c0074086a01640d8301010064005300290e4eda0a73746172745f74696d657a12312e303030303030303031353436393239377204000000e901000000da0b73746172745f70726963657a0a5374616b656420746164da0a746f6b656e5f6e616d65da0473746164da0c746f6b656e5f73796d626f6c7a0a696d6167652e73697465da0e746f6b656e5f6c6f676f5f75726c720c00000072070000002909da0a5f5f6f70657261746f72da03736574da03637478da0663616c6c6572da0d6765745f74696d657374616d70da065f5f72617465da07646563696d616cda0a5f5f6d65746164617461da0e5f5f746f74616c5f6d696e746564a900721e000000721e000000da00da045f5f5f5f0c000000731200000000010c010a010c0108010801080108010a0172200000006300000000000000000100000008000000430000007322000000740074016a01640164026402640364036403830618007d0074027c006a038301530029044e69b2070000720f00000072070000002904da036e6f77da086461746574696d65da0d5f5f6669785f646563696d616cda077365636f6e64732901da027464721e000000721e000000721f00000072190000001800000073040000000002180172190000002901da06616d6f756e74630100000000000000030000000500000043000000735a0000007c0064016b047310740064028301820174016a0274036a047c0074036a0564038d0301007c00740683001b007d0174076a0883007c0117007d0274076a097c0283010100740a74036a05050019007c01370003003c007c01530029044e72070000007a1e5374616b6520616d6f756e74206d75737420626520706f736974697665212903da02746f7226000000da0c6d61696e5f6163636f756e74290bda0e417373657274696f6e4572726f72da0c7461645f636f6e7472616374da0d7472616e736665725f66726f6d7217000000da04746869737218000000da096765745f7072696365721d000000da036765747216000000da0a5f5f62616c616e63657329037226000000da0d616d6f756e745f6d696e746564da05746f74616c721e000000721e000000721f000000da057374616b651e000000730e0000000002100114020a010c010a011201723200000063010000000000000006000000040000004300000073a80000007c0064016b0473107400640283018201740174026a0319007c006b0573267400640383018201740174026a03050019007c00380003003c00740483007d017c017c0014007d0274056a0683007d0374077c0374086a0974026a0a83011b0083017d047c007c0414007d0574056a0b7c037c001800830101007c027c05180064016b047294740c6a0d7c027c05180064048d01010074086a0e7c0274026a0364058d0201007c02530029064e72070000007a1e5374616b6520616d6f756e74206d75737420626520706f736974697665217a1d4e6f7420656e6f75676820636f696e7320746f2077697468647261772129017226000000290272260000007227000000290f7229000000722f00000072170000007218000000722d000000721d000000722e0000007223000000722a000000da0a62616c616e63655f6f66722c0000007216000000da0e7661756c745f636f6e7472616374da0c6d696e745f72657761726473da087472616e7366657229067226000000da0d63757272656e745f7072696365da0d72657475726e5f616d6f756e74da06737570706c79da0f63757272656e745f61766572616765da147472616e736665725f617761795f616d6f756e74721e000000721e000000721f000000da0e77697468647261775f7374616b652a000000731a0000000002100116011201060108010801140108010e010c0110021001723c0000002901da086e65775f72617465630100000000000000020000000300000043000000733a0000007400830001007c0064016b0573167401640283018201740283007d0174038300740464033c007c00740464043c007c01740464053c006400530029064e72070000007a1d43616e6e6f742068617665206e65676174697665207374616b696e6721720e000000720400000072100000002905da0e5f5f6173736572745f6f776e65727229000000722d0000007219000000721a0000002902723d0000007237000000721e000000721e000000721f000000da0b6368616e67655f726174653c000000730c00000000020601100106010a010801723f000000290272260000007227000000630200000000000000030000000400000043000000734e0000007c0064016b047310740064028301820174016a027d0274037c0219007c006b05732a740064038301820174037c02050019007c00380003003c0074037c01050019007c00370003003c006400530029044e72070000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636f696e7320746f2073656e64212904722900000072170000007218000000722f000000290372260000007227000000da0673656e646572721e000000721e000000721f000000723600000046000000730a0000000002100106011401100172360000002901da076163636f756e74630100000000000000010000000200000043000000730800000074007c001900530029014e2901722f00000029017241000000721e000000721e000000721f00000072330000004f0000007302000000000272330000002902da056f776e6572da077370656e646572630200000000000000020000000300000043000000730c00000074007c007c0166021900530029014e2901722f000000290272420000007243000000721e000000721e000000721f000000da09616c6c6f77616e636554000000730200000000027244000000630200000000000000030000000400000043000000734a0000007c0064016b047310740064028301820174016a027d0274037c0219007c006b05732a740064038301820174037c027c016602050019007c00370003003c0074037c027c0166021900530029044e72070000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a3243616e6e6f7420617070726f76652062616c616e63652074686174206578636565647320746f74616c2062616c616e6365212904722900000072170000007218000000722f0000002903722600000072270000007240000000721e000000721e000000721f000000da07617070726f766559000000730c00000000021001060106010e01140172450000002903722600000072270000007228000000630300000000000000040000000500000043000000738a0000007c0064016b047310740064028301820174016a027d0374037c0219007c006b05732a740064038301820174037c027c03660219007c006b057352740064046a0474037c027c03660219007c0083028301820174037c027c036602050019007c00380003003c0074037c02050019007c00380003003c0074037c01050019007c00370003003c006400530029054e72070000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636f696e7320746f2073656e64217a494e6f7420656e6f75676820636f696e7320617070726f76656420746f2073656e642120596f752068617665207b7d20616e642061726520747279696e6720746f207370656e64207b7d2905722900000072170000007218000000722f000000da06666f726d617429047226000000722700000072280000007240000000721e000000721e000000721f000000722b00000063000000731200000000021001060114010a010c01120114011001722b000000630000000000000000000000000500000043000000731e00000074006401190074006402190074018300740064031900180013001400530029044e72100000007204000000720e0000002902721a0000007219000000721e000000721e000000721e000000721f000000722d00000070000000730400000000021001722d0000002902da036b6579da0576616c7565630200000000000000020000000300000043000000732200000074006a017402640119006b02731674036402830182017c0174027c003c006400530029034e720c0000007a1f4f6e6c79206f70657261746f722063616e20736574206d6574616461746121290472170000007218000000721c0000007229000000290272470000007248000000721e000000721e000000721f000000da0f6368616e67655f6d6574616461746176000000730600000000021001060172490000002901da096e65775f6f776e6572630100000000000000010000000200000043000000731400000074008300010074016a027c00830101006400530029014e2903723e000000721500000072160000002901724a000000721e000000721e000000721f000000da0c6368616e67655f6f776e65727d000000730400000000020601724b000000630000000000000000000000000200000043000000731a00000074006a0174026a0383006b02731674046401830182016400530029024e7a174f6e6c79206f70657261746f722063616e2063616c6c212905721700000072180000007215000000722e0000007229000000721e000000721e000000721e000000721f000000723e0000008300000073020000000001723e0000002901da0b6f6c645f646563696d616c630100000000000000020000000200000043000000731600000074006a017c008301010074006a0283007d017c01530029014e2903da0f5f5f74656d706f726172795f7661727216000000722e0000002902724c000000da0b6e65775f646563696d616c721e000000721e000000721f000000722300000087000000730600000000010a01080172230000004e291fda09696d706f72746c6962da0d696d706f72745f6d6f64756c65722a0000007234000000da0448617368721a000000722f000000721c000000da085661726961626c65721d0000007215000000724d0000007220000000da085f5f6578706f72747219000000da05666c6f61747232000000723c000000723f000000da037374727236000000723300000072440000007245000000722b000000722d000000da03416e797249000000724b000000723e0000007223000000721e000000721e000000721e000000721f000000da083c6d6f64756c653e0100000073420000000a010a010c01060108010c010c010c010c03080c10060601100b0601101106011009060112080601100406011204060112090601140c100606011206060110050804
 
Contract con_october_stake
Variable __owner__
New Value null
 
Contract con_october_stake
Variable __submitted__
New Value 2022,10,23,22,28,20,0
 
Contract con_october_stake
Variable __developer__
New Value f0fc0db25cc1381a98052a2826cb905b78fb6ab4d7ef76f64054509bee070b07
 
Contract currency
Variable balances
Key f0fc0db25cc1381a98052a2826cb905b78fb6ab4d7ef76f64054509bee070b07
New Value 38.85207100591715956