Transaction #422676

Hash c1b2cb9cb4809c2085f25eda7dd2fd872bb9f903800fa1110430231883d9af18
Status Success
Timestamp 65 days ago - 11/22/2021, 11:25:55 AM UTC+0
Block 407102
Stamps Used 366
Burned Fee 0.02165680 TAU
From ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d 
Contract Name submission
Function Name submit_contract

Additional Info
SubBlock Number 0
Nonce 2549
Processor 5b09493df6c18d17cc883ebce54fcb1f5afbd507533417fe32c006009a9c3c4a
Signature 8fb1ff8fc48fc4aa4a5f3a8c52c07d38cb832d0e9a50b699edb6591dbd62a6a7501cda01728ca6fc7f8811a049ead3633cd2fb2c09c54198954e84e2a00d3c08
Stamps Supplied 845
Stamps per TAU 169

Kwargs

code I = importlib staking = Hash(default_value=0) emission_con = Variable() total_emission = Variable() total_stake = Variable() current_stake = Variable() active = Variable() funded = Variable() start_date = Variable() start_date_end = Variable() end_date = Variable() NEB_FEE = 2 NEB_CONTRACT = 'con_nebula' LP_VAULT = 'con_neb_vault_lp_002' MIN_STAKE_PERIOD = 60 MAX_RUNTIME = 129600 OPERATORS = [ 'ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d', 'e787ed5907742fa8d50b3ca2701ab8e03ec749ced806a15cdab800a127d7f863' ] @export def fund_vault(emission_contract: str, total_emission_amount: float, total_stake_amount: float, minutes_till_start: int, start_period_in_minutes: int, minutes_till_end: int): assert funded.get() != True, 'Vault is already funded!' assert total_emission_amount > 0, 'total_emission_amount not valid!' assert total_stake_amount > 0, 'total_stake_amount not valid!' assert minutes_till_start > 0, 'minutes_till_start not valid!' assert start_period_in_minutes >= MIN_STAKE_PERIOD, 'Staking needs to be open for at least 2 days!' assert minutes_till_end > 0 and minutes_till_end <= MAX_RUNTIME, 'minutes_till_end not valid!' emission_con.set(emission_contract) current_stake.set(0) total_emission.set(total_emission_amount) total_stake.set(total_stake_amount) start_date.set(now + datetime.timedelta(minutes=minutes_till_start)) start_date_end.set(start_date.get() + datetime.timedelta(minutes=start_period_in_minutes)) end_date.set(start_date_end.get() + datetime.timedelta(minutes=minutes_till_end)) single_fee = (total_emission.get() / 100 * NEB_FEE) / len(OPERATORS) for address in OPERATORS: I.import_module(emission_con.get()).transfer_from( main_account=ctx.caller, amount=single_fee, to=address) send_to_vault(emission_con.get(), total_emission.get()) active.set(True) funded.set(True) @export def send_to_vault(contract: str, amount: float): I.import_module(contract).transfer_from( main_account=ctx.caller, amount=amount, to=ctx.this) @export def stake(neb_amount: float): assert_active() assert now > start_date.get(), f'Staking not started yet: {start_date.get()}' assert now < start_date_end.get(), f'Staking period ended: {start_date_end.get()}' staking[ctx.caller] += neb_amount send_to_vault(NEB_CONTRACT, neb_amount) current_stake.set(current_stake.get() + neb_amount) level = I.import_module(LP_VAULT).lock() max_stake = total_stake.get() / 100 * level['emission'] assert staking[ctx.caller] <= max_stake, f'Max stake exceeded: {max_stake} NEB (Level {level["level"]})' assert current_stake.get() <= total_stake.get(), f'Max total stake exceeded: {total_stake.get()} NEB' @export def unstake(): assert_active() assert staking[ctx.caller] != 0, f'Address is not staking!' assert now > end_date.get(), f'End date not reached: {end_date.get()}' stake_percent = staking[ctx.caller] / current_stake.get() * 100 user_emission = total_emission.get() / 100 * stake_percent I.import_module(emission_con.get()).transfer( amount=user_emission, to=ctx.caller) I.import_module(NEB_CONTRACT).transfer( amount=staking[ctx.caller], to=ctx.caller) staking.clear(ctx.caller) I.import_module(LP_VAULT).unlock() return f'Emission: {user_emission} {emission_con.get()}' @export def enable_vault(): active.set(True) assert_owner() @export def disable_vault(): active.set(False) assert_owner() @export def emergency_withdraw(contract: str, amount: float): I.import_module(contract).transfer(amount, ctx.caller) assert_owner() def assert_active(): assert active.get() == True, 'Vault inactive!' def assert_owner(): assert ctx.caller in OPERATORS, 'Only executable by operators!'
name con_neb_vault_int_001

State Changes

