├── .eslintrc.json
├── public
├── favicon.ico
└── vercel.svg
├── .babelrc
├── artifacts
└── contracts
│ └── Campaign.sol
│ ├── Campaign.dbg.json
│ ├── CampaignFactory.dbg.json
│ ├── Campaign.json
│ └── CampaignFactory.json
├── style
└── global.css
├── pages
├── api
│ └── hello.js
├── createcampaign.js
├── _app.js
├── dashboard.js
├── index.js
└── [address].js
├── next.config.js
├── components
├── layout
│ ├── components
│ │ ├── HeaderLogo.js
│ │ ├── HeaderRight.js
│ │ ├── HeaderNav.js
│ │ └── Wallet.js
│ ├── themes.js
│ ├── Header.js
│ └── Layout.js
└── Form
│ ├── Components
│ ├── FormLeftWrapper.js
│ └── FormRightWrapper.js
│ └── Form.js
├── scripts
└── deploy.js
├── .gitignore
├── hardhat.config.js
├── package.json
├── cache
└── solidity-files-cache.json
├── test.js
├── README.md
└── contracts
└── Campaign.sol
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shuvishubham/web3-fundraiser-youtube/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["next/babel"],
3 | "plugins": [
4 | ["styled-components", { "ssr": true }]
5 | ]
6 | }
--------------------------------------------------------------------------------
/artifacts/contracts/Campaign.sol/Campaign.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "..\\..\\build-info\\4448f5bb50d1994d4b5be7351d05708e.json"
4 | }
5 |
--------------------------------------------------------------------------------
/artifacts/contracts/Campaign.sol/CampaignFactory.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "..\\..\\build-info\\4448f5bb50d1994d4b5be7351d05708e.json"
4 | }
5 |
--------------------------------------------------------------------------------
/style/global.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Poppins&family=Roboto&display=swap');
2 | @import url('https://fonts.googleapis.com/css2?family=Praise&display=swap');
--------------------------------------------------------------------------------
/pages/api/hello.js:
--------------------------------------------------------------------------------
1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2 |
3 | export default function handler(req, res) {
4 | res.status(200).json({ name: 'John Doe' })
5 | }
6 |
--------------------------------------------------------------------------------
/pages/createcampaign.js:
--------------------------------------------------------------------------------
1 | import Form from '../components/Form/Form';
2 |
3 | const createcampaign = () => {
4 | return (
5 |
6 |
7 |
8 | )
9 | }
10 |
11 | export default createcampaign
--------------------------------------------------------------------------------
/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {
3 | reactStrictMode: true,
4 | images: {
5 | domains: ['ipfs.infura.io', 'th.bing.com', 'crowdfunding.infura-ipfs.io']
6 | }
7 | }
8 |
9 | module.exports = nextConfig
10 |
--------------------------------------------------------------------------------
/pages/_app.js:
--------------------------------------------------------------------------------
1 | import Layout from '../components/layout/Layout';
2 | import '../style/global.css'
3 |
4 | function MyApp({ Component, pageProps }) {
5 | return (
6 |
7 |
8 |
9 | )
10 | }
11 |
12 | export default MyApp
13 |
--------------------------------------------------------------------------------
/components/layout/components/HeaderLogo.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 |
3 | const HeaderLogo = () => {
4 | return (
5 | The Saviour
6 | )
7 | }
8 |
9 | const Logo = styled.h1`
10 | font-weight: normal;
11 | font-size: 40px;
12 | margin-left: 11px;
13 | font-family: 'Praise';
14 | letter-spacing: 3px;
15 | cursor: pointer;
16 | `
17 |
18 | export default HeaderLogo
--------------------------------------------------------------------------------
/scripts/deploy.js:
--------------------------------------------------------------------------------
1 | const hre = require('hardhat');
2 |
3 | async function main() {
4 |
5 | const CampaignFactory = await hre.ethers.getContractFactory("CampaignFactory")
6 | const campaignFactory = await CampaignFactory.deploy();
7 |
8 | await campaignFactory.deployed();
9 |
10 | console.log("Factory deployed to:", campaignFactory.address);
11 | }
12 |
13 | main()
14 | .then(() => process.exit(0))
15 | .catch((error) => {
16 | console.log(error);
17 | process.exit(1);
18 | });
--------------------------------------------------------------------------------
/components/layout/themes.js:
--------------------------------------------------------------------------------
1 | const light = {
2 | color: "#000",
3 | bgColor: '#efe7fd',
4 | bgImage: 'linear-gradient(180deg, #efe7fd 0%, #bdccf7 60%)',
5 | bgDiv: '#fff',
6 | bgSubDiv: '#efe7fd'
7 | }
8 |
9 | const dark = {
10 | color: '#fff',
11 | bgColor: '#923cb5',
12 | bgImage: 'linear-gradient(180deg, #2f0f3d 5%, #000000 90%)',
13 | bgDiv: 'black',
14 | bgSubDiv: 'rgb(33, 36, 41)'
15 | }
16 |
17 | const themes = {
18 | light: light,
19 | dark: dark,
20 | }
21 |
22 | export default themes;
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 | .pnpm-debug.log*
27 |
28 | # local env files
29 | .env.local
30 | .env.development.local
31 | .env.test.local
32 | .env.production.local
33 |
34 | # vercel
35 | .vercel
36 |
--------------------------------------------------------------------------------
/components/layout/Header.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | import HeaderLogo from './components/HeaderLogo'
3 | import HeaderNav from './components/HeaderNav'
4 | import HeaderRight from './components/HeaderRight'
5 |
6 | const Header = () => {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 | )
14 | };
15 |
16 | const HeaderWrapper = styled.div`
17 | width: 100%;
18 | height: 70px;
19 | display: flex;
20 | justify-content: space-between;
21 | align-items: center;
22 | `
23 |
24 | export default Header
--------------------------------------------------------------------------------
/hardhat.config.js:
--------------------------------------------------------------------------------
1 | require("@nomiclabs/hardhat-waffle");
2 | require('dotenv').config({ path: './.env.local' });
3 |
4 | task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
5 | const accounts = await hre.ethers.getSigners();
6 |
7 | for (const account of accounts) {
8 | console.log(account.address);
9 | }
10 | })
11 |
12 | const privateKey = process.env.NEXT_PUBLIC_PRIVATE_KEY
13 |
14 | module.exports = {
15 | solidity: "0.8.10",
16 | defaultNetwork: "polygon",
17 | networks: {
18 | hardhat: {},
19 | polygon: {
20 | url: process.env.NEXT_PUBLIC_RPC_URL,
21 | accounts: [privateKey]
22 | }
23 | }
24 | };
25 |
26 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "thesaviour",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@emotion/react": "^11.8.1",
13 | "@emotion/styled": "^11.8.1",
14 | "@mui/icons-material": "^5.4.2",
15 | "@mui/material": "^5.4.3",
16 | "@mui/styled-engine-sc": "^5.4.2",
17 | "dotenv": "^16.0.0",
18 | "ipfs-http-client": "^56.0.1",
19 | "next": "12.1.0",
20 | "react": "17.0.2",
21 | "react-dom": "17.0.2",
22 | "react-loader-spinner": "^6.0.0-0",
23 | "react-toastify": "^8.2.0",
24 | "styled-components": "^5.3.3"
25 | },
26 | "devDependencies": {
27 | "@nomiclabs/hardhat-ethers": "^2.0.5",
28 | "@nomiclabs/hardhat-waffle": "^2.0.2",
29 | "babel-plugin-styled-components": "^2.0.6",
30 | "chai": "^4.3.6",
31 | "eslint": "8.9.0",
32 | "eslint-config-next": "12.1.0",
33 | "ethereum-waffle": "^3.4.0",
34 | "ethers": "^5.5.4"
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/cache/solidity-files-cache.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-cache-2",
3 | "files": {
4 | "C:\\Users\\shiva\\Desktop\\crowdfunding\\contracts\\Campaign.sol": {
5 | "lastModificationDate": 1663503202186,
6 | "contentHash": "a26a33820a548406f476441a9d80ba9e",
7 | "sourceName": "contracts/Campaign.sol",
8 | "solcConfig": {
9 | "version": "0.8.10",
10 | "settings": {
11 | "optimizer": {
12 | "enabled": false,
13 | "runs": 200
14 | },
15 | "outputSelection": {
16 | "*": {
17 | "*": [
18 | "abi",
19 | "evm.bytecode",
20 | "evm.deployedBytecode",
21 | "evm.methodIdentifiers",
22 | "metadata"
23 | ],
24 | "": [
25 | "ast"
26 | ]
27 | }
28 | }
29 | }
30 | },
31 | "imports": [],
32 | "versionPragmas": [
33 | ">0.7.0 <=0.9.0"
34 | ],
35 | "artifacts": [
36 | "Campaign",
37 | "CampaignFactory"
38 | ]
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/components/layout/components/HeaderRight.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | import Brightness7Icon from '@mui/icons-material/Brightness7';
3 | import DarkModeIcon from '@mui/icons-material/DarkMode';
4 | import {App} from '../Layout';
5 | import { useContext } from 'react';
6 | import Wallet from './Wallet';
7 |
8 |
9 | const HeaderRight = () => {
10 | const ThemeToggler = useContext(App);
11 |
12 | return (
13 |
14 |
15 |
16 | {ThemeToggler.theme === 'light' ? : }
17 |
18 |
19 | )
20 | }
21 |
22 | const HeaderRightWrapper = styled.div`
23 | display: flex;
24 | justify-content: center;
25 | align-items: center;
26 | margin-right: 16px;
27 | height: 50%;
28 | `
29 | const ThemeToggle = styled.div`
30 | display: flex;
31 | justify-content: center;
32 | align-items: center;
33 | background-color: ${(props) => props.theme.bgDiv};
34 | height: 100%;
35 | padding: 5px;
36 | width: 45px;
37 | border-radius: 12px;
38 | cursor: pointer;
39 | `
40 |
41 | export default HeaderRight
--------------------------------------------------------------------------------
/components/layout/Layout.js:
--------------------------------------------------------------------------------
1 | import Header from "./Header";
2 | import themes from "./themes";
3 | import styled, { ThemeProvider, createGlobalStyle } from "styled-components";
4 | import { useState, createContext } from "react";
5 | import { ToastContainer } from 'react-toastify';
6 | import 'react-toastify/dist/ReactToastify.css';
7 |
8 | const App = createContext();
9 |
10 | const Layout = ({ children }) => {
11 | const [theme, setTheme] = useState("light");
12 |
13 | const changeTheme = () => {
14 | setTheme(theme == "light" ? "dark" : "light");
15 | };
16 |
17 | return (
18 |
19 |
20 |
21 |
22 |
23 |
24 | {children}
25 |
26 |
27 |
28 | );
29 | }
30 |
31 | const GlobalStyle = createGlobalStyle`
32 | body {
33 | margin: 0;
34 | padding: 0;
35 | overflow-x: hidden;
36 | }
37 | `;
38 |
39 | const LayoutWrapper = styled.div`
40 | min-height: 100vh;
41 | background-color: ${(props) => props.theme.bgColor};
42 | background-image: ${(props) => props.theme.bgImage};
43 | color: ${(props) => props.theme.color};
44 | `;
45 |
46 | export default Layout;
47 | export { App };
48 |
--------------------------------------------------------------------------------
/test.js:
--------------------------------------------------------------------------------
1 | const CampaignFactory = require("./artifacts/contracts/Campaign.sol/CampaignFactory.json");
2 | const Campaign = require("./artifacts/contracts/Campaign.sol/Campaign.json");
3 | const { ethers } = require("ethers");
4 | require("dotenv").config({ path: "./.env.local" });
5 |
6 | const main = async () => {
7 | // const provider = new ethers.providers.JsonRpcProvider(
8 | // process.env.NEXT_PUBLIC_RPC_URL
9 | // );
10 |
11 | // const contract = new ethers.Contract(
12 | // process.env.NEXT_PUBLIC_ADDRESS,
13 | // CampaignFactory.abi,
14 | // provider
15 | // );
16 |
17 | // const getDeployedCampaign = contract.filters.campaignCreated(null,null,null,null,null,null,'Health');
18 | // let events = await contract.queryFilter(getDeployedCampaign);
19 | // let event = events.reverse();
20 | // console.log(event);
21 |
22 | const provider = new ethers.providers.JsonRpcProvider(
23 | process.env.NEXT_PUBLIC_RPC_URL
24 | );
25 |
26 | const contract = new ethers.Contract(
27 | "0x813b7E7972D4E64D0481BA48517bCe4df480d51e",
28 | Campaign.abi,
29 | provider
30 | );
31 |
32 | const Donations = contract.filters.donated('0xc538779A628a21D7CCA7b1a3E57E92f5226C3E27');
33 | const AllDonations = await contract.queryFilter(Donations);
34 |
35 | const DonationsData = AllDonations.map((e) => {
36 | return {
37 | donar: e.args.donar,
38 | amount: parseInt(e.args.amount),
39 | timestamp : parseInt(e.args.timestamp)
40 | }});
41 |
42 | console.log(DonationsData);
43 |
44 | };
45 |
46 | main();
47 |
--------------------------------------------------------------------------------
/components/layout/components/HeaderNav.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | import { useRouter } from 'next/router';
3 | import Link from 'next/link';
4 |
5 | const HeaderNav = () => {
6 | const Router = useRouter();
7 |
8 | return (
9 |
10 |
11 | Campaigns
12 |
13 |
14 | Create Campaign
15 |
16 |
17 | Dashboard
18 |
19 |
20 | )
21 | }
22 |
23 | const HeaderNavWrapper = styled.div`
24 | display: flex;
25 | align-items: center;
26 | justify-content: space-between;
27 | background-color: ${(props) => props.theme.bgDiv};
28 | padding: 6px;
29 | height: 50%;
30 | border-radius: 10px;
31 | `
32 |
33 | const HeaderNavLinks = styled.div`
34 | display: flex;
35 | align-items: center;
36 | justify-content: space-between;
37 | background-color: ${(props) => props.active ? props.theme.bgSubDiv : props.theme.bgDiv };
38 | height: 100%;
39 | font-family: 'Roboto';
40 | margin: 5px;
41 | border-radius: 10px;
42 | padding: 0 5px 0 5px;
43 | cursor: pointer;
44 | text-transform: uppercase;
45 | font-weight: bold;
46 | font-size: small;
47 | `
48 |
49 | export default HeaderNav
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2 |
3 | ## Getting Started
4 |
5 | First, run the development server:
6 |
7 | ```bash
8 | npm run dev
9 | # or
10 | yarn dev
11 | ```
12 |
13 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14 |
15 | You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16 |
17 | [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18 |
19 | The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20 |
21 | ## Learn More
22 |
23 | To learn more about Next.js, take a look at the following resources:
24 |
25 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27 |
28 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29 |
30 | ## Deploy on Vercel
31 |
32 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33 |
34 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
35 |
--------------------------------------------------------------------------------
/components/Form/Components/FormLeftWrapper.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | import { FormState } from '../Form';
3 | import { useContext } from 'react';
4 |
5 | const FormLeftWrapper = () => {
6 | const Handler = useContext(FormState);
7 |
8 | return (
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
19 |
20 |
21 | )
22 | }
23 |
24 | const FormLeft = styled.div`
25 | width:48%;
26 | `
27 |
28 | const FormInput = styled.div`
29 | display:flex ;
30 | flex-direction:column;
31 | font-family:'poppins';
32 | margin-top:10px ;
33 | `
34 | const Input = styled.input`
35 | padding:15px;
36 | background-color:${(props) => props.theme.bgDiv} ;
37 | color:${(props) => props.theme.color} ;
38 | margin-top:4px;
39 | border:none ;
40 | border-radius:8px ;
41 | outline:none;
42 | font-size:large;
43 | width:100% ;
44 | `
45 |
46 | const TextArea = styled.textarea`
47 | padding:15px;
48 | background-color:${(props) => props.theme.bgDiv} ;
49 | color:${(props) => props.theme.color} ;
50 | margin-top:4px;
51 | border:none;
52 | border-radius:8px ;
53 | outline:none;
54 | font-size:large;
55 | max-width:100%;
56 | min-width:100%;
57 | overflow-x:hidden;
58 | min-height:160px ;
59 | `
60 |
61 | export default FormLeftWrapper;
--------------------------------------------------------------------------------
/contracts/Campaign.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Unlicensed
2 |
3 | pragma solidity >0.7.0 <=0.9.0;
4 |
5 | contract CampaignFactory {
6 | address[] public deployedCampaigns;
7 |
8 | event campaignCreated(
9 | string title,
10 | uint requiredAmount,
11 | address indexed owner,
12 | address campaignAddress,
13 | string imgURI,
14 | uint indexed timestamp,
15 | string indexed category
16 | );
17 |
18 | function createCampaign(
19 | string memory campaignTitle,
20 | uint requiredCampaignAmount,
21 | string memory imgURI,
22 | string memory category,
23 | string memory storyURI) public
24 | {
25 |
26 | Campaign newCampaign = new Campaign(
27 | campaignTitle, requiredCampaignAmount, imgURI, storyURI, msg.sender);
28 |
29 |
30 | deployedCampaigns.push(address(newCampaign));
31 |
32 | emit campaignCreated(
33 | campaignTitle,
34 | requiredCampaignAmount,
35 | msg.sender,
36 | address(newCampaign),
37 | imgURI,
38 | block.timestamp,
39 | category
40 | );
41 |
42 | }
43 | }
44 |
45 |
46 | contract Campaign {
47 | string public title;
48 | uint public requiredAmount;
49 | string public image;
50 | string public story;
51 | address payable public owner;
52 | uint public receivedAmount;
53 |
54 | event donated(address indexed donar, uint indexed amount, uint indexed timestamp);
55 |
56 | constructor(
57 | string memory campaignTitle,
58 | uint requiredCampaignAmount,
59 | string memory imgURI,
60 | string memory storyURI,
61 | address campaignOwner
62 | ) {
63 | title = campaignTitle;
64 | requiredAmount = requiredCampaignAmount;
65 | image = imgURI;
66 | story = storyURI;
67 | owner = payable(campaignOwner);
68 | }
69 |
70 | function donate() public payable {
71 | require(requiredAmount > receivedAmount, "required amount fullfilled");
72 | owner.transfer(msg.value);
73 | receivedAmount += msg.value;
74 | emit donated(msg.sender, msg.value, block.timestamp);
75 | }
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/components/layout/components/Wallet.js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 | import { ethers } from "ethers";
3 | import { useState } from "react";
4 |
5 |
6 | const networks = {
7 | polygon: {
8 | chainId: `0x${Number(80001).toString(16)}`,
9 | chainName: "Polygon Testnet",
10 | nativeCurrency: {
11 | name: "MATIC",
12 | symbol: "MATIC",
13 | decimals: 18,
14 | },
15 | rpcUrls: ["https://rpc-mumbai.maticvigil.com/"],
16 | blockExplorerUrls: ["https://mumbai.polygonscan.com/"],
17 | },
18 | };
19 |
20 |
21 | const Wallet = () => {
22 | const [address, setAddress] = useState("");
23 | const [balance, setBalance] = useState("");
24 |
25 |
26 | const connectWallet = async () => {
27 | await window.ethereum.request({ method: "eth_requestAccounts" });
28 | const provider = new ethers.providers.Web3Provider(window.ethereum, "any");
29 | if (provider.network !== "matic") {
30 | await window.ethereum.request({
31 | method: "wallet_addEthereumChain",
32 | params: [
33 | {
34 | ...networks["polygon"],
35 | },
36 | ],
37 | });
38 | }
39 | const account = provider.getSigner();
40 | const Address = await account.getAddress();
41 | setAddress(Address);
42 | const Balance = ethers.utils.formatEther(await account.getBalance());
43 | setBalance(Balance);
44 |
45 | };
46 |
47 | return (
48 |
49 | {balance == '' ? : {balance.slice(0,4)} Matic }
50 | {address == '' ? Connect Wallet : {address.slice(0,6)}...{address.slice(39)}}
51 |
52 | );
53 | };
54 |
55 | const ConnectWalletWrapper = styled.div`
56 | display: flex;
57 | align-items: center;
58 | justify-content: space-between;
59 | background-color: ${(props) => props.theme.bgDiv};
60 | padding: 5px 9px;
61 | height: 100%;
62 | color: ${(props) => props.theme.color};
63 | border-radius: 10px;
64 | margin-right: 15px;
65 | font-family: 'Roboto';
66 | font-weight: bold;
67 | font-size: small;
68 | cursor: pointer;
69 | `;
70 |
71 | const Address = styled.h2`
72 | background-color: ${(props) => props.theme.bgSubDiv};
73 | height: 100%;
74 | display: flex;
75 | align-items: center;
76 | justify-content: center;
77 | padding: 0 5px 0 5px;
78 | border-radius: 10px;
79 | `
80 |
81 | const Balance = styled.h2`
82 | display: flex;
83 | height: 100%;
84 | align-items: center;
85 | justify-content: center;
86 | margin-right: 5px;
87 | `
88 |
89 | export default Wallet;
--------------------------------------------------------------------------------
/components/Form/Form.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | import FormLeftWrapper from './Components/FormLeftWrapper'
3 | import FormRightWrapper from './Components/FormRightWrapper'
4 | import { createContext, useState } from 'react';
5 | import {TailSpin} from 'react-loader-spinner';
6 | import {ethers} from 'ethers';
7 | import {toast} from 'react-toastify';
8 | import CampaignFactory from '../../artifacts/contracts/Campaign.sol/CampaignFactory.json'
9 |
10 | const FormState = createContext();
11 |
12 | const Form = () => {
13 | const [form, setForm] = useState({
14 | campaignTitle: "",
15 | story: "",
16 | requiredAmount: "",
17 | category: "education",
18 | });
19 |
20 | const [loading, setLoading] = useState(false);
21 | const [address, setAddress] = useState("");
22 | const [uploaded, setUploaded] = useState(false);
23 |
24 | const [storyUrl, setStoryUrl] = useState();
25 | const [imageUrl, setImageUrl] = useState();
26 |
27 | const FormHandler = (e) => {
28 | setForm({
29 | ...form,
30 | [e.target.name]: e.target.value
31 | })
32 | }
33 |
34 | const [image, setImage] = useState(null);
35 |
36 | const ImageHandler = (e) => {
37 | setImage(e.target.files[0]);
38 | }
39 |
40 | const startCampaign = async (e) => {
41 | e.preventDefault();
42 | const provider = new ethers.providers.Web3Provider(window.ethereum);
43 | const signer = provider.getSigner();
44 |
45 | if(form.campaignTitle === "") {
46 | toast.warn("Title Field Is Empty");
47 | } else if(form.story === "" ) {
48 | toast.warn("Story Field Is Empty");
49 | } else if(form.requiredAmount === "") {
50 | toast.warn("Required Amount Field Is Empty");
51 | } else if(uploaded == false) {
52 | toast.warn("Files Upload Required")
53 | }
54 | else {
55 | setLoading(true);
56 |
57 | const contract = new ethers.Contract(
58 | process.env.NEXT_PUBLIC_ADDRESS,
59 | CampaignFactory.abi,
60 | signer
61 | );
62 |
63 | const CampaignAmount = ethers.utils.parseEther(form.requiredAmount);
64 |
65 | const campaignData = await contract.createCampaign(
66 | form.campaignTitle,
67 | CampaignAmount,
68 | imageUrl,
69 | form.category,
70 | storyUrl
71 | );
72 |
73 | await campaignData.wait();
74 |
75 | setAddress(campaignData.to);
76 | }
77 | }
78 |
79 | return (
80 |
81 |
82 |
83 | {loading == true ?
84 | address == "" ?
85 |
86 |
87 | :
88 |
89 | Campagin Started Sucessfully!
90 | {address}
91 |
94 |
95 | :
96 |
97 |
98 |
99 |
100 | }
101 |
102 |
103 |
104 | )
105 | }
106 |
107 | const FormWrapper = styled.div`
108 | width: 100%;
109 | display:flex;
110 | justify-content:center;
111 | `
112 |
113 | const FormMain = styled.div`
114 | width:80%;
115 | `
116 |
117 | const FormInputsWrapper = styled.div`
118 | display:flex;
119 | justify-content:space-between ;
120 | margin-top:45px ;
121 | `
122 |
123 | const Spinner = styled.div`
124 | width:100%;
125 | height:80vh;
126 | display:flex ;
127 | justify-content:center ;
128 | align-items:center ;
129 | `
130 | const Address = styled.div`
131 | width:100%;
132 | height:80vh;
133 | display:flex ;
134 | display:flex ;
135 | flex-direction:column;
136 | align-items:center ;
137 | background-color:${(props) => props.theme.bgSubDiv} ;
138 | border-radius:8px;
139 | `
140 |
141 | const Button = styled.button`
142 | display: flex;
143 | justify-content:center;
144 | width:30% ;
145 | padding:15px ;
146 | color:white ;
147 | background-color:#00b712 ;
148 | background-image:
149 | linear-gradient(180deg, #00b712 0%, #5aff15 80%) ;
150 | border:none;
151 | margin-top:30px ;
152 | cursor: pointer;
153 | font-weight:bold ;
154 | font-size:large ;
155 | `
156 |
157 | export default Form;
158 | export {FormState};
--------------------------------------------------------------------------------
/pages/dashboard.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | import FilterAltIcon from '@mui/icons-material/FilterAlt';
3 | import AccountBoxIcon from '@mui/icons-material/AccountBox';
4 | import PaidIcon from '@mui/icons-material/Paid';
5 | import EventIcon from '@mui/icons-material/Event';
6 | import Image from 'next/image';
7 | import { ethers } from 'ethers';
8 | import CampaignFactory from '../artifacts/contracts/Campaign.sol/CampaignFactory.json'
9 | import { useEffect, useState } from 'react';
10 | import Link from 'next/link';
11 |
12 | export default function Dashboard() {
13 | const [campaignsData, setCampaignsData] = useState([]);
14 |
15 | useEffect(() => {
16 | const Request = async () => {
17 | await window.ethereum.request({ method: 'eth_requestAccounts' });
18 | const Web3provider = new ethers.providers.Web3Provider(window.ethereum);
19 | const signer = Web3provider.getSigner();
20 | const Address = await signer.getAddress();
21 |
22 | const provider = new ethers.providers.JsonRpcProvider(
23 | process.env.NEXT_PUBLIC_RPC_URL
24 | );
25 |
26 | const contract = new ethers.Contract(
27 | process.env.NEXT_PUBLIC_ADDRESS,
28 | CampaignFactory.abi,
29 | provider
30 | );
31 |
32 | const getAllCampaigns = contract.filters.campaignCreated(null, null, Address);
33 | const AllCampaigns = await contract.queryFilter(getAllCampaigns);
34 | const AllData = AllCampaigns.map((e) => {
35 | return {
36 | title: e.args.title,
37 | image: e.args.imgURI,
38 | owner: e.args.owner,
39 | timeStamp: parseInt(e.args.timestamp),
40 | amount: ethers.utils.formatEther(e.args.requiredAmount),
41 | address: e.args.campaignAddress
42 | }
43 | })
44 | setCampaignsData(AllData)
45 | }
46 | Request();
47 | }, [])
48 |
49 | return (
50 |
51 |
52 | {/* Cards Container */}
53 |
54 |
55 | {/* Card */}
56 | {campaignsData.map((e) => {
57 | return (
58 |
59 |
60 |
65 |
66 |
67 | {e.title}
68 |
69 |
70 | Owner
71 | {e.owner.slice(0,6)}...{e.owner.slice(39)}
72 |
73 |
74 | Amount
75 | {e.amount} Matic
76 |
77 |
78 |
79 | {new Date(e.timeStamp * 1000).toLocaleString()}
80 |
81 |
84 |
85 | )
86 | })}
87 | {/* Card */}
88 |
89 |
90 |
91 | )
92 | }
93 |
94 |
95 |
96 | const HomeWrapper = styled.div`
97 | display: flex;
98 | flex-direction: column;
99 | align-items: center;
100 | width: 100%;
101 | `
102 | const CardsWrapper = styled.div`
103 | display: flex;
104 | justify-content: space-between;
105 | flex-wrap: wrap;
106 | width: 80%;
107 | margin-top: 25px;
108 | `
109 | const Card = styled.div`
110 | width: 30%;
111 | margin-top: 20px;
112 | background-color: ${(props) => props.theme.bgDiv};
113 |
114 | &:hover{
115 | transform: translateY(-10px);
116 | transition: transform 0.5s;
117 | }
118 |
119 | &:not(:hover){
120 | transition: transform 0.5s;
121 | }
122 | `
123 | const CardImg = styled.div`
124 | position: relative;
125 | height: 120px;
126 | width: 100%;
127 | `
128 | const Title = styled.h2`
129 | font-family: 'Roboto';
130 | font-size: 18px;
131 | margin: 2px 0px;
132 | background-color: ${(props) => props.theme.bgSubDiv};
133 | padding: 5px;
134 | cursor: pointer;
135 | font-weight: normal;
136 | `
137 | const CardData = styled.div`
138 | display: flex;
139 | justify-content: space-between;
140 | margin: 2px 0px;
141 | background-color: ${(props) => props.theme.bgSubDiv};
142 | padding: 5px;
143 | cursor: pointer;
144 | `
145 | const Text = styled.p`
146 | display: flex;
147 | align-items: center;
148 | margin: 0;
149 | padding: 0;
150 | font-family: 'Roboto';
151 | font-size: 18px;
152 | font-weight: bold;
153 | `
154 | const Button = styled.button`
155 | padding: 8px;
156 | text-align: center;
157 | width: 100%;
158 | background-color:#00b712 ;
159 | background-image:
160 | linear-gradient(180deg, #00b712 0%, #5aff15 80%);
161 | border: none;
162 | cursor: pointer;
163 | font-family: 'Roboto';
164 | text-transform: uppercase;
165 | color: #fff;
166 | font-size: 14px;
167 | font-weight: bold;
168 | `
--------------------------------------------------------------------------------
/components/Form/Components/FormRightWrapper.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | import { FormState } from '../Form';
3 | import { useState, useContext } from 'react';
4 | import { toast } from 'react-toastify';
5 | import {TailSpin} from 'react-loader-spinner'
6 | import {create as IPFSHTTPClient} from 'ipfs-http-client';
7 |
8 | const projectId = process.env.NEXT_PUBLIC_IPFS_ID
9 | const projectSecret = process.env.NEXT_PUBLIC_IPFS_KEY
10 | const auth = 'Basic ' + Buffer.from(projectId + ":" + projectSecret).toString('base64')
11 |
12 | const client = IPFSHTTPClient({
13 | host:'ipfs.infura.io',
14 | port:5001,
15 | protocol: 'https',
16 | headers: {
17 | authorization: auth
18 | }
19 | })
20 |
21 | const FormRightWrapper = () => {
22 | const Handler = useContext(FormState);
23 |
24 | const [uploadLoading, setUploadLoading] = useState(false);
25 | const [uploaded, setUploaded] = useState(false);
26 |
27 | const uploadFiles = async (e) => {
28 | e.preventDefault();
29 | setUploadLoading(true);
30 |
31 | if(Handler.form.story !== "") {
32 | try {
33 | const added = await client.add(Handler.form.story);
34 | Handler.setStoryUrl(added.path)
35 | } catch (error) {
36 | toast.warn(`Error Uploading Story`);
37 | }
38 | }
39 |
40 |
41 | if(Handler.image !== null) {
42 | try {
43 | const added = await client.add(Handler.image);
44 | Handler.setImageUrl(added.path)
45 | } catch (error) {
46 | toast.warn(`Error Uploading Image`);
47 | }
48 | }
49 |
50 | setUploadLoading(false);
51 | setUploaded(true);
52 | Handler.setUploaded(true);
53 | toast.success("Files Uploaded Sucessfully")
54 | }
55 |
56 | return (
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
71 |
72 |
73 |
74 | {/* Image */}
75 |
76 |
77 |
78 |
79 |
80 | {uploadLoading == true ? :
81 | uploaded == false ?
82 |
85 | :
86 | }
87 |
90 |
91 | )
92 | }
93 |
94 | const FormRight = styled.div`
95 | width:45%;
96 | `
97 |
98 | const FormInput = styled.div`
99 | display:flex ;
100 | flex-direction:column;
101 | font-family:'poppins';
102 | margin-top:10px ;
103 | `
104 |
105 | const FormRow = styled.div`
106 | display: flex;
107 | justify-content:space-between;
108 | width:100% ;
109 | `
110 |
111 | const Input = styled.input`
112 | padding:15px;
113 | background-color:${(props) => props.theme.bgDiv} ;
114 | color:${(props) => props.theme.color} ;
115 | margin-top:4px;
116 | border:none ;
117 | border-radius:8px ;
118 | outline:none;
119 | font-size:large;
120 | width:100% ;
121 | `
122 |
123 | const RowFirstInput = styled.div`
124 | display:flex ;
125 | flex-direction:column ;
126 | width:45% ;
127 | `
128 |
129 | const RowSecondInput = styled.div`
130 | display:flex ;
131 | flex-direction:column ;
132 | width:45% ;
133 | `
134 |
135 | const Select = styled.select`
136 | padding:15px;
137 | background-color:${(props) => props.theme.bgDiv} ;
138 | color:${(props) => props.theme.color} ;
139 | margin-top:4px;
140 | border:none ;
141 | border-radius:8px ;
142 | outline:none;
143 | font-size:large;
144 | width:100% ;
145 | `
146 |
147 | const Image = styled.input`
148 | background-color:${(props) => props.theme.bgDiv} ;
149 | color:${(props) => props.theme.color} ;
150 | margin-top:4px;
151 | border:none ;
152 | border-radius:8px ;
153 | outline:none;
154 | font-size:large;
155 | width:100% ;
156 |
157 | &::-webkit-file-upload-button {
158 | padding: 15px ;
159 | background-color: ${(props) => props.theme.bgSubDiv} ;
160 | color: ${(props) => props.theme.color} ;
161 | outline:none ;
162 | border:none ;
163 | font-weight:bold ;
164 | }
165 | `
166 |
167 | const Button = styled.button`
168 | display: flex;
169 | justify-content:center;
170 | width:100% ;
171 | padding:15px ;
172 | color:white ;
173 | background-color:#00b712 ;
174 | background-image:
175 | linear-gradient(180deg, #00b712 0%, #5aff15 80%) ;
176 | border:none;
177 | margin-top:30px ;
178 | cursor: pointer;
179 | font-weight:bold ;
180 | font-size:large ;
181 | `
182 |
183 | export default FormRightWrapper
--------------------------------------------------------------------------------
/pages/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components';
2 | import FilterAltIcon from '@mui/icons-material/FilterAlt';
3 | import AccountBoxIcon from '@mui/icons-material/AccountBox';
4 | import PaidIcon from '@mui/icons-material/Paid';
5 | import EventIcon from '@mui/icons-material/Event';
6 | import Image from 'next/image';
7 | import { ethers } from 'ethers';
8 | import CampaignFactory from '../artifacts/contracts/Campaign.sol/CampaignFactory.json'
9 | import { useState } from 'react';
10 | import Link from 'next/link'
11 |
12 | export default function Index({AllData, HealthData, EducationData,AnimalData}) {
13 | const [filter, setFilter] = useState(AllData);
14 |
15 | return (
16 |
17 |
18 | {/* Filter Section */}
19 |
20 |
21 | setFilter(AllData)}>All
22 | setFilter(HealthData)}>Health
23 | setFilter(EducationData)}>Education
24 | setFilter(AnimalData)}>Animal
25 |
26 |
27 | {/* Cards Container */}
28 |
29 |
30 | {/* Card */}
31 | {filter.map((e) => {
32 | return (
33 |
34 |
35 |
40 |
41 |
42 | {e.title}
43 |
44 |
45 | Owner
46 | {e.owner.slice(0,6)}...{e.owner.slice(39)}
47 |
48 |
49 | Amount
50 | {e.amount} Matic
51 |
52 |
53 |
54 | {new Date(e.timeStamp * 1000).toLocaleString()}
55 |
56 |
59 |
60 | )
61 | })}
62 | {/* Card */}
63 |
64 |
65 |
66 | )
67 | }
68 |
69 |
70 |
71 | export async function getStaticProps() {
72 | const provider = new ethers.providers.JsonRpcProvider(
73 | process.env.NEXT_PUBLIC_RPC_URL
74 | );
75 |
76 | const contract = new ethers.Contract(
77 | process.env.NEXT_PUBLIC_ADDRESS,
78 | CampaignFactory.abi,
79 | provider
80 | );
81 |
82 | const getAllCampaigns = contract.filters.campaignCreated();
83 | const AllCampaigns = await contract.queryFilter(getAllCampaigns);
84 | const AllData = AllCampaigns.map((e) => {
85 | return {
86 | title: e.args.title,
87 | image: e.args.imgURI,
88 | owner: e.args.owner,
89 | timeStamp: parseInt(e.args.timestamp),
90 | amount: ethers.utils.formatEther(e.args.requiredAmount),
91 | address: e.args.campaignAddress
92 | }
93 | });
94 |
95 | const getHealthCampaigns = contract.filters.campaignCreated(null,null,null,null,null,null,'Health');
96 | const HealthCampaigns = await contract.queryFilter(getHealthCampaigns);
97 | const HealthData = HealthCampaigns.map((e) => {
98 | return {
99 | title: e.args.title,
100 | image: e.args.imgURI,
101 | owner: e.args.owner,
102 | timeStamp: parseInt(e.args.timestamp),
103 | amount: ethers.utils.formatEther(e.args.requiredAmount),
104 | address: e.args.campaignAddress
105 | }
106 | });
107 |
108 | const getEducationCampaigns = contract.filters.campaignCreated(null,null,null,null,null,null,'education');
109 | const EducationCampaigns = await contract.queryFilter(getEducationCampaigns);
110 | const EducationData = EducationCampaigns.map((e) => {
111 | return {
112 | title: e.args.title,
113 | image: e.args.imgURI,
114 | owner: e.args.owner,
115 | timeStamp: parseInt(e.args.timestamp),
116 | amount: ethers.utils.formatEther(e.args.requiredAmount),
117 | address: e.args.campaignAddress
118 | }
119 | });
120 |
121 | const getAnimalCampaigns = contract.filters.campaignCreated(null,null,null,null,null,null,'Animal');
122 | const AnimalCampaigns = await contract.queryFilter(getAnimalCampaigns);
123 | const AnimalData = AnimalCampaigns.map((e) => {
124 | return {
125 | title: e.args.title,
126 | image: e.args.imgURI,
127 | owner: e.args.owner,
128 | timeStamp: parseInt(e.args.timestamp),
129 | amount: ethers.utils.formatEther(e.args.requiredAmount),
130 | address: e.args.campaignAddress
131 | }
132 | });
133 |
134 | return {
135 | props: {
136 | AllData,
137 | HealthData,
138 | EducationData,
139 | AnimalData
140 | },
141 | revalidate: 10
142 | }
143 | }
144 |
145 |
146 |
147 |
148 |
149 |
150 | const HomeWrapper = styled.div`
151 | display: flex;
152 | flex-direction: column;
153 | align-items: center;
154 | width: 100%;
155 | `
156 | const FilterWrapper = styled.div`
157 | display: flex;
158 | align-items: center;
159 | width: 80%;
160 | margin-top: 15px;
161 | `
162 | const Category = styled.div`
163 | padding: 10px 15px;
164 | background-color: ${(props) => props.theme.bgDiv};
165 | margin: 0px 15px;
166 | border-radius: 8px;
167 | font-family: 'Poppins';
168 | font-weight: normal;
169 | cursor: pointer;
170 | `
171 | const CardsWrapper = styled.div`
172 | display: flex;
173 | justify-content: space-between;
174 | flex-wrap: wrap;
175 | width: 80%;
176 | margin-top: 25px;
177 | `
178 | const Card = styled.div`
179 | width: 30%;
180 | margin-top: 20px;
181 | background-color: ${(props) => props.theme.bgDiv};
182 |
183 | &:hover{
184 | transform: translateY(-10px);
185 | transition: transform 0.5s;
186 | }
187 |
188 | &:not(:hover){
189 | transition: transform 0.5s;
190 | }
191 | `
192 | const CardImg = styled.div`
193 | position: relative;
194 | height: 120px;
195 | width: 100%;
196 | `
197 | const Title = styled.h2`
198 | font-family: 'Roboto';
199 | font-size: 18px;
200 | margin: 2px 0px;
201 | background-color: ${(props) => props.theme.bgSubDiv};
202 | padding: 5px;
203 | cursor: pointer;
204 | font-weight: normal;
205 | `
206 | const CardData = styled.div`
207 | display: flex;
208 | justify-content: space-between;
209 | margin: 2px 0px;
210 | background-color: ${(props) => props.theme.bgSubDiv};
211 | padding: 5px;
212 | cursor: pointer;
213 | `
214 | const Text = styled.p`
215 | display: flex;
216 | align-items: center;
217 | margin: 0;
218 | padding: 0;
219 | font-family: 'Roboto';
220 | font-size: 18px;
221 | font-weight: bold;
222 | `
223 | const Button = styled.button`
224 | padding: 8px;
225 | text-align: center;
226 | width: 100%;
227 | background-color:#00b712 ;
228 | background-image:
229 | linear-gradient(180deg, #00b712 0%, #5aff15 80%);
230 | border: none;
231 | cursor: pointer;
232 | font-family: 'Roboto';
233 | text-transform: uppercase;
234 | color: #fff;
235 | font-size: 14px;
236 | font-weight: bold;
237 | `
--------------------------------------------------------------------------------
/pages/[address].js:
--------------------------------------------------------------------------------
1 | import styled from "styled-components";
2 | import Image from "next/image";
3 | import {ethers} from 'ethers';
4 | import CampaignFactory from '../artifacts/contracts/Campaign.sol/CampaignFactory.json'
5 | import Campaign from '../artifacts/contracts/Campaign.sol/Campaign.json'
6 | import { useEffect, useState } from "react";
7 |
8 |
9 | export default function Detail({Data, DonationsData}) {
10 | const [mydonations, setMydonations] = useState([]);
11 | const [story, setStory] = useState('');
12 | const [amount, setAmount] = useState();
13 | const [change, setChange] = useState(false);
14 |
15 | useEffect(() => {
16 | const Request = async () => {
17 | let storyData;
18 |
19 | await window.ethereum.request({ method: 'eth_requestAccounts' });
20 | const Web3provider = new ethers.providers.Web3Provider(window.ethereum);
21 | const signer = Web3provider.getSigner();
22 | const Address = await signer.getAddress();
23 |
24 | const provider = new ethers.providers.JsonRpcProvider(
25 | process.env.NEXT_PUBLIC_RPC_URL
26 | );
27 |
28 | const contract = new ethers.Contract(
29 | Data.address,
30 | Campaign.abi,
31 | provider
32 | );
33 |
34 | fetch('https://crowdfunding.infura-ipfs.io/ipfs/' + Data.storyUrl)
35 | .then(res => res.text()).then(data => storyData = data);
36 |
37 | const MyDonations = contract.filters.donated(Address);
38 | const MyAllDonations = await contract.queryFilter(MyDonations);
39 |
40 | setMydonations(MyAllDonations.map((e) => {
41 | return {
42 | donar: e.args.donar,
43 | amount: ethers.utils.formatEther(e.args.amount),
44 | timestamp : parseInt(e.args.timestamp)
45 | }
46 | }));
47 |
48 | setStory(storyData);
49 | }
50 |
51 | Request();
52 | }, [change])
53 |
54 |
55 | const DonateFunds = async () => {
56 | try {
57 | await window.ethereum.request({ method: 'eth_requestAccounts' });
58 | const provider = new ethers.providers.Web3Provider(window.ethereum);
59 | const signer = provider.getSigner();
60 |
61 | const contract = new ethers.Contract(Data.address, Campaign.abi, signer);
62 |
63 | const transaction = await contract.donate({value: ethers.utils.parseEther(amount)});
64 | await transaction.wait();
65 |
66 | setChange(true);
67 | setAmount('');
68 |
69 | } catch (error) {
70 | console.log(error);
71 | }
72 |
73 | }
74 |
75 | return (
76 |
77 |
78 |
79 |
86 |
87 |
88 | {story}
89 |
90 |
91 |
92 | {Data.title}
93 |
94 | setAmount(e.target.value)} type="number" placeholder="Enter Amount To Donate" />
95 | Donate
96 |
97 |
98 |
99 | Required Amount
100 | {Data.requiredAmount} Matic
101 |
102 |
103 | Received Amount
104 | {Data.receivedAmount} Matic
105 |
106 |
107 |
108 |
109 | Recent Donation
110 | {DonationsData.map((e) => {
111 | return (
112 |
113 | {e.donar.slice(0,6)}...{e.donar.slice(39)}
114 | {e.amount} Matic
115 | {new Date(e.timestamp * 1000).toLocaleString()}
116 |
117 | )
118 | })
119 | }
120 |
121 |
122 | My Past Donation
123 | {mydonations.map((e) => {
124 | return (
125 |
126 | {e.donar.slice(0,6)}...{e.donar.slice(39)}
127 | {e.amount} Matic
128 | {new Date(e.timestamp * 1000).toLocaleString()}
129 |
130 | )
131 | })
132 | }
133 |
134 |
135 |
136 |
137 | );
138 | }
139 |
140 |
141 | export async function getStaticPaths() {
142 | const provider = new ethers.providers.JsonRpcProvider(
143 | process.env.NEXT_PUBLIC_RPC_URL
144 | );
145 |
146 | const contract = new ethers.Contract(
147 | process.env.NEXT_PUBLIC_ADDRESS,
148 | CampaignFactory.abi,
149 | provider
150 | );
151 |
152 | const getAllCampaigns = contract.filters.campaignCreated();
153 | const AllCampaigns = await contract.queryFilter(getAllCampaigns);
154 |
155 | return {
156 | paths: AllCampaigns.map((e) => ({
157 | params: {
158 | address: e.args.campaignAddress.toString(),
159 | }
160 | })),
161 | fallback: "blocking"
162 | }
163 | }
164 |
165 | export async function getStaticProps(context) {
166 | const provider = new ethers.providers.JsonRpcProvider(
167 | process.env.NEXT_PUBLIC_RPC_URL
168 | );
169 |
170 | const contract = new ethers.Contract(
171 | context.params.address,
172 | Campaign.abi,
173 | provider
174 | );
175 |
176 | const title = await contract.title();
177 | const requiredAmount = await contract.requiredAmount();
178 | const image = await contract.image();
179 | const storyUrl = await contract.story();
180 | const owner = await contract.owner();
181 | const receivedAmount = await contract.receivedAmount();
182 |
183 | const Donations = contract.filters.donated();
184 | const AllDonations = await contract.queryFilter(Donations);
185 |
186 |
187 | const Data = {
188 | address: context.params.address,
189 | title,
190 | requiredAmount: ethers.utils.formatEther(requiredAmount),
191 | image,
192 | receivedAmount: ethers.utils.formatEther(receivedAmount),
193 | storyUrl,
194 | owner,
195 | }
196 |
197 | const DonationsData = AllDonations.map((e) => {
198 | return {
199 | donar: e.args.donar,
200 | amount: ethers.utils.formatEther(e.args.amount),
201 | timestamp : parseInt(e.args.timestamp)
202 | }});
203 |
204 | return {
205 | props: {
206 | Data,
207 | DonationsData
208 | },
209 | revalidate: 10
210 | }
211 |
212 |
213 | }
214 |
215 |
216 |
217 |
218 | const DetailWrapper = styled.div`
219 | display: flex;
220 | justify-content: space-between;
221 | padding: 20px;
222 | width: 98%;
223 | `;
224 | const LeftContainer = styled.div`
225 | width: 45%;
226 | `;
227 | const RightContainer = styled.div`
228 | width: 50%;
229 | `;
230 | const ImageSection = styled.div`
231 | width: 100%;
232 | position: relative;
233 | height: 350px;
234 | `;
235 | const Text = styled.p`
236 | font-family: "Roboto";
237 | font-size: large;
238 | color: ${(props) => props.theme.color};
239 | text-align: justify;
240 | `;
241 | const Title = styled.h1`
242 | padding: 0;
243 | margin: 0;
244 | font-family: "Poppins";
245 | font-size: x-large;
246 | color: ${(props) => props.theme.color};
247 | `;
248 | const DonateSection = styled.div`
249 | display: flex;
250 | width: 100%;
251 | justify-content: space-between;
252 | align-items: center;
253 | margin-top: 10px;
254 | `;
255 | const Input = styled.input`
256 | padding: 8px 15px;
257 | background-color: ${(props) => props.theme.bgDiv};
258 | color: ${(props) => props.theme.color};
259 | border: none;
260 | border-radius: 8px;
261 | outline: none;
262 | font-size: large;
263 | width: 40%;
264 | height: 40px;
265 | `;
266 | const Donate = styled.button`
267 | display: flex;
268 | justify-content: center;
269 | width: 40%;
270 | padding: 15px;
271 | color: white;
272 | background-color: #00b712;
273 | background-image: linear-gradient(180deg, #00b712 0%, #5aff15 80%);
274 | border: none;
275 | cursor: pointer;
276 | font-weight: bold;
277 | border-radius: 8px;
278 | font-size: large;
279 | `;
280 | const FundsData = styled.div`
281 | width: 100%;
282 | display: flex;
283 | justify-content: space-between;
284 | margin-top: 10px;
285 | `;
286 | const Funds = styled.div`
287 | width: 45%;
288 | background-color: ${(props) => props.theme.bgDiv};
289 | padding: 8px;
290 | border-radius: 8px;
291 | text-align: center;
292 | `;
293 | const FundText = styled.p`
294 | margin: 2px;
295 | padding: 0;
296 | font-family: "Poppins";
297 | font-size: normal;
298 | `;
299 | const Donated = styled.div`
300 | height: 280px;
301 | margin-top: 15px;
302 | background-color: ${(props) => props.theme.bgDiv};
303 | `;
304 | const LiveDonation = styled.div`
305 | height: 65%;
306 | overflow-y: auto;
307 | `;
308 | const MyDonation = styled.div`
309 | height: 35%;
310 | overflow-y: auto;
311 | `;
312 | const DonationTitle = styled.div`
313 | font-family: "Roboto";
314 | font-size: x-small;
315 | text-transform: uppercase;
316 | padding: 4px;
317 | text-align: center;
318 | background-color: #4cd137;
319 | `;
320 | const Donation = styled.div`
321 | display: flex;
322 | justify-content: space-between;
323 | margin-top: 4px;
324 | background-color: ${(props) => props.theme.bgSubDiv};
325 | padding: 4px 8px;
326 | `;
327 | const DonationData = styled.p`
328 | color: ${(props) => props.theme.color};
329 | font-family: "Roboto";
330 | font-size: large;
331 | margin: 0;
332 | padding: 0;
333 | `;
--------------------------------------------------------------------------------
/artifacts/contracts/Campaign.sol/Campaign.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "Campaign",
4 | "sourceName": "contracts/Campaign.sol",
5 | "abi": [
6 | {
7 | "inputs": [
8 | {
9 | "internalType": "string",
10 | "name": "campaignTitle",
11 | "type": "string"
12 | },
13 | {
14 | "internalType": "uint256",
15 | "name": "requiredCampaignAmount",
16 | "type": "uint256"
17 | },
18 | {
19 | "internalType": "string",
20 | "name": "imgURI",
21 | "type": "string"
22 | },
23 | {
24 | "internalType": "string",
25 | "name": "storyURI",
26 | "type": "string"
27 | },
28 | {
29 | "internalType": "address",
30 | "name": "campaignOwner",
31 | "type": "address"
32 | }
33 | ],
34 | "stateMutability": "nonpayable",
35 | "type": "constructor"
36 | },
37 | {
38 | "anonymous": false,
39 | "inputs": [
40 | {
41 | "indexed": true,
42 | "internalType": "address",
43 | "name": "donar",
44 | "type": "address"
45 | },
46 | {
47 | "indexed": true,
48 | "internalType": "uint256",
49 | "name": "amount",
50 | "type": "uint256"
51 | },
52 | {
53 | "indexed": true,
54 | "internalType": "uint256",
55 | "name": "timestamp",
56 | "type": "uint256"
57 | }
58 | ],
59 | "name": "donated",
60 | "type": "event"
61 | },
62 | {
63 | "inputs": [],
64 | "name": "donate",
65 | "outputs": [],
66 | "stateMutability": "payable",
67 | "type": "function"
68 | },
69 | {
70 | "inputs": [],
71 | "name": "image",
72 | "outputs": [
73 | {
74 | "internalType": "string",
75 | "name": "",
76 | "type": "string"
77 | }
78 | ],
79 | "stateMutability": "view",
80 | "type": "function"
81 | },
82 | {
83 | "inputs": [],
84 | "name": "owner",
85 | "outputs": [
86 | {
87 | "internalType": "address payable",
88 | "name": "",
89 | "type": "address"
90 | }
91 | ],
92 | "stateMutability": "view",
93 | "type": "function"
94 | },
95 | {
96 | "inputs": [],
97 | "name": "receivedAmount",
98 | "outputs": [
99 | {
100 | "internalType": "uint256",
101 | "name": "",
102 | "type": "uint256"
103 | }
104 | ],
105 | "stateMutability": "view",
106 | "type": "function"
107 | },
108 | {
109 | "inputs": [],
110 | "name": "requiredAmount",
111 | "outputs": [
112 | {
113 | "internalType": "uint256",
114 | "name": "",
115 | "type": "uint256"
116 | }
117 | ],
118 | "stateMutability": "view",
119 | "type": "function"
120 | },
121 | {
122 | "inputs": [],
123 | "name": "story",
124 | "outputs": [
125 | {
126 | "internalType": "string",
127 | "name": "",
128 | "type": "string"
129 | }
130 | ],
131 | "stateMutability": "view",
132 | "type": "function"
133 | },
134 | {
135 | "inputs": [],
136 | "name": "title",
137 | "outputs": [
138 | {
139 | "internalType": "string",
140 | "name": "",
141 | "type": "string"
142 | }
143 | ],
144 | "stateMutability": "view",
145 | "type": "function"
146 | }
147 | ],
148 | "bytecode": "0x60806040523480156200001157600080fd5b5060405162000c5b38038062000c5b8339818101604052810190620000379190620003c2565b84600090805190602001906200004f929190620000d5565b508360018190555082600290805190602001906200006f929190620000d5565b50816003908051906020019062000088929190620000d5565b5080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050506200050c565b828054620000e390620004d6565b90600052602060002090601f01602090048101928262000107576000855562000153565b82601f106200012257805160ff191683800117855562000153565b8280016001018555821562000153579182015b828111156200015257825182559160200191906001019062000135565b5b50905062000162919062000166565b5090565b5b808211156200018157600081600090555060010162000167565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001ee82620001a3565b810181811067ffffffffffffffff8211171562000210576200020f620001b4565b5b80604052505050565b60006200022562000185565b9050620002338282620001e3565b919050565b600067ffffffffffffffff821115620002565762000255620001b4565b5b6200026182620001a3565b9050602081019050919050565b60005b838110156200028e57808201518184015260208101905062000271565b838111156200029e576000848401525b50505050565b6000620002bb620002b58462000238565b62000219565b905082815260208101848484011115620002da57620002d96200019e565b5b620002e78482856200026e565b509392505050565b600082601f83011262000307576200030662000199565b5b815162000319848260208601620002a4565b91505092915050565b6000819050919050565b620003378162000322565b81146200034357600080fd5b50565b60008151905062000357816200032c565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200038a826200035d565b9050919050565b6200039c816200037d565b8114620003a857600080fd5b50565b600081519050620003bc8162000391565b92915050565b600080600080600060a08688031215620003e157620003e06200018f565b5b600086015167ffffffffffffffff81111562000402576200040162000194565b5b6200041088828901620002ef565b9550506020620004238882890162000346565b945050604086015167ffffffffffffffff81111562000447576200044662000194565b5b6200045588828901620002ef565b935050606086015167ffffffffffffffff81111562000479576200047862000194565b5b6200048788828901620002ef565b92505060806200049a88828901620003ab565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004ef57607f821691505b60208210811415620005065762000505620004a7565b5b50919050565b61073f806200051c6000396000f3fe6080604052600436106100705760003560e01c80638da5cb5b1161004e5780638da5cb5b146100f65780639632e72014610121578063ed88c68e1461014c578063f3ccaac01461015657610070565b806346c922d11461007557806348b9ef40146100a05780634a79d50c146100cb575b600080fd5b34801561008157600080fd5b5061008a610181565b6040516100979190610505565b60405180910390f35b3480156100ac57600080fd5b506100b561020f565b6040516100c29190610540565b60405180910390f35b3480156100d757600080fd5b506100e0610215565b6040516100ed9190610505565b60405180910390f35b34801561010257600080fd5b5061010b6102a3565b604051610118919061059c565b60405180910390f35b34801561012d57600080fd5b506101366102c9565b6040516101439190610540565b60405180910390f35b6101546102cf565b005b34801561016257600080fd5b5061016b6103de565b6040516101789190610505565b60405180910390f35b6003805461018e906105e6565b80601f01602080910402602001604051908101604052809291908181526020018280546101ba906105e6565b80156102075780601f106101dc57610100808354040283529160200191610207565b820191906000526020600020905b8154815290600101906020018083116101ea57829003601f168201915b505050505081565b60015481565b60008054610222906105e6565b80601f016020809104026020016040519081016040528092919081815260200182805461024e906105e6565b801561029b5780601f106102705761010080835404028352916020019161029b565b820191906000526020600020905b81548152906001019060200180831161027e57829003601f168201915b505050505081565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60055460015411610315576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030c90610664565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561037d573d6000803e3d6000fd5b50346005600082825461039091906106b3565b9250508190555042343373ffffffffffffffffffffffffffffffffffffffff167fe6add99d06d9ad7fc456e746aa162eed6211c5002ef2dacdd67b8d2016822fba60405160405180910390a4565b600280546103eb906105e6565b80601f0160208091040260200160405190810160405280929190818152602001828054610417906105e6565b80156104645780601f1061043957610100808354040283529160200191610464565b820191906000526020600020905b81548152906001019060200180831161044757829003601f168201915b505050505081565b600081519050919050565b600082825260208201905092915050565b60005b838110156104a657808201518184015260208101905061048b565b838111156104b5576000848401525b50505050565b6000601f19601f8301169050919050565b60006104d78261046c565b6104e18185610477565b93506104f1818560208601610488565b6104fa816104bb565b840191505092915050565b6000602082019050818103600083015261051f81846104cc565b905092915050565b6000819050919050565b61053a81610527565b82525050565b60006020820190506105556000830184610531565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105868261055b565b9050919050565b6105968161057b565b82525050565b60006020820190506105b1600083018461058d565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806105fe57607f821691505b60208210811415610612576106116105b7565b5b50919050565b7f726571756972656420616d6f756e742066756c6c66696c6c6564000000000000600082015250565b600061064e601a83610477565b915061065982610618565b602082019050919050565b6000602082019050818103600083015261067d81610641565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006106be82610527565b91506106c983610527565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156106fe576106fd610684565b5b82820190509291505056fea264697066735822122049d5066d3c5b82ab8326badfb522eca6125f0587380ad2e66d98b45d05211bb464736f6c634300080a0033",
149 | "deployedBytecode": "0x6080604052600436106100705760003560e01c80638da5cb5b1161004e5780638da5cb5b146100f65780639632e72014610121578063ed88c68e1461014c578063f3ccaac01461015657610070565b806346c922d11461007557806348b9ef40146100a05780634a79d50c146100cb575b600080fd5b34801561008157600080fd5b5061008a610181565b6040516100979190610505565b60405180910390f35b3480156100ac57600080fd5b506100b561020f565b6040516100c29190610540565b60405180910390f35b3480156100d757600080fd5b506100e0610215565b6040516100ed9190610505565b60405180910390f35b34801561010257600080fd5b5061010b6102a3565b604051610118919061059c565b60405180910390f35b34801561012d57600080fd5b506101366102c9565b6040516101439190610540565b60405180910390f35b6101546102cf565b005b34801561016257600080fd5b5061016b6103de565b6040516101789190610505565b60405180910390f35b6003805461018e906105e6565b80601f01602080910402602001604051908101604052809291908181526020018280546101ba906105e6565b80156102075780601f106101dc57610100808354040283529160200191610207565b820191906000526020600020905b8154815290600101906020018083116101ea57829003601f168201915b505050505081565b60015481565b60008054610222906105e6565b80601f016020809104026020016040519081016040528092919081815260200182805461024e906105e6565b801561029b5780601f106102705761010080835404028352916020019161029b565b820191906000526020600020905b81548152906001019060200180831161027e57829003601f168201915b505050505081565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60055460015411610315576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030c90610664565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561037d573d6000803e3d6000fd5b50346005600082825461039091906106b3565b9250508190555042343373ffffffffffffffffffffffffffffffffffffffff167fe6add99d06d9ad7fc456e746aa162eed6211c5002ef2dacdd67b8d2016822fba60405160405180910390a4565b600280546103eb906105e6565b80601f0160208091040260200160405190810160405280929190818152602001828054610417906105e6565b80156104645780601f1061043957610100808354040283529160200191610464565b820191906000526020600020905b81548152906001019060200180831161044757829003601f168201915b505050505081565b600081519050919050565b600082825260208201905092915050565b60005b838110156104a657808201518184015260208101905061048b565b838111156104b5576000848401525b50505050565b6000601f19601f8301169050919050565b60006104d78261046c565b6104e18185610477565b93506104f1818560208601610488565b6104fa816104bb565b840191505092915050565b6000602082019050818103600083015261051f81846104cc565b905092915050565b6000819050919050565b61053a81610527565b82525050565b60006020820190506105556000830184610531565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105868261055b565b9050919050565b6105968161057b565b82525050565b60006020820190506105b1600083018461058d565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806105fe57607f821691505b60208210811415610612576106116105b7565b5b50919050565b7f726571756972656420616d6f756e742066756c6c66696c6c6564000000000000600082015250565b600061064e601a83610477565b915061065982610618565b602082019050919050565b6000602082019050818103600083015261067d81610641565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006106be82610527565b91506106c983610527565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156106fe576106fd610684565b5b82820190509291505056fea264697066735822122049d5066d3c5b82ab8326badfb522eca6125f0587380ad2e66d98b45d05211bb464736f6c634300080a0033",
150 | "linkReferences": {},
151 | "deployedLinkReferences": {}
152 | }
153 |
--------------------------------------------------------------------------------
/artifacts/contracts/Campaign.sol/CampaignFactory.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "CampaignFactory",
4 | "sourceName": "contracts/Campaign.sol",
5 | "abi": [
6 | {
7 | "anonymous": false,
8 | "inputs": [
9 | {
10 | "indexed": false,
11 | "internalType": "string",
12 | "name": "title",
13 | "type": "string"
14 | },
15 | {
16 | "indexed": false,
17 | "internalType": "uint256",
18 | "name": "requiredAmount",
19 | "type": "uint256"
20 | },
21 | {
22 | "indexed": true,
23 | "internalType": "address",
24 | "name": "owner",
25 | "type": "address"
26 | },
27 | {
28 | "indexed": false,
29 | "internalType": "address",
30 | "name": "campaignAddress",
31 | "type": "address"
32 | },
33 | {
34 | "indexed": false,
35 | "internalType": "string",
36 | "name": "imgURI",
37 | "type": "string"
38 | },
39 | {
40 | "indexed": true,
41 | "internalType": "uint256",
42 | "name": "timestamp",
43 | "type": "uint256"
44 | },
45 | {
46 | "indexed": true,
47 | "internalType": "string",
48 | "name": "category",
49 | "type": "string"
50 | }
51 | ],
52 | "name": "campaignCreated",
53 | "type": "event"
54 | },
55 | {
56 | "inputs": [
57 | {
58 | "internalType": "string",
59 | "name": "campaignTitle",
60 | "type": "string"
61 | },
62 | {
63 | "internalType": "uint256",
64 | "name": "requiredCampaignAmount",
65 | "type": "uint256"
66 | },
67 | {
68 | "internalType": "string",
69 | "name": "imgURI",
70 | "type": "string"
71 | },
72 | {
73 | "internalType": "string",
74 | "name": "category",
75 | "type": "string"
76 | },
77 | {
78 | "internalType": "string",
79 | "name": "storyURI",
80 | "type": "string"
81 | }
82 | ],
83 | "name": "createCampaign",
84 | "outputs": [],
85 | "stateMutability": "nonpayable",
86 | "type": "function"
87 | },
88 | {
89 | "inputs": [
90 | {
91 | "internalType": "uint256",
92 | "name": "",
93 | "type": "uint256"
94 | }
95 | ],
96 | "name": "deployedCampaigns",
97 | "outputs": [
98 | {
99 | "internalType": "address",
100 | "name": "",
101 | "type": "address"
102 | }
103 | ],
104 | "stateMutability": "view",
105 | "type": "function"
106 | }
107 | ],
108 | "bytecode": "0x608060405234801561001057600080fd5b506113a8806100206000396000f3fe60806040523480156200001157600080fd5b50600436106200003a5760003560e01c8063339d50a5146200003f578063c658857d1462000075575b600080fd5b6200005d600480360381019062000057919062000251565b62000095565b6040516200006c9190620002c8565b60405180910390f35b6200009360048036038101906200008d919062000447565b620000d5565b005b60008181548110620000a657600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008585858433604051620000ea90620001f4565b620000fa959493929190620005ef565b604051809103906000f08015801562000117573d6000803e3d6000fd5b5090506000819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826040516200018d9190620006a3565b6040518091039020423373ffffffffffffffffffffffffffffffffffffffff167ff932d905365211c7f19fda44bcb55b1adbe63365f7cdae1c35ddcb3e38ed1d468989868a604051620001e49493929190620006bc565b60405180910390a4505050505050565b610c5b806200071883390190565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6200022b8162000216565b81146200023757600080fd5b50565b6000813590506200024b8162000220565b92915050565b6000602082840312156200026a57620002696200020c565b5b60006200027a848285016200023a565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002b08262000283565b9050919050565b620002c281620002a3565b82525050565b6000602082019050620002df6000830184620002b7565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200033a82620002ef565b810181811067ffffffffffffffff821117156200035c576200035b62000300565b5b80604052505050565b60006200037162000202565b90506200037f82826200032f565b919050565b600067ffffffffffffffff821115620003a257620003a162000300565b5b620003ad82620002ef565b9050602081019050919050565b82818337600083830152505050565b6000620003e0620003da8462000384565b62000365565b905082815260208101848484011115620003ff57620003fe620002ea565b5b6200040c848285620003ba565b509392505050565b600082601f8301126200042c576200042b620002e5565b5b81356200043e848260208601620003c9565b91505092915050565b600080600080600060a086880312156200046657620004656200020c565b5b600086013567ffffffffffffffff81111562000487576200048662000211565b5b620004958882890162000414565b9550506020620004a8888289016200023a565b945050604086013567ffffffffffffffff811115620004cc57620004cb62000211565b5b620004da8882890162000414565b935050606086013567ffffffffffffffff811115620004fe57620004fd62000211565b5b6200050c8882890162000414565b925050608086013567ffffffffffffffff81111562000530576200052f62000211565b5b6200053e8882890162000414565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b60005b83811015620005875780820151818401526020810190506200056a565b8381111562000597576000848401525b50505050565b6000620005aa826200054b565b620005b6818562000556565b9350620005c881856020860162000567565b620005d381620002ef565b840191505092915050565b620005e98162000216565b82525050565b600060a08201905081810360008301526200060b81886200059d565b90506200061c6020830187620005de565b81810360408301526200063081866200059d565b905081810360608301526200064681856200059d565b9050620006576080830184620002b7565b9695505050505050565b600081905092915050565b600062000679826200054b565b62000685818562000661565b93506200069781856020860162000567565b80840191505092915050565b6000620006b182846200066c565b915081905092915050565b60006080820190508181036000830152620006d881876200059d565b9050620006e96020830186620005de565b620006f86040830185620002b7565b81810360608301526200070c81846200059d565b90509594505050505056fe60806040523480156200001157600080fd5b5060405162000c5b38038062000c5b8339818101604052810190620000379190620003c2565b84600090805190602001906200004f929190620000d5565b508360018190555082600290805190602001906200006f929190620000d5565b50816003908051906020019062000088929190620000d5565b5080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050506200050c565b828054620000e390620004d6565b90600052602060002090601f01602090048101928262000107576000855562000153565b82601f106200012257805160ff191683800117855562000153565b8280016001018555821562000153579182015b828111156200015257825182559160200191906001019062000135565b5b50905062000162919062000166565b5090565b5b808211156200018157600081600090555060010162000167565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001ee82620001a3565b810181811067ffffffffffffffff8211171562000210576200020f620001b4565b5b80604052505050565b60006200022562000185565b9050620002338282620001e3565b919050565b600067ffffffffffffffff821115620002565762000255620001b4565b5b6200026182620001a3565b9050602081019050919050565b60005b838110156200028e57808201518184015260208101905062000271565b838111156200029e576000848401525b50505050565b6000620002bb620002b58462000238565b62000219565b905082815260208101848484011115620002da57620002d96200019e565b5b620002e78482856200026e565b509392505050565b600082601f83011262000307576200030662000199565b5b815162000319848260208601620002a4565b91505092915050565b6000819050919050565b620003378162000322565b81146200034357600080fd5b50565b60008151905062000357816200032c565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200038a826200035d565b9050919050565b6200039c816200037d565b8114620003a857600080fd5b50565b600081519050620003bc8162000391565b92915050565b600080600080600060a08688031215620003e157620003e06200018f565b5b600086015167ffffffffffffffff81111562000402576200040162000194565b5b6200041088828901620002ef565b9550506020620004238882890162000346565b945050604086015167ffffffffffffffff81111562000447576200044662000194565b5b6200045588828901620002ef565b935050606086015167ffffffffffffffff81111562000479576200047862000194565b5b6200048788828901620002ef565b92505060806200049a88828901620003ab565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004ef57607f821691505b60208210811415620005065762000505620004a7565b5b50919050565b61073f806200051c6000396000f3fe6080604052600436106100705760003560e01c80638da5cb5b1161004e5780638da5cb5b146100f65780639632e72014610121578063ed88c68e1461014c578063f3ccaac01461015657610070565b806346c922d11461007557806348b9ef40146100a05780634a79d50c146100cb575b600080fd5b34801561008157600080fd5b5061008a610181565b6040516100979190610505565b60405180910390f35b3480156100ac57600080fd5b506100b561020f565b6040516100c29190610540565b60405180910390f35b3480156100d757600080fd5b506100e0610215565b6040516100ed9190610505565b60405180910390f35b34801561010257600080fd5b5061010b6102a3565b604051610118919061059c565b60405180910390f35b34801561012d57600080fd5b506101366102c9565b6040516101439190610540565b60405180910390f35b6101546102cf565b005b34801561016257600080fd5b5061016b6103de565b6040516101789190610505565b60405180910390f35b6003805461018e906105e6565b80601f01602080910402602001604051908101604052809291908181526020018280546101ba906105e6565b80156102075780601f106101dc57610100808354040283529160200191610207565b820191906000526020600020905b8154815290600101906020018083116101ea57829003601f168201915b505050505081565b60015481565b60008054610222906105e6565b80601f016020809104026020016040519081016040528092919081815260200182805461024e906105e6565b801561029b5780601f106102705761010080835404028352916020019161029b565b820191906000526020600020905b81548152906001019060200180831161027e57829003601f168201915b505050505081565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60055460015411610315576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030c90610664565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561037d573d6000803e3d6000fd5b50346005600082825461039091906106b3565b9250508190555042343373ffffffffffffffffffffffffffffffffffffffff167fe6add99d06d9ad7fc456e746aa162eed6211c5002ef2dacdd67b8d2016822fba60405160405180910390a4565b600280546103eb906105e6565b80601f0160208091040260200160405190810160405280929190818152602001828054610417906105e6565b80156104645780601f1061043957610100808354040283529160200191610464565b820191906000526020600020905b81548152906001019060200180831161044757829003601f168201915b505050505081565b600081519050919050565b600082825260208201905092915050565b60005b838110156104a657808201518184015260208101905061048b565b838111156104b5576000848401525b50505050565b6000601f19601f8301169050919050565b60006104d78261046c565b6104e18185610477565b93506104f1818560208601610488565b6104fa816104bb565b840191505092915050565b6000602082019050818103600083015261051f81846104cc565b905092915050565b6000819050919050565b61053a81610527565b82525050565b60006020820190506105556000830184610531565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105868261055b565b9050919050565b6105968161057b565b82525050565b60006020820190506105b1600083018461058d565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806105fe57607f821691505b60208210811415610612576106116105b7565b5b50919050565b7f726571756972656420616d6f756e742066756c6c66696c6c6564000000000000600082015250565b600061064e601a83610477565b915061065982610618565b602082019050919050565b6000602082019050818103600083015261067d81610641565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006106be82610527565b91506106c983610527565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156106fe576106fd610684565b5b82820190509291505056fea264697066735822122049d5066d3c5b82ab8326badfb522eca6125f0587380ad2e66d98b45d05211bb464736f6c634300080a0033a26469706673582212205c29212825824985e61f9bfda725be6e9c54157d433e43cdd9a17afc0cd4423364736f6c634300080a0033",
109 | "deployedBytecode": "0x60806040523480156200001157600080fd5b50600436106200003a5760003560e01c8063339d50a5146200003f578063c658857d1462000075575b600080fd5b6200005d600480360381019062000057919062000251565b62000095565b6040516200006c9190620002c8565b60405180910390f35b6200009360048036038101906200008d919062000447565b620000d5565b005b60008181548110620000a657600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008585858433604051620000ea90620001f4565b620000fa959493929190620005ef565b604051809103906000f08015801562000117573d6000803e3d6000fd5b5090506000819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826040516200018d9190620006a3565b6040518091039020423373ffffffffffffffffffffffffffffffffffffffff167ff932d905365211c7f19fda44bcb55b1adbe63365f7cdae1c35ddcb3e38ed1d468989868a604051620001e49493929190620006bc565b60405180910390a4505050505050565b610c5b806200071883390190565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6200022b8162000216565b81146200023757600080fd5b50565b6000813590506200024b8162000220565b92915050565b6000602082840312156200026a57620002696200020c565b5b60006200027a848285016200023a565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002b08262000283565b9050919050565b620002c281620002a3565b82525050565b6000602082019050620002df6000830184620002b7565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200033a82620002ef565b810181811067ffffffffffffffff821117156200035c576200035b62000300565b5b80604052505050565b60006200037162000202565b90506200037f82826200032f565b919050565b600067ffffffffffffffff821115620003a257620003a162000300565b5b620003ad82620002ef565b9050602081019050919050565b82818337600083830152505050565b6000620003e0620003da8462000384565b62000365565b905082815260208101848484011115620003ff57620003fe620002ea565b5b6200040c848285620003ba565b509392505050565b600082601f8301126200042c576200042b620002e5565b5b81356200043e848260208601620003c9565b91505092915050565b600080600080600060a086880312156200046657620004656200020c565b5b600086013567ffffffffffffffff81111562000487576200048662000211565b5b620004958882890162000414565b9550506020620004a8888289016200023a565b945050604086013567ffffffffffffffff811115620004cc57620004cb62000211565b5b620004da8882890162000414565b935050606086013567ffffffffffffffff811115620004fe57620004fd62000211565b5b6200050c8882890162000414565b925050608086013567ffffffffffffffff81111562000530576200052f62000211565b5b6200053e8882890162000414565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b60005b83811015620005875780820151818401526020810190506200056a565b8381111562000597576000848401525b50505050565b6000620005aa826200054b565b620005b6818562000556565b9350620005c881856020860162000567565b620005d381620002ef565b840191505092915050565b620005e98162000216565b82525050565b600060a08201905081810360008301526200060b81886200059d565b90506200061c6020830187620005de565b81810360408301526200063081866200059d565b905081810360608301526200064681856200059d565b9050620006576080830184620002b7565b9695505050505050565b600081905092915050565b600062000679826200054b565b62000685818562000661565b93506200069781856020860162000567565b80840191505092915050565b6000620006b182846200066c565b915081905092915050565b60006080820190508181036000830152620006d881876200059d565b9050620006e96020830186620005de565b620006f86040830185620002b7565b81810360608301526200070c81846200059d565b90509594505050505056fe60806040523480156200001157600080fd5b5060405162000c5b38038062000c5b8339818101604052810190620000379190620003c2565b84600090805190602001906200004f929190620000d5565b508360018190555082600290805190602001906200006f929190620000d5565b50816003908051906020019062000088929190620000d5565b5080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050506200050c565b828054620000e390620004d6565b90600052602060002090601f01602090048101928262000107576000855562000153565b82601f106200012257805160ff191683800117855562000153565b8280016001018555821562000153579182015b828111156200015257825182559160200191906001019062000135565b5b50905062000162919062000166565b5090565b5b808211156200018157600081600090555060010162000167565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001ee82620001a3565b810181811067ffffffffffffffff8211171562000210576200020f620001b4565b5b80604052505050565b60006200022562000185565b9050620002338282620001e3565b919050565b600067ffffffffffffffff821115620002565762000255620001b4565b5b6200026182620001a3565b9050602081019050919050565b60005b838110156200028e57808201518184015260208101905062000271565b838111156200029e576000848401525b50505050565b6000620002bb620002b58462000238565b62000219565b905082815260208101848484011115620002da57620002d96200019e565b5b620002e78482856200026e565b509392505050565b600082601f83011262000307576200030662000199565b5b815162000319848260208601620002a4565b91505092915050565b6000819050919050565b620003378162000322565b81146200034357600080fd5b50565b60008151905062000357816200032c565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200038a826200035d565b9050919050565b6200039c816200037d565b8114620003a857600080fd5b50565b600081519050620003bc8162000391565b92915050565b600080600080600060a08688031215620003e157620003e06200018f565b5b600086015167ffffffffffffffff81111562000402576200040162000194565b5b6200041088828901620002ef565b9550506020620004238882890162000346565b945050604086015167ffffffffffffffff81111562000447576200044662000194565b5b6200045588828901620002ef565b935050606086015167ffffffffffffffff81111562000479576200047862000194565b5b6200048788828901620002ef565b92505060806200049a88828901620003ab565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004ef57607f821691505b60208210811415620005065762000505620004a7565b5b50919050565b61073f806200051c6000396000f3fe6080604052600436106100705760003560e01c80638da5cb5b1161004e5780638da5cb5b146100f65780639632e72014610121578063ed88c68e1461014c578063f3ccaac01461015657610070565b806346c922d11461007557806348b9ef40146100a05780634a79d50c146100cb575b600080fd5b34801561008157600080fd5b5061008a610181565b6040516100979190610505565b60405180910390f35b3480156100ac57600080fd5b506100b561020f565b6040516100c29190610540565b60405180910390f35b3480156100d757600080fd5b506100e0610215565b6040516100ed9190610505565b60405180910390f35b34801561010257600080fd5b5061010b6102a3565b604051610118919061059c565b60405180910390f35b34801561012d57600080fd5b506101366102c9565b6040516101439190610540565b60405180910390f35b6101546102cf565b005b34801561016257600080fd5b5061016b6103de565b6040516101789190610505565b60405180910390f35b6003805461018e906105e6565b80601f01602080910402602001604051908101604052809291908181526020018280546101ba906105e6565b80156102075780601f106101dc57610100808354040283529160200191610207565b820191906000526020600020905b8154815290600101906020018083116101ea57829003601f168201915b505050505081565b60015481565b60008054610222906105e6565b80601f016020809104026020016040519081016040528092919081815260200182805461024e906105e6565b801561029b5780601f106102705761010080835404028352916020019161029b565b820191906000526020600020905b81548152906001019060200180831161027e57829003601f168201915b505050505081565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60055460015411610315576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030c90610664565b60405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561037d573d6000803e3d6000fd5b50346005600082825461039091906106b3565b9250508190555042343373ffffffffffffffffffffffffffffffffffffffff167fe6add99d06d9ad7fc456e746aa162eed6211c5002ef2dacdd67b8d2016822fba60405160405180910390a4565b600280546103eb906105e6565b80601f0160208091040260200160405190810160405280929190818152602001828054610417906105e6565b80156104645780601f1061043957610100808354040283529160200191610464565b820191906000526020600020905b81548152906001019060200180831161044757829003601f168201915b505050505081565b600081519050919050565b600082825260208201905092915050565b60005b838110156104a657808201518184015260208101905061048b565b838111156104b5576000848401525b50505050565b6000601f19601f8301169050919050565b60006104d78261046c565b6104e18185610477565b93506104f1818560208601610488565b6104fa816104bb565b840191505092915050565b6000602082019050818103600083015261051f81846104cc565b905092915050565b6000819050919050565b61053a81610527565b82525050565b60006020820190506105556000830184610531565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105868261055b565b9050919050565b6105968161057b565b82525050565b60006020820190506105b1600083018461058d565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806105fe57607f821691505b60208210811415610612576106116105b7565b5b50919050565b7f726571756972656420616d6f756e742066756c6c66696c6c6564000000000000600082015250565b600061064e601a83610477565b915061065982610618565b602082019050919050565b6000602082019050818103600083015261067d81610641565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006106be82610527565b91506106c983610527565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156106fe576106fd610684565b5b82820190509291505056fea264697066735822122049d5066d3c5b82ab8326badfb522eca6125f0587380ad2e66d98b45d05211bb464736f6c634300080a0033a26469706673582212205c29212825824985e61f9bfda725be6e9c54157d433e43cdd9a17afc0cd4423364736f6c634300080a0033",
110 | "linkReferences": {},
111 | "deployedLinkReferences": {}
112 | }
113 |
--------------------------------------------------------------------------------