Transaction #135012

Hash 4ce3dc12e71f07f6d83914e942a681c24ecb4c716517196e98a89b9ef1c0993a
Status Success
Timestamp 71 days ago - 7/16/2021, 2:58:25 AM UTC+0
Block 132100
Stamps Used 230
Burned Fee 0.03538462 TAU
From ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d 
Contract Name submission
Function Name submit_contract

Additional Info
SubBlock Number 0
Nonce 1708
Processor 5b09493df6c18d17cc883ebce54fcb1f5afbd507533417fe32c006009a9c3c4a
Signature b8dc3b552210e3b718e64fea7cc0623bb26e320055feed8c01c3559315a400fdafb923236179ffc166f76c0149ff4190ad0e0b8028f6464f5d2286b0b1175c09
Stamps Supplied 664
Stamps per TAU 65

Kwargs

code # Sender needs to approve contract to spend GOLD # Set stamps for subscribe() & unsubscribe() to 70 import currency as tau import con_gold_contract as gold owner = Variable() tau_amount = Variable() data = Hash(default_value=0) reserve = Variable() burn = Variable() @construct def init(): owner.set(ctx.caller) tau_amount.set(1500) reserve.set("96dae3b6213fb80eac7c6f4fa0fd26f34022741c56773107b20199cb43f5ed62") burn.set("0000000000000BURN0000000000000") @export def subscribe(): gold_price = ForeignHash(foreign_contract='con_rocketswap_official_v1_1', foreign_name='prices') gold_amount = tau_amount.get() / gold_price["con_gold_contract"] gold.transfer_from(amount=gold_amount, to=ctx.this, main_account=ctx.caller) data[ctx.caller] += gold_amount data[ctx.caller, "start"] = now @export def unsubscribe(): time_delta = now - data[ctx.caller, "start"] if time_delta <= datetime.timedelta(days=30): payout = data[ctx.caller] / 100 * 30 elif time_delta <= datetime.timedelta(days=90): payout = data[ctx.caller] / 100 * 50 elif time_delta <= datetime.timedelta(days=120): payout = data[ctx.caller] / 100 * 70 else: payout = data[ctx.caller] / 100 * 80 # Pay back user gold.transfer(amount=payout, to=ctx.caller) amount_delta = data[ctx.caller] - payout # Burn half or remaining amount gold.transfer(amount=(amount_delta / 2), to=burn.get()) # Send other half to reserve gold.transfer(amount=(amount_delta - (amount_delta / 2)), to=reserve.get()) data[ctx.caller] = 0 return payout @export def set_tau_amount(amount: int): assert ctx.caller == owner.get(), "Only owner can adjust TAU amount" assert amount >= 0, "Amount of TAU can't be negative" tau_amount.set(amount) @export def deposit_gold(amount: float): gold.transfer_from(amount=amount, to=ctx.this, main_account=ctx.caller) @export def withdraw_gold(amount: float): assert owner.get() == ctx.caller, "Only the owner can withdraw GOLD" gold.transfer(amount=amount, to=ctx.caller)
name con_gold_ape_002

State Changes

Contract con_gold_ape_002
Variable owner
New Value ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
 
Contract con_gold_ape_002
Variable tau_amount
New Value 1500
 
Contract con_gold_ape_002
Variable reserve
New Value 96dae3b6213fb80eac7c6f4fa0fd26f34022741c56773107b20199cb43f5ed62
 
Contract con_gold_ape_002
Variable burn
New Value 0000000000000BURN0000000000000
 
Contract con_gold_ape_002
Variable __code__
New Value import currency as tau import con_gold_contract as gold __owner = Variable(contract='con_gold_ape_002', name='owner') __tau_amount = Variable(contract='con_gold_ape_002', name='tau_amount') __data = Hash(default_value=0, contract='con_gold_ape_002', name='data') __reserve = Variable(contract='con_gold_ape_002', name='reserve') __burn = Variable(contract='con_gold_ape_002', name='burn') def ____(): __owner.set(ctx.caller) __tau_amount.set(1500) __reserve.set( '96dae3b6213fb80eac7c6f4fa0fd26f34022741c56773107b20199cb43f5ed62') __burn.set('0000000000000BURN0000000000000') @__export('con_gold_ape_002') def subscribe(): __gold_price = ForeignHash(foreign_contract= 'con_rocketswap_official_v1_1', foreign_name='prices', contract= 'con_gold_ape_002', name='gold_price') gold_amount = __tau_amount.get() / __gold_price['con_gold_contract'] gold.transfer_from(amount=gold_amount, to=ctx.this, main_account=ctx.caller ) __data[ctx.caller] += gold_amount __data[ctx.caller, 'start'] = now @__export('con_gold_ape_002') def unsubscribe(): time_delta = now - __data[ctx.caller, 'start'] if time_delta <= datetime.timedelta(days=30): payout = __data[ctx.caller] / 100 * 30 elif time_delta <= datetime.timedelta(days=90): payout = __data[ctx.caller] / 100 * 50 elif time_delta <= datetime.timedelta(days=120): payout = __data[ctx.caller] / 100 * 70 else: payout = __data[ctx.caller] / 100 * 80 gold.transfer(amount=payout, to=ctx.caller) amount_delta = __data[ctx.caller] - payout gold.transfer(amount=amount_delta / 2, to=__burn.get()) gold.transfer(amount=amount_delta - amount_delta / 2, to=__reserve.get()) __data[ctx.caller] = 0 return payout @__export('con_gold_ape_002') def set_tau_amount(amount: int): assert ctx.caller == __owner.get(), 'Only owner can adjust TAU amount' assert amount >= 0, "Amount of TAU can't be negative" __tau_amount.set(amount) @__export('con_gold_ape_002') def deposit_gold(amount: float): gold.transfer_from(amount=amount, to=ctx.this, main_account=ctx.caller) @__export('con_gold_ape_002') def withdraw_gold(amount: float): assert __owner.get() == ctx.caller, 'Only the owner can withdraw GOLD' gold.transfer(amount=amount, to=ctx.caller)
 