Contract con_neb_vault_int_001
Variable __code__
New Value I = importlib __staking = Hash(default_value=0, contract='con_neb_vault_int_001', name= 'staking') __emission_con = Variable(contract='con_neb_vault_int_001', name='emission_con' ) __total_emission = Variable(contract='con_neb_vault_int_001', name= 'total_emission') __total_stake = Variable(contract='con_neb_vault_int_001', name='total_stake') __current_stake = Variable(contract='con_neb_vault_int_001', name= 'current_stake') __active = Variable(contract='con_neb_vault_int_001', name='active') __funded = Variable(contract='con_neb_vault_int_001', name='funded') __start_date = Variable(contract='con_neb_vault_int_001', name='start_date') __start_date_end = Variable(contract='con_neb_vault_int_001', name= 'start_date_end') __end_date = Variable(contract='con_neb_vault_int_001', name='end_date') NEB_FEE = 2 NEB_CONTRACT = 'con_nebula' LP_VAULT = 'con_neb_vault_lp_002' MIN_STAKE_PERIOD = 60 MAX_RUNTIME = 129600 OPERATORS = ['ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d' , 'e787ed5907742fa8d50b3ca2701ab8e03ec749ced806a15cdab800a127d7f863'] @__export('con_neb_vault_int_001') def fund_vault(emission_contract: str, total_emission_amount: float, total_stake_amount: float, minutes_till_start: int, start_period_in_minutes: int, minutes_till_end: int): assert __funded.get() != True, 'Vault is already funded!' assert total_emission_amount > 0, 'total_emission_amount not valid!' assert total_stake_amount > 0, 'total_stake_amount not valid!' assert minutes_till_start > 0, 'minutes_till_start not valid!' assert start_period_in_minutes >= MIN_STAKE_PERIOD, 'Staking needs to be open for at least 2 days!' assert minutes_till_end > 0 and minutes_till_end <= MAX_RUNTIME, 'minutes_till_end not valid!' __emission_con.set(emission_contract) __current_stake.set(0) __total_emission.set(total_emission_amount) __total_stake.set(total_stake_amount) __start_date.set(now + datetime.timedelta(minutes=minutes_till_start)) __start_date_end.set(__start_date.get() + datetime.timedelta(minutes= start_period_in_minutes)) __end_date.set(__start_date_end.get() + datetime.timedelta(minutes= minutes_till_end)) single_fee = __total_emission.get() / 100 * NEB_FEE / len(OPERATORS) for address in OPERATORS: I.import_module(__emission_con.get()).transfer_from(main_account= ctx.caller, amount=single_fee, to=address) send_to_vault(__emission_con.get(), __total_emission.get()) __active.set(True) __funded.set(True) @__export('con_neb_vault_int_001') def send_to_vault(contract: str, amount: float): I.import_module(contract).transfer_from(main_account=ctx.caller, amount =amount, to=ctx.this) @__export('con_neb_vault_int_001') def stake(neb_amount: float): __assert_active() assert now > __start_date.get( ), f'Staking not started yet: {__start_date.get()}' assert now < __start_date_end.get( ), f'Staking period ended: {__start_date_end.get()}' __staking[ctx.caller] += neb_amount send_to_vault(NEB_CONTRACT, neb_amount) __current_stake.set(__current_stake.get() + neb_amount) level = I.import_module(LP_VAULT).lock() max_stake = __total_stake.get() / 100 * level['emission'] assert __staking[ctx.caller ] <= max_stake, f"Max stake exceeded: {max_stake} NEB (Level {level['level']})" assert __current_stake.get() <= __total_stake.get( ), f'Max total stake exceeded: {__total_stake.get()} NEB' @__export('con_neb_vault_int_001') def unstake(): __assert_active() assert __staking[ctx.caller] != 0, f'Address is not staking!' assert now > __end_date.get(), f'End date not reached: {__end_date.get()}' stake_percent = __staking[ctx.caller] / __current_stake.get() * 100 user_emission = __total_emission.get() / 100 * stake_percent I.import_module(__emission_con.get()).transfer(amount=user_emission, to =ctx.caller) I.import_module(NEB_CONTRACT).transfer(amount=__staking[ctx.caller], to =ctx.caller) __staking.clear(ctx.caller) I.import_module(LP_VAULT).unlock() return f'Emission: {user_emission} {__emission_con.get()}' @__export('con_neb_vault_int_001') def enable_vault(): __active.set(True) __assert_owner() @__export('con_neb_vault_int_001') def disable_vault(): __active.set(False) __assert_owner() @__export('con_neb_vault_int_001') def emergency_withdraw(contract: str, amount: float): I.import_module(contract).transfer(amount, ctx.caller) __assert_owner() def __assert_active(): assert __active.get() == True, 'Vault inactive!' def __assert_owner(): assert ctx.caller in OPERATORS, 'Only executable by operators!'
 
