Decentralized Application that uses a Smart Contract to allow/deny access to specific sections of the site
To get started developing for this projects, please clone the repo:
git clone https://github.com/adpinola/Subscription.gitThese two tools are not included in the package.json file, so you will need to add them manually
If you don't have the modules installed, execute this inside the project directory
cd Subscription
npm installTo run the project locally for development purposes, follow these steps:
- Open Ganache and start a blockchain.
- Once it´s available, copy one of the 10 account adresses available and replace that value in the field
__LOCAL_ACCOUNT__in the filetruffle-config.js. This account will be used to deploy the contract in your local dev environment. - In MetaMask, add the Ganache network. check the port in the Ganache UI
- Import the accounts using the MNEMONIC from Ganache.
- In your terminal, run
npm run dev. This will deploy the contract in the Ganache network and then will start the development server at port 3000
This application uses Truffle to test the contract code. Run the following command.
npm run contract:testThis will open a window with a list of every .spec file that is in the integration folder. If you click on one of them, it will open another window of the selected browser and start its test. You can visually track every step of the testing process and get snapshots.
To run the tests in "headless" mode (without the visual interface), run the following
npm run cypress:allThis project comes with three tools for checking code styles and syntax errors: ESLint, Prettier and Solhint. These are use to check both React and Contract code.
To check your code with both tools, you have to run
npm run linterTo auto-fix the auto-fixable issues with both tools, execute this
npm run formatYou can run the checkers and fixers separately.
Checking with ESLint
npm run lint:eslintChecking with Prettier
npm run lint:prettierAuto-fixing with ESLint
npm run format:eslintAuto-fixing with Prettier
npm run format:prettierThe specific linter for solidity code is Solhint. Run this command to execute the check
npm run solhintIn fact, what npm run linter and npm run format do is just executing the ESLint checker (or fixer) and then the Prettier checker (or fixer)
If you feel to contribute to this project, please open a PR!