Transaction #881716

Hash fd357a8b45322eb4edeb16fc13d57b4fb4b8966b32d979c8bfb99047bd1ebc98
Status Success
Timestamp 768 days ago - 4/4/2022, 7:36:10 PM UTC+0
Block 835462
Stamps Used 500
Burned Fee 0.02958580 TAU
From a5565739151e6f8d3fbb03ab605a31cc285e36a717a95002a60e6e4d4e4fa411 
Contract Name submission
Function Name submit_contract

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

Kwargs

code import currency as tau import con_reflecttau_v2 as rtau I = importlib metadata = Hash() reflections = Hash(default_value=0.0) forward_holders_index = Hash(default_value=False) reverse_holders_index = Hash(default_value=False) contract = Variable() holders_amount = Variable() @construct def init(name: str): metadata['tax'] = decimal(12) metadata['tau_pool'] = decimal(0) metadata['balance_limit'] = decimal(1_000) metadata['dex'] = 'con_rocketswap_official_v1_1' # Rewards metadata['redistribute_perc'] = 66.67 # Team metadata['dev_perc_of_tax'] = 16.67 # Buyback and Burn metadata['buyback_perc_of_tax'] = 8.33 # Auto-LP metadata['autolp_perc_of_tax'] = 8.33 contract.set(name) holders_amount.set(0) approve() @export def approve(): # Approve sending unlimited amount of TAU to developer action core contract for dev fees tau.approve(amount=999_999_999_999_999_999, to=rtau.get_metadata('action_dev')) # Approve sending unlimited amount of RTAU to DEX contract to be able to sell RTAU rtau.approve(amount=999_999_999_999_999_999, to=metadata['dex']) @export def change_metadata(key: str, value: Any): rtau.assert_signer_is_operator() metadata[key] = value @export def execute(payload: dict, caller: str): assert ctx.caller == rtau.contract(), 'You are not allowed to do that' if payload['function'] == 'transfer': assert not 'external' in payload, 'External call not allowed!' return process_transfer(payload['amount'], payload['to'], caller) if payload['function'] == 'transfer_from': assert not 'external' in payload, 'External call not allowed!' return process_transfer(payload['amount'], payload['to'], caller, payload['main_account']) if payload['function'] == 'manage_holders_index': assert not 'external' in payload, 'External call not allowed!' manage_holders_index(payload['address'], payload['amount']) if payload['function'] == 'redistribute_tau': return redistribute_tau(payload['start'], payload['end'], payload['reset_pool']) if payload['function'] == 'calc_taxes': return calc_taxes(payload['amount'], payload['to']) def process_transfer(amount: float, to: str, caller: str, main_account: str=""): tax = calc_taxes(amount, to) # DEX Buy if (caller == metadata['dex'] and to != contract.get() and main_account == ""): amount -= process_taxes(tax) manage_holders_index(to, rtau.balance_of(to)) # DEX Sell elif (to == metadata['dex'] and ctx.signer == main_account and ctx.caller != rtau.get_metadata('action_liquidity')): amount -= process_taxes(tax) manage_holders_index(main_account, rtau.balance_of(main_account)) # Normal Transfer (not transfer_from, here they dont include a sender so we use signer) elif (not to.startswith('con_') and not main_account.startswith('con_')): manage_holders_index(to, rtau.balance_of(to) + amount) manage_holders_index(ctx.signer, rtau.balance_of(ctx.signer)) return amount def calc_taxes(amount: float, to: str): if to in (rtau.get_metadata('action_liquidity'), rtau.get_metadata('action_buyback'), rtau.burn_address()): return decimal(0) return amount / 100 * metadata['tax'] def process_taxes(taxes: float): if taxes > 0: rswp = I.import_module(metadata['dex']) tau_amount = rswp.sell(contract=rtau.contract(), token_amount=taxes) tau.transfer(amount=(tau_amount / 100 * metadata['dev_perc_of_tax']), to=rtau.get_metadata('action_dev')) tau.transfer(amount=(tau_amount / 100 * metadata['buyback_perc_of_tax']), to=rtau.get_metadata('action_buyback')) tau.transfer(amount=(tau_amount / 100 * metadata['autolp_perc_of_tax']), to=rtau.get_metadata('action_liquidity')) metadata['tau_pool'] += (tau_amount / 100 * metadata['redistribute_perc']) return taxes def manage_holders_index(address: str, amount: float): if amount >= metadata['balance_limit']: # Add to holders index and be eligible for TAU reflection if (reverse_holders_index[address] == False): holders_amount.set(holders_amount.get() + 1) forward_holders_index[holders_amount.get()] = address reverse_holders_index[address] = holders_amount.get() else: # Remove from holders index and not be eligible for TAU reflection if (reverse_holders_index[address] != False): forward_holders_index[reverse_holders_index[address]] = False reverse_holders_index[address] = False def redistribute_tau(start: int=None, end: int=None, reset_pool: bool=None): if start == None: start = 1 if end == None: end = holders_amount.get() + 1 if reset_pool == None: reset_pool = True supply = rtau.circulating_supply() - rtau.balance_of(metadata['dex']) for holder_id in range(start, end): if (forward_holders_index[holder_id] != False): holder_balance_share = rtau.balance_of(address=forward_holders_index[holder_id]) / supply * 100 reflections[forward_holders_index[holder_id]] += metadata["tau_pool"] / 100 * holder_balance_share if reset_pool: metadata['tau_pool'] = decimal(0) @export def claim_tau(): assert reflections[ctx.caller] > 0, "There is nothing to claim" tau.transfer(amount=reflections[ctx.caller], to=ctx.caller) reflections[ctx.caller] = decimal(0)
constructor_args {"name":"con_reflecttau_v2_reflection"}
name con_reflecttau_v2_reflection

