Contract con_autocollide_2


Contract Code


  
1 import con_collider_007 as collider
2 import con_collider_contract as token
3 import con_rocketswap_official_v1_1 as rswp
4 import currency
5
6 @export
7 def run_collide(times: int, amount: float):
8 currency.approve(amount=1000000, to='con_collider_contract')
9 token.approve(amount=1000000, to='con_rocketswap_official_v1_1')
10
11 currency.transfer_from(amount=amount*times, to=ctx.this, main_account=ctx.caller)
12
13 for x in range(times):
14 result = collider.collide(amount=amount)
15 if 'won' in result:
16 rswp.sell(contract='con_collider_contract', token_amount=token.balance_of(ctx.this) * 0.9)
17
18 token.transfer(amount=token.balance_of(ctx.this), to=ctx.caller)
19 currency.transfer(amount=currency.balance_of(ctx.this), to=ctx.caller)
20
21 @export
22 def return_tau():
23 currency.transfer(amount=currency.balance_of(ctx.this), to=ctx.caller)

Byte Code

e30000000000000000000000000400000040000000734c000000640064016c005a01640064016c025a03640064016c045a05640064016c065a066507640283016508650964039c0264046405840483015a0a65076402830164066407840083015a0b640153002908e9000000004eda11636f6e5f6175746f636f6c6c6964655f322902da0574696d6573da06616d6f756e7463020000000000000004000000060000004300000073ac00000074006a016401640264038d02010074026a016401640464038d02010074006a037c017c00140074046a0574046a0664058d030100784274077c00830144005d367d0274086a097c0164068d017d0364077c036b06723e740a6a0b640274026a0c74046a058301740d64088301140064098d020100713e570074026a0e74026a0c74046a05830174046a0664038d02010074006a0e74006a0c74046a05830174046a0664038d02010064005300290a4e6940420f00da15636f6e5f636f6c6c696465725f636f6e747261637429027204000000da02746fda1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f31290372040000007206000000da0c6d61696e5f6163636f756e7429017204000000da03776f6e7a03302e392902da08636f6e7472616374da0c746f6b656e5f616d6f756e74290fda0863757272656e6379da07617070726f7665da05746f6b656eda0d7472616e736665725f66726f6dda03637478da0474686973da0663616c6c6572da0572616e6765da08636f6c6c69646572da07636f6c6c696465da0472737770da0473656c6cda0a62616c616e63655f6f66da07646563696d616cda087472616e73666572290472030000007204000000da0178da06726573756c74a900721d000000da00da0b72756e5f636f6c6c69646507000000731600000000020e010e010e010a010e010c0108010a0118011801721f000000630000000000000000000000000400000043000000731c00000074006a0174006a0274036a04830174036a0564018d0201006400530029024e2902720400000072060000002906720c000000721a0000007218000000721000000072110000007212000000721d000000721d000000721d000000721e000000da0a72657475726e5f74617516000000730200000000027220000000290cda10636f6e5f636f6c6c696465725f30303772140000007205000000720e00000072070000007216000000720c000000da085f5f6578706f7274da03696e74da05666c6f6174721f0000007220000000721d000000721d000000721d000000721e000000da083c6d6f64756c653e01000000730c00000008010801080108030601120e