Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add front #7

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.vscode
.vscode
30 changes: 15 additions & 15 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
node_modules
.env

# Hardhat files
/cache
/artifacts

# TypeChain files
/typechain
/typechain-types

# solidity-coverage files
/coverage
/coverage.json

node_modules
.env
# Hardhat files
/cache
/artifacts
# TypeChain files
/typechain
/typechain-types
# solidity-coverage files
/coverage
/coverage.json
.yarn
2 changes: 1 addition & 1 deletion backend/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodeLinker: node-modules
nodeLinker: node-modules
70 changes: 35 additions & 35 deletions backend/a_launcher.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
#!/bin/bash

while true
do
echo "Welcome to the deployment menu"
echo "Please select an option:"

PS3='Choose a deployment option: '
options=("Tests" "Deploy Local" "Deploy Harmonie Testnet" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Tests")
echo "Testing the contracts on localhost network"
REPORT_GAS=true npx hardhat coverage
break
;;
"Deploy Local")
echo "Deploying contracts on localhost network"
npx hardhat run scripts/deploy.js --network localhost
break
;;
"Deploy Harmonie Testnet")
echo "Deploying factory on localhost network"
npx hardhat run scripts/deploy.js --network localhost
break
;;
"Quit")
echo "Exiting..."
exit 0
;;
*) echo "Invalid option $REPLY";;
esac
done
done
#!/bin/bash
while true
do
echo "Welcome to the deployment menu"
echo "Please select an option:"
PS3='Choose a deployment option: '
options=("Tests" "Deploy Local" "Deploy Harmonie Testnet" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Tests")
echo "Testing the contracts on localhost network"
REPORT_GAS=true npx hardhat coverage
break
;;
"Deploy Local")
echo "Deploying contracts on localhost network"
npx hardhat run scripts/deploy.js --network localhost
break
;;
"Deploy Harmonie Testnet")
echo "Deploying factory on localhost network"
npx hardhat run scripts/deploy.js --network localhost
break
;;
"Quit")
echo "Exiting..."
exit 0
;;
*) echo "Invalid option $REPLY";;
esac
done
done
71 changes: 36 additions & 35 deletions backend/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
require("@nomicfoundation/hardhat-toolbox");
require('dotenv').config();

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.24",
settings: {
optimizer: {
enabled: true,
runs: 200
}
},
defaultNetwork: "hardhat",
networks: {
localhost: {
url: "http://127.0.0.1:8545",
//accounts : from hardhat
chainId: 31337,
gas: 5000000,
},
// mumbai: {
// url: `https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}`,
// accounts: [`0x${PRIVATE_KEY}`],
// chainId: 80001,
// from: `${DEFAULT_ADDRESS_MUMBAI}`
// }
// ,
// goerli: {
// url: `https://goerli.infura.io/v3/${process.env.INFURA_API_KEY}`,
// accounts: [`${PRIVATE_KEY}`],
// from: `${DEFAULT_ADDRESS_GOERLI}`

// },
},
};
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();

// import("hardhat/config").HardhatUserConfig;

module.exports = {
solidity: "0.8.24",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
defaultNetwork: "hardhat",
networks: {
localhost: {
url: "http://127.0.0.1:8545",
chainId: 31337,
gas: 5000000,
},

// mumbai: {
// url: `https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}`,
// accounts: [`0x${PRIVATE_KEY}`],
// chainId: 80001,
// from: `${DEFAULT_ADDRESS_MUMBAI}`
// }
// ,
// goerli: {
// url: `https://goerli.infura.io/v3/${process.env.INFURA_API_KEY}`,
// accounts: [`${PRIVATE_KEY}`],
// from: `${DEFAULT_ADDRESS_GOERLI}`

// },
},
};
54 changes: 27 additions & 27 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "backend",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-ignition": "^0.15.0",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"chai": "^4.2.0",
"ethers": "^6.4.0",
"hardhat": "^2.22.2",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.0",
"typechain": "^8.3.0"
},
"dependencies": {
"@openzeppelin/contracts": "^5.0.2",
"dotenv": "^16.4.5"
}
}
{
"name": "backend",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-ignition": "^0.15.0",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"chai": "^4.2.0",
"ethers": "^6.11.1",
"hardhat": "^2.22.2",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.0",
"typechain": "^8.3.0"
},
"dependencies": {
"@openzeppelin/contracts": "^5.0.2",
"dotenv": "^16.4.5"
}
}
73 changes: 42 additions & 31 deletions backend/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
const hre = require("hardhat");
const fs = require("fs");

async function main() {

const { chainId } = await ethers.provider.getNetwork();
let paymentAddress;
/*********************************************************/

const Admins = await hre.ethers.getContractFactory("Admins");
const admins = await Admins.deploy();
await admins.deployed();
console.log(
`Admins deployed to ${admins.address}`
);


const data1 = {
address: admins.address,
abi: JSON.parse(admins.interface.format('json'))
}
// fs.writeFileSync('./../front/public/contracts/solarNft.json',
// JSON.stringify(data1))
// fs.writeFileSync(`./../front/public/contracts/${chainId}/solarNft.json`,
// JSON.stringify(data1))
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
const hre = require("hardhat");
const ethers = require("ethers");
// const fs = require("fs");

async function main() {
// const { chainId } = await ethers.provider.getNetwork();

const Admins = await hre.ethers.getContractFactory("Admins");
const admins = await Admins.deploy();
await admins.deployed();
console.log(`Admins deployed to ${admins.address}`);

const data1 = {
address: admins.address,
abi: JSON.parse(admins.interface.format("json")),
};
// fs.writeFileSync('./../front/public/contracts/solarNft.json', JSON.stringify(data1))
// fs.writeFileSync(`./../front/public/contracts/${chainId}/solarNft.json`, JSON.stringify(data1))
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

// async function main() {
// const [deployer] = await ethers.getSigners();

// console.log("Deploying contracts with the account:", deployer.address);

// const Admins = await hre.ethers.getContractFactory("Admins");
// const admins = await Admins.deploy();
// // await admins.deployed();
// console.log(`Admins deployed to ${admins.address}`);
// }

// main()
// .then(() => process.exit(0))
// .catch((error) => {
// console.error(error);
// process.exit(1);
// });
Loading
Loading