rahataid / rahat-platform

Rahat-Platform is a backend for Rahat, also known as Rahat core
https://docs.rahat.io
GNU Lesser General Public License v3.0
3 stars 13 forks source link

Hardhat-Ignition contracts deployement scripts #146

Open myanzik opened 1 month ago

myanzik commented 1 month ago

In the Rahat project, we need to automate the deployment of three key smart contracts: RahatAccessManager, RahatToken, and RahatTreasury. These contracts are critical to managing access control, token distribution, and treasury functions within the platform.

This issue involves creating deployment scripts using Hardhat-Ignition for automating the process. Hardhat-Ignition is a Hardhat plugin that simplifies complex deployments and handles various contract configurations across different environments. The scripts will ensure seamless contract deployment to specified networks (e.g., local, testnet, mainnet) with the necessary contract dependencies.

Acceptance Criteria:

  1. Deploy Smart Contracts:

    • Create deployment scripts for the following contracts:
      • RahatAccessManager: For managing roles and permissions within the system.
      • RahatToken: The token contract used for issuing tokens on the platform.
      • RahatTreasury: The contract responsible for managing and releasing funds from the treasury.
  2. Parameter Configuration:

    • The scripts must allow dynamic configuration of parameters (e.g., initial supply for RahatToken, admin addresses for RahatAccessManager) through environment variables or configuration files.
  3. Sequential Deployment:

    • Ensure that contracts are deployed in the correct order:
      1. RahatAccessManager (to set up role-based access control).
      2. RahatToken (to issue tokens with proper permissions from RahatAccessManager).
      3. RahatTreasury (to manage the treasury using tokens and access control).
  4. Contract Interaction Setup:

    • Once deployed, the scripts should automatically configure interactions between contracts:
      • RahatToken should reference the RahatAccessManager for role-based control.
      • RahatTreasury should be connected to both RahatAccessManager (for permissions) and RahatToken (for token transfers).
  5. Deployment to Multiple Networks:

    • Provide support for deployment to multiple networks (e.g., local development network, testnets like Rinkeby, mainnet).
    • Ensure deployment configuration can switch between network environments by using Hardhat's network management.
  6. Logging and Feedback:

    • Include clear console logs for each step of the deployment, including:
      • Contract addresses after deployment.
      • Confirmation of contract interactions and dependencies.
    • Provide feedback in case of deployment failures, such as missing parameters or failed transactions.

Tasks:

  1. Install Hardhat-Ignition:

    npm install --save-dev @nomicfoundation/hardhat-ignition
  2. Create Deployment Scripts:

    • Inside the deploy folder, create separate deployment scripts for each contract:
      • deployRahatAccessManager.ts
      • deployRahatToken.ts
      • deployRahatTreasury.ts

References:

Preet-taparia commented 1 month ago

hey i would like to work on it, and you have written the title as "Harhat" instead of "Hardhat"

myanzik commented 1 month ago

Sure. @Preet-taparia . Just assigned to you

Preet-taparia commented 1 month ago

@myanzik the README.md is most probably not updated as few of the instructions are not that clear or outdated like it is asking for cloning rahataid/rahat-platform-nx, and pnpm getEth is no longer there instead geteth is used, and same is case for the documentation, maybe it is because the repository was recently updated but it is causing me few problem with installation.

Few of the instance while installation:

pnpm bootstrap

image

Though i am able to see Swagger UI using pnpm rahat

But i am not able to use Application

image

Is this expected behaviour? and should i continue the development, or have i messed up somewhere

manjik-rumsan commented 1 month ago

@Preet-taparia thanks for pointing out in documentation.

I think its working fine. This is just the backend services. you need to run following in this repo

rahat-core

pnpm rahat

rahat-beneficiary-service

pnpm beneficiary

for frontend you need to run this project rahat-ui

for the task you are working on , you need to go through the apps/contracts and setup the deployment scripts.