# @hiveupme's HIVE swapping service (and a potential problem with its rewards system)

@hiveupme is a HIVE <-> SWAP.HIVE instant swapping service developed by @theguruasia that has a 0.1% normal fee. Its official website is at https://swaphive.github.io/swap/.

This post focuses on a potential problem I encountered with @hiveupme, particularly with its 0.075% reward system for its users adding liquidity to it. 🤔

Note that this post has lots of Math! 🤯😅

@hiveupme logo

On this post, I call both HIVE and SWAP.HIVE as "tokens" for simplicity.

## 🤔 Details 🤔

• There is a 0.1% base fee for converting HIVE to SWAP.HIVE, or SWAP.HIVE to HIVE. That means for every 1 token you swap with the other, you receive 0.999 of the other, where 0.001 is the deducted fee. However, the fee is rounded down (but the minimum fee is 0.001 token), so you can swap 1.999 of one token and receive 1.998 of the other token, making the fee become practically reduced to 0.05%.
• Whenever the balance of one token is low enough, the fee is waived and you get 0.075% of the amount you converted as reward. That means for every 10 of a token you swap, you get 10.075 of the other where 0.075 is the reward. To maximize the reward, you should swap `1.333 * n + 0.001` of a token to the other to get `1.334 * n + 0.001` where `n` is any positive integer, such that 1.334 of a token gives 1.335 of the other, 2.667 gives 2.669, 4.000 gives 4.003, and so on.

## 🤯 More details 🤯

With the given details above, we can deduce that whenever the balance of one token is low enough, every time you convert 1.334 of a token to the other, you get 1.335 of the other, and whenever you have at least 1.999 of the other token, swap it back. Repeating this cycle until the balance of either token is no longer low enough earns you lots of the token with the low balance (sadly at the expense of @hiveupme and/or its supporters). 🤫

For example, if the balance of HIVE on @hiveupme is low enough such that there is bonus 0.075% HIVE for converting SWAP.HIVE to HIVE and you have 10 SWAP.HIVE, convert 9.332 (equivalent to 1.333 * 7 + 0.001) SWAP.HIVE to get 9.339 (equivalent to 1.334 * 7 + 0.001) SWAP.HIVE, then convert 1.999 SWAP.HIVE to HIVE 4 times to get 7.992 (equivalent to 1.998 * 4) HIVE. See here that the bonus of converting 9.332 SWAP.HIVE to HIVE here gives a profit of 0.007 HIVE, while converting back 7.998 (equivalent to 1.999 * 4) SWAP.HIVE (which is less than the 9.332 SWAP.HIVE we used earlier) back to HIVE only has 0.004 HIVE fee. This "cycle" gave us a net profit of 0.003 HIVE, and can be repeated endlessly as long as the balance of HIVE on @hiveupme is low enough. 🔄

As another example, I actually traded two 1.999 SWAP.HIVE (the one with the much higher balance in @hiveupme when I initiated the trades) here and here for which I received two 1.998 HIVE here and here. I then swapped 4 HIVE here for which I received 4 SWAP.HIVE here with the reward of 0.003 SWAP.HIVE here. That's a net profit of 0.001 HIVE from 4 SWAP.HIVE. That's small indeed, but if you have a bot which can automate the process again and again - that's 1 HIVE/SWAP.HIVE profit swapped for every 4,000 of the other token swapped repeatedly with minimal effort. 🤖

## 😊 Final words 😊

@hiveupme is a great instant swapping service between HIVE and SWAP.HIVE, as its normal fee is only 0.1% (much less than #HiveEngine and #TribalDex which have 0.75% fee, and #LeoDex and #BeeSwap which have 0.25% fee).

I have published this post for the following people:

• The developer of @hiveupme who is @theguruasia to add updates to prevent people from abusing this issue I found, probably with something as simple as the fee getting rounded up (or even just rounded off) instead of getting rounded down.
• Hive users who like @hiveupme to provide liquidity to it (and get rewarded in the process, without doing the "cycles" as I described above), because this issue is only a problem if the balance either HIVE or SWAP.HIVE is low in the @hiveupme Hive account (unless @theguruasia has already implemented the update I suggested above).

## 🥳 Thank you for reading! 😎

Posted with STEMGeeks

0
0
0.000
(Edited)

Hi @savvyplayer,
Thank you for notifying this issue. Honestly I am not a maths-genius, so I am not aware of this until you mentioned here. I will try to resolve this mystery, if fail I will ask your support to resolve it!
Thank you again!

Update :-

probably with something as simple as the fee getting rounded up (or even just rounded off) instead of getting rounded down.

Upgraded the script to work with rounded up fee values.

\$WINE

0
0
0.000

Thanks for acknowledging my report. 😀

Anyway, while I see that you have updated the fee such that it is rounded up instead of rounded down, your webpage still shows the old values when about to swap one token to another (only 0.001 fee instead of 0.002) which might mislead some users (as you can see on my screenshot below). 🤔

Thanks for the !WINE! 😀 Have a !PIZZA too! 😁

0
0
0.000

Sure I will work on that too! Back-end & front-end are in separate scripts!
\$WINE

0
0
0.000
(Edited)

I thought that it's easy to be reminded to change the frontend when making changes to the backend. 🤯😅

Thanks for the WINE again! 😀 Have some !PGM in return! 😁

0
0
0.000

Sent 0.1 PGM tokens to @theguruasia

remaining commands 1

Buy and stake 10 PGM token to send 0.1 PGM per day,
100 PGM token to send 0.1 PGM three times per day
500 to send and receive 0.1 PGM five times per day
1000 to send and receive 0.1 PGM ten times per day

Discord

Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP

Get votes from @ pgm-curator by paying in PGM, here is a guide

Create a HIVE account with PGM from our discord server, here is a guide

I'm a bot, if you want a hand ask @ zottone444

0
0
0.000

PIZZA!

PIZZA Holders sent \$PIZZA tips in this post's comments:
@savvyplayer(1/10) tipped @theguruasia (x1)

You can now send \$PIZZA tips in Discord via tip.cc!

0
0
0.000