EQNOX DEX - A safe market for your stakes

By Kakashi_EQNOX | EQNOX | 26 Apr 2022

Disclaimer the examples provided are based on the testnet contract. They do not correspond to the reality of the mainnet contract, and should only be used for informative purposes.

EQNOX is the first certificate of deposit based on seasons. It was launched on January 1st, with a 3-month auction process to build liquidity, and has recently changed seasons. If you are new to EQNOX, or would like to know more about it, be sure to check our previous article on the ABCs of EQNOX!

Currently, on EQNOX, it's Spring, which means that by staking you'll be able to net a 1.47% minimum daily interest, and if you want to end a stake (which you totally shouldn't at least before finishing reading this article), you'll be able to do so on a 14.7% penalty. Pretty neat, right? But it gets better!

Around the third month of EQNOX, we started looking for ways to build an ecosystem around it. It's great that the predictability of the contract allows us to know that Winter and Autumn are the most active months (due to the high interest and 0-penalties, respectively), but the other seasons could be fun too!

So we set on this journey to find the next thing. We listened to our community and realized that one of the things that could be really useful would be a way to buy and sell stakes in a trustless way. That got us thinking "It sounds like a decentralized exchange. That's what we are going to make."


What is a DEX?

So, you want to get into crypto and all you've got are pieces of paper with people or structures drawn on them. You create an account on Binance, Kraken, or Coinbase, and they let you trade that money (fiat currency) for tokens (cryptocurrency). You can then do trades and move your tokens through other chains, the whole shebang. These are known as Centralized Exchanges. They're secure enough for you to use them since they are regulated by some sort of federal entity, but they are highly centralized because there is some third party controlling its operations. Decentralized Exchanges, on the other hand, are trustless exchanges, by means of smart contracts, that are not regulated and are completely decentralized. You may already use some of these such as Uniswap or PancakeSwap.

Stakes on an exchange?

I know, right? Exchanges deal with tokens, so why not stakes? And at this point, you may be wondering "why are they talking so much? why don't they just put it on PCS or something?". It can't be done. Easy as that. You see, stakes are the result of an activity performed over a stake, so they don't have proper quantifiability. Each stake is different in its own way, so it's not like we could say "I want to sell 3 stakes", and they're added to a liquidity pool. So we had to get smart about it. And smart about it we got. We designed an exchange contract specifically for this kind of activity in a way that the security of your stakes is our top priority.

The DEX contract

This contract was developed to allow you, to a decree, to perform financial activities over your stakes while continuously gaining interest. To that end, it has three features (that's it).

The first one is "listing", where you can pick your stake, and your price and list it. To this value, a dev fee is applied. The interface will inform you of that and inform you how much you'll earn so that you can take that into consideration.

The second one is "buying". You can get a list of stakes available for purchase, and you can get any one of them by paying the agreed price.

The third one is "cancelling". If you're not happy with any of your current listings, then you can get your stake back, without any additional costs (besides the BSC transaction cost) and, even better, your stake won't miss a day of interest.


The challenge of building a DEX for stakes

When we developed the EQNOX contract, we added some features that allow you to manage your stakes. You may know them as "account", "merge", "move", and "split". Moving stakes is, by far, the most important feature for the DEX. Without it, it wouldn't be possible for the stake to go from one wallet to another. But at the same time, one of our concerns was "what if anyone finds a way to move another person's stake?", so we limited the stake transfer to its owner. You, and only you, are able to move your stakes to another account.

At the same time, this posed a new challenge for us. The rules applied to accounts also apply to contracts! Therefore, there was no way a listing could be done in one single step. So we mustered our ideas, and we decided on a 3-step listing. You'd list the stake, then transfer it, and finally confirm it. But to do so, in a way that you could do this in a safe way, we added four conditions.

The first one is that you can only list one stake at a time. Until you confirm the current stake, you cannot list another one.

The second one is that only a handful of users can stake at a given time. Whenever a stake is confirmed, a new user can list a stake.

The third one is that there should be a time window in which you are allowed to confirm a stake so that you don't lock other users out. This time window is quite generous, but you should always have enough BNB to run the three transactions. We'll get to that in a bit.

The fourth one reinforces the latter by penalizing someone that locks other users. This is done through a security deposit. The way the security deposit is made is by sending a certain amount of BUSD as a pledge that you'll finish the process. When you confirm the listing, you get it all back. If you don't confirm it, you don't. This way, the likelihood of locking out the contract on purpose is minimal.

Using the DEX

The DEX will be available on our website as well as any other activity we have. When the contract launches, you'll notice that your menu has a new option (DAX tab).

EQNOX's main menu


Depending on whether you have an unconfirmed stake or not, this tab is composed of five to six sections.

The first one gives you a general idea of what's happening in the DEX, such as the number of available stakes for sale, and some data on your listings.

General section

The second one appears when you have an incomplete listing. It allows you to continue the listing from where you left and gives you an idea of how long you have until the listing expires. Don't worry if your listing expires. While we don't encourage you to wait for the last moment before it expires, we've made it so that even if displays "expired", you still have a chance to finish the process as long as someone else hasn't taken your spot.

Unconfirmed Listings

The third one lists stakes that you can buy. You can order them by price or shares per BUSD

Buy a stake section

By pressing the buy button, you'll be prompted with a confirmation for the purchase. No muss, no fuss.

purchase confirmation


The fourth one lets you pick a stake to list. You can perform the same action on the staking tab as well!

Sell a stake section

One thing that we are really happy with it was how seamless the listing goes. If it wasn't for the three signatures, you wouldn't even notice that it was a 3-step process. You may have to do a BUSD transaction approval before the first step, if you haven't allowed BUSD transfers for the DEX contract before.

selling a stake


The fifth one displays your listings. From here you can cancel active listings, and check your Cancelled or Annuled (removed after losing the spot due to expiration) listings. 

my listings section

Canceling a listing is also a straightforward process with a prompt informing that you receive your stake back.

canceling a listing

And last, but not least, the history section. Here you can check any info on stakes that you either bought or sold.

history section

Final Thoughts

The DEX contract was quite the challenge, but it also made us appreciate the thought we give to two important aspects of any smart contract. The future that we want to build, and the security and stability that we want to provide. These two walk hand in hand, and if we focus too much on one, it might affect the other.

We want to bring this lesson with us to new developments, and you'll be able to see that when the PulseChain launches. That being said, the current article and contract code only apply to the staking DEX on BSC, and you can expect a different approach when we launch on PC. 

We hope you enjoy using the DEX!

Thank you for your support,




How do you rate this article?



EQUNOX is a certificate of deposit project on the Binance Smart Chain network. It dynamizes interest and penalties through the concept of seasons, where you'll gain more interest during the winter and have no penalties during the autumn. Through this basis and a participation of the community on tokenomic decisions, EQNOX is both a disruptive technology for traditional finance and early Certificate of Deposit tokens.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.