State Changes

Contract con_reflecttau_v2_reflection
Variable metadata
Key tax
New Value 12
 
Contract con_reflecttau_v2_reflection
Variable metadata
Key tau_pool
New Value 0
 
Contract con_reflecttau_v2_reflection
Variable metadata
Key balance_limit
New Value 1000
 
Contract con_reflecttau_v2_reflection
Variable metadata
Key dex
New Value con_rocketswap_official_v1_1
 
Contract con_reflecttau_v2_reflection
Variable metadata
Key redistribute_perc
New Value 66.67
 
Contract con_reflecttau_v2_reflection
Variable metadata
Key dev_perc_of_tax
New Value 16.67
 
Contract con_reflecttau_v2_reflection
Variable metadata
Key buyback_perc_of_tax
New Value 8.33
 
Contract con_reflecttau_v2_reflection
Variable metadata
Key autolp_perc_of_tax
New Value 8.33
 
Contract con_reflecttau_v2_reflection
Variable contract
New Value con_reflecttau_v2_reflection
 
Contract con_reflecttau_v2_reflection
Variable holders_amount
New Value 0
 
Contract currency
Variable balances
Key con_reflecttau_v2_reflection:con_reflecttau_v2_developer
New Value 1000000000000000000
 
Contract con_reflecttau_v2
Variable balances
Key con_reflecttau_v2_reflection:con_rocketswap_official_v1_1
New Value 999999999999999999.0
 
