Transaction #1521

Hash b185ef3bc14a6a7ef437303fcabe163274f7d424c0c595950eac4f470b9363c5
Status Success
Timestamp 410 days ago - 3/20/2023, 5:25:19 PM UTC+0
Block 1521
Stamps Used 329
Burned Fee 0.01946746 TAU
From 42a13c664781a24ab4aca978abb685d9c07ef9ae64a2af865a043e3186a66907 
Contract Name submission
Function Name submit_contract

Additional Info
Nonce 59
Processor e79133b02cd2a84e2ce5d24b2f44433f61f0db7e10acedfc241e94dff06f710a
Signature 642f2a894182096f5531e63d1f863babb4da451b61adaff70b9ab3bac32248d2d1f7db324658558c451a6442cf508190fd0ded3e6678491a655f446e15d57703
Stamps Supplied 1000
Stamps per TAU 169

Kwargs

code I = importlib import currency as tau import con_yeti_contract_11 as yeti_token import con_rocketswap_official_v1_1 YETI = "con_yeti_contract_11" DEX = con_rocketswap_official_v1_1 REWARDS_CONTRACT = "con_distr_rewards_yeti_6" operator = Variable() tau_to_distribute = Variable() @construct def init(): operator.set(YETI) tau_to_distribute.set(decimal("0.00")) approve() @export def approve(): tau.approve(amount=9999999999999999999999, to="con_rocketswap_official_v1_1") yeti_token.approve(amount=9999999999999999999999, to="con_rocketswap_official_v1_1") @export def sell_yeti_for_rewards(cost_of_distr: float, reward_token: str): # check if caller is operator assert_operator() # get total YETI balance of this contract yeti_balance = ForeignHash(foreign_contract=YETI, foreign_name="balances") yeti_amount = yeti_balance[REWARDS_CONTRACT] # sell all YETI for TAU DEX.sell(contract=YETI, token_amount=yeti_amount) # get total TAU balance of this contract currency_balance = ForeignHash(foreign_contract="currency", foreign_name="balances") currency_amount = currency_balance[REWARDS_CONTRACT] assert currency_amount > cost_of_distr, "Not enough to cover distribution fees" # amount worth distributing currency_amount -= cost_of_distr # pay owner wallet to cover distribution fees tau.transfer(amount=cost_of_distr, to=ctx.signer) if reward_token == "currency": tau_to_distribute.set(tau_to_distribute.get() + currency_amount) else: DEX.buy(contract=reward_token, currency_amount=currency_amount) @export def distribute_rewards(reward_token: str, addresses: list, amounts: list): assert_operator() if reward_token == "currency": for num in range(len(addresses)): address = addresses[num] amount = amounts[num] # contracts do not get rewards if not address.startswith("con_"): assert tau_to_distribute.get() >= decimal("0" ), "TAU for distribution is exhausted!" tau.transfer(amount=amount, to=address) tau_to_distribute.set(tau_to_distribute.get() - amount) else: for num in range(len(addresses)): address = addresses[num] amount = amounts[num] token = I.import_module(reward_token) # contracts do not get rewards if not address.startswith("con_"): token.transfer(amount=amount, to=address) def assert_operator(): assert ctx.caller == operator.get(), "Only operator can call!"
name con_distr_rewards_yeti_6

State Changes

Contract con_distr_rewards_yeti_6
Variable operator
New Value con_yeti_contract_11
 
Contract con_distr_rewards_yeti_6
Variable tau_to_distribute
New Value 0.00
 
Contract currency
Variable balances
Key con_distr_rewards_yeti_6:con_rocketswap_official_v1_1
New Value {"__big_int__":"9999999999999999999999"}
 
Contract con_yeti_contract_11
Variable balances
Key con_distr_rewards_yeti_6:con_rocketswap_official_v1_1
New Value {"__big_int__":"9999999999999999999999"}
 
