Transaction #1141324

Hash 605b83f6bbb0c7f41572d5f5020e201743aa0d0507238d796fdbfdcc8addeed7
Status Success
Timestamp 89 days ago - 10/30/2022, 12:49:50 AM UTC+0
Block 1092386
Stamps Used 282
Burned Fee 0.01668639 TAU
From 28f7fa3ecbb7d794e623a6692f09a06a912f58ff478a44d034d174dd5e9fac9e 
Contract Name submission
Function Name submit_contract

Additional Info
SubBlock Number 0
Nonce 147
Processor 5b09493df6c18d17cc883ebce54fcb1f5afbd507533417fe32c006009a9c3c4a
Signature af98433f2e3bc97e0eb799132fab2c190fc7575cb8bc35881e823f631990531dd6047932127da008c45b8a8b03aa30e85260175b3c38186194da6e83ce2a090d
Stamps Supplied 845
Stamps per TAU 169

Kwargs

code I = importlib rswp_reserves = ForeignHash(foreign_contract='con_rocketswap_official_v1_1', foreign_name='reserves') rswp_state = ForeignHash(foreign_contract='con_rocketswap_official_v1_1', foreign_name='state') balances = Hash(default_value=0) metadata = Hash() last_predicted_price = Variable() owner = Variable() @construct def init(): # Token info metadata["token_name"] = 'LIM' metadata["token_symbol"] = 'LIM' metadata["token_contract"] = 'con_limerence_lst001_lst002' balances[ctx.caller] = 1_000_000 owner.set(ctx.caller) last_predicted_price.set(0) # DEX metadata["dex"] = ["con_rocketswap_official_v1_1"] metadata["minimum_price"] = 1 @export def change_metadata(key: str, value: Any): assert_owner() metadata[key] = value @export def transfer(amount: float, to: str): assert amount > 0, "Cannot send negative balances!" sender = ctx.caller assert balances[sender] >= amount, "Not enough CURRENCY to send!" balances[sender] -= amount balances[to] += amount @export def approve(amount: float, to: str): assert amount > 0, "Cannot send negative balances!" sender = ctx.caller 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, sender] >= amount, f"Not enough coins approved to send! You have {balances[main_account, sender]} and are trying to spend {amount}" assert balances[main_account] >= amount, "Not enough coins to send!" if to in metadata["dex"]: # check if there is a rocketswap market for this token if rswp_reserves[metadata["token_contract"]] is None: # reserve initial value is None when testing locally balances[main_account, sender] -= amount balances[main_account] -= amount balances[to] += amount return if rswp_reserves[metadata["token_contract"]] is [0,0]: balances[main_account, sender] -= amount balances[main_account] -= amount balances[to] += amount return # predict new price if there should be a sell currency_reserve, token_reserve = rswp_reserves[metadata["token_contract"]] k = currency_reserve * token_reserve new_token_reserve = token_reserve + amount new_currency_reserve = k / new_token_reserve currency_purchased = currency_reserve - new_currency_reserve fee = currency_purchased * rswp_state["FEE_PERCENTAGE"] * 1 currency_purchased -= fee new_currency_reserve += fee if currency_purchased > 0: price = new_currency_reserve / new_token_reserve last_predicted_price.set(price) assert price > metadata["minimum_price"], f"selling not possible at token price: ~{last_predicted_price.get()}" balances[main_account, sender] -= amount balances[main_account] -= amount balances[to] += amount return balances[main_account, sender] -= amount balances[main_account] -= amount balances[to] += amount def assert_owner(): assert ctx.caller is owner.get(), "Only owner can call this method!"
name con_limerence_lst001_lst002

State Changes

Contract con_limerence_lst001_lst002
Variable metadata
Key token_name
New Value LIM
 
Contract con_limerence_lst001_lst002
Variable metadata
Key token_symbol
New Value LIM
 
Contract con_limerence_lst001_lst002
Variable metadata
Key token_contract
New Value con_limerence_lst001_lst002
 
Contract con_limerence_lst001_lst002
Variable balances
Key 28f7fa3ecbb7d794e623a6692f09a06a912f58ff478a44d034d174dd5e9fac9e
New Value 1000000
 
Contract con_limerence_lst001_lst002
Variable owner
New Value 28f7fa3ecbb7d794e623a6692f09a06a912f58ff478a44d034d174dd5e9fac9e
 
Contract con_limerence_lst001_lst002
Variable last_predicted_price
New Value 0
 
Contract con_limerence_lst001_lst002
Variable metadata
Key dex
New Value ["con_rocketswap_official_v1_1"]
 
Contract con_limerence_lst001_lst002
Variable metadata
Key minimum_price
New Value 1
 