Contract con_reflecttau_v2_reflection
Variable __code__
New Value import currency as tau import con_reflecttau_v2 as rtau I = importlib __metadata = Hash(contract='con_reflecttau_v2_reflection', name='metadata') __reflections = Hash(default_value=decimal('0.0'), contract= 'con_reflecttau_v2_reflection', name='reflections') __forward_holders_index = Hash(default_value=False, contract= 'con_reflecttau_v2_reflection', name='forward_holders_index') __reverse_holders_index = Hash(default_value=False, contract= 'con_reflecttau_v2_reflection', name='reverse_holders_index') __contract = Variable(contract='con_reflecttau_v2_reflection', name='contract') __holders_amount = Variable(contract='con_reflecttau_v2_reflection', name= 'holders_amount') def ____(name: str): __metadata['tax'] = decimal(12) __metadata['tau_pool'] = decimal(0) __metadata['balance_limit'] = decimal(1000) __metadata['dex'] = 'con_rocketswap_official_v1_1' __metadata['redistribute_perc'] = decimal('66.67') __metadata['dev_perc_of_tax'] = decimal('16.67') __metadata['buyback_perc_of_tax'] = decimal('8.33') __metadata['autolp_perc_of_tax'] = decimal('8.33') __contract.set(name) __holders_amount.set(0) approve() @__export('con_reflecttau_v2_reflection') def approve(): tau.approve(amount=999999999999999999, to=rtau.get_metadata('action_dev')) rtau.approve(amount=999999999999999999, to=__metadata['dex']) @__export('con_reflecttau_v2_reflection') def change_metadata(key: str, value: Any): rtau.assert_signer_is_operator() __metadata[key] = value @__export('con_reflecttau_v2_reflection') def execute(payload: dict, caller: str): assert ctx.caller == rtau.contract(), 'You are not allowed to do that' if payload['function'] == 'transfer': assert not 'external' in payload, 'External call not allowed!' return __process_transfer(payload['amount'], payload['to'], caller) if payload['function'] == 'transfer_from': assert not 'external' in payload, 'External call not allowed!' return __process_transfer(payload['amount'], payload['to'], caller, payload['main_account']) if payload['function'] == 'manage_holders_index': assert not 'external' in payload, 'External call not allowed!' __manage_holders_index(payload['address'], payload['amount']) if payload['function'] == 'redistribute_tau': return __redistribute_tau(payload['start'], payload['end'], payload ['reset_pool']) if payload['function'] == 'calc_taxes': return __calc_taxes(payload['amount'], payload['to']) def __process_transfer(amount: float, to: str, caller: str, main_account: str=''): tax = __calc_taxes(amount, to) if caller == __metadata['dex'] and to != __contract.get( ) and main_account == '': amount -= __process_taxes(tax) __manage_holders_index(to, rtau.balance_of(to)) elif to == __metadata['dex' ] and ctx.signer == main_account and ctx.caller != rtau.get_metadata( 'action_liquidity'): amount -= __process_taxes(tax) __manage_holders_index(main_account, rtau.balance_of(main_account)) elif not to.startswith('con_') and not main_account.startswith('con_'): __manage_holders_index(to, rtau.balance_of(to) + amount) __manage_holders_index(ctx.signer, rtau.balance_of(ctx.signer)) return amount def __calc_taxes(amount: float, to: str): if to in (rtau.get_metadata('action_liquidity'), rtau.get_metadata( 'action_buyback'), rtau.burn_address()): return decimal(0) return amount / 100 * __metadata['tax'] def __process_taxes(taxes: float): if taxes > 0: rswp = I.import_module(__metadata['dex']) tau_amount = rswp.sell(contract=rtau.contract(), token_amount=taxes) tau.transfer(amount=tau_amount / 100 * __metadata['dev_perc_of_tax' ], to=rtau.get_metadata('action_dev')) tau.transfer(amount=tau_amount / 100 * __metadata[ 'buyback_perc_of_tax'], to=rtau.get_metadata('action_buyback')) tau.transfer(amount=tau_amount / 100 * __metadata[ 'autolp_perc_of_tax'], to=rtau.get_metadata('action_liquidity')) __metadata['tau_pool'] += tau_amount / 100 * __metadata[ 'redistribute_perc'] return taxes def __manage_holders_index(address: str, amount: float): if amount >= __metadata['balance_limit']: if __reverse_holders_index[address] == False: __holders_amount.set(__holders_amount.get() + 1) __forward_holders_index[__holders_amount.get()] = address __reverse_holders_index[address] = __holders_amount.get() elif __reverse_holders_index[address] != False: __forward_holders_index[__reverse_holders_index[address]] = False __reverse_holders_index[address] = False def __redistribute_tau(start: int=None, end: int=None, reset_pool: bool=None): if start == None: start = 1 if end == None: end = __holders_amount.get() + 1 if reset_pool == None: reset_pool = True supply = rtau.circulating_supply() - rtau.balance_of(__metadata['dex']) for holder_id in range(start, end): if __forward_holders_index[holder_id] != False: holder_balance_share = rtau.balance_of(address= __forward_holders_index[holder_id]) / supply * 100 __reflections[__forward_holders_index[holder_id]] += __metadata[ 'tau_pool'] / 100 * holder_balance_share if reset_pool: __metadata['tau_pool'] = decimal(0) @__export('con_reflecttau_v2_reflection') def claim_tau(): assert __reflections[ctx.caller] > 0, 'There is nothing to claim' tau.transfer(amount=__reflections[ctx.caller], to=ctx.caller) __reflections[ctx.caller] = decimal(0)
 