Contract con_distr_rewards_yeti_6
Variable __code__
New Value I = importlib import currency as tau import con_yeti_contract_11 as yeti_token import con_rocketswap_official_v1_1 YETI = 'con_yeti_contract_11' DEX = con_rocketswap_official_v1_1 REWARDS_CONTRACT = 'con_distr_rewards_yeti_6' __operator = Variable(contract='con_distr_rewards_yeti_6', name='operator') __tau_to_distribute = Variable(contract='con_distr_rewards_yeti_6', name= 'tau_to_distribute') def ____(): __operator.set(YETI) __tau_to_distribute.set(decimal('0.00')) approve() @__export('con_distr_rewards_yeti_6') def approve(): tau.approve(amount=9999999999999999999999, to= 'con_rocketswap_official_v1_1') yeti_token.approve(amount=9999999999999999999999, to= 'con_rocketswap_official_v1_1') @__export('con_distr_rewards_yeti_6') def sell_yeti_for_rewards(cost_of_distr: float, reward_token: str): __assert_operator() __yeti_balance = ForeignHash(foreign_contract=YETI, foreign_name= 'balances', contract='con_distr_rewards_yeti_6', name='yeti_balance') yeti_amount = __yeti_balance[REWARDS_CONTRACT] DEX.sell(contract=YETI, token_amount=yeti_amount) __currency_balance = ForeignHash(foreign_contract='currency', foreign_name='balances', contract='con_distr_rewards_yeti_6', name= 'currency_balance') currency_amount = __currency_balance[REWARDS_CONTRACT] assert currency_amount > cost_of_distr, 'Not enough to cover distribution fees' currency_amount -= cost_of_distr tau.transfer(amount=cost_of_distr, to=ctx.signer) if reward_token == 'currency': __tau_to_distribute.set(__tau_to_distribute.get() + currency_amount) else: DEX.buy(contract=reward_token, currency_amount=currency_amount) @__export('con_distr_rewards_yeti_6') def distribute_rewards(reward_token: str, addresses: list, amounts: list): __assert_operator() if reward_token == 'currency': for num in range(len(addresses)): address = addresses[num] amount = amounts[num] if not address.startswith('con_'): assert __tau_to_distribute.get() >= decimal('0' ), 'TAU for distribution is exhausted!' tau.transfer(amount=amount, to=address) __tau_to_distribute.set(__tau_to_distribute.get() - amount) else: for num in range(len(addresses)): address = addresses[num] amount = amounts[num] token = I.import_module(reward_token) if not address.startswith('con_'): token.transfer(amount=amount, to=address) def __assert_operator(): assert ctx.caller == __operator.get(), 'Only operator can call!'
 
