Skip to content

Commit

Permalink
Add front (#7)
Browse files Browse the repository at this point in the history
* test

test

* delet files

* rainbowkit wagmi adminRouter

---------

Co-authored-by: Volkan Güneri <[email protected]>
Co-authored-by: root <root@DESKTOP-IA0TRAI>
  • Loading branch information
3 people authored Apr 4, 2024
1 parent 14f395a commit 66e7737
Show file tree
Hide file tree
Showing 33 changed files with 20,878 additions and 22,757 deletions.
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
File renamed without changes.
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

0 comments on commit 66e7737

Please sign in to comment.