Contract con_reflecttau_v2_reflection
Variable __compiled__
New Value e300000000000000000000000006000000400000007320010000640064016c005a01640064016c025a0365045a0565066402640364048d025a0765066508640583016402640664078d035a09650664086402640964078d035a0a650664086402640a64078d035a0b650c6402640b64048d025a0d650c6402640c64048d025a0e650f640d9c01640e640f84045a1065116402830164106411840083015a12651164028301650f651364129c0264136414840483015a146511640283016515650f64159c0264166417840483015a16642a6517650f650f650f64199c04641a641b84055a186517650f641c9c02641d641e84045a196517641f9c016420642184045a1a650f651764229c026423642484045a1b642b651c651c651d64259c036426642784055a1e65116402830164286429840083015a1f64015300292ce9000000004eda1c636f6e5f7265666c6563747461755f76325f7265666c656374696f6eda086d657461646174612902da08636f6e7472616374da046e616d657a03302e30da0b7265666c656374696f6e732903da0d64656661756c745f76616c75657204000000720500000046da15666f72776172645f686f6c646572735f696e646578da15726576657273655f686f6c646572735f696e6465787204000000da0e686f6c646572735f616d6f756e7429017205000000630100000000000000010000000300000043000000737a000000740064018301740164023c00740064038301740164043c00740064058301740164063c006407740164083c007400640983017401640a3c007400640b83017401640c3c007400640d83017401640e3c007400640d83017401640f3c0074026a037c008301010074046a036403830101007405830001006400530029104ee90c000000da037461787201000000da087461755f706f6f6c69e8030000da0d62616c616e63655f6c696d6974da1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f31da036465787a0536362e3637da117265646973747269627574655f706572637a0531362e3637da0f6465765f706572635f6f665f7461787a04382e3333da136275796261636b5f706572635f6f665f746178da126175746f6c705f706572635f6f665f7461782906da07646563696d616cda0a5f5f6d65746164617461da0a5f5f636f6e7472616374da03736574da105f5f686f6c646572735f616d6f756e74da07617070726f766529017205000000a900721b000000da00da045f5f5f5f10000000731600000000010c010c010c0108010c010c010c010c010a010a01721d000000630000000000000000000000000400000043000000732a00000074006a01640174026a036402830164038d02010074026a01640174046404190064038d0201006400530029054e6c04000000ff7fc74ece5a056fda0a616374696f6e5f6465762902da06616d6f756e74da02746f72100000002905da03746175721a000000da0472746175da0c6765745f6d657461646174617216000000721b000000721b000000721b000000721c000000721a0000001e000000730400000000021401721a0000002902da036b6579da0576616c7565630200000000000000020000000300000043000000731400000074006a01830001007c0174027c003c006400530029014e29037222000000da196173736572745f7369676e65725f69735f6f70657261746f727216000000290272240000007225000000721b000000721b000000721c000000da0f6368616e67655f6d657461646174612400000073040000000002080172270000002902da077061796c6f6164da0663616c6c657263020000000000000002000000060000004300000073f000000074006a0174026a0383006b02731674046401830182017c006402190064036b02724664047c006b077332740464058301820174057c00640619007c00640719007c01830353007c006402190064086b02727c64047c006b077362740464058301820174057c00640619007c00640719007c017c0064091900830453007c0064021900640a6b0272aa64047c006b077398740464058301820174067c00640b19007c0064061900830201007c0064021900640c6b0272ce74077c00640d19007c00640e19007c00640f1900830353007c006402190064106b0272ec74087c00640619007c0064071900830253006400530029114e7a1e596f7520617265206e6f7420616c6c6f77656420746f20646f2074686174da0866756e6374696f6eda087472616e73666572da0865787465726e616c7a1a45787465726e616c2063616c6c206e6f7420616c6c6f77656421721f0000007220000000da0d7472616e736665725f66726f6dda0c6d61696e5f6163636f756e74da146d616e6167655f686f6c646572735f696e646578da0761646472657373da107265646973747269627574655f746175da057374617274da03656e64da0a72657365745f706f6f6cda0a63616c635f74617865732909da03637478722900000072220000007204000000da0e417373657274696f6e4572726f72da125f5f70726f636573735f7472616e73666572da165f5f6d616e6167655f686f6c646572735f696e646578da125f5f7265646973747269627574655f746175da0c5f5f63616c635f7461786573290272280000007229000000721b000000721b000000721c000000da07657865637574652a0000007320000000000216010c01100114010c01100110010a010c01100112010c01100108010c01723c000000721c0000002904721f00000072200000007229000000722e00000063040000000000000005000000040000004300000073d000000074007c007c0183027d047c027401640119006b0272487c0174026a0383006b0372487c0364026b0272487c0074047c04830138007d0074057c0174066a077c018301830201006e847c017401640119006b02728c74086a097c036b02728c74086a0a74066a0b640383016b03728c7c0074047c04830138007d0074057c0374066a077c038301830201006e407c016a0c640483010c0072cc7c036a0c640483010c0072cc74057c0174066a077c0183017c00170083020100740574086a0974066a0774086a098301830201007c00530029054e7210000000721c000000da10616374696f6e5f6c6971756964697479da04636f6e5f290d723b00000072160000007217000000da03676574da0f5f5f70726f636573735f746178657372390000007222000000da0a62616c616e63655f6f667236000000da067369676e657272290000007223000000da0a737461727473776974682905721f00000072200000007229000000722e000000720c000000721b000000721b000000721c00000072380000003e000000731c00000000020a01180108010c0112010c01120108010c01120118011401140172380000002902721f000000722000000063020000000000000002000000040000004300000073360000007c0174006a016401830174006a016402830174006a02830066036b06722674036403830153007c0064041b007404640519001400530029064e723d000000da0e616374696f6e5f6275796261636b7201000000e964000000720c000000290572220000007223000000da0c6275726e5f61646472657373721500000072160000002902721f0000007220000000721b000000721b000000721c000000723b00000050000000730800000000010e0110010801723b0000002901da05746178657363010000000000000003000000060000004300000073a80000007c0064016b0472a474006a0174026402190083017d017c016a0374046a0583007c0064038d027d0274066a077c0264041b00740264051900140074046a086406830164078d02010074066a077c0264041b00740264081900140074046a086409830164078d02010074066a077c0264041b007402640a1900140074046a08640b830164078d0201007402640c050019007c0264041b007402640d19001400370003003c007c005300290e4e7201000000721000000029027204000000da0c746f6b656e5f616d6f756e7472450000007212000000721e0000002902721f0000007220000000721300000072440000007214000000723d000000720d00000072110000002909da0149da0d696d706f72745f6d6f64756c657216000000da0473656c6c722200000072040000007221000000722b000000722300000029037247000000da0472737770da0a7461755f616d6f756e74721b000000721b000000721c0000007240000000570000007318000000000108010e01120112010e010c0114010c01140110010c01724000000029027230000000721f00000063020000000000000002000000040000004300000073680000007c017400640119006b05724474017c00190064026b02726474026a0374026a04830064031700830101007c00740574026a0483003c0074026a04830074017c003c006e2074017c00190064026b0372646402740574017c0019003c00640274017c003c006400530029044e720e00000046e90100000029067216000000da175f5f726576657273655f686f6c646572735f696e64657872190000007218000000723f000000da175f5f666f72776172645f686f6c646572735f696e64657829027230000000721f000000721b000000721b000000721c000000723900000066000000731000000000010c010c0112010c010e010c010c017239000000290372320000007233000000723400000063030000000000000006000000060000004300000073ae0000007c0064006b02720c64017d007c0164006b02722074006a018300640117007d017c0264006b02722c64027d0274026a03830074026a04740564031900830118007d03785674067c007c01830244005d487d0474077c04190064046b03724e74026a0474077c04190064058d017c031b00640614007d05740874077c0419000500190074056407190064061b007c051400370003003c00714e57007c0272aa740964088301740564073c006400530029094e724e00000054721000000046290172300000007245000000720d0000007201000000290a7219000000723f0000007222000000da1263697263756c6174696e675f737570706c7972410000007216000000da0572616e67657250000000da0d5f5f7265666c656374696f6e7372150000002906723200000072330000007234000000da06737570706c79da09686f6c6465725f6964da14686f6c6465725f62616c616e63655f7368617265721b000000721b000000721c000000723a00000071000000731c00000000010801040108010c0108010401160110010c0218010c0118010401723a000000630000000000000000000000000400000043000000733e000000740074016a02190064016b047316740364028301820174046a05740074016a02190074016a0264038d020100740664018301740074016a023c006400530029044e72010000007a195468657265206973206e6f7468696e6720746f20636c61696d2902721f0000007220000000290772530000007236000000722900000072370000007221000000722b0000007215000000721b000000721b000000721b000000721c000000da09636c61696d5f74617583000000730600000000021601160172570000002901721c00000029034e4e4e2920da0863757272656e63797221000000da11636f6e5f7265666c6563747461755f76327222000000da09696d706f72746c69627249000000da04486173687216000000721500000072530000007250000000724f000000da085661726961626c6572170000007219000000da03737472721d000000da085f5f6578706f7274721a000000da03416e797227000000da0464696374723c000000da05666c6f61747238000000723b00000072400000007239000000da03696e74da04626f6f6c723a0000007257000000721b000000721b000000721b000000721c000000da083c6d6f64756c653e0100000073300000000801080104010c0108010a0104010a0104010a010c01040108030e0e10060601120506011214161110070e0f100b1412
 
Contract con_reflecttau_v2_reflection
Variable __owner__
New Value null
 
Contract con_reflecttau_v2_reflection
Variable __submitted__
New Value 2022,4,4,19,36,12,0
 
Contract con_reflecttau_v2_reflection
Variable __developer__
New Value a5565739151e6f8d3fbb03ab605a31cc285e36a717a95002a60e6e4d4e4fa411
 
Contract currency
Variable balances
Key a5565739151e6f8d3fbb03ab605a31cc285e36a717a95002a60e6e4d4e4fa411
New Value 38653.258236034368238851850813896288