Transaction #1034957

Hash 25eceb90809abb035ebf3c46733639518a76f0a0144c91f13e033968f26e8ac6
Status Success
Timestamp 631 days ago - 8/27/2022, 12:26:22 AM UTC+0
Block 986727
Stamps Used 490
Burned Fee 0.02899408 TAU
From ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d 
Contract Name submission
Function Name submit_contract

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

Kwargs

code balances = Hash(default_value=0) metadata = Hash() tax_percent = Variable() swap_allowed = Variable() vault_contract = Variable() tax_blacklist = Variable() total_supply = Variable() swap_end_date = Variable() SWAP_FACTOR = 0.01 BURN_ADDRESS = 'NEBULA_BURN_ADDRESS' INTERNAL_VAULT = 'INTERNAL_NEB_VAULT' GOLD_CONTRACT = 'con_gold_contract' OPERATORS = [ 'ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d', 'e787ed5907742fa8d50b3ca2701ab8e03ec749ced806a15cdab800a127d7f863' ] @construct def seed(): balances[ctx.caller] = 10_000_000 metadata['token_name'] = "Nebula TEST" metadata['token_symbol'] = "NEBT" metadata['operator'] = ctx.caller tax_percent.set(2) swap_allowed.set(False) tax_blacklist.set(['con_rocketswap_official_v1_1']) swap_end_date.set(now + datetime.timedelta(days=120)) vault_contract.set('') total_supply.set(0) @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!' assert balances[ctx.caller] >= amount, 'Not enough coins to send!' balances[ctx.caller] -= amount balances[to] += amount if to in tax_blacklist.get(): pay_tax(amount) @export def approve(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' balances[ctx.caller, to] += amount @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!' balances[main_account, ctx.caller] -= amount balances[main_account] -= amount balances[to] += amount if to in tax_blacklist.get(): pay_tax(amount) # ------ TAX ------ def pay_tax(amount: float): tax_amount = int(amount / 100 * tax_percent.get()) if tax_amount > 0: difference = int(balances[ctx.signer] - tax_amount) assert balances[ctx.signer] >= tax_amount, 'Not enough coins to pay for NEB tax. Missing {} NEB'.format((difference * -1) + 1) if not vault_contract.get(): vault = INTERNAL_VAULT else: vault = vault_contract.get() balances[vault] += tax_amount balances[ctx.signer] -= tax_amount @export def set_tax(tax_in_percent: float): assert_owner() assert (tax_in_percent >= 0 and tax_in_percent <= 100), 'Value must be between 0 and 100' tax_percent.set(tax_in_percent) @export def add_to_tax_blacklist(recipient: str): assert_owner() assert recipient not in tax_blacklist.get(), 'Recipient already on tax blacklist' lst = tax_blacklist.get() lst.append(recipient) tax_blacklist.set(lst) @export def remove_from_tax_blacklist(recipient: str): assert_owner() assert recipient in tax_blacklist.get(), 'Recipient not on tax blacklist' lst = tax_blacklist.get() lst.remove(recipient) tax_blacklist.set(lst) # ------ SWAP ------ @export def swap_gold(amount: float): assert now < swap_end_date.get(), 'Swap period ended' assert swap_allowed.get() == True, 'Swapping GOLD for NEB currently disabled' assert amount > 0, 'Cannot swap negative balances!' gold = importlib.import_module(GOLD_CONTRACT) gold.transfer_from(amount=amount, to=BURN_ADDRESS, main_account=ctx.caller) swap_amount = amount * SWAP_FACTOR balances[ctx.caller] += swap_amount total_supply.set(total_supply.get() + swap_amount) @export def enable_swap(): assert_owner() swap_allowed.set(True) @export def disable_swap(): assert_owner() swap_allowed.set(False) @export def time_until_swap_end(): return swap_end_date.get() - now # ------ BURNING ------ @export def burn(amount: float): assert amount > 0, 'Cannot burn negative amount!' assert balances[ctx.caller] >= amount, 'Not enough coins to burn!' balances[BURN_ADDRESS] += amount balances[ctx.caller] -= amount # ------ VAULT ------ @export def set_vault(contract: str): assert_owner() vault_contract.set(contract) @export def flush_internal_vault(): assert_owner() assert vault_contract.get(), 'Vault contract not set!' balances[vault_contract.get()] += balances[INTERNAL_VAULT] balances[INTERNAL_VAULT] = 0 # ------ SUPPLY ------ @export def circulating_supply(): return int(total_supply.get() - balances[BURN_ADDRESS]) @export def total_supply(): return int(total_supply.get()) # ------ INTERNAL ------ def assert_owner(): assert ctx.caller in OPERATORS, 'Only executable by operators!'
name con_nebula_test

