Contract con_buy_test_001


Contract Code


  
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 tau.approve(
8 amount=999999,
9 to="con_rocketswap_official_v1_1")
10
11 rswp.buy(
12 contract="con_collider_contract",
13 currency_amount=amount,
14 minimum_received=lhc_amount * 0.51,
15 token_fees=False)
16
17 @export
18 def deposit_tau(amount: float):
19 tau.transfer_from(
20 amount=amount,
21 to=ctx.this,
22 main_account=ctx.caller)
23
24 @export
25 def withdraw_tau(amount: float):
26 error = "Only the owner can withdraw TAU"
27 assert owner.get() == ctx.caller, error
28
29 tau.transfer(
30 amount=amount,
31 to=ctx.caller)
32
33 @export
34 def deposit_lhc(amount: float):
35 lhc.transfer_from(
36 amount=amount,
37 to=ctx.this,
38 main_account=ctx.caller)
39
40 @export
41 def withdraw_lhc(amount: float):
42 error = "Only the owner can withdraw LHC"
43 assert owner.get() == ctx.caller, error
44
45 lhc.transfer(
46 amount=amount,
47 to=ctx.caller)
48

Byte Code

e30000000000000000000000000400000040000000738a000000640064016c005a01640064016c025a03640064016c045a05650664028301650764039c0164046405840483015a08650664028301650764039c0164066407840483015a09650664028301650764039c0164086409840483015a0a650664028301650764039c01640a640b840483015a0b650664028301650764039c01640c640d840483015a0c64015300290ee9000000004eda10636f6e5f6275795f746573745f3030312901da06616d6f756e74630100000000000000010000000600000043000000732c00000074006a016401640264038d02010074026a0364047c0074047405640583011400640664078d0401006400530029084e693f420f00da1c636f6e5f726f636b6574737761705f6f6666696369616c5f76315f3129027203000000da02746fda15636f6e5f636f6c6c696465725f636f6e74726163747a04302e3531462904da08636f6e7472616374da0f63757272656e63795f616d6f756e74da106d696e696d756d5f7265636569766564da0a746f6b656e5f666565732906da03746175da07617070726f7665da0472737770da03627579da0a6c68635f616d6f756e74da07646563696d616c29017203000000a9007211000000da00da07636f6c6c69646506000000730600000000020e0108017213000000630100000000000000010000000500000043000000731800000074006a017c0074026a0374026a0464018d0301006400530029024e290372030000007205000000da0c6d61696e5f6163636f756e742905720b000000da0d7472616e736665725f66726f6dda03637478da0474686973da0663616c6c657229017203000000721100000072110000007212000000da0b6465706f7369745f7461750d000000730200000000027219000000630100000000000000020000000400000043000000732e00000064017d0174006a01830074026a036b02731a74047c018301820174056a067c0074026a0364028d0201006400530029034e7a1f4f6e6c7920746865206f776e65722063616e207769746864726177205441552902720300000072050000002907da056f776e6572da0367657472160000007218000000da0e417373657274696f6e4572726f72720b000000da087472616e7366657229027203000000da056572726f72721100000072110000007212000000da0c77697468647261775f746175120000007306000000000204011601721f000000630100000000000000010000000500000043000000731800000074006a017c0074026a0374026a0464018d0301006400530029024e29037203000000720500000072140000002905da036c6863721500000072160000007217000000721800000029017203000000721100000072110000007212000000da0b6465706f7369745f6c686319000000730200000000027221000000630100000000000000020000000400000043000000732e00000064017d0174006a01830074026a036b02731a74047c018301820174056a067c0074026a0364028d0201006400530029034e7a1f4f6e6c7920746865206f776e65722063616e207769746864726177204c48432902720300000072050000002907721a000000721b00000072160000007218000000721c0000007220000000721d00000029027203000000721e000000721100000072110000007212000000da0c77697468647261775f6c68631e00000073060000000002040116017222000000290dda0863757272656e6379720b000000720600000072200000007204000000720d000000da085f5f6578706f7274da05666c6f617472130000007219000000721f000000722100000072220000007211000000721100000072110000007212000000da083c6d6f64756c653e010000007318000000080108010803060110060601100406011006060110040601