Transaction #1336

Hash 00271ba7502736b8d7c62a00c7fd334c9487ecfebeceb9583f264978a0a1059f
Status Success
Timestamp 455 days ago - 2/4/2023, 3:46:44 AM UTC+0
Block 1336
Stamps Used 299
Burned Fee 0.01769231 TAU
From 42a13c664781a24ab4aca978abb685d9c07ef9ae64a2af865a043e3186a66907 
Contract Name submission
Function Name submit_contract

Additional Info
Nonce 1
Processor 11185fe3c6e68d11f89929e2f531de3fb640771de1aee32c606c30c70b6600d2
Signature 90d77365ee974eb0a81eef34ef04f1a68eba2c487c9d2e31d79f570f449ce1f7e697a8dd16e32970fd052a32c727caf8cfd8814f8a93dcc24fc09e8c8ec1f103
Stamps Supplied 845
Stamps per TAU 169

Kwargs

code I = importlib import currency as tau import con_yeti_contract_test_1 as yeti_token import con_rocketswap_official_v1_1 YETI = 'con_yeti_contract_test_1' DEX = con_rocketswap_official_v1_1 REWARDS_CONTRACT = 'con_yeti_rewards_test_1' currency_balance = ForeignHash(foreign_contract='currency', foreign_name='balances') yeti_balance = ForeignHash(foreign_contract=YETI, foreign_name='balances') operator = Variable() @construct def init(): operator.set(YETI) 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') def buy_reward_token(contract: str, fee_cover_perc: float): #if nothing is passed to fee_cover_perc we assume a default value if fee_cover_perc == None: fee_cover_perc = decimal('0.05') #get total YETI balance of this contract yeti_amount = yeti_balance[REWARDS_CONTRACT] #sell YETI balance for TAU DEX.sell(contract=YETI, token_amount=yeti_amount) #get total TAU balance of this contract rewards_currency_amount = currency_balance[REWARDS_CONTRACT] #reserve a percentage to cover for present and future transaction fees fee_cover = rewards_currency_amount * fee_cover_perc currency_amount = rewards_currency_amount - fee_cover #buy reward token with TAU from YETI sell DEX.buy(contract=contract, currency_amount=currency_amount) @export def distribute_rewards(contract: str, addresses: list, holder_min: float, distribute_min: float, fee_cover_perc: float): #check if caller is operator assert_operator() #if nothing is passed to holder_min and distribute_min, we assume certain default values if holder_min == None: holder_min = 50_000_000 if distribute_min == None: distribute_min = 1000 #buy reward token for distribution buy_reward_token(contract=contract, fee_cover_perc=fee_cover_perc) #get total reward token balance of this contract rewards_token_balance = ForeignHash(foreign_contract=contract, foreign_name='balances') rewards_token_amount = rewards_token_balance[REWARDS_CONTRACT] #check minimum reward token amount required for distribution assert rewards_token_amount >= distribute_min, \ f'Not enough funds to distribute! Current amount is {rewards_token_amount}' reward_token = I.import_module(contract) for address in addresses: #get holder YETI balance user_yeti_balance = yeti_balance[address] #check if holder has a certain minimum to qualify for reward and #if address is not a contract if user_yeti_balance >= holder_min and not address.startswith('con_'): #calculate amount to reward reward_amount = rewards_token_amount * (user_yeti_balance/100_000_000_000) #transfer reward to holder reward_token.transfer(amount=reward_amount, to=address) def assert_operator(): assert ctx.caller == operator.get(), 'Only operator can call!'
name con_yeti_rewards_test_1

State Changes

Contract con_yeti_rewards_test_1
Variable operator
New Value con_yeti_contract_test_1
 
Contract currency
Variable balances
Key con_yeti_rewards_test_1:con_rocketswap_official_v1_1
New Value {"__big_int__":"9999999999999999999999"}
 
Contract con_yeti_contract_test_1
Variable balances
Key con_yeti_rewards_test_1:con_rocketswap_official_v1_1
New Value {"__big_int__":"9999999999999999999999"}
 