Contract con_gold_ape_002
Variable __compiled__
New Value e3000000000000000000000000050000004000000073bc000000640064016c005a01640064016c025a0365046402640364048d025a0565046402640564048d025a06650764006402640664078d035a0865046402640864048d025a0965046402640964048d025a0a640a640b84005a0b650c64028301640c640d840083015a0d650c64028301640e640f840083015a0e650c64028301650f64109c0164116412840483015a10650c64028301651164109c0164136414840483015a12650c64028301651164109c0164156416840483015a13640153002917e9000000004eda10636f6e5f676f6c645f6170655f303032da056f776e65722902da08636f6e7472616374da046e616d65da0a7461755f616d6f756e74da04646174612903da0d64656661756c745f76616c756572040000007205000000da0772657365727665da046275726e630000000000000000000000000200000043000000732e00000074006a0174026a038301010074046a0164018301010074056a0164028301010074066a016403830101006400530029044e69dc050000da4039366461653362363231336662383065616337633666346661306664323666333430323237343163353637373331303762323031393963623433663565643632da1e303030303030303030303030304255524e303030303030303030303030302907da075f5f6f776e6572da03736574da03637478da0663616c6c6572da0c5f5f7461755f616d6f756e74da095f5f72657365727665da065f5f6275726ea90072140000007214000000da00da045f5f5f5f0a000000730a00000000010c010a0104010601721600000063000000000000000002000000060000004300000073580000007400640164026403640464058d047d0074016a0283007c00640619001b007d0174036a047c0174056a0674056a0764078d030100740874056a07050019007c01370003003c007409740874056a07640866023c006400530029094eda1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f31da067072696365737202000000da0a676f6c645f70726963652904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d6572040000007205000000da11636f6e5f676f6c645f636f6e74726163742903da06616d6f756e74da02746fda0c6d61696e5f6163636f756e74da057374617274290ada0b466f726569676e486173687211000000da03676574da04676f6c64da0d7472616e736665725f66726f6d720f000000da04746869737210000000da065f5f64617461da036e6f772902da0c5f5f676f6c645f7072696365da0b676f6c645f616d6f756e74721400000072140000007215000000da0973756273637269626512000000730e0000000002020104010a01100114021201722a00000063000000000000000003000000040000004300000073ec0000007400740174026a0364016602190018007d007c0074046a05640264038d016b017236740174026a03190064041b00640214007d016e5a7c0074046a05640564038d016b01725a740174026a03190064041b00640614007d016e367c0074046a05640764038d016b01727e740174026a03190064041b00640814007d016e12740174026a03190064041b00640914007d0174066a077c0174026a03640a8d020100740174026a0319007c0118007d0274066a077c02640b1b0074086a098300640a8d02010074066a077c027c02640b1b001800740a6a098300640a8d020100640c740174026a033c007c015300290d4e7220000000e91e0000002901da0464617973e964000000e95a000000e932000000e978000000e946000000e9500000002902721d000000721e000000e9020000007201000000290b72270000007226000000720f0000007210000000da086461746574696d65da0974696d6564656c74617223000000da087472616e736665727213000000722200000072120000002903da0a74696d655f64656c7461da067061796f7574da0c616d6f756e745f64656c7461721400000072140000007215000000da0b756e7375627363726962651e000000731c00000000021201100114011001140110011402120110010e0116011a010a01723a0000002901721d000000630100000000000000010000000200000043000000733400000074006a0174026a0383006b02731674046401830182017c0064026b057326740464038301820174056a067c00830101006400530029044e7a204f6e6c79206f776e65722063616e2061646a7573742054415520616d6f756e7472010000007a1f416d6f756e74206f66205441552063616e2774206265206e656761746976652907720f0000007210000000720d0000007222000000da0e417373657274696f6e4572726f727211000000720e0000002901721d000000721400000072140000007215000000da0e7365745f7461755f616d6f756e74310000007306000000000216011001723c000000630100000000000000010000000500000043000000731800000074006a017c0074026a0374026a0464018d0301006400530029024e2903721d000000721e000000721f000000290572230000007224000000720f000000722500000072100000002901721d000000721400000072140000007215000000da0c6465706f7369745f676f6c643800000073020000000002723d000000630100000000000000010000000400000043000000732a00000074006a01830074026a036b027316740464018301820174056a067c0074026a0364028d0201006400530029034e7a204f6e6c7920746865206f776e65722063616e20776974686472617720474f4c442902721d000000721e0000002907720d0000007222000000720f0000007210000000723b000000722300000072360000002901721d000000721400000072140000007215000000da0d77697468647261775f676f6c643d000000730400000000021601723e0000002914da0863757272656e6379da03746175721c0000007223000000da085661726961626c65720d0000007211000000da04486173687226000000721200000072130000007216000000da085f5f6578706f7274722a000000723a000000da03696e74723c000000da05666c6f6174723d000000723e0000007214000000721400000072140000007215000000da083c6d6f64756c653e01000000731e000000080108010c010c010e010c010c030808100c101306011006060110040601
 
Contract con_gold_ape_002
Variable __owner__
New Value null
 
Contract con_gold_ape_002
Variable __submitted__
New Value 2021,7,15,18,58,26,0
 
Contract con_gold_ape_002
Variable __developer__
New Value ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
 
Contract currency
Variable balances
Key ae7d14d6d9b8443f881ba6244727b69b681010e782d4fe482dbfb0b6aca02d5d
New Value 13.95230025769231257