Crypto Academy Season 4 [ Advanced course ] week 5: JustSwap

Hey steemians

In this post i will be submitting my homework task for professor @kouba01.

IMG_20210814_014850.jpg

Q-1) Present the Just Swap platform in your own way, demonstrating its importance within the Tron ecosystem blockchain.

Decentralised finance(DeFi) is gaining the attention of the users of cryptocurrencies because of its ability to provide security, speed and low transaction fee. Tron blockchain is also working on DeFi and they have launched many protocols and projects that might help the users of Tron blockchain.

Justswap is a decentralised exchange that works on the Tron blockchain and it instant swaps the TRC 20 tokens available on the Justswap at the current price of those tokens. Justswap uses smart contracts for this purpose and thus removing the intermediaries from the whole process of swapping which leads to fewer fees and a higher speed of swapping.

Unlike other centralised exchanges where traders need to wait for their orders to get filled, in Justswap there is unlimited liquidity, which means a trader doesn't need to wait to swap his/her tokens.

IMG_20211008_222313.png

Fig1: Justswap

Now a question might arise in your mind regarding unlimited liquidity, yeah it is a legit question and the answer for the question is liquidity mining, in Justswap you can stake your asset in liquidity pools and in return you will get rewards for providing liquidity in Tron blockchain and Justswap.


~Note:~

OnlyTRC20 tokens can be swapped because they are the token standard that is used for implementing the smart contracts in the Tron blockchain like ERC20 in Ethereum blockchain.

The rewards we get for providing liquidity comes from the fees paid by the users swapping TRC20 tokens on Justswap. The trading fees of Justswap is only 0.3%.


~Developers and working of Justswap~


As I mentioned above the popularity of Defi as well as the implementation of Defi by Ethereum blockchain made Tron blockchain compel to come up with the Defi that can mitigate the limitation faces by the users in Ethereum blockchain.

Justin Sun, the founder of the Tron blockchain made a foundation called Just that will particularly focus on the implementation of Defi on the Tron blockchain. So Just foundation launched the Justswap protocol for swapping TRC20 tokens on the Tron network in August 2020.

Justswap is the first and only swapping platform for TRC20 tokens on the Tron blockchain which makes it more significant. The main focus of Justswap is to provide the users with fewer transaction fees unlike in Ethereum blockchain and to be more precise, in Uniswap. TRC20 tokens being compatible with ERC20 tokens makes Justswap a very good swapping platform for the users of both blockchains.

For working, Justswap is a protocol that uses smart contracts to swap and by using smart contracts, exchange or swapping of tokens and adding liquidity for swapping the TRC20 tokens can be handled easily as well as rapidly, removing the mediators results in less transaction fee in comparison to Uniswap, a swapping platform of Ethereum blockchain.


~Justswap platform and its sections~


There are sections or you can say features in the Justswap platform and now, I will be talking about those different sections in the Justswap platform.

IMG_20211008_222217.png

Fig2: Justswap and it's services

(1) Swap and liquidity mining


Exchanging and swapping TRC20 tokens instantly is the main function of the Justswap platform and the fees for trading or exchanging tokens is only 0.3%.

Liquidity mining is the other feature provided by Justswap where users can stake their assets and in return, they can get rewards for providing liquidity in the Justswap and Tron blockchain.

Liquidity mining and swapping both works in conjunction to make swapping easy by providing unlimited liquidity and providing rewards to the users who staked their assets for liquidity.

IMG_20211008_222541.png

Fig3: Justswap liquidity mining


IMG_20211008_222313.png

Fig4: Justswap

(2) Scan


In the scan section or feature, we can look for all the trading pairs that are being used in the Justswap platform, Scan section also provides the liquidity data or the liquidity in the Justswap platform along with the volume of that particular pair.

You can see all the trading pairs supported by the Justswap platform and you can also see that there is an unlimited space that can be filled by the trading pairs, which tells us that any TRC20 token having liquidity can also be exchanged or swapped.

You can see all the recent transactions made in the Justswap platform in the Transaction section of the Scan feature.