Contract con_yeti_rewards_test_1
Variable __code__
New Value I = importlib import currency as tau import con_yeti_contract_test_1 as yeti_token import con_rocketswap_official_v1_1 YETI = 'con_yeti_contract_test_1' DEX = con_rocketswap_official_v1_1 REWARDS_CONTRACT = 'con_yeti_rewards_test_1' __currency_balance = ForeignHash(foreign_contract='currency', foreign_name= 'balances', contract='con_yeti_rewards_test_1', name='currency_balance') __yeti_balance = ForeignHash(foreign_contract=YETI, foreign_name='balances', contract='con_yeti_rewards_test_1', name='yeti_balance') __operator = Variable(contract='con_yeti_rewards_test_1', name='operator') def ____(): __operator.set(YETI) approve() @__export('con_yeti_rewards_test_1') def approve(): tau.approve(amount=9999999999999999999999, to= 'con_rocketswap_official_v1_1') yeti_token.approve(amount=9999999999999999999999, to= 'con_rocketswap_official_v1_1') def __buy_reward_token(contract: str, fee_cover_perc: float): if fee_cover_perc == None: fee_cover_perc = decimal('0.05') yeti_amount = __yeti_balance[REWARDS_CONTRACT] DEX.sell(contract=YETI, token_amount=yeti_amount) rewards_currency_amount = __currency_balance[REWARDS_CONTRACT] fee_cover = rewards_currency_amount * fee_cover_perc currency_amount = rewards_currency_amount - fee_cover DEX.buy(contract=contract, currency_amount=currency_amount) @__export('con_yeti_rewards_test_1') def distribute_rewards(contract: str, addresses: list, holder_min: float, distribute_min: float, fee_cover_perc: float): __assert_operator() if holder_min == None: holder_min = 50000000 if distribute_min == None: distribute_min = 1000 __buy_reward_token(contract=contract, fee_cover_perc=fee_cover_perc) __rewards_token_balance = ForeignHash(foreign_contract=contract, foreign_name='balances', contract='con_yeti_rewards_test_1', name= 'rewards_token_balance') rewards_token_amount = __rewards_token_balance[REWARDS_CONTRACT] assert rewards_token_amount >= distribute_min, f'Not enough funds to distribute! Current amount is {rewards_token_amount}' reward_token = I.import_module(contract) for address in addresses: user_yeti_balance = __yeti_balance[address] if user_yeti_balance >= holder_min and not address.startswith('con_'): reward_amount = rewards_token_amount * (user_yeti_balance / 100000000000) reward_token.transfer(amount=reward_amount, to=address) def __assert_operator(): assert ctx.caller == __operator.get(), 'Only operator can call!'
 