State Changes

Contract con_nebula_test
Variable balances
Key ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
New Value 10000000
 
Contract con_nebula_test
Variable metadata
Key token_name
New Value Nebula TEST
 
Contract con_nebula_test
Variable metadata
Key token_symbol
New Value NEBT
 
Contract con_nebula_test
Variable metadata
Key operator
New Value ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
 
Contract con_nebula_test
Variable tax_percent
New Value 2
 
Contract con_nebula_test
Variable swap_allowed
New Value false
 
Contract con_nebula_test
Variable tax_blacklist
New Value ["con_rocketswap_official_v1_1"]
 
Contract con_nebula_test
Variable swap_end_date
New Value 2022,12,25,0,26,24,0
 
Contract con_nebula_test
Variable vault_contract
New Value
 
Contract con_nebula_test
Variable total_supply
New Value 0
 
Contract con_nebula_test
Variable __code__
New Value __balances = Hash(default_value=0, contract='con_nebula_test', name='balances') __metadata = Hash(contract='con_nebula_test', name='metadata') __tax_percent = Variable(contract='con_nebula_test', name='tax_percent') __swap_allowed = Variable(contract='con_nebula_test', name='swap_allowed') __vault_contract = Variable(contract='con_nebula_test', name='vault_contract') __tax_blacklist = Variable(contract='con_nebula_test', name='tax_blacklist') __total_supply = Variable(contract='con_nebula_test', name='total_supply') __swap_end_date = Variable(contract='con_nebula_test', name='swap_end_date') SWAP_FACTOR = decimal('0.01') BURN_ADDRESS = 'NEBULA_BURN_ADDRESS' INTERNAL_VAULT = 'INTERNAL_NEB_VAULT' GOLD_CONTRACT = 'con_gold_contract' OPERATORS = ['ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d' , 'e787ed5907742fa8d50b3ca2701ab8e03ec749ced806a15cdab800a127d7f863'] def ____(): __balances[ctx.caller] = 10000000 __metadata['token_name'] = 'Nebula TEST' __metadata['token_symbol'] = 'NEBT' __metadata['operator'] = ctx.caller __tax_percent.set(2) __swap_allowed.set(False) __tax_blacklist.set(['con_rocketswap_official_v1_1']) __swap_end_date.set(now + datetime.timedelta(days=120)) __vault_contract.set('') __total_supply.set(0) @__export('con_nebula_test') def change_metadata(key: str, value: Any): __assert_owner() __metadata[key] = value @__export('con_nebula_test') def transfer(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' assert __balances[ctx.caller] >= amount, 'Not enough coins to send!' __balances[ctx.caller] -= amount __balances[to] += amount if to in __tax_blacklist.get(): __pay_tax(amount) @__export('con_nebula_test') def approve(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' __balances[ctx.caller, to] += amount @__export('con_nebula_test') 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!' __balances[main_account, ctx.caller] -= amount __balances[main_account] -= amount __balances[to] += amount if to in __tax_blacklist.get(): __pay_tax(amount) def __pay_tax(amount: float): tax_amount = int(amount / 100 * __tax_percent.get()) if tax_amount > 0: difference = int(__balances[ctx.signer] - tax_amount) assert __balances[ctx.signer ] >= tax_amount, 'Not enough coins to pay for NEB tax. Missing {} NEB'.format( difference * -1 + 1) if not __vault_contract.get(): vault = INTERNAL_VAULT else: vault = __vault_contract.get() __balances[vault] += tax_amount __balances[ctx.signer] -= tax_amount @__export('con_nebula_test') def set_tax(tax_in_percent: float): __assert_owner() assert tax_in_percent >= 0 and tax_in_percent <= 100, 'Value must be between 0 and 100' __tax_percent.set(tax_in_percent) @__export('con_nebula_test') def add_to_tax_blacklist(recipient: str): __assert_owner() assert recipient not in __tax_blacklist.get( ), 'Recipient already on tax blacklist' lst = __tax_blacklist.get() lst.append(recipient) __tax_blacklist.set(lst) @__export('con_nebula_test') def remove_from_tax_blacklist(recipient: str): __assert_owner() assert recipient in __tax_blacklist.get(), 'Recipient not on tax blacklist' lst = __tax_blacklist.get() lst.remove(recipient) __tax_blacklist.set(lst) @__export('con_nebula_test') def swap_gold(amount: float): assert now < __swap_end_date.get(), 'Swap period ended' assert __swap_allowed.get( ) == True, 'Swapping GOLD for NEB currently disabled' assert amount > 0, 'Cannot swap negative balances!' gold = importlib.import_module(GOLD_CONTRACT) gold.transfer_from(amount=amount, to=BURN_ADDRESS, main_account=ctx.caller) swap_amount = amount * SWAP_FACTOR __balances[ctx.caller] += swap_amount __total_supply.set(__total_supply.get() + swap_amount) @__export('con_nebula_test') def enable_swap(): __assert_owner() __swap_allowed.set(True) @__export('con_nebula_test') def disable_swap(): __assert_owner() __swap_allowed.set(False) @__export('con_nebula_test') def time_until_swap_end(): return __swap_end_date.get() - now @__export('con_nebula_test') def burn(amount: float): assert amount > 0, 'Cannot burn negative amount!' assert __balances[ctx.caller] >= amount, 'Not enough coins to burn!' __balances[BURN_ADDRESS] += amount __balances[ctx.caller] -= amount @__export('con_nebula_test') def set_vault(contract: str): __assert_owner() __vault_contract.set(contract) @__export('con_nebula_test') def flush_internal_vault(): __assert_owner() assert __vault_contract.get(), 'Vault contract not set!' __balances[__vault_contract.get()] += __balances[INTERNAL_VAULT] __balances[INTERNAL_VAULT] = 0 @__export('con_nebula_test') def circulating_supply(): return int(__total_supply.get() - __balances[BURN_ADDRESS]) @__export('con_nebula_test') def total_supply(): return int(__total_supply.get()) def __assert_owner(): assert ctx.caller in OPERATORS, 'Only executable by operators!'
 
Contract con_nebula_test
Variable __compiled__
New Value e3000000000000000000000000050000004000000073e6010000650064006401640264038d035a0165006401640464058d025a0265036401640664058d025a0465036401640764058d025a0565036401640864058d025a0665036401640964058d025a0765036401640a64058d025a0865036401640b64058d025a09650a640c83015a0b640d5a0c640e5a0d640f5a0e6410641167025a0f6412641384005a106511640183016512651364149c0264156416840483015a146511640183016515651264179c0264186419840483015a166511640183016515651264179c02641a641b840483015a17651164018301651565126512641c9c03641d641e840483015a186515641f9c016420642184045a19651164018301651564229c0164236424840483015a1a651164018301651264259c0164266427840483015a1b651164018301651264259c0164286429840483015a1c6511640183016515641f9c01642a642b840483015a1d651164018301642c642d840083015a1e651164018301642e642f840083015a1f65116401830164306431840083015a206511640183016515641f9c0164326433840483015a21651164018301651264349c0164356436840483015a2265116401830164376438840083015a236511640183016439643a840083015a24651164018301643b640a840083015a25643c643d84005a26643e5300293fe900000000da0f636f6e5f6e6562756c615f74657374da0862616c616e6365732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da086d65746164617461290272050000007206000000da0b7461785f70657263656e74da0c737761705f616c6c6f776564da0e7661756c745f636f6e7472616374da0d7461785f626c61636b6c697374da0c746f74616c5f737570706c79da0d737761705f656e645f646174657a04302e3031da134e4542554c415f4255524e5f41444452455353da12494e5445524e414c5f4e45425f5641554c54da11636f6e5f676f6c645f636f6e7472616374da4061653764313464366439623834343366383831626136323434373237623639623638313031306537383264346665343832646266623062366163613032643564da406537383765643539303737343266613864353062336361323730316162386530336563373439636564383036613135636461623830306131323764376638363363000000000000000000000000050000004300000073720000006401740074016a023c006402740364033c006404740364053c0074016a02740364063c0074046a0564078301010074066a0564088301010074076a05640967018301010074086a057409740a6a0b640a640b8d01170083010100740c6a05640c83010100740d6a05640d8301010064005300290e4e69809698007a0b4e6562756c612054455354da0a746f6b656e5f6e616d65da044e454254da0c746f6b656e5f73796d626f6cda086f70657261746f72e90200000046da1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f31e9780000002901da0464617973da007201000000290eda0a5f5f62616c616e636573da03637478da0663616c6c6572da0a5f5f6d65746164617461da0d5f5f7461785f70657263656e74da03736574da0e5f5f737761705f616c6c6f776564da0f5f5f7461785f626c61636b6c697374da0f5f5f737761705f656e645f64617465da036e6f77da086461746574696d65da0974696d6564656c7461da105f5f7661756c745f636f6e7472616374da0e5f5f746f74616c5f737570706c79a900722a000000722a000000721b000000da045f5f5f5f11000000731400000000010a01080108010a010a010a010c0116010a01722b0000002902da036b6579da0576616c756563020000000000000002000000030000004300000073120000007400830001007c0174017c003c006400530029014e2902da0e5f5f6173736572745f6f776e6572721f0000002902722c000000722d000000722a000000722a000000721b000000da0f6368616e67655f6d657461646174611e000000730400000000020601722f0000002902da06616d6f756e74da02746f63020000000000000002000000040000004300000073600000007c0064016b0473107400640283018201740174026a0319007c006b0573267400640383018201740174026a03050019007c00380003003c0074017c01050019007c00370003003c007c0174046a0583006b06725c74067c00830101006400530029044e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636f696e7320746f2073656e64212907da0e417373657274696f6e4572726f72721c000000721d000000721e0000007223000000da03676574da095f5f7061795f746178290272300000007231000000722a000000722a000000721b000000da087472616e7366657224000000730c000000000210011601120110010c017235000000630200000000000000020000000400000043000000732a0000007c0064016b0473107400640283018201740174026a037c016602050019007c00370003003c006400530029034e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e6365732129047232000000721c000000721d000000721e000000290272300000007231000000722a000000722a000000721b000000da07617070726f76652e0000007304000000000210017236000000290372300000007231000000da0c6d61696e5f6163636f756e74630300000000000000030000000500000043000000739e0000007c0064016b047310740064028301820174017c0274026a03660219007c006b05733c740064036a0474017c0274026a03660219007c0083028301820174017c0219007c006b057350740064048301820174017c0274026a036602050019007c00380003003c0074017c02050019007c00380003003c0074017c01050019007c00370003003c007c0174056a0683006b06729a74077c00830101006400530029054e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a494e6f7420656e6f75676820636f696e7320617070726f76656420746f2073656e642120596f752068617665207b7d20616e642061726520747279696e6720746f207370656e64207b7d7a194e6f7420656e6f75676820636f696e7320746f2073656e642129087232000000721c000000721d000000721e000000da06666f726d61747223000000723300000072340000002903723000000072310000007237000000722a000000722a000000721b000000da0d7472616e736665725f66726f6d340000007314000000000210010c010c01140114011601100110010c01723900000029017230000000630100000000000000040000000400000043000000738e00000074007c0064011b0074016a028300140083017d017c0164026b04728a7400740374046a0519007c01180083017d02740374046a0519007c016b057352740664036a077c02640514006404170083018301820174086a028300736074097d036e0874086a0283007d0374037c03050019007c01370003003c00740374046a05050019007c01380003003c006400530029064ee96400000072010000007a334e6f7420656e6f75676820636f696e7320746f2070617920666f72204e4542207461782e204d697373696e67207b7d204e4542e901000000e9ffffffff290ada03696e7472200000007233000000721c000000721d000000da067369676e6572723200000072380000007228000000da0e494e5445524e414c5f5641554c5429047230000000da0a7461785f616d6f756e74da0a646966666572656e6365da057661756c74722a000000722a000000721b0000007234000000420000007316000000000114010801120108010c011001080106020801100172340000002901da0e7461785f696e5f70657263656e74630100000000000000010000000200000043000000732c0000007400830001007c0064016b0572167c0064026b01731e740164038301820174026a037c00830101006400530029044e7201000000723a0000007a1f56616c7565206d757374206265206265747765656e203020616e64203130302904722e00000072320000007220000000722100000029017243000000722a000000722a000000721b000000da077365745f74617851000000730600000000020601180172440000002901da09726563697069656e74630100000000000000020000000200000043000000733a0000007400830001007c0074016a0283006b07731a740364018301820174016a0283007d017c016a047c008301010074016a057c01830101006400530029024e7a22526563697069656e7420616c7265616479206f6e2074617820626c61636b6c6973742906722e000000722300000072330000007232000000da06617070656e64722100000029027245000000da036c7374722a000000722a000000721b000000da146164645f746f5f7461785f626c61636b6c69737458000000730c000000000206010e01060108010a017248000000630100000000000000020000000200000043000000733a0000007400830001007c0074016a0283006b06731a740364018301820174016a0283007d017c016a047c008301010074016a057c01830101006400530029024e7a1e526563697069656e74206e6f74206f6e2074617820626c61636b6c6973742906722e000000722300000072330000007232000000da0672656d6f76657221000000290272450000007247000000722a000000722a000000721b000000da1972656d6f76655f66726f6d5f7461785f626c61636b6c69737462000000730a00000000020601140108010a01724a0000006301000000000000000300000005000000430000007384000000740074016a0283006b007314740364018301820174046a02830064026b02732874036403830182017c0064046b047338740364058301820174056a06740783017d017c016a087c007409740a6a0b64068d0301007c00740c14007d02740d740a6a0b050019007c02370003003c00740e6a0f740e6a0283007c021700830101006400530029074e7a115377617020706572696f6420656e646564547a285377617070696e6720474f4c4420666f72204e45422063757272656e746c792064697361626c656472010000007a1e43616e6e6f742073776170206e656761746976652062616c616e636573212903723000000072310000007237000000291072250000007224000000723300000072320000007222000000da09696d706f72746c6962da0d696d706f72745f6d6f64756c65da0d474f4c445f434f4e54524143547239000000da0c4255524e5f41444452455353721d000000721e000000da0b535741505f464143544f52721c0000007229000000722100000029037230000000da04676f6c64da0b737761705f616d6f756e74722a000000722a000000721b000000da09737761705f676f6c646b00000073120000000002140106010e0110010a011201080112017252000000630000000000000000000000000200000043000000731400000074008300010074016a026401830101006400530029024e542903722e00000072220000007221000000722a000000722a000000722a000000721b000000da0b656e61626c655f73776170780000007304000000000206017253000000630000000000000000000000000200000043000000731400000074008300010074016a026401830101006400530029024e462903722e00000072220000007221000000722a000000722a000000722a000000721b000000da0c64697361626c655f737761707e0000007304000000000206017254000000630000000000000000000000000200000043000000730c00000074006a01830074021800530029014e2903722400000072330000007225000000722a000000722a000000722a000000721b000000da1374696d655f756e74696c5f737761705f656e6484000000730200000000027255000000630100000000000000010000000400000043000000734c0000007c0064016b0473107400640283018201740174026a0319007c006b057326740064038301820174017404050019007c00370003003c00740174026a03050019007c00380003003c006400530029044e72010000007a1c43616e6e6f74206275726e206e6567617469766520616d6f756e74217a194e6f7420656e6f75676820636f696e7320746f206275726e2129057232000000721c000000721d000000721e000000724e00000029017230000000722a000000722a000000721b000000da046275726e8900000073080000000002100116011001725600000029017205000000630100000000000000010000000200000043000000731400000074008300010074016a027c00830101006400530029014e2903722e0000007228000000722100000029017205000000722a000000722a000000721b000000da097365745f7661756c74910000007304000000000206017257000000630000000000000000000000000500000043000000733a00000074008300010074016a02830073167403640183018201740474016a02830005001900740474051900370003003c006402740474053c006400530029034e7a175661756c7420636f6e7472616374206e6f74207365742172010000002906722e000000722800000072330000007232000000721c000000723f000000722a000000722a000000722a000000721b000000da14666c7573685f696e7465726e616c5f7661756c74970000007308000000000206011001180172580000006300000000000000000000000004000000430000007314000000740074016a02830074037404190018008301530029014e2905723d00000072290000007233000000721c000000724e000000722a000000722a000000722a000000721b000000da1263697263756c6174696e675f737570706c799f000000730200000000027259000000630000000000000000000000000200000043000000730c000000740074016a0283008301530029014e2903723d00000072290000007233000000722a000000722a000000722a000000721b000000720c000000a400000073020000000002630000000000000000000000000200000043000000731600000074006a0174026b06731274036401830182016400530029024e7a1d4f6e6c792065786563757461626c65206279206f70657261746f7273212904721d000000721e000000da094f50455241544f52537232000000722a000000722a000000722a000000721b000000722e000000a900000073020000000001722e0000004e2927da0448617368721c000000721f000000da085661726961626c65722000000072220000007228000000722300000072290000007224000000da07646563696d616c724f000000724e000000723f000000724d000000725a000000722b000000da085f5f6578706f7274da03737472da03416e79722f000000da05666c6f6174723500000072360000007239000000723400000072440000007248000000724a00000072520000007253000000725400000072550000007256000000725700000072580000007259000000720c000000722e000000722a000000722a000000722a000000721b000000da083c6d6f64756c653e0100000073540000000e010c010c010c010c010c010c010c01080104010401040102010603080d0601120506011209060112050601140d0e0f0601100606011009060110080601100c1006100610050601100706011005100810051005
 
Contract con_nebula_test
Variable __owner__
New Value null
 
Contract con_nebula_test
Variable __submitted__
New Value 2022,8,27,0,26,24,0
 
Contract con_nebula_test
Variable __developer__
New Value ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
 
Contract currency
Variable balances
Key ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
New Value 115508.601353004564756386790877960945