IMG_20211008_222803.png

Fig5: Scan section

IMG_20211008_222736.png

Fig6: Trading pairs on scan section

(3) Wrapped tokens


We can also swap TRX for WTRX and BTT for WBTT on the Justswap platform. Both WTRX and WBTT are the wrapped tokens of the TRX and BTT tokens.

Wrapped tokens WTRX and WBTT have the same value as TRX and BTT or they are made equivalent or pegged the same as TRX and BTT. Just like the stable coins.

WBTT and WTRX are the official TRC20 contracts for BTT and TRX tokens and can facilitate the exchanging or swapping function in the Tron blockchain and it can also provide interoperability.

IMG_20211008_223020.png

Fig7: WBTT Exchange


IMG_20211008_222955.png

Fig8:WTRX Exchange

~Importance of Justswap within Trom ecosystem blockchain~


Justswap plays a significant role in the Tron blockchain and the importance of Justswap is stated below:

(1) Fostering the sense of adoption of DeFi: As I mentioned above that the popularity of DeFi is increasing exponentially with time because of the facility DeFi provides, Justswap being a decentralised exchange on the Tron blockchain gains the attention of the users holding TRC20 token who wants to swap their tokens instantly. Justswap was the first exchange developed on the Tron blockchain and its popularity among TRC20 tokens holders will certainly foster the sense of adopting DeFi.


(2) Justswap, a decentralised exchange: Being a decentralised exchange, we don't need to get verified on Justswap by providing our ID to the exchange, as we do in centralised exchange like Binance. Decentralised exchange means that the users of the TRC20 token holders are in total control of their tokens unlike in centralised exchange.

A user just needs a Tron wallet to access the Justswap by linking his/her Tron wallet with it.


(3) Providing better service: Users don't have to wait for their order to get matched or fulfilled instead unlimited liquidity is present in the Justswap by which the process of swapping TRC20 tokens gets done in an instant.

Unlike Uniswap, an exchange of Ethereum, Justswap costs only 0.3% trading fee which is very less and that trading fee is distributed among the liquidity providers for providing liquidity in the Justswap platform.

Justswap provides its user with the facility to exchange tokens at a very low price and instantly.


(4) Easy to access and open-source: It is very easy to access Justswap by just connecting the Tron wallet to it. Justswap is also an open-source marketplace that means anyone can access it without any restriction and the process of exchanging the tokens is fair and transparent to all.

All the above-mentioned points make Justswap an important part of the Tron blockchain, every day thousands of users use Justswap to exchange their TRC20 tokens and providing liquidity to gain rewards.


Q-2) What tokens does JustSwap support trading? How is the price of a JustSwap token determined (how it works)? Use an illustration to explain it.

Justswap supports TRC20 tokens for trading as they are the token standard used for the implementation of the smart contracts transfers on the Tron blockchain, there are around 44 coins that are being traded on the Justswap and the number of trading pairs is 270.

Even though Justswap supports TRC20 tokens, it also supports TRX and BTT by wrapping these tokens and making them WTRX and WBTT, I have shown you that in the features section of the Justswap, WTRX and WBTT have the same value as TRX and BTT or they are pegged to the value of TRX and BTT just like the USDT.

IMG_20211009_143849.png

Q2, fig1: Tokens on justswap, Coingecko

This is the data that I get from the Coingecko.

Now for further information about the trading tokens on the Justswap platform, I go to a platform of Just(the foundation of Tron) called Justlist, it is a platform to prevent frauds in the Tron platform by providing only legit data and list of tokens that can be traded In the platform.

Both Justlist and Justswap show two categories of tokens and these categories are:

(A) Justswap default list(mainly traded on the platform.)

(B) Tron alliance list(tokens that are in alliance with the Tron blockchain are included too.)

IMG_20211009_143531.png

Q2, fig2: Category of Tokens on Justlist, Justlist

IMG_20211009_143552.png

Q2, fig3: Default Tokens on Justswap, Justlist

IMG_20211009_143614.png

