HPDEX information
The following information has been gathered on the HPDEX Decentralized Exchange for High Performance Blockchain:
Native Token: HPD
Token Address: 0x6383f770f1eec68e80ac0c5527be71a11b4d182c
Token source code validated? YES
Token Owner Address: 0x7DeF1e608721490D2A1537F213A4b7d4D0b116FF
Current total supply (02.08.22): 66,000,000
Max total supply: 1,000,000,000 (uint256 private constant maxSupply = 1000000000 * 1e18;)
Percentage of maximum supply already mined: 6.6%
HPB “Wrapper” contract (HPB <-> WHPB)
Address: 0xBE05Ac1FB417c9EA435b37a9Cecd39Bc70359d31
Contract Validated: YES
Factory Contract — Based on Uniswap V2
Address: 0xe1d563bcfd4e2a5a9ce355cc8631421186521aaa
Validated: YES
Router Contract — Based on Uniswap V2
Address: 0x708fC988B16562b0525840F1787E1C2aAbFE4AA6
Validated: NO
(original Uniswap smart contract code: https://github.com/Uniswap/v2-periphery/blob/master/contracts/UniswapV2Router02.sol)
When pasting this code into Remix pointing to HPB network and loading the Router contract address, the IDE suggests that the majority of the smart contract code is Uniswap standard. For example, if you call the Factory Address and the HPB Wrapper contract, they are both valid:

However if you attempt to remove any liquidity by calling the “removeLiquidity” function, the transaction reverts with an error.

Typically to call this function, it is a 2-step process:
Step 1 — You need to approve the DEX router address as the “spender” of the LP tokens you hold which represent your liquidity pair.
If that sounds confusing, then it’s worth recapping how a DEX works….
You create a new “token pair” with two tokens.
If you wish to create a pair whereby one of the tokens happens to be a native coin (e.g. HPB) then it first needs to be “wrapped” into WHPB to make it a HRC20 token.
Once you create the liquidity pair (or add to an existing liquidity pair) then you receive back LP tokens which represent your ownership of that liquidity pair. It’s kind of like a receipt for ownership, and is used to “cash out” your tokens at a later date.
So basically, if you have any liquidity in a DEX, then you will have received an LP token representing that liquidity pair.
For example, if you deposited ONE tokens and HPB tokens (note: HPB is automatically “wrapped” into WHPB) into the HPDEX, then you would receive LP tokens, and the contract address of those specific LP tokens is indicated in the image below:

Every new token pairing will have a different LP token address, however if you ADD MORE liquidity to an existing token pairing, then the LP token address will be the same. So basically, in this example, the ONE-HPB LP token pair has now been established, so if you add liquidity to this token pair, you will get more of these LP tokens with this contract address.
So, in order to cash out your liquidity, you need to send back your LP tokens, and you’ll receive your original tokens.
In order to to this, we first need to interact with the specific LP token contract, and tell it that we are allowing the DEX router contract to “spend” these tokens on our behalf, as currently they will be in our own wallets.
To do this, we usually have three options:
- Interact with a DEX front end…. this involves clicking on a “Approve” button, and telling your LP contract how many LP tokens you are “approving” the DEX Router contract to spend.
https://app.hpdex.org/#/remove/0x8ce49d1feccc1b44fe69a9089c385f43091c1c6b/HPB
Notice in the URL link above it is the contract address of the LP token for ONE-HPB

Basically this page just acts as a website “front-end” to interacting with the smart contract for Uniswap LP tokens. You are approving the DEX router contract as the spender, and specifying how many LP tokens you will be allowing the Router contract to spend.
2. Another option, is to call these functions directly from a block explorer. Whenever a smart contract is validated, the block explorer now has the ability to interact directly with the smart contract, without the need for a website front-end. You would simply go to the LP contract address in the block explorer, then open the contract tab, and you can then interact directly with it using the read/write function calls.

In the case of HPDEX, the Uniswap Router contract has not been validated by the developers, and attempts to validate individual LP token contracts fail, so this is not an option right now.
3. The third option, is to interact with the smart contract using an IDE such as Remix. In order to do this successfully, you need a copy of the original smart contract code (usually copied from a block explorer when the Dev’s validate their smart contracts) or from a Developer Github repo.
You can paste the smart contract code into Remix, and then connect to it using the contract address that has been deployed onto the blockchain.
So for example, the industry standard smart contract code for a Uniswap LP token called UniswapV2Pair, and the original code is here:
So, if the smart contract code deployed to HPB chain uses industry standard code, then you should be able to interact with the read/write functions within that smart contract, if you load the code into Remix, and point it to the LP token address.
Here is me loading the LP contract address for the HPB-USDT pairing (LP contract address for this pairing is: 0x118e1317dc0469c9aedf7ade5d1aa1a47fc2f5b4)

If you look on the left-side of the image, I am able to read all the functions of the LP token, so it looks to be pretty much industry standard. If you look closely, you’ll also see the contract address of the two individual tokens that represent this LP token (HPB and USDT)
HPB (technically it is “Wrapped” HPB or WHPB)
Token0–0xBE05Ac1FB417c9EA435b37a9Cecd39Bc70359d31
USDT
Token1–0xD378634119d2F7b3Cf3D60E0B0f5e048e74cE3Cf
Now I could substitute the LP token address for any LP token pairing, and I should get information for all token pairs on HPDEX.
So for example, if I change the LP token address in Remix to the LP token address for the HPB-DON LP token pair (0xec0c995cf2cffbc2716369e24aee021064054385) then I will be able to interact with that specific LP contract:

As you can see, in this instance, Token1 is now represented by the address of the DON token smart contract.
So the LP token smart contract code appears to be valid.
You should now be able to “approve” the amount of LP tokens that you wish for the DEX Router contract to spend, which will essentially allow you to “cash out” your original tokens by sending those LP tokens to the DEX

So in the image example above, I’m approving the DEX router contract 100 tokens to spend
IMPORTANT: if the tokens are expressed to 18 decimals (industry standard) then technically if you wanted the Router DEX contract to spend 100 of your LP tokens, then you’d actually type in 100000000000000000000
If you want to see how many tokens you have expressed to 18 decimals, you could always use the “balanceOf” functional call, and type in your own wallet address, and it will show you how many LP tokens you have in your wallet for that token pair, expressed to 18 decimals.
Once you have approved a certain amount of LP tokens, you can then use the “removeLiquidity” function from the actual Router contract itself..
So you copy the Router smart contract code into Remix, and then load the Router contract address, and you will be presented with all the functions of the Router contract.
Assuming HPDEX uses industry standard UniswapV2Router02 code, we can copy this code into Remix:
We then load up the contract address for Router:
0x708fC988B16562b0525840F1787E1C2aAbFE4AA6
We now see all the functions of the Router smart contract….

So now in theory, if we call the “removeLiquidy” funtion, and provide all of the necessary values, we should be able to remove our liquidity from the DEX…

Let’s look closer at these required values for a moment…
TokenA — This represents Token0 — which is the Contract address for WHPB
TokenB — This represents Token1 — which is the Contract address for DON
Liquidity — The amount of LP tokens you “approved” on the Router contract
amountAMin — the minimum amount of HPB tokens to remove (usually this is just set to 0)
amountBMin — the minimum amount of DON tokens to remove (again, this isusually set to 0)
to: The address you want your liquidity to go to…i.e. your wallet
deadline: The time (expressed as epoch time (see: https://www.epochconverter.com/) until this trnasaction will revert. Normally you set this value (as epoch) around 5–10 minutes after the current time.
So for example, if the current time was Tuesday, August 2, 2022 1:14:53 PM then this is expressed as epoch time 1659446093, so you could add 5 minutes to this value (i.e. 300 seconds) which makes the value 1659446393 and therefore this transaction must be executed successfully before Tuesday, August 2, 2022 1:14:58 PM
So assuming you approved the Router contract to “spend” the LP tokens, and your values are valid, you should be able to successfully transact with the smart contract.
When I try to do this, I get a revert error message…I have no idea why, and because the smart contract for Router has not been validated or published, it is very difficult to troubleshoot why it’s not working, as it could be that the smart contract code I’m pasting into Remix does not match the actual smart contract code which was deployed on chain, or it could mean that another (unknown) function within the smart contract is intercepting this “removeLiquidity” call, such as some kind of “pauseWithdrawals” function, which isn’t part of the standard Uniswap code.
Without publishing the smart contract code, it’s very very difficult to figure out what the problem is, hence the reason why it is so important to publish and validate all blockchain smart contracts.
The issue could in fact be very innocent, but without validated contracts, we cannot tell.