Contract con_distr_rewards_yeti_6
Variable __compiled__
New Value e30000000000000000000000000500000040000000739600000065005a01640064016c025a03640064016c045a05640064016c065a0664025a0765065a0864035a09650a6403640464058d025a0b650a6403640664058d025a0c6407640884005a0d650e640383016409640a840083015a0f650e6403830165106511640b9c02640c640d840483015a12650e64038301651165136513640e9c03640f6410840483015a146411641284005a15640153002913e9000000004eda14636f6e5f796574695f636f6e74726163745f3131da18636f6e5f64697374725f726577617264735f796574695f36da086f70657261746f722902da08636f6e7472616374da046e616d65da117461755f746f5f64697374726962757465630000000000000000000000000300000043000000732200000074006a0174028301010074036a01740464018301830101007405830001006400530029024e7a04302e30302906da0a5f5f6f70657261746f72da03736574da0459455449da135f5f7461755f746f5f64697374726962757465da07646563696d616cda07617070726f7665a900720e000000720e000000da00da045f5f5f5f0d000000730600000000010a010e017210000000630000000000000000000000000400000043000000732000000074006a016401640264038d02010074026a016401640264038d0201006400530029044e6c05000000ff7f7f64ea26064fe121da1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f312902da06616d6f756e74da02746f2903da03746175720d000000da0a796574695f746f6b656e720e000000720e000000720e000000720f000000720d0000001300000073080000000002060108010601720d0000002902da0d636f73745f6f665f6469737472da0c7265776172645f746f6b656e630200000000000000060000000600000043000000739a0000007400830001007401740264016402640364048d047d027c02740319007d0374046a0574027c0364058d0201007401640664016402640764048d047d047c04740319007d057c057c006b04735474066408830182017c057c0038007d0574076a087c0074096a0a64098d0201007c0164066b027288740b6a0c740b6a0d83007c051700830101006e0e74046a0e7c017c05640a8d02010064005300290b4eda0862616c616e6365737203000000da0c796574695f62616c616e63652904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d657205000000720600000029027205000000da0c746f6b656e5f616d6f756e74da0863757272656e6379da1063757272656e63795f62616c616e63657a254e6f7420656e6f75676820746f20636f76657220646973747269627574696f6e206665657329027212000000721300000029027205000000da0f63757272656e63795f616d6f756e74290fda115f5f6173736572745f6f70657261746f72da0b466f726569676e48617368720a000000da10524557415244535f434f4e5452414354da03444558da0473656c6cda0e417373657274696f6e4572726f727214000000da087472616e73666572da03637478da067369676e6572720b0000007209000000da03676574da03627579290672160000007217000000da0e5f5f796574695f62616c616e6365da0b796574695f616d6f756e74da125f5f63757272656e63795f62616c616e6365721f000000720e000000720e000000720f000000da1573656c6c5f796574695f666f725f726577617264731b000000731e0000000002060104010c0108010e01040104010801080110010801100108011402722e00000029037217000000da09616464726573736573da07616d6f756e747363030000000000000007000000050000004300000073c40000007400830001007c0064016b02727878b0740174027c018301830144005d567d037c017c0319007d047c027c0319007d057c046a0364028301731c74046a0583007406640383016b057352740764048301820174086a097c057c0464058d02010074046a0a74046a0583007c05180083010100711c57006e487846740174027c018301830144005d367d037c017c0319007d047c027c0319007d05740b6a0c7c0083017d067c046a036402830173867c066a097c057c0464058d020100718657006400530029064e721d000000da04636f6e5fda01307a2254415520666f7220646973747269627574696f6e2069732065786861757374656421290272120000007213000000290d7220000000da0572616e6765da036c656eda0a73746172747377697468720b0000007229000000720c0000007225000000721400000072260000007209000000da0149da0d696d706f72745f6d6f64756c6529077217000000722f0000007230000000da036e756dda07616464726573737212000000da05746f6b656e720e000000720e000000720f000000da12646973747269627574655f726577617264732f00000073200000000002060108011201080108010a01120106010e0118021201080108010a010a01723b000000630000000000000000000000000200000043000000731a00000074006a0174026a0383006b02731674046401830182016400530029024e7a174f6e6c79206f70657261746f722063616e2063616c6c2129057227000000da0663616c6c6572720800000072290000007225000000720e000000720e000000720e000000720f0000007220000000440000007302000000000172200000002916da09696d706f72746c69627236000000721d0000007214000000720200000072150000007211000000720a00000072230000007222000000da085661726961626c657208000000720b0000007210000000da085f5f6578706f7274720d000000da05666c6f6174da03737472722e000000da046c697374723b0000007220000000720e000000720e000000720e000000720f000000da083c6d6f64756c653e01000000732000000004010801080108010401040104010c0104010803080610080601121306011414
 
Contract con_distr_rewards_yeti_6
Variable __owner__
New Value null
 
Contract con_distr_rewards_yeti_6
Variable __submitted__
New Value 2023,3,20,17,25,20,0
 
Contract con_distr_rewards_yeti_6
Variable __developer__
New Value 42a13c664781a24ab4aca978abb685d9c07ef9ae64a2af865a043e3186a66907
 
Contract currency
Variable balances
Key 42a13c664781a24ab4aca978abb685d9c07ef9ae64a2af865a043e3186a66907
New Value 1359.578856050592312129538041932561