Q2, fig4: Alliance Tokens on Justswap, Justlist

How the price of a token determined on the Justswap platform?


When we place trades on the centralised exchanges like Binance and Poloniex, we came across order book in which the bid price and ask price can be seen and the spread also, by looking at the bid price, ask price and the spread, traders trade at the centralised platform and wait for their orders to get fulfilled.

But when we talk about a decentralised exchange where intermediaries and mediators are removed and all the process of trading gets done with the help of smart contracts. It is a simple and fast process.

Justswap is an automated market maker or protocol that means it automatically provides liquidity from the liquidity pool on the Justswap platform for trading purposes. Smart contracts are also used to swap the TRC20 tokens, the liquidity provided by the liquidity providers are being used for the swapping purpose and in return, the liquidity providers get rewards from the trading fees.

graphic 1.png

Q2, fig5: Working of Justswap, by an illustration made by me

As all of us have seen that trading or swapping involves two tokens and thus Justswap uses smart contracts to maintain a relationship between the tokens that are being swapped and the relation is:

X*Y=k

Where,
X = Token 1
Y = Token 2
and K is the constant.

The number of a swapped token must be replaced with the other token and by doing this the value of constant K remains unaltered or the same for every swapping.

Now the point is if k remains the same and unchanged in the formula that means the number of token 1 is inversely proportional to the number of token 2.

So, if we increase the amount of token 1, there will be a decrease in the amount of token 2 and vice versa, this is called the constant product mechanism.

curve.png

Q2, fig6: How Price determined and vary in Justswap, by an illustration made by me

Price variation and proving that X and Y are inversely proportional


Now to prove that X and Y are inversely proportional to each other and they vary inversely to each other, I will be taking a real example in Justswap where I will be swapping TRX in a small amount and then in a large amount and we will see the variation in the price of conversion.

I have taken a pair of TRX and ETH and in the first example, you can see that for 10 TRX I was getting 0.000278169735030597 ETH. The price of conversion is 35949.273916 TRX per ETH.

Now for the second example, you can add that for 100000000 TRX I was getting 1526.777802324733845406 ETH. The price of conversion is 65497.415437 TRX per ETH.

As you can see that the amount of TRX per ETH approximately doubles itself when I wanted to purchase in a large amount and it all happened to balance the number of tokens 1 and 2 as well as to maintain the value of constant k.

IMG_20211009_153028.png

Q2, fig7: How Price varies in Justswap, taking a small amount of TRX

IMG_20211009_153047.png

Q2, fig8: How Price varies in Justswap, taking a large amount of TRX

Q-3) How do I connect my wallet to JustSwap.io? Is there a mobile app?

Steps to connect the Tron wallet with the Justswap are as follow:

(1) Open justswap and click on the connect wallet option.

(2) Choose TronLink wallet to connect the Tron wallet to Justswap.

(3) As I was already operating my Tron wallet from my mobile, I needed to restore it on the laptop.

(4) I named the account and chose to restore my account via Private key, there are three options available to restore the wallet, private key, mnemonics and Keystore.

(5) My Tron wallet got opened on the laptop and then I clicked on the connect wallet again to connect my wallet to Justswap.

(6) I approved the request to connect the wallet to the Justswap and confirmed it.

(7) My wallet was connected to the Justswap as you can see in the screenshot below.

IMG_20211009_153934.png

Q3, fig 1: Click on Connect wallet

IMG_20211009_154005.png

Q3, fig 2: Choose TronLink

IMG_20211009_154048.png

Q3, fig 3: Restore account

IMG_20211009_154120.png

Q3, fig 4: Name wallet

IMG_20211009_154145.png

Q3, fig 5: Choose Private key

IMG_20211009_154209.png

Q3, fig 6: Tron wallet opened

IMG_20211009_154307.png

Q3, fig 7: Approve request

IMG_20211009_154333.png

Q3, fig 8: Wallet connected with Justswap

Is there a Mobile app?


There is not any particular app for Justswap in mobile but in the TronLink Pro wallet(for the mobile user) we can find many Dapps based on the Tron ecosystem blockchain.

