1 |
import currency as tau |
2 |
import con_collider_contract as lhc |
3 |
import con_rocketswap_official_v1_1 as rswp |
4 |
|
5 |
@export |
6 |
def collide(amount: float): |
7 |
|
8 |
tau.transfer_from( |
9 |
amount=amount, |
10 |
to=ctx.this, |
11 |
main_account=ctx.caller) |
12 |
|
13 |
tau.approve( |
14 |
amount=999999, |
15 |
to="con_rocketswap_official_v1_1") |
16 |
|
17 |
rswp_prices = ForeignHash( |
18 |
foreign_contract='con_rocketswap_official_v1_1', |
19 |
foreign_name='prices') |
20 |
|
21 |
lhc_price = rswp_prices["con_collider_contract"] |
22 |
|
23 |
rswp.buy( |
24 |
contract="con_collider_contract", |
25 |
currency_amount=amount, |
26 |
minimum_received=(amount / lhc_price * 0.51), |
27 |
token_fees=False) |
28 |
|
29 |
@export |
30 |
def deposit_tau(amount: float): |
31 |
tau.transfer_from( |
32 |
amount=amount, |
33 |
to=ctx.this, |
34 |
main_account=ctx.caller) |
35 |
|
36 |
@export |
37 |
def withdraw_tau(amount: float): |
38 |
error = "Only the owner can withdraw TAU" |
39 |
assert owner.get() == ctx.caller, error |
40 |
|
41 |
tau.transfer( |
42 |
amount=amount, |
43 |
to=ctx.caller) |
44 |
|
45 |
@export |
46 |
def deposit_lhc(amount: float): |
47 |
lhc.transfer_from( |
48 |
amount=amount, |
49 |
to=ctx.this, |
50 |
main_account=ctx.caller) |
51 |
|
52 |
@export |
53 |
def withdraw_lhc(amount: float): |
54 |
error = "Only the owner can withdraw LHC" |
55 |
assert owner.get() == ctx.caller, error |
56 |
|
57 |
lhc.transfer( |
58 |
amount=amount, |
59 |
to=ctx.caller) |
e30000000000000000000000000400000040000000738a000000640064016c005a01640064016c025a03640064016c045a05650664028301650764039c0164046405840483015a08650664028301650764039c0164066407840483015a09650664028301650764039c0164086409840483015a0a650664028301650764039c01640a640b840483015a0b650664028301650764039c01640c640d840483015a0c64015300290ee9000000004eda10636f6e5f6275795f746573745f3030322901da06616d6f756e74630100000000000000030000000600000043000000735c00000074006a017c0074026a0374026a0464018d03010074006a056402640364048d0201007406640364056406640764088d047d017c01640919007d0274076a0864097c007c007c021b007409640a83011400640b640c8d04010064005300290d4e29037203000000da02746fda0c6d61696e5f6163636f756e74693f420f00da1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f31290272030000007204000000da067072696365737202000000da0b727377705f7072696365732904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d65da08636f6e7472616374da046e616d65da15636f6e5f636f6c6c696465725f636f6e74726163747a04302e3531462904720b000000da0f63757272656e63795f616d6f756e74da106d696e696d756d5f7265636569766564da0a746f6b656e5f66656573290ada03746175da0d7472616e736665725f66726f6dda03637478da0474686973da0663616c6c6572da07617070726f7665da0b466f726569676e48617368da0472737770da03627579da07646563696d616c29037203000000da0d5f5f727377705f707269636573da096c68635f7072696365a900721d000000da00da07636f6c6c696465060000007310000000000214010e01020104010a0108010801721f000000630100000000000000010000000500000043000000731800000074006a017c0074026a0374026a0464018d0301006400530029024e290372030000007204000000720500000029057211000000721200000072130000007214000000721500000029017203000000721d000000721d000000721e000000da0b6465706f7369745f74617513000000730200000000027220000000630100000000000000020000000400000043000000732e00000064017d0174006a01830074026a036b02731a74047c018301820174056a067c0074026a0364028d0201006400530029034e7a1f4f6e6c7920746865206f776e65722063616e207769746864726177205441552902720300000072040000002907da056f776e6572da0367657472130000007215000000da0e417373657274696f6e4572726f727211000000da087472616e7366657229027203000000da056572726f72721d000000721d000000721e000000da0c77697468647261775f7461751800000073060000000002040116017226000000630100000000000000010000000500000043000000731800000074006a017c0074026a0374026a0464018d0301006400530029024e29037203000000720400000072050000002905da036c6863721200000072130000007214000000721500000029017203000000721d000000721d000000721e000000da0b6465706f7369745f6c68631f000000730200000000027228000000630100000000000000020000000400000043000000732e00000064017d0174006a01830074026a036b02731a74047c018301820174056a067c0074026a0364028d0201006400530029034e7a1f4f6e6c7920746865206f776e65722063616e207769746864726177204c484329027203000000720400000029077221000000722200000072130000007215000000722300000072270000007224000000290272030000007225000000721d000000721d000000721e000000da0c77697468647261775f6c68632400000073060000000002040116017229000000290dda0863757272656e63797211000000720d000000722700000072060000007218000000da085f5f6578706f7274da05666c6f6174721f0000007220000000722600000072280000007229000000721d000000721d000000721d000000721e000000da083c6d6f64756c653e0100000073180000000801080108030601100c0601100406011006060110040601