Contract con_limerence_lst001_lst002
Variable __code__
New Value I = importlib __rswp_reserves = ForeignHash(foreign_contract= 'con_rocketswap_official_v1_1', foreign_name='reserves', contract= 'con_limerence_lst001_lst002', name='rswp_reserves') __rswp_state = ForeignHash(foreign_contract='con_rocketswap_official_v1_1', foreign_name='state', contract='con_limerence_lst001_lst002', name= 'rswp_state') __balances = Hash(default_value=0, contract='con_limerence_lst001_lst002', name='balances') __metadata = Hash(contract='con_limerence_lst001_lst002', name='metadata') __last_predicted_price = Variable(contract='con_limerence_lst001_lst002', name='last_predicted_price') __owner = Variable(contract='con_limerence_lst001_lst002', name='owner') def ____(): __metadata['token_name'] = 'LIM' __metadata['token_symbol'] = 'LIM' __metadata['token_contract'] = 'con_limerence_lst001_lst002' __balances[ctx.caller] = 1000000 __owner.set(ctx.caller) __last_predicted_price.set(0) __metadata['dex'] = ['con_rocketswap_official_v1_1'] __metadata['minimum_price'] = 1 @__export('con_limerence_lst001_lst002') def change_metadata(key: str, value: Any): __assert_owner() __metadata[key] = value @__export('con_limerence_lst001_lst002') def transfer(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller assert __balances[sender] >= amount, 'Not enough CURRENCY to send!' __balances[sender] -= amount __balances[to] += amount @__export('con_limerence_lst001_lst002') def approve(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller __balances[sender, to] += amount return __balances[sender, to] @__export('con_limerence_lst001_lst002') def transfer_from(amount: float, to: str, main_account: str): assert amount > 0, 'Cannot send negative balances!' sender = ctx.caller assert __balances[main_account, sender ] >= amount, f'Not enough coins approved to send! You have {__balances[main_account, sender]} and are trying to spend {amount}' assert __balances[main_account] >= amount, 'Not enough coins to send!' if to in __metadata['dex']: if __rswp_reserves[__metadata['token_contract']] is None: __balances[main_account, sender] -= amount __balances[main_account] -= amount __balances[to] += amount return if __rswp_reserves[__metadata['token_contract']] is [0, 0]: __balances[main_account, sender] -= amount __balances[main_account] -= amount __balances[to] += amount return currency_reserve, token_reserve = __rswp_reserves[__metadata[ 'token_contract']] k = currency_reserve * token_reserve new_token_reserve = token_reserve + amount new_currency_reserve = k / new_token_reserve currency_purchased = currency_reserve - new_currency_reserve fee = currency_purchased * __rswp_state['FEE_PERCENTAGE'] * 1 currency_purchased -= fee new_currency_reserve += fee if currency_purchased > 0: price = new_currency_reserve / new_token_reserve __last_predicted_price.set(price) assert price > __metadata['minimum_price' ], f'selling not possible at token price: ~{__last_predicted_price.get()}' __balances[main_account, sender] -= amount __balances[main_account] -= amount __balances[to] += amount return __balances[main_account, sender] -= amount __balances[main_account] -= amount __balances[to] += amount def __assert_owner(): assert ctx.caller is __owner.get(), 'Only owner can call this method!'
 
Contract con_limerence_lst001_lst002
Variable __compiled__
New Value e3000000000000000000000000060000004000000073cc00000065005a016502640064016402640364048d045a036502640064056402640664048d045a04650564076402640864098d035a0665056402640a640b8d025a0765086402640c640b8d025a0965086402640d640b8d025a0a640e640f84005a0b650c64028301650d650e64109c0264116412840483015a0f650c640283016510650d64139c0264146415840483015a11650c640283016510650d64139c0264166417840483015a12650c640283016510650d650d64189c036419641a840483015a13641b641c84005a14641d5300291eda1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f31da087265736572766573da1b636f6e5f6c696d6572656e63655f6c73743030315f6c7374303032da0d727377705f72657365727665732904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d65da08636f6e7472616374da046e616d65da057374617465da0a727377705f7374617465e900000000da0862616c616e6365732903da0d64656661756c745f76616c756572070000007208000000da086d65746164617461290272070000007208000000da146c6173745f7072656469637465645f7072696365da056f776e6572630000000000000000000000000300000043000000734e0000006401740064023c006401740064033c006404740064053c006406740174026a033c0074046a0574026a038301010074066a0564078301010064086701740064093c00640a7400640b3c0064005300290c4eda034c494dda0a746f6b656e5f6e616d65da0c746f6b656e5f73796d626f6c7203000000da0e746f6b656e5f636f6e74726163746940420f00720b0000007201000000da03646578e901000000da0d6d696e696d756d5f70726963652907da0a5f5f6d65746164617461da0a5f5f62616c616e636573da03637478da0663616c6c6572da075f5f6f776e6572da03736574da165f5f6c6173745f7072656469637465645f7072696365a900721f000000721f000000da00da045f5f5f5f10000000731000000000010801080108010a010c010a010a0172210000002902da036b6579da0576616c756563020000000000000002000000030000004300000073120000007400830001007c0174017c003c006400530029014e2902da0e5f5f6173736572745f6f776e65727218000000290272220000007223000000721f000000721f0000007220000000da0f6368616e67655f6d657461646174611b00000073040000000002060172250000002902da06616d6f756e74da02746f630200000000000000030000000400000043000000734e0000007c0064016b047310740064028301820174016a027d0274037c0219007c006b05732a740064038301820174037c02050019007c00380003003c0074037c01050019007c00370003003c006400530029044e720b0000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a1c4e6f7420656e6f7567682043555252454e435920746f2073656e64212904da0e417373657274696f6e4572726f72721a000000721b0000007219000000290372260000007227000000da0673656e646572721f000000721f0000007220000000da087472616e7366657221000000730a00000000021001060114011001722a00000063020000000000000003000000040000004300000073360000007c0064016b047310740064028301820174016a027d0274037c027c016602050019007c00370003003c0074037c027c0166021900530029034e720b0000007a1e43616e6e6f742073656e64206e656761746976652062616c616e6365732129047228000000721a000000721b00000072190000002903722600000072270000007229000000721f000000721f0000007220000000da07617070726f76652a00000073080000000002100106011401722b000000290372260000007227000000da0c6d61696e5f6163636f756e746303000000000000000c000000050000004300000073f40100007c0064016b047310740064028301820174016a027d0374037c027c03660219007c006b0573427400640374037c027c03660219009b0064047c009b009d048301820174037c0219007c006b05735674006405830182017c017404640619006b06900172bc7405740464071900190064006b0872ac74037c027c036602050019007c00380003003c0074037c02050019007c00380003003c0074037c01050019007c00370003003c0064005300740574046407190019006401640167026b0872f874037c027c036602050019007c00380003003c0074037c02050019007c00380003003c0074037c01050019007c00370003003c0064005300740574046407190019005c027d047d057c047c0514007d067c057c0017007d077c067c071b007d087c047c0818007d097c097406640819001400640914007d0a7c097c0a38007d097c087c0a37007d087c0964016b04900172b87c087c071b007d0b74076a087c0b830101007c0b7404640a19006b04900173847400640b74076a0983009b009d028301820174037c027c036602050019007c00380003003c0074037c02050019007c00380003003c0074037c01050019007c00370003003c006400530074037c027c036602050019007c00380003003c0074037c02050019007c00380003003c0074037c01050019007c00370003003c0064005300290c4e720b0000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a2c4e6f7420656e6f75676820636f696e7320617070726f76656420746f2073656e642120596f752068617665207a1920616e642061726520747279696e6720746f207370656e64207a194e6f7420656e6f75676820636f696e7320746f2073656e642172150000007214000000da0e4645455f50455243454e54414745721600000072170000007a2673656c6c696e67206e6f7420706f737369626c6520617420746f6b656e2070726963653a207e290a7228000000721a000000721b00000072190000007218000000da0f5f5f727377705f7265736572766573da0c5f5f727377705f7374617465721e000000721d000000da03676574290c72260000007227000000722c0000007229000000da1063757272656e63795f72657365727665da0d746f6b656e5f72657365727665da016bda116e65775f746f6b656e5f72657365727665da146e65775f63757272656e63795f72657365727665da1263757272656e63795f707572636861736564da03666565da057072696365721f000000721f0000007220000000da0d7472616e736665725f66726f6d32000000734a0000000002100106010a01220114010e01100114011001100104011401140110011001040104010c0108010801080108011001080108010a0108010a01100110011401100110010401140110017239000000630000000000000000000000000200000043000000731a00000074006a0174026a0383006b08731674046401830182016400530029024e7a204f6e6c79206f776e65722063616e2063616c6c2074686973206d6574686f64212905721a000000721b000000721c00000072300000007228000000721f000000721f000000721f000000722000000072240000005b0000007302000000000172240000004e2915da09696d706f72746c6962da0149da0b466f726569676e48617368722e000000722f000000da044861736872190000007218000000da085661726961626c65721e000000721c0000007221000000da085f5f6578706f7274da03737472da03416e797225000000da05666c6f6174722a000000722b00000072390000007224000000721f000000721f000000721f0000007220000000da083c6d6f64756c653e01000000732c0000000401020104010a01040104010801060108010c01040108010c03080b06011205060112080601120706011428
 
Contract con_limerence_lst001_lst002
Variable __owner__
New Value null
 
Contract con_limerence_lst001_lst002
Variable __submitted__
New Value 2022,10,30,0,49,53,0
 
Contract con_limerence_lst001_lst002
Variable __developer__
New Value 28f7fa3ecbb7d794e623a6692f09a06a912f58ff478a44d034d174dd5e9fac9e
 
Contract currency
Variable balances
Key 28f7fa3ecbb7d794e623a6692f09a06a912f58ff478a44d034d174dd5e9fac9e
New Value 1140.858246741471405896668958796649