We can find Just, JustLend, Justswap, Sun.io, Tronscan and many other Dapps on the TronLink wallet on the mobile. It is very easy to access the Dapps and connect them to the TronLink wallet, they automatically get connected to the wallet and makes it easy for the users of the Tron blockchain.


Steps for Opening Justswap on mobile and connecting it to the wallet are as follow:

(1) Download the TronLink pro from the play store if you are an android user.

(2) Open the TronLink wallet, create a new one if you don't have any and if you have already a wallet you can restore it.

(3) Go to the Discover section where you can find many Dapps including Justswap.

(4) Click on Justswap to open the Justswap, after opening the Justswap your TronLink pro wallet will automatically get connected to Justswap.

(5) Now you can swap and provide liquidity in the liquidity pool easily without any laptop. I often use TronLink pro to access the Dapps on the Tron blockchain.

IMG_20211009_171821.jpg

Qp3, fig 9: Download TronLink pro

IMG_20211009_171922.jpg

Qp3, fig 10: Open TronLink pro and go to discover section


IMG_20211009_172014.jpg

Qp3, fig 11: Click on Justseap

IMG_20211009_172056.jpg

Qp3, fig 12: Connected TronLink pro wallet to Justswap

Q-4) Include a real example of your interaction with Just Swap, demonstrate how you can trade on the platform.

Steps for demonstrating how to trade tokens on Justswap are as follows:

(1) I opened my Tronlink Pro and checked my asset, I had 81 TRX and 17.6 WBTT in my wallet, then I clicked on the discover section to access the Dapps like Justswap.

(2) After clicking on the discover section, Justswap appeared and I clicked on it.

(3) Justswap opened and the swap function appeared in which it was asking From and to for conversion or swapping.

(4) I choose to convert 10 TRX into WBTT, I was getting 260 WBTT for 10 TRX, in this section, you can also see that the liquidity provider fee is 0.03 TRX, it is the same as I mentioned above that the trading fee is 0.3%, then I clicked on the swap.

(5) Then I confirmed the swap function and choose fast authorisation mode because we just only have to put our password once at the starting instead of putting a password for every transaction in safe mode, it is a fast way to do things but it is not much safe.

(6) Then I confirmed the transaction and a notification appeared telling me that my swap function was completed. While confirming the transaction, a warning appeared telling that "using smart contracts may consume energy and if energy isn't enough, it will burn TRX".

(7) Then I finally check my assets after the swapping and I had 66.72 TRX and 277.9 WBTT which confirmed my swap function.

A real example or my interaction with Justswap is given below

IMG_20211008_232309.jpg

Q4, Fig 1: Click on discover section and my assets

IMG_20211008_232352.jpg

Q4, Fig 2: Click on Justswap


IMG_20211008_233842.jpg

Q4, Fig 3: Swap section

IMG_20211008_233959.jpg

Q4, Fig 4: Fill swapping details


IMG_20211008_234220.jpg

Q4, Fig 5: Confirm swap

IMG_20211008_234317.jpg

Q4, Fig 6: Choose authorisation mode


IMG_20211008_234420.jpg

Q4, Fig 7: Confirm transaction

IMG_20211008_234457.jpg

Q4, Fig 8: Swap completed


IMG_20211008_234542.jpg

Q4, Fig 9: Assets after swapping

IMG_20211008_234744.jpg

Q4, Fig 10: Confirmation of swapping and details of transactions

Analysis of the Swap function


To analyse my Swap function I posted my address in Tronscan and the analysis that I did is given below:

(1) The Tronscan states that it is a Smart contract transaction as we all know from our theoretical knowledge.

(2) It shows that my transaction action was 10 TRX swap 260 WBTT.

(3) It shows that it is a TRC20 transfer as we all were talking about that Justswap swaps TRC20 tokens.

(4) I have consumed 350 Bandwidth, we have given 1500 bandwidth daily to transfer assets, it recharges automatically as the time passes.

