Skip to content

DEX smart contract! learning the design behindđź“š

License

Notifications You must be signed in to change notification settings

gab0071/DEX-BACKEND

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CatellaTech DAO BACKEND 👷‍♂️⛓

Badge showing project license type Badge showing the solidity version Badge showing the hardhat version Author

This smart contract is a decentralized exchange (DEX) that allows users to trade ERC20 tokens. The contract is inheriting from the ERC20 interface, which means it is using the functionality of an existing ERC20 contract to keep track of Crypto Dev LP tokens being used on the exchange.

The contract has a public address, cryptoDevTokenAddress, which stores the ERC20 contract address of Crypto Dev LP tokens. The contract also has a constructor that is used to initialize the ERC20 contract address and set the token name and token.

The contract has two main functions: addLiquidity and getReserve. The addLiquidity function allows users to add liquidity to the exchange, which means that they are providing ERC20 and Ether tokens in exchange for LP tokens (a token created by the exchange contract). The getReserve function returns the number of Crypto Dev LP tokens that the contract has in reserve.

In general, this smart contract works as a decentralized exchange that allows users to exchange ERC20 tokens in a decentralized way and without the need to trust a third party to carry out the transactions.

Requirements ⬇

  • Build an exchange with only one asset pair (Eth / Crypto Dev)
  • Your Decentralized Exchange should take a fees of 1% on swaps
  • When user adds liquidity, they should be given Crypto Dev LP tokens (Liquidity Provider tokens)
  • CD LP tokens should be given proportional to the Ether user is willing to add to the liquidity

You can see the smart contract on Etherscan: Project.


Installing / Getting started

# Clone this project
$ git clone https://github.com/gab0071/DEX-BACKEND

# Access
$ cd DEX-BACKEND

# Install dependencies
$ npm install

Commands

  • $ npx hardhat compile
  • $ npx hardhat run scripts/deploy.js --network goerli

In the folder constants/index.js:

const CRYPTO_DEV_TOKEN_CONTRACT_ADDRESS = "ADDRESS-OF-CRYPTO-DEV-TOKEN";

module.exports = { CRYPTO_DEV_TOKEN_CONTRACT_ADDRESS };

Technologies / Built With

License

This project is under license from MIT. For more details, see the LICENSE file.

Contributing

Contributions are always welcome! Open a PR or an issue!


Made with ❤️ by catellaTech.

Releases

No releases published

Packages

No packages published