--------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
--------------------------|----------|----------|----------|----------|----------------|
contracts/ | 98.8 | 65.85 | 97.3 | 98.15 | |
GradeManager.sol | 100 | 75 | 100 | 96.55 | 100 |
GradeSBT.sol | 96.67 | 60.71 | 90.91 | 97.22 | 182 |
IGradeSBT.sol | 100 | 100 | 100 | 100 | |
IPresenceCounter.sol | 100 | 100 | 100 | 100 | |
ParticipationSFT.sol | 100 | 73.08 | 100 | 100 | |
PresenceCounter.sol | 100 | 50 | 100 | 100 | |
PresenceCounterMock.sol | 100 | 100 | 100 | 100 | |
--------------------------|----------|----------|----------|----------|----------------|
All files | 98.8 | 65.85 | 97.3 | 98.15 | |
--------------------------|----------|----------|----------|----------|----------------|
Before getting started, make sure you have the following prerequisites installed on your machine:
- Node.js (latest recommended version)
- npm or yarn
- Hardhat
-
Clone the project repository:
git clone [email protected]:matrixise/alyra-shingitai.git cd alyra-shingitai
-
You have to go to the project directory:
cd shingitai-backend
-
Install the necessary dependencies:
npm install
-
Verify that Hardhat is installed by running:
npx hardhat --version
To start a local Hardhat node, use the following command:
npx hardhat node
This will simulate a local blockchain network for development and testing purposes.
To execute the project's test suite, run:
npx hardhat test
This will run all the defined tests to ensure your smart contract functions correctly.
You can deploy your smart contract on the local Hardhat network by running:
npx hardhat ignition deploy ignition/modules/Deployments.js --network localhost
This allows you to interact with your smart contract in a development environment.
You can deploy your smart contract to the Sepolia test network using Hardhat. This allows you to test your contract in a public test environment.
- Sepolia Test Network: Ensure you have access to the Sepolia test network and have configured your Hardhat project with the necessary network settings.
- ETH on Sepolia: You need some Sepolia ETH to pay for deployment transactions. You can obtain Sepolia ETH from a faucet.
npx hardhat ignition deploy ignition/modules/Deployments.ts --network sepolia
The project uses a task file written in YAML to automate common Hardhat commands. This simplifies running tests, launching a node, and deploying smart contracts.
To use the task file, you need to install task
on your system. If you haven’t installed it yet, do so by running:
brew install go-task/tap/go-task
curl -sL https://taskfile.dev/install.sh | sh
Download and install task from taskfile.dev.
Once task
is installed, you can execute the commands defined in the Taskfile.yml
file.
task -l
task: Available tasks for this project:
* update-abi: Update the ABI everywhere.
* abi_generator:install:dependencies: Install the dependencies
* all:install:dependencies: Install the dependencies for each project
* backend:compile: Compile the smart contract
* backend:coverage: Run the coverage
* backend:deploy:hardhat: Deploy the SCs on Hardhat
* backend:deploy:sepolia: Deploy on Sepolia
* backend:format: Run the formatting system
* backend:hardhat:node: Run a Hardhat Node
* backend:install:dependencies: Install the dependencies
* backend:populate:hardhat: Populate SC
* backend:tests: Run the tests
* backoffice:format: Format the code
* backoffice:install:dependencies: Install the dependencies
* backoffice:lint: Run the linter
* certificate:format: Format the code
* certificate:install:dependencies: Install the dependencies
* certificate:lint: Run the linter
* github:actions: Run the Github Actions with act
* indexer:install:dependencies: Install the dependencies
* indexer:run: Run the Ponder node
* member:format: Format the code
* member:install:dependencies: Install the dependencies
* member:lint: Run the linter
* tools:badges:reduce-size: Reduce the size of the badges
* tools:badges:upload: Upload the Badges and Images to Pinata
* tools:install:dependencies: Install the dependencies
* tools:update-all: Update all
* tools:update:populate: Update the populate
task backend:install:dependencies
task backend:tests
task backend:hardhat:node
task backend:deploy:hardhat
To deploy your smart contract to the Sepolia network, use the following command:
task backend:deploy:sepolia
Using task
helps centralize and streamline the execution of essential project commands.
You can use act
to run your GitHub Actions workflows locally. This is useful for testing your CI/CD pipeline without
pushing changes to GitHub.
- Docker: Ensure Docker is installed and running on your machine.
- Act: You can download the binary from GitHub releases or install it via Homebrew.
brew install act
- Go to the act releases page.
- Download the appropriate binary for your operating system.
- Extract the binary and move it to a directory in your PATH.
Once act
is installed, you can simulate your GitHub Actions workflows locally. Make sure Docker is running, as act
uses Docker to execute the workflows.
- Navigate to the root of your project directory where the
.github/workflows
directory is located. - Run the following command to execute the default workflow:
act
- If you have multiple workflows or need to specify an event, you can use:
act <event_name>
Replace <event_name>
with the specific event you want to simulate, such as push
or pull_request
.
This setup allows you to test your workflows locally, ensuring they work as expected before committing changes to your repository.