(5) I have consumed 30,598 energy in the swap function, I had 0 energy in my wallet as you can see in the details also, so as I mentioned above that my TRX will burn if the energy is not enough. So my 4.28 TRX got burnt to compensate for the energy consumed(30.598) in the swap function.

Initially, I had 81 TRX and I swapped 10 TRX for WBTT, additionally, 4.28 TRX got burned to compensate for the consumed energy.

81 - 10 - 4.28 = 66.72(approx)

I had 66.72 TRX in my Tronlink wallet after the swapping which you can see in the screenshots above.


Additional Information: You can freeze TRX to get bandwidth and energy required in the transaction if you dont want to loose TRX.

OR

You can also use TronLending to lend energy, it costs 0.8 TRX a day for 100k energy for a day, by this you can save your TRX from burning.


Q-5) Include a real example of your interaction with Just Swap, explain How to add liquidity to JustSwap.

Steps for demonstrating how to add liquidity on Justswap are as follows:

(1) I opened my Tronlink Pro and checked my asset, I had 66.7 TRX and 277.9 WBTT in my wallet, then I clicked on the discover section to access the Dapps like Justswap.

(2) After clicking on the discover section, Justswap appeared and I clicked on it.

(3) Justswap opened and the pool function appeared in which it was asking Add liquidity, I clicked on add liquidity and a pair appeared in which TRX is the default and one is for the users to choose.

(4) I choose to add 10.63 TRX and 277.9 WBTT, the price was 0.0382 TRX per WBTT or 26.126 WBTT per TRX. Then I clicked on supply.

(5) I chose fast authorisation mode because we just only have to put our password once at the starting instead of putting a password for every transaction in safe mode, it is a fast way to do things but it is not much safe.

(6) Then I confirmed the transaction which has a function of approval, I had to approve WBTT because it was my first time adding WBTT to the liquidity pool and then a notification appeared telling me that my approve function was completed. While confirming the transaction, a warning appeared telling that "using smart contracts may consume energy and if energy isn't enough, it will burn TRX".

(7) Then I clicked on confirm supply of 10.6 TRX and 277.9 WBTT and in return, I would be getting 48.52 TRX/WBTT pool token.

(8) I confirmed the transaction which has a function of add liquidity then a notification appeared telling me that my add liquidity function was completed. While confirming the transaction, a warning appeared telling that "using smart contracts may consume energy and if energy isn't enough, it will burn TRX".

(9) Then the process of adding liquidity was completed and I got 48.52 TRX/WBTT tokens.

A real example or my interaction with Justswap is given below:

IMG_20211009_004858.jpg

Q5, Fig 1: Click on discover section and my assets

IMG_20211009_004939.jpg

Q5, Fig 2: Click on Justswap


IMG_20211009_005015.jpg

Q5, Fig 3: Click on add liquidity

IMG_20211009_005108.jpg

Q5, Fig 4: Add liquidity section


IMG_20211009_005154.jpg

Q5, Fig 5: Filling details

IMG_20211009_010003.jpg

Q5, Fig 6: Choose authorisation mode


IMG_20211009_005306.jpg

Q5, Fig 7: Confirm approval

IMG_20211009_005338.jpg

Q5, Fig 8: Approving WBTT


IMG_20211009_005436.jpg

Q5, Fig 9: Confirm supply

IMG_20211009_005520.jpg

Q5, Fig 10: Confirm transaction


IMG_20211009_005547.jpg

Q5, Fig 11: Signature confirmation

IMG_20211009_005619.jpg

Q5, Fig 12: Process of providing Liquidity is completed


IMG_20211009_010203.jpg

Q5, Fig 13: Approval verification from Tronscan

IMG_20211009_010340.jpg

Q5, Fig 14: Liquidity verification on Tronscan

Analysis of the Approve function


To analyse my Approve function I posted my address in Tronscan and the analysis that I did is given below:

(1) The Tronscan states that it is a Smart contract transaction as we all know from our theoretical knowledge.

(2) It shows that my transaction action was to approve the WBTT token for trading.

