Smart contract for crowdfunding that meets specific requirements. The smart contract will allow project owners to list various projects and initiate crowdfunding campaigns for each project. Users should be able to participate in the crowdfunding campaigns by interacting with the smart contract, such as sending funds.
.
├── contracts # Smart Contracts
├── scripts # Scripts
├── tasks # Interactions Hardhat Tasks
├── tests # Automated tests
└── README.md
- Install the dependencies, you may use either yarn or npm
- Compile the Smart Contract
- Run the tests and see the results
- Check the coverage
To see the currently available tasks run yarn hardhat
or npx hardhat
- Deploy
- Create Project
- Participate
- Retrieve Project
- Get all Projects
- Get contribution by User
- Withdraw
Note: To run on Goerli or Sepolia Network.
Create
.env
file, see.env.example
for more details.
yarn hardhat deploy --network sepolia
For simplicity amount is always in WEI
yarn hardhat create-project --crowdfunding "0xF241B32766781e867D08C9458Bb2939d687a7820" --participation-amount "10" --desc "Project For Funding" --title "Project One" --network sepolia
Project Created! Transaction hash: 0xef271aa179d1f54e04cb18f8e62c986a6e0f74a9437c508b34e8bc0ad16b3936
yarn hardhat participate --crowdfunding "0xF241B32766781e867D08C9458Bb2939d687a7820" --project-id "1" --amount "10" --network sepolia
Thanks for participation! Transaction hash: 0x90f931799a61c6dfc6ab34debd9d157a45d45d290699884b6ed4f3b86c81a99e
yarn hardhat project-details --crowdfunding "0xF241B32766781e867D08C9458Bb2939d687a7820" --project-id "1" --network sepolia
Project Found!
Id=[1]
Title=[Project One]
Description=[Project For Funding]
Owner=[0x4276653514F9206c2cB371DF4D530f6fEe0EDE17]
Participation Amount=[10]
Total Funding Amount=[10]
yarn hardhat projects --crowdfunding "0xF241B32766781e867D08C9458Bb2939d687a7820" --network sepolia
Project Found!
Id=[1]
Title=[Project One]
Description=[Project For Funding]
Owner=[0x4276653514F9206c2cB371DF4D530f6fEe0EDE17]
Participation Amount=[10]
Total Funding Amount=[10]
Project Found!
Id=[2]
Title=[Project Two]
Description=[Project For Funding]
Owner=[0x4276653514F9206c2cB371DF4D530f6fEe0EDE17]
Participation Amount=[100]
Total Funding Amount=[100]
yarn hardhat project-contribution --crowdfunding "0xF241B32766781e867D08C9458Bb2939d687a7820" --project-id "1" --user--address "0x4276653514F9206c2cB371DF4D530f6fEe0EDE17" --network sepolia
User=[0x4276653514F9206c2cB371DF4D530f6fEe0EDE17] contributed 10 wei
yarn hardhat withdraw --crowdfunding "0xF241B32766781e867D08C9458Bb2939d687a7820" --project-id "1" --network sepoli
Withdraw successful! Transaction hash: 0x345e25a16715c9288b4aea7ca7e6e6c32e76e2df3dad9aa0f762f364a0dec09c
Note: You can use either
yarn
ornpm
yarn install || npm install
yarn hardhat compile || npx hardhat compile
yarn hardhat test || npx hardhat test
yarn hardhat coverage || npx hardhat coverage