Contract con_neb_vault_int_001
Variable __compiled__
New Value e30000000000000000000000000800000040000000734401000065005a01650264006401640264038d035a0365046401640464058d025a0565046401640664058d025a0665046401640764058d025a0765046401640864058d025a0865046401640964058d025a0965046401640a64058d025a0a65046401640b64058d025a0b65046401640c64058d025a0c65046401640d64058d025a0d640e5a0e640f5a0f64105a1064115a1164125a126413641467025a1365146401830165156516651665176517651764159c0664166417840483015a186514640183016515651664189c026419641a840483015a196514640183016516641b9c01641c641d840483015a1a651464018301641e641f840083015a1b65146401830164206421840083015a1c65146401830164226423840083015a1d6514640183016515651664189c0264246425840483015a1e6426642784005a1f6428642984005a20642a5300292be900000000da15636f6e5f6e65625f7661756c745f696e745f303031da077374616b696e672903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da0c656d697373696f6e5f636f6e290272050000007206000000da0e746f74616c5f656d697373696f6eda0b746f74616c5f7374616b65da0d63757272656e745f7374616b65da06616374697665da0666756e646564da0a73746172745f64617465da0e73746172745f646174655f656e64da08656e645f64617465e902000000da0a636f6e5f6e6562756c61da14636f6e5f6e65625f7661756c745f6c705f303032e93c0000006940fa0100da4061653764313464366439623834343366383831626136323434373237623639623638313031306537383264346665343832646266623062366163613032643564da40653738376564353930373734326661386435306233636132373031616238653033656337343963656438303661313563646162383030613132376437663836332906da11656d697373696f6e5f636f6e7472616374da15746f74616c5f656d697373696f6e5f616d6f756e74da12746f74616c5f7374616b655f616d6f756e74da126d696e757465735f74696c6c5f7374617274da1773746172745f706572696f645f696e5f6d696e75746573da106d696e757465735f74696c6c5f656e64630600000000000000080000000600000043000000734a01000074006a01830064016b03731474026402830182017c0164036b04732474026404830182017c0264036b04733474026405830182017c0364036b04734474026406830182017c0474036b05735474026407830182017c0564036b0472647c0574046b01736c740264088301820174056a067c008301010074076a0664038301010074086a067c018301010074096a067c0283010100740a6a06740b740c6a0d7c0364098d01170083010100740e6a06740a6a018300740c6a0d7c0464098d01170083010100740f6a06740e6a018300740c6a0d7c0564098d0117008301010074086a018300640a1b00741014007411741283011b007d067828741244005d207d0774136a1474056a01830083016a1574166a177c067c07640b8d03010071fc5700741874056a01830074086a0183008302010074196a0664018301010074006a0664018301010064005300290c4e547a185661756c7420697320616c72656164792066756e6465642172010000007a20746f74616c5f656d697373696f6e5f616d6f756e74206e6f742076616c6964217a1d746f74616c5f7374616b655f616d6f756e74206e6f742076616c6964217a1d6d696e757465735f74696c6c5f7374617274206e6f742076616c6964217a2d5374616b696e67206e6565647320746f206265206f70656e20666f72206174206c6561737420322064617973217a1b6d696e757465735f74696c6c5f656e64206e6f742076616c6964212901da076d696e75746573e9640000002903da0c6d61696e5f6163636f756e74da06616d6f756e74da02746f291ada085f5f66756e646564da03676574da0e417373657274696f6e4572726f72da104d494e5f5354414b455f504552494f44da0b4d41585f52554e54494d45da0e5f5f656d697373696f6e5f636f6eda03736574da0f5f5f63757272656e745f7374616b65da105f5f746f74616c5f656d697373696f6eda0d5f5f746f74616c5f7374616b65da0c5f5f73746172745f64617465da036e6f77da086461746574696d65da0974696d6564656c7461da105f5f73746172745f646174655f656e64da0a5f5f656e645f64617465da074e45425f464545da036c656eda094f50455241544f5253da0149da0d696d706f72745f6d6f64756c65da0d7472616e736665725f66726f6dda03637478da0663616c6c6572da0d73656e645f746f5f7661756c74da085f5f61637469766529087216000000721700000072180000007219000000721a000000721b000000da0a73696e676c655f666565da0761646472657373a900723d000000da00da0a66756e645f7661756c741a000000732c00000000041401100110011001100118010a010a010a010a0116010e010c010e010c0118010a010e01120112010a01723f00000029027205000000721f000000630200000000000000020000000500000043000000731e00000074006a017c0083016a0274036a047c0174036a0564018d0301006400530029024e2903721e000000721f0000007220000000290672340000007235000000723600000072370000007238000000da047468697329027205000000721f000000723d000000723d000000723e000000723900000036000000730400000000020e0172390000002901da0a6e65625f616d6f756e7463010000000000000003000000060000004300000073e2000000740083000100740174026a0383006b0473247404640174026a0383009b009d0283018201740174056a0383006b0073427404640274056a0383009b009d0283018201740674076a08050019007c00370003003c007409740a7c0083020100740b6a0c740b6a0383007c00170083010100740d6a0e740f83016a1083007d0174116a03830064031b007c016404190014007d02740674076a0819007c026b0173ba740464057c029b0064067c01640719009b0064089d0583018201740b6a03830074116a0383006b0173de7404640974116a0383009b00640a9d038301820164005300290b4e7a195374616b696e67206e6f742073746172746564207965743a207a165374616b696e6720706572696f6420656e6465643a20721d000000da08656d697373696f6e7a144d6178207374616b652065786365656465643a207a0c204e454220284c6576656c20da056c6576656cfa01297a1a4d617820746f74616c207374616b652065786365656465643a207a04204e45422912da0f5f5f6173736572745f616374697665722c000000722b00000072220000007223000000722f000000da095f5f7374616b696e67723700000072380000007239000000da0c4e45425f434f4e54524143547228000000722700000072340000007235000000da084c505f5641554c54da046c6f636b722a000000290372410000007243000000da096d61785f7374616b65723d000000723d000000723e000000da057374616b653c000000731c000000000206010e0110010e01100112010a0112010e011401080120011201724b00000063000000000000000002000000040000004300000073c4000000740083000100740174026a03190064016b03731c7404640283018201740574066a0783006b04733a7404640374066a0783009b009d0283018201740174026a03190074086a0783001b00640414007d0074096a07830064041b007c0014007d01740a6a0b740c6a07830083016a0d7c0174026a0364058d020100740a6a0b740e83016a0d740174026a03190074026a0364058d02010074016a0f74026a0383010100740a6a0b741083016a118300010064067c019b006407740c6a0783009b009d04530029084e72010000007a1741646472657373206973206e6f74207374616b696e67217a16456e642064617465206e6f7420726561636865643a20721d0000002902721f00000072200000007a0a456d697373696f6e3a20fa0120291272450000007246000000723700000072380000007223000000722c0000007230000000722200000072280000007229000000723400000072350000007226000000da087472616e736665727247000000da05636c6561727248000000da06756e6c6f636b2902da0d7374616b655f70657263656e74da0d757365725f656d697373696f6e723d000000723d000000723e000000da07756e7374616b654e00000073180000000002060116011e011601100110010a0112010a010c010e017252000000630000000000000000000000000200000043000000731400000074006a016401830101007402830001006400530029024e542903723a0000007227000000da0e5f5f6173736572745f6f776e6572723d000000723d000000723d000000723e000000da0c656e61626c655f7661756c745e000000730400000000020a017254000000630000000000000000000000000200000043000000731400000074006a016401830101007402830001006400530029024e462903723a00000072270000007253000000723d000000723d000000723d000000723e000000da0d64697361626c655f7661756c7464000000730400000000020a017255000000630200000000000000020000000300000043000000731e00000074006a017c0083016a027c0174036a04830201007405830001006400530029014e290672340000007235000000724d00000072370000007238000000725300000029027205000000721f000000723d000000723d000000723e000000da12656d657267656e63795f77697468647261776a0000007304000000000214017256000000630000000000000000000000000200000043000000731800000074006a01830064016b02731474026402830182016400530029034e547a0f5661756c7420696e616374697665212903723a00000072220000007223000000723d000000723d000000723d000000723e000000724500000070000000730200000000017245000000630000000000000000000000000200000043000000731600000074006a0174026b06731274036401830182016400530029024e7a1d4f6e6c792065786563757461626c65206279206f70657261746f72732129047237000000723800000072330000007223000000723d000000723d000000723d000000723e0000007253000000740000007302000000000172530000004e2921da09696d706f72746c69627234000000da04486173687246000000da085661726961626c6572260000007229000000722a0000007228000000723a0000007221000000722b000000722f0000007230000000723100000072470000007248000000722400000072250000007233000000da085f5f6578706f7274da03737472da05666c6f6174da03696e74723f0000007239000000724b000000725200000072540000007255000000725600000072450000007253000000723d000000723d000000723d000000723e000000da083c6d6f64756c653e0100000073480000000401060108010c02040108010c01040108010c010c010c01040108010c01040104010401040104010201060306010401040112190601120506011011101010061006060112050804
 
Contract con_neb_vault_int_001
Variable __owner__
New Value null
 
Contract con_neb_vault_int_001
Variable __submitted__
New Value 2021,11,22,3,25,57,0
 
Contract con_neb_vault_int_001
Variable __developer__
New Value ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
 
Contract currency
Variable balances
Key ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
New Value 10037.790178272907546239742449416545