(3) I have consumed 345 Bandwidth, we have given 1500 bandwidth daily to transfer assets, it recharges automatically as the time passes.

(5) I have consumed 22,315 energy in the approve function, I had 0 energy in my wallet as you can see in the details also, so as I mentioned above that my TRX will burn if the energy is not enough. So my 3.12 TRX got burnt to compensate for the energy consumed(22,315) in the approve function.



Analysis of the Add liquidity function


To analyse my Add liquidity function I posted my address in Tronscan and the analysis that I did is given below:

(1) The Tronscan states that it is a Smart contract transaction as we all know from our theoretical knowledge.

(2) It shows that my transaction action was to add 10.6 TRX and 277.9 WBTT liquidity.

(3) It shows that it is a TRC20 transfer as we all were talking about that Justswap swaps TRC20 tokens.

(4) I have consumed 383 Bandwidth, we have given 1500 bandwidth daily to transfer assets, it recharges automatically as the time passes.

(5) I have consumed 58,112 energy in the add liquidity function, I had 0 energy in my wallet as you can see in the details also, so as I mentioned above that my TRX will burn if the energy is not enough. So my 8.1 TRX got burnt to compensate for the energy(58,112) in the add liquidity function.

Initially, I had 66.7 TRX and I burnt 3.12 TRX for approving WBTT, additionally, 8.1 TRX got burnt to compensate for the consumed energy. I provided 10.6 TRX for liquidity along with 277.9 WBTT.

66.72 - 3.12 - 8.1 - 10.6 = 44.82(approx) TRX

277.9 WBTT - 277.9 WBTT = 0 WBTT

I had 44.82 TRX and 0 WBTT in my Tronlink wallet after the add liquidity function which you can see in the screenshots below.

14.png

Q5, fig 15: My wallet after swapping, approving and Adding liquidity

Conclusion


The overwhelming response and demand of Defi platforms that remove the role of mediators and establish a pure decentralised network motivated the founder of Trin blockchain, Justin Sun to create Dapps on the Tron blockchain. The reason behind the attention towards Justswap being a decentralised exchange was the lower fees and instant swapping of the assets on the platform.

43 tokens and 270 pairs are being traded on the Justswap, TRC20 tokens standard make it possible to implement the smart contracts on the Tron blockchain, there are wrapped tokens too like WTRX and WBTT to make it suitable to trade as TRC20 tokens on Justswap platform.

Liquidity providers provide liquidity to the platform that helps in the swapping of the assets and in return, they get a reward. The trading fee on the platform is 0.3%.

It is very easy to access the Dapps when using TronLink Pro, the mobile version as it gets automatically connect to the TronLink wallet instead of connecting again and again.

A constant is maintained while swapping the tokens and an equal number of tokens is added to the pool, if purchasing of a token increases, the number of the swapped token decrease as the pair are inversely proportional to each other.

In a nutshell, Justswap is an efficient Dex that lowers the trading fee and instantly swaps the assets by maintaining a balance in the pool and keeping the same constant.

Thank you
That was all from my side

For the attention of professor @kouba01

Sort:  

Hello @sarveshnegi2811,
Thank you for participating in the 5th Week Crypto Course in its 4th season and for your efforts to complete the suggested tasks, you deserve a Total|10/10 rating, according to the following scale:

OriginalityCompliance with topicConsistency of methodQuality of analysisClarity of structure & language
(2/2)
(2/2)
(2/2)
(2/2)
(2/2)

My review :

Excellent and integrated content, as you respected all aspects required to be clarified, including the illustration.

Thanks again for your effort, and we look forward to reading your next work.
Sincerely,@kouba01

You have been upvoted by @sapwood, a Country Representative from INDIA. We are voting with the Steemit Community Curator @steemcurator07 account to support the newcomers coming into Steemit.

Engagement is essential to foster a sense of community. Therefore we would request our members to visit each other's post and make insightful comments.

Thank you.

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.028
BTC 57756.99
ETH 3058.42
USDT 1.00
SBD 2.26