Transaction:

158884c42d742ce48a2204fb2956499bdb51bf085985ab8929b070abc807f041
Status
Success
Timestamp
10/12/2021, 11:40:41 PM
Result
None
Block Number
42663
SubBlock Number
0
Nonce
666
Processor
89f67bb871351a1629d66676e4bd92bbacb23bd0649b890542ef98f1b664a497
Stamps Used
484 ( 37.2 dTAU )
Contract Name
submission
Function Name
submit_contract
Signature
9f556ae664231e941c503c7b1b2dd82ba5dbcbac1f5e59d2a0a5f64b565170871d97b511995b3a46cfb85f236a69e095dc2cf08d5dfe77520c64403e8c805400

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] = 0 metadata['token_name'] = "Nebula" metadata['token_symbol'] = "NEB" 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

State Changes

Contract
con_nebula
Variable
balances
New Value
0
Contract
con_nebula
Variable
metadata
Key
token_name
New Value
Nebula
Contract
con_nebula
Variable
metadata
Key
token_symbol
New Value
NEB
Contract
con_nebula
Variable
metadata
Key
operator
New Value
ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
Contract
con_nebula
Variable
tax_percent
New Value
2
Contract
con_nebula
Variable
swap_allowed
New Value
false
Contract
con_nebula
Variable
tax_blacklist
New Value
["con_rocketswap_official_v1_1"]
Contract
con_nebula
Variable
swap_end_date
New Value
{"__time__":[2022,2,9,23,40,43,0]}
Contract
con_nebula
Variable
vault_contract
New Value
Contract
con_nebula
Variable
total_supply
New Value
0
Contract
con_nebula
Variable
__code__
New Value
__balances = Hash(default_value=0, contract='con_nebula', name='balances') __metadata = Hash(contract='con_nebula', name='metadata') __tax_percent = Variable(contract='con_nebula', name='tax_percent') __swap_allowed = Variable(contract='con_nebula', name='swap_allowed') __vault_contract = Variable(contract='con_nebula', name='vault_contract') __tax_blacklist = Variable(contract='con_nebula', name='tax_blacklist') __total_supply = Variable(contract='con_nebula', name='total_supply') __swap_end_date = Variable(contract='con_nebula', 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] = 0 __metadata['token_name'] = 'Nebula' __metadata['token_symbol'] = 'NEB' __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') def change_metadata(key: str, value: Any): __assert_owner() __metadata[key] = value @__export('con_nebula') 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') def approve(amount: float, to: str): assert amount > 0, 'Cannot send negative balances!' __balances[ctx.caller, to] += amount @__export('con_nebula') 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') 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') 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') 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') 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') def enable_swap(): __assert_owner() __swap_allowed.set(True) @__export('con_nebula') def disable_swap(): __assert_owner() __swap_allowed.set(False) @__export('con_nebula') def time_until_swap_end(): return __swap_end_date.get() - now @__export('con_nebula') 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') def set_vault(contract: str): __assert_owner() __vault_contract.set(contract) @__export('con_nebula') 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') def circulating_supply(): return int(__total_supply.get() - __balances[BURN_ADDRESS]) @__export('con_nebula') def total_supply(): return int(__total_supply.get()) def __assert_owner(): assert ctx.caller in OPERATORS, 'Only executable by operators!'
Contract
con_nebula
Variable
__compiled__
New Value
{"__bytes__":"e3000000000000000000000000050000004000000073e6010000650064006401640264038d035a0165006401640464058d025a0265036401640664058d025a0465036401640764058d025a0565036401640864058d025a0665036401640964058d025a0765036401640a64058d025a0865036401640b64058d025a09650a640c83015a0b640d5a0c640e5a0d640f5a0e6410641167025a0f6412641384005a106511640183016512651364149c0264156416840483015a146511640183016515651264179c0264186419840483015a166511640183016515651264179c02641a641b840483015a17651164018301651565126512641c9c03641d641e840483015a186515641f9c016420642184045a19651164018301651564229c0164236424840483015a1a651164018301651264259c0164266427840483015a1b651164018301651264259c0164286429840483015a1c6511640183016515641f9c01642a642b840483015a1d651164018301642c642d840083015a1e651164018301642e642f840083015a1f65116401830164306431840083015a206511640183016515641f9c0164326433840483015a21651164018301651264349c0164356436840483015a2265116401830164376438840083015a236511640183016439643a840083015a24651164018301643b640a840083015a25643c643d84005a26643e5300293fe900000000da0a636f6e5f6e6562756c61da0862616c616e6365732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da086d65746164617461290272050000007206000000da0b7461785f70657263656e74da0c737761705f616c6c6f776564da0e7661756c745f636f6e7472616374da0d7461785f626c61636b6c697374da0c746f74616c5f737570706c79da0d737761705f656e645f646174657a04302e3031da134e4542554c415f4255524e5f41444452455353da12494e5445524e414c5f4e45425f5641554c54da11636f6e5f676f6c645f636f6e7472616374da4061653764313464366439623834343366383831626136323434373237623639623638313031306537383264346665343832646266623062366163613032643564da406537383765643539303737343266613864353062336361323730316162386530336563373439636564383036613135636461623830306131323764376638363363000000000000000000000000050000004300000073720000006401740074016a023c006402740364033c006404740364053c0074016a02740364063c0074046a0564078301010074066a0564088301010074076a05640967018301010074086a057409740a6a0b640a640b8d01170083010100740c6a05640c83010100740d6a0564018301010064005300290d4e7201000000da064e6562756c61da0a746f6b656e5f6e616d65da034e4542da0c746f6b656e5f73796d626f6cda086f70657261746f72e90200000046da1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f31e9780000002901da0464617973da00290eda0a5f5f62616c616e636573da03637478da0663616c6c6572da0a5f5f6d65746164617461da0d5f5f7461785f70657263656e74da03736574da0e5f5f737761705f616c6c6f776564da0f5f5f7461785f626c61636b6c697374da0f5f5f737761705f656e645f64617465da036e6f77da086461746574696d65da0974696d6564656c7461da105f5f7661756c745f636f6e7472616374da0e5f5f746f74616c5f737570706c79a900722b000000722b000000721c000000da045f5f5f5f11000000731400000000010a01080108010a010a010a010c0116010a01722c0000002902da036b6579da0576616c756563020000000000000002000000030000004300000073120000007400830001007c0174017c003c006400530029014e2902da0e5f5f6173736572745f6f776e657272200000002902722d000000722e000000722b000000722b000000721c000000da0f6368616e67655f6d657461646174611e00000073040000000002060172300000002902da06616d6f756e74da02746f63020000000000000002000000040000004300000073600000007c0064016b0473107400640283018201740174026a0319007c006b0573267400640383018201740174026a03050019007c00380003003c0074017c01050019007c00370003003c007c0174046a0583006b06725c74067c00830101006400530029044e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636f696e7320746f2073656e64212907da0e417373657274696f6e4572726f72721d000000721e000000721f0000007224000000da03676574da095f5f7061795f746178290272310000007232000000722b000000722b000000721c000000da087472616e7366657224000000730c000000000210011601120110010c017236000000630200000000000000020000000400000043000000732a0000007c0064016b0473107400640283018201740174026a037c016602050019007c00370003003c006400530029034e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e6365732129047233000000721d000000721e000000721f000000290272310000007232000000722b000000722b000000721c000000da07617070726f76652e0000007304000000000210017237000000290372310000007232000000da0c6d61696e5f6163636f756e74630300000000000000030000000500000043000000739e0000007c0064016b047310740064028301820174017c0274026a03660219007c006b05733c740064036a0474017c0274026a03660219007c0083028301820174017c0219007c006b057350740064048301820174017c0274026a036602050019007c00380003003c0074017c02050019007c00380003003c0074017c01050019007c00370003003c007c0174056a0683006b06729a74077c00830101006400530029054e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a494e6f7420656e6f75676820636f696e7320617070726f76656420746f2073656e642120596f752068617665207b7d20616e642061726520747279696e6720746f207370656e64207b7d7a194e6f7420656e6f75676820636f696e7320746f2073656e642129087233000000721d000000721e000000721f000000da06666f726d61747224000000723400000072350000002903723100000072320000007238000000722b000000722b000000721c000000da0d7472616e736665725f66726f6d340000007314000000000210010c010c01140114011601100110010c01723a00000029017231000000630100000000000000040000000400000043000000738e00000074007c0064011b0074016a028300140083017d017c0164026b04728a7400740374046a0519007c01180083017d02740374046a0519007c016b057352740664036a077c02640514006404170083018301820174086a028300736074097d036e0874086a0283007d0374037c03050019007c01370003003c00740374046a05050019007c01380003003c006400530029064ee96400000072010000007a334e6f7420656e6f75676820636f696e7320746f2070617920666f72204e4542207461782e204d697373696e67207b7d204e4542e901000000e9ffffffff290ada03696e7472210000007234000000721d000000721e000000da067369676e6572723300000072390000007229000000da0e494e5445524e414c5f5641554c5429047231000000da0a7461785f616d6f756e74da0a646966666572656e6365da057661756c74722b000000722b000000721c0000007235000000420000007316000000000114010801120108010c011001080106020801100172350000002901da0e7461785f696e5f70657263656e74630100000000000000010000000200000043000000732c0000007400830001007c0064016b0572167c0064026b01731e740164038301820174026a037c00830101006400530029044e7201000000723b0000007a1f56616c7565206d757374206265206265747765656e203020616e64203130302904722f00000072330000007221000000722200000029017244000000722b000000722b000000721c000000da077365745f74617851000000730600000000020601180172450000002901da09726563697069656e74630100000000000000020000000200000043000000733a0000007400830001007c0074016a0283006b07731a740364018301820174016a0283007d017c016a047c008301010074016a057c01830101006400530029024e7a22526563697069656e7420616c7265616479206f6e2074617820626c61636b6c6973742906722f000000722400000072340000007233000000da06617070656e64722200000029027246000000da036c7374722b000000722b000000721c000000da146164645f746f5f7461785f626c61636b6c69737458000000730c000000000206010e01060108010a017249000000630100000000000000020000000200000043000000733a0000007400830001007c0074016a0283006b06731a740364018301820174016a0283007d017c016a047c008301010074016a057c01830101006400530029024e7a1e526563697069656e74206e6f74206f6e2074617820626c61636b6c6973742906722f000000722400000072340000007233000000da0672656d6f76657222000000290272460000007248000000722b000000722b000000721c000000da1972656d6f76655f66726f6d5f7461785f626c61636b6c69737462000000730a00000000020601140108010a01724b0000006301000000000000000300000005000000430000007384000000740074016a0283006b007314740364018301820174046a02830064026b02732874036403830182017c0064046b047338740364058301820174056a06740783017d017c016a087c007409740a6a0b64068d0301007c00740c14007d02740d740a6a0b050019007c02370003003c00740e6a0f740e6a0283007c021700830101006400530029074e7a115377617020706572696f6420656e646564547a285377617070696e6720474f4c4420666f72204e45422063757272656e746c792064697361626c656472010000007a1e43616e6e6f742073776170206e656761746976652062616c616e636573212903723100000072320000007238000000291072260000007225000000723400000072330000007223000000da09696d706f72746c6962da0d696d706f72745f6d6f64756c65da0d474f4c445f434f4e5452414354723a000000da0c4255524e5f41444452455353721e000000721f000000da0b535741505f464143544f52721d000000722a000000722200000029037231000000da04676f6c64da0b737761705f616d6f756e74722b000000722b000000721c000000da09737761705f676f6c646b00000073120000000002140106010e0110010a011201080112017253000000630000000000000000000000000200000043000000731400000074008300010074016a026401830101006400530029024e542903722f00000072230000007222000000722b000000722b000000722b000000721c000000da0b656e61626c655f73776170780000007304000000000206017254000000630000000000000000000000000200000043000000731400000074008300010074016a026401830101006400530029024e462903722f00000072230000007222000000722b000000722b000000722b000000721c000000da0c64697361626c655f737761707e0000007304000000000206017255000000630000000000000000000000000200000043000000730c00000074006a01830074021800530029014e2903722500000072340000007226000000722b000000722b000000722b000000721c000000da1374696d655f756e74696c5f737761705f656e6484000000730200000000027256000000630100000000000000010000000400000043000000734c0000007c0064016b0473107400640283018201740174026a0319007c006b057326740064038301820174017404050019007c00370003003c00740174026a03050019007c00380003003c006400530029044e72010000007a1c43616e6e6f74206275726e206e6567617469766520616d6f756e74217a194e6f7420656e6f75676820636f696e7320746f206275726e2129057233000000721d000000721e000000721f000000724f00000029017231000000722b000000722b000000721c000000da046275726e8900000073080000000002100116011001725700000029017205000000630100000000000000010000000200000043000000731400000074008300010074016a027c00830101006400530029014e2903722f0000007229000000722200000029017205000000722b000000722b000000721c000000da097365745f7661756c74910000007304000000000206017258000000630000000000000000000000000500000043000000733a00000074008300010074016a02830073167403640183018201740474016a02830005001900740474051900370003003c006402740474053c006400530029034e7a175661756c7420636f6e7472616374206e6f74207365742172010000002906722f000000722900000072340000007233000000721d0000007240000000722b000000722b000000722b000000721c000000da14666c7573685f696e7465726e616c5f7661756c74970000007308000000000206011001180172590000006300000000000000000000000004000000430000007314000000740074016a02830074037404190018008301530029014e2905723e000000722a0000007234000000721d000000724f000000722b000000722b000000722b000000721c000000da1263697263756c6174696e675f737570706c799f00000073020000000002725a000000630000000000000000000000000200000043000000730c000000740074016a0283008301530029014e2903723e000000722a0000007234000000722b000000722b000000722b000000721c000000720c000000a400000073020000000002630000000000000000000000000200000043000000731600000074006a0174026b06731274036401830182016400530029024e7a1d4f6e6c792065786563757461626c65206279206f70657261746f7273212904721e000000721f000000da094f50455241544f52537233000000722b000000722b000000722b000000721c000000722f000000a900000073020000000001722f0000004e2927da0448617368721d0000007220000000da085661726961626c657221000000722300000072290000007224000000722a0000007225000000da07646563696d616c7250000000724f0000007240000000724e000000725b000000722c000000da085f5f6578706f7274da03737472da03416e797230000000da05666c6f617472360000007237000000723a000000723500000072450000007249000000724b0000007253000000725400000072550000007256000000725700000072580000007259000000725a000000720c000000722f000000722b000000722b000000722b000000721c000000da083c6d6f64756c653e0100000073540000000e010c010c010c010c010c010c010c01080104010401040102010603080d0601120506011209060112050601140d0e0f0601100606011009060110080601100c1006100610050601100706011005100810051005"}
Contract
con_nebula
Variable
__owner__
New Value
NULL
Contract
con_nebula
Variable
__submitted__
New Value
{"__time__":[2021,10,12,23,40,43,0]}
Contract
con_nebula
Variable
__developer__
New Value
ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
Contract
currency
Variable
balances
New Value
182