Contract con_yeti_rewards_test_1
Variable __compiled__
New Value e3000000000000000000000000070000004000000073a600000065005a01640064016c025a03640064016c045a05640064016c065a0664025a0765065a0864035a09650a640464056403640664078d045a0b650a650764056403640864078d045a0c650d64036409640a8d025a0e640b640c84005a0f651064038301640d640e840083015a1165126513640f9c026410641184045a146510640383016512651565136513651364129c0564136414840483015a166415641684005a17640153002917e9000000004eda18636f6e5f796574695f636f6e74726163745f746573745f31da17636f6e5f796574695f726577617264735f746573745f31da0863757272656e6379da0862616c616e636573da1063757272656e63795f62616c616e63652904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d65da08636f6e7472616374da046e616d65da0c796574695f62616c616e6365da086f70657261746f7229027209000000720a000000630000000000000000000000000200000043000000731400000074006a017402830101007403830001006400530029014e2904da0a5f5f6f70657261746f72da03736574da0459455449da07617070726f7665a90072110000007211000000da00da045f5f5f5f0f000000730400000000010a017213000000630000000000000000000000000400000043000000732000000074006a016401640264038d02010074026a016401640264038d0201006400530029044e6c05000000ff7f7f64ea26064fe121da1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f312902da06616d6f756e74da02746f2903da037461757210000000da0a796574695f746f6b656e721100000072110000007211000000721200000072100000001400000073080000000002060108010601721000000029027209000000da0e6665655f636f7665725f7065726363020000000000000006000000040000004300000073500000007c0164006b0272107400640183017d017401740219007d0274036a0474057c0264028d0201007406740219007d037c037c0114007d047c037c0418007d0574036a077c007c0564038d0201006400530029044e7a04302e303529027209000000da0c746f6b656e5f616d6f756e7429027209000000da0f63757272656e63795f616d6f756e742908da07646563696d616cda0e5f5f796574695f62616c616e6365da10524557415244535f434f4e5452414354da03444558da0473656c6c720f000000da125f5f63757272656e63795f62616c616e6365da03627579290672090000007219000000da0b796574695f616d6f756e74da17726577617264735f63757272656e63795f616d6f756e74da096665655f636f766572721b000000721100000072110000007212000000da125f5f6275795f7265776172645f746f6b656e1c000000731000000000010801080108010e01080108010801722600000029057209000000da09616464726573736573da0a686f6c6465725f6d696eda0e646973747269627574655f6d696e72190000006305000000000000000b000000060000004300000073aa0000007400830001007c0264006b02721264017d027c0364006b02721e64027d0374017c007c0464038d02010074027c0064046405640664078d047d057c05740319007d067c067c036b057358740464087c069b009d028301820174056a067c0083017d0778427c0144005d3a7d0874077c0819007d097c097c026b0572687c086a08640983010c0072687c067c09640a1b0014007d0a7c076a097c0a7c08640b8d0201007168570064005300290c4e6980f0fa0269e803000029027209000000721900000072050000007203000000da15726577617264735f746f6b656e5f62616c616e63652904720700000072080000007209000000720a0000007a324e6f7420656e6f7567682066756e647320746f2064697374726962757465212043757272656e7420616d6f756e7420697320da04636f6e5f6c030000000068ed105d00290272150000007216000000290ada115f5f6173736572745f6f70657261746f727226000000da0b466f726569676e48617368721e000000da0e417373657274696f6e4572726f72da0149da0d696d706f72745f6d6f64756c65721d000000da0a73746172747377697468da087472616e73666572290b72090000007227000000722800000072290000007219000000da175f5f726577617264735f746f6b656e5f62616c616e6365da14726577617264735f746f6b656e5f616d6f756e74da0c7265776172645f746f6b656eda0761646472657373da11757365725f796574695f62616c616e6365da0d7265776172645f616d6f756e74721100000072110000007212000000da12646973747269627574655f726577617264732700000073240000000003060108010401080104010c01040104010801080116010a010a0108011401040108017239000000630000000000000000000000000200000043000000731a00000074006a0174026a0383006b02731674046401830182016400530029024e7a174f6e6c79206f70657261746f722063616e2063616c6c212905da03637478da0663616c6c6572720d000000da03676574722e0000007211000000721100000072110000007212000000722c0000003e00000073020000000001722c0000002918da09696d706f72746c6962722f00000072040000007217000000720200000072180000007214000000720f000000721f000000721e000000722d0000007221000000721d000000da085661726961626c65720d0000007213000000da085f5f6578706f72747210000000da03737472da05666c6f61747226000000da046c6973747239000000722c0000007211000000721100000072110000007212000000da083c6d6f64756c653e010000007324000000040108010801080104010401040104010c0106010a010c0308051008100b060106011215
 
Contract con_yeti_rewards_test_1
Variable __owner__
New Value null
 
Contract con_yeti_rewards_test_1
Variable __submitted__
New Value 2023,2,4,3,46,45,0
 
Contract con_yeti_rewards_test_1
Variable __developer__
New Value 42a13c664781a24ab4aca978abb685d9c07ef9ae64a2af865a043e3186a66907
 
Contract currency
Variable balances
Key 42a13c664781a24ab4aca978abb685d9c07ef9ae64a2af865a043e3186a66907
New Value 3940.30431107354201408