Transaction:
5056d4dc6090b8248793b0d7dcc89ef48f6e27180b832115f39d0ed4b7e163fe
Status
Success
Timestamp
1/11/2022, 10:38:34 PM
Result
None
Block Number
64093SubBlock Number
0
Nonce
1799
Processor
89f67bb871351a1629d66676e4bd92bbacb23bd0649b890542ef98f1b664a497
Stamps Used
382 ( 29.4 dTAU )
Contract Name
submission
Function Name
submit_contract
Signature
0ae7bf577f1d91a638e4b93c3a838b40bf748a913e6ec931d2907c45d9d74129ea9572653b11aaf18bfe7b252f03cdf8021bee034d9285a5215c735f3b90880a
Kwargs
code
# _ _ _ _ _____ _ _ __ __ _ _
# | \ | | | | | | |_ _| | | | | \ \ / / | | |
# | \| | ___| |__ _ _| | __ _ | | _ __ | |_ ___ _ __ _ __ __ _| | \ \ / /_ _ _ _| | |_
# | . ` |/ _ \ '_ \| | | | |/ _` | | | | '_ \| __/ _ \ '__| '_ \ / _` | | \ \/ / _` | | | | | __|
# | |\ | __/ |_) | |_| | | (_| | _| |_| | | | || __/ | | | | | (_| | | \ / (_| | |_| | | |_
# |_| \_|\___|_.__/ \__,_|_|\__,_| |_____|_| |_|\__\___|_| |_| |_|\__,_|_| \/ \__,_|\__,_|_|\__|
#
#
I = importlib
staking = Hash(default_value=0)
payouts = 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_002'
LP_VAULT = 'con_neb_vault_lp_051'
MIN_STAKE_PERIOD = 5
MAX_RUNTIME = 5
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 neb_amount > 0, 'Negative amounts are not allowed'
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'
# TODO: TEST
@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)
I.import_module(LP_VAULT).unlock()
staking[ctx.caller] = 0
payouts[ctx.caller] = user_emission
return f'Emission: {user_emission} {emission_con.get()}'
@export
def active(is_active: bool):
active.set(is_active)
assert_owner()
@export
def emergency_withdraw(contract: str, amount: float):
I.import_module(contract).transfer(amount, ctx.caller)
assert_owner()
# TODO: TEST
@export
def emergency_set_stake(address: str, amount: float):
staking[address] = amount
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_056
State Changes
Contract
con_neb_vault_int_056
Variable
__code__
New Value
I = importlib
__staking = Hash(default_value=0, contract='con_neb_vault_int_056', name=
'staking')
__payouts = Hash(default_value=0, contract='con_neb_vault_int_056', name=
'payouts')
__emission_con = Variable(contract='con_neb_vault_int_056', name='emission_con'
)
__total_emission = Variable(contract='con_neb_vault_int_056', name=
'total_emission')
__total_stake = Variable(contract='con_neb_vault_int_056', name='total_stake')
__current_stake = Variable(contract='con_neb_vault_int_056', name=
'current_stake')
__active = Variable(contract='con_neb_vault_int_056', name='active')
__funded = Variable(contract='con_neb_vault_int_056', name='funded')
__start_date = Variable(contract='con_neb_vault_int_056', name='start_date')
__start_date_end = Variable(contract='con_neb_vault_int_056', name=
'start_date_end')
__end_date = Variable(contract='con_neb_vault_int_056', name='end_date')
NEB_FEE = 2
NEB_CONTRACT = 'con_nebula_002'
LP_VAULT = 'con_neb_vault_lp_051'
MIN_STAKE_PERIOD = 5
MAX_RUNTIME = 5
OPERATORS = ['ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d'
, 'e787ed5907742fa8d50b3ca2701ab8e03ec749ced806a15cdab800a127d7f863']
@__export('con_neb_vault_int_056')
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_056')
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_056')
def stake(neb_amount: float):
__assert_active()
assert neb_amount > 0, 'Negative amounts are not allowed'
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_056')
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)
I.import_module(LP_VAULT).unlock()
__staking[ctx.caller] = 0
__payouts[ctx.caller] = user_emission
return f'Emission: {user_emission} {__emission_con.get()}'
@__export('con_neb_vault_int_056')
def active(is_active: bool):
__active.set(is_active)
__assert_owner()
@__export('con_neb_vault_int_056')
def emergency_withdraw(contract: str, amount: float):
I.import_module(contract).transfer(amount, ctx.caller)
__assert_owner()
@__export('con_neb_vault_int_056')
def emergency_set_stake(address: str, amount: float):
__staking[address] = amount
__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_056
Variable
__compiled__
New Value
{"__bytes__":"e30000000000000000000000000800000040000000736001000065005a01650264006401640264038d035a03650264006401640464038d035a0465056401640564068d025a0665056401640764068d025a0765056401640864068d025a0865056401640964068d025a0965056401640a64068d025a0a65056401640b64068d025a0b65056401640c64068d025a0c65056401640d64068d025a0d65056401640e64068d025a0e640f5a0f64105a1064115a1164125a1264125a136413641467025a1465156401830165166517651765186518651864159c0664166417840483015a196515640183016516651764189c026419641a840483015a1a6515640183016517641b9c01641c641d840483015a1b651564018301641e641f840083015a1c651564018301651d64209c016421640a840483015a1e6515640183016516651764189c0264226423840483015a1f6515640183016516651764249c0264256426840483015a206427642884005a216429642a84005a22642b5300292ce900000000da15636f6e5f6e65625f7661756c745f696e745f303536da077374616b696e672903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da077061796f757473da0c656d697373696f6e5f636f6e290272050000007206000000da0e746f74616c5f656d697373696f6eda0b746f74616c5f7374616b65da0d63757272656e745f7374616b65da06616374697665da0666756e646564da0a73746172745f64617465da0e73746172745f646174655f656e64da08656e645f64617465e902000000da0e636f6e5f6e6562756c615f303032da14636f6e5f6e65625f7661756c745f6c705f303531e905000000da4061653764313464366439623834343366383831626136323434373237623639623638313031306537383264346665343832646266623062366163613032643564da40653738376564353930373734326661386435306233636132373031616238653033656337343963656438303661313563646162383030613132376437663836332906da11656d697373696f6e5f636f6e7472616374da15746f74616c5f656d697373696f6e5f616d6f756e74da12746f74616c5f7374616b655f616d6f756e74da126d696e757465735f74696c6c5f7374617274da1773746172745f706572696f645f696e5f6d696e75746573da106d696e757465735f74696c6c5f656e64630600000000000000080000000600000043000000734a01000074006a01830064016b03731474026402830182017c0164036b04732474026404830182017c0264036b04733474026405830182017c0364036b04734474026406830182017c0474036b05735474026407830182017c0564036b0472647c0574046b01736c740264088301820174056a067c008301010074076a0664038301010074086a067c018301010074096a067c0283010100740a6a06740b740c6a0d7c0364098d01170083010100740e6a06740a6a018300740c6a0d7c0464098d01170083010100740f6a06740e6a018300740c6a0d7c0564098d0117008301010074086a018300640a1b00741014007411741283011b007d067828741244005d207d0774136a1474056a01830083016a1574166a177c067c07640b8d03010071fc5700741874056a01830074086a0183008302010074196a0664018301010074006a0664018301010064005300290c4e547a185661756c7420697320616c72656164792066756e6465642172010000007a20746f74616c5f656d697373696f6e5f616d6f756e74206e6f742076616c6964217a1d746f74616c5f7374616b655f616d6f756e74206e6f742076616c6964217a1d6d696e757465735f74696c6c5f7374617274206e6f742076616c6964217a2d5374616b696e67206e6565647320746f206265206f70656e20666f72206174206c6561737420322064617973217a1b6d696e757465735f74696c6c5f656e64206e6f742076616c6964212901da076d696e75746573e9640000002903da0c6d61696e5f6163636f756e74da06616d6f756e74da02746f291ada085f5f66756e646564da03676574da0e417373657274696f6e4572726f72da104d494e5f5354414b455f504552494f44da0b4d41585f52554e54494d45da0e5f5f656d697373696f6e5f636f6eda03736574da0f5f5f63757272656e745f7374616b65da105f5f746f74616c5f656d697373696f6eda0d5f5f746f74616c5f7374616b65da0c5f5f73746172745f64617465da036e6f77da086461746574696d65da0974696d6564656c7461da105f5f73746172745f646174655f656e64da0a5f5f656e645f64617465da074e45425f464545da036c656eda094f50455241544f5253da0149da0d696d706f72745f6d6f64756c65da0d7472616e736665725f66726f6dda03637478da0663616c6c6572da0d73656e645f746f5f7661756c74da085f5f6163746976652908721700000072180000007219000000721a000000721b000000721c000000da0a73696e676c655f666565da0761646472657373a900723e000000da00da0a66756e645f7661756c741c000000732c00000000041401100110011001100118010a010a010a010a0116010e010c010e010c0118010a010e01120112010a017240000000290272050000007220000000630200000000000000020000000500000043000000731e00000074006a017c0083016a0274036a047c0174036a0564018d0301006400530029024e2903721f00000072200000007221000000290672350000007236000000723700000072380000007239000000da0474686973290272050000007220000000723e000000723e000000723f000000723a00000038000000730400000000020e01723a0000002901da0a6e65625f616d6f756e7463010000000000000003000000060000004300000073f20000007400830001007c0064016b0473167401640283018201740274036a0483006b0473347401640374036a0483009b009d0283018201740274056a0483006b0073527401640474056a0483009b009d0283018201740674076a08050019007c00370003003c007409740a7c0083020100740b6a0c740b6a0483007c00170083010100740d6a0e740f83016a1083007d0174116a04830064051b007c016406190014007d02740674076a0819007c026b0173ca740164077c029b0064087c01640919009b00640a9d0583018201740b6a04830074116a0483006b0173ee7401640b74116a0483009b00640c9d038301820164005300290d4e72010000007a204e6567617469766520616d6f756e747320617265206e6f7420616c6c6f7765647a195374616b696e67206e6f742073746172746564207965743a207a165374616b696e6720706572696f6420656e6465643a20721e000000da08656d697373696f6e7a144d6178207374616b652065786365656465643a207a0c204e454220284c6576656c20da056c6576656cfa01297a1a4d617820746f74616c207374616b652065786365656465643a207a04204e45422912da0f5f5f6173736572745f6163746976657224000000722d000000722c00000072230000007230000000da095f5f7374616b696e6772380000007239000000723a000000da0c4e45425f434f4e54524143547229000000722800000072350000007236000000da084c505f5641554c54da046c6f636b722b000000290372420000007244000000da096d61785f7374616b65723e000000723e000000723f000000da057374616b653e000000731e0000000002060110010e0110010e01100112010a0112010e011401080120011201724c00000063000000000000000002000000040000004300000073cc000000740083000100740174026a03190064016b03731c7404640283018201740574066a0783006b04733a7404640374066a0783009b009d0283018201740174026a03190074086a0783001b00640414007d0074096a07830064041b007c0014007d01740a6a0b740c6a07830083016a0d7c0174026a0364058d020100740a6a0b740e83016a0d740174026a03190074026a0364058d020100740a6a0b740f83016a10830001006401740174026a033c007c01741174026a033c0064067c019b006407740c6a0783009b009d04530029084e72010000007a1741646472657373206973206e6f74207374616b696e67217a16456e642064617465206e6f7420726561636865643a20721e0000002902722000000072210000007a0a456d697373696f6e3a20fa0120291272460000007247000000723800000072390000007224000000722d000000723100000072230000007229000000722a000000723500000072360000007227000000da087472616e7366657272480000007249000000da06756e6c6f636bda095f5f7061796f7574732902da0d7374616b655f70657263656e74da0d757365725f656d697373696f6e723e000000723e000000723f000000da07756e7374616b6551000000731a0000000002060116011e011601100110010a0112010a010e010a010a0172530000002901da0969735f616374697665630100000000000000010000000200000043000000731400000074006a017c00830101007402830001006400530029014e2903723b0000007228000000da0e5f5f6173736572745f6f776e657229017254000000723e000000723e000000723f000000720c00000062000000730400000000020a01630200000000000000020000000300000043000000731e00000074006a017c0083016a027c0174036a04830201007405830001006400530029014e290672350000007236000000724e000000723800000072390000007255000000290272050000007220000000723e000000723e000000723f000000da12656d657267656e63795f77697468647261776800000073040000000002140172560000002902723d000000722000000063020000000000000002000000030000004300000073120000007c0174007c003c007401830001006400530029014e2902724700000072550000002902723d0000007220000000723e000000723e000000723f000000da13656d657267656e63795f7365745f7374616b656e0000007304000000000208017257000000630000000000000000000000000200000043000000731800000074006a01830064016b02731474026402830182016400530029034e547a0f5661756c7420696e616374697665212903723b00000072230000007224000000723e000000723e000000723e000000723f000000724600000074000000730200000000017246000000630000000000000000000000000200000043000000731600000074006a0174026b06731274036401830182016400530029024e7a1d4f6e6c792065786563757461626c65206279206f70657261746f72732129047238000000723900000072340000007224000000723e000000723e000000723e000000723f0000007255000000780000007302000000000172550000004e2923da09696d706f72746c69627235000000da044861736872470000007250000000da085661726961626c657227000000722a000000722b0000007229000000723b0000007222000000722c00000072300000007231000000723200000072480000007249000000722500000072260000007234000000da085f5f6578706f7274da03737472da05666c6f6174da03696e747240000000723a000000724c0000007253000000da04626f6f6c720c0000007256000000725700000072460000007255000000723e000000723e000000723e000000723f000000da083c6d6f64756c653e010000007350000000040106010801060108010c02040108010c01040108010c010c010c01040108010c0104010401040104010401020106030601040104011219060112050601101210110601100506011205060112050804"}
Contract
con_neb_vault_int_056
Variable
__owner__
New Value
NULL
Contract
con_neb_vault_int_056
Variable
__submitted__
New Value
{"__time__":[2022,1,11,22,38,35,0]}
Contract
con_neb_vault_int_056
Variable
__developer__
New Value
ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
Contract
currency
Variable
balances
New Value
2,450