Skip to content

Commit

Permalink
feat: hardhat setup
Browse files Browse the repository at this point in the history
  • Loading branch information
singyiu committed Oct 24, 2023
1 parent 940a93e commit a45daec
Show file tree
Hide file tree
Showing 5 changed files with 4,445 additions and 86 deletions.
46 changes: 46 additions & 0 deletions packages/contracts/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require("@nomicfoundation/hardhat-toolbox");
//require("@nomiclabs/hardhat-etherscan");

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: {
compilers: [
{
version: "0.8.21",
settings: {
optimizer: {
enabled: true,
runs: 3000,
},
},
},
],
},
networks: {
scrollSepolia: {
url: "https://sepolia-rpc.scroll.io/" || "",
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
zkEVM_testnet: {
url: "https://rpc.public.zkevm-test.net" || "",
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
},
etherscan: {
apiKey: {
scrollSepolia: '2TWMJ1A7DVHAC1TH538S6IWJ5UT5T9VKTP',
},
customChains: [
{
network: 'scrollSepolia',
chainId: 534351,
urls: {
apiURL: 'https://sepolia-blockscout.scroll.io/api',
browserURL: 'https://sepolia-blockscout.scroll.io/',
},
},
],
},
};
3 changes: 3 additions & 0 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
"@openzeppelin/contracts": "^5.0.0"
},
"devDependencies": {
"@nomicfoundation/hardhat-toolbox": "^3.0.0",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@types/node": "^18.15.11",
"ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0",
"forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",
"hardhat": "^2.18.2",
"prettier": "^2.6.2",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"solhint": "^3.3.7",
Expand Down
41 changes: 41 additions & 0 deletions packages/contracts/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const hre = require("hardhat");

async function main() {
const maToken = await hre.ethers.deployContract("MockERC20", ["MockAToken", "maToken"]);
await maToken.waitForDeployment();
const maTokenAddress = await maToken.getAddress();
console.log("maTokenAddress", maTokenAddress);

const mockPool = await hre.ethers.deployContract("MockPool", [maTokenAddress]);
await mockPool.waitForDeployment();
const mockPoolAddress = await mockPool.getAddress();
console.log("mockPoolAddress", mockPoolAddress);

const mockPoolAddressesProvider = await hre.ethers.deployContract("MockPoolAddressesProvider", [mockPoolAddress]);
await mockPoolAddressesProvider.waitForDeployment();
const mockPoolAddressesProviderAddress = await mockPoolAddressesProvider.getAddress();
console.log("mockPoolAddressesProviderAddress", mockPoolAddressesProviderAddress);

const mockDAI = await hre.ethers.deployContract("MockERC20", ["MockDAI", "mDAI"]);
await mockDAI.waitForDeployment();
const mockDAIAddress = await mockDAI.getAddress();
console.log("mockDAIAddress", mockDAIAddress);

const lapuVault = await hre.ethers.deployContract("LapuVault", ["0x15bc81b35a8498cee37E2C7B857538B006CeCAa5", mockDAIAddress, "LapuVault", "LAPU", mockPoolAddressesProviderAddress, maTokenAddress]);
await lapuVault.waitForDeployment();
const lapuVaultAddress = await lapuVault.getAddress();
console.log("lapuVaultAddress", lapuVaultAddress);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Loading

0 comments on commit a45daec

Please sign in to comment.