This project is built to serve as a starter for a descentralized exchange application. The project was built following the course 6-Figure Blockchain Developer from EatTheBlocks
It includes the dex contract, scripts to run and deploy local or on testnets and a basic front-end app that connects to the contract.
The stack used Solidity, Typescript, Hardhat, EthersJS, React (create-react-app), TailwindCSS
Clone the project locally and cd in the created directory
npm install
npx hardhat node
In another teminal window
npm run deploy:local
Contract is deployed by the first account created by Hardhat. Connect one of these accounts to your Metamask wallet to test it in front-end.
Seed your contract with data locally for development
npm run seed
Create a .env file based on the 'env.example' and provide the network url
(usually provided by INFURA or other provider).
npm run deploy -- --<network>
(Ex: npm run deploy -- --rinkeby)
Requires provision of the owner for the target network.
THIS CONTRACT HAS NOT BEEN TESTED ON ANY TESTNET YET
npm run test
cd frontend
npm install
Create a .env file based on the provided example (env.example) and set REACT_APP_ENVIRONMENT value to "local" to connect to local chain or <testnet> if you have the contract deployed to one of the networks. (currently supported by the scripts rinkeby and mumbai)
Also currently requires an INFURA project to connect to testnets and wallet.
npm start
Open http://localhost:3000 in browser
npm run build
npm test
npx hardhat accounts
npx hardhat compile
npx hardhat clean
npx hardhat test
npx hardhat node
npx hardhat help
REPORT_GAS=true npx hardhat test
npx hardhat coverage
npx hardhat run scripts/deploy.ts
TS_NODE_FILES=true npx ts-node scripts/deploy.ts
npx eslint '**/*.{js,ts}'
npx eslint '**/*.{js,ts}' --fix
npx prettier '**/*.{json,sol,md}' --check
npx prettier '**/*.{json,sol,md}' --write
npx solhint 'contracts/**/*.sol'
npx solhint 'contracts/**/*.sol' --fixTo try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten.
Then, copy the deployment address and paste it in to replace DEPLOYED_CONTRACT_ADDRESS in this command:
npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"For faster runs of your tests and scripts, consider skipping ts-node's type checking by setting the environment variable TS_NODE_TRANSPILE_ONLY to 1 in hardhat's environment. For more details see the documentation.