mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
Added deployment script
This commit is contained in:
parent
0b38e0f407
commit
d853b50d8a
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,3 +3,6 @@ node_modules
|
|||
#Hardhat files
|
||||
cache
|
||||
artifacts
|
||||
|
||||
.env
|
||||
flatten
|
5
contracts/proxy/dummyImpl.sol
Normal file
5
contracts/proxy/dummyImpl.sol
Normal file
|
@ -0,0 +1,5 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
contract InstaEmptyImpl {
|
||||
|
||||
}
|
|
@ -1,22 +1,76 @@
|
|||
// Buidler
|
||||
require("@nomiclabs/hardhat-ethers");
|
||||
require("@nomiclabs/hardhat-waffle");
|
||||
require("@nomiclabs/hardhat-web3")
|
||||
require("hardhat-deploy");
|
||||
require("hardhat-deploy-ethers");
|
||||
|
||||
// This is a sample Hardhat task. To learn how to create your own go to
|
||||
// https://hardhat.org/guides/create-task.html
|
||||
task("accounts", "Prints the list of accounts", async () => {
|
||||
const accounts = await ethers.getSigners();
|
||||
require("@nomiclabs/hardhat-etherscan");
|
||||
|
||||
for (const account of accounts) {
|
||||
console.log(account.address);
|
||||
}
|
||||
});
|
||||
require("dotenv").config();
|
||||
|
||||
// You need to export an object to set up your config
|
||||
// Go to https://hardhat.org/config/ to learn more
|
||||
const { utils } = require("ethers");
|
||||
|
||||
/**
|
||||
* @type import('hardhat/config').HardhatUserConfig
|
||||
*/
|
||||
const ALCHEMY_ID = process.env.ALCHEMY_ID;
|
||||
const PRIVATE_KEY = process.env.PRIVATE_KEY;
|
||||
// ================================= CONFIG =========================================
|
||||
module.exports = {
|
||||
solidity: "0.7.3",
|
||||
defaultNetwork: "hardhat",
|
||||
tenderly: {
|
||||
project: "team-development",
|
||||
username: "InstaDApp",
|
||||
forkNetwork: "1"
|
||||
},
|
||||
networks: {
|
||||
hardhat: {
|
||||
forking: {
|
||||
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||
blockNumber: 12068005,
|
||||
},
|
||||
blockGasLimit: 12000000,
|
||||
|
||||
masterAddress: INSTA_MASTER,
|
||||
instaIndexAddress: INSTA_INDEX
|
||||
},
|
||||
kovan: {
|
||||
url: `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||
accounts: [`0x${PRIVATE_KEY}`]
|
||||
},
|
||||
mainnet: {
|
||||
url: `https://eth.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||
accounts: [`0x${PRIVATE_KEY}`],
|
||||
timeout: 150000,
|
||||
gasPrice: parseInt(utils.parseUnits("93", "gwei"))
|
||||
},
|
||||
matic: {
|
||||
url: "https://rpc-mainnet.maticvigil.com/",
|
||||
accounts: [`0x${PRIVATE_KEY}`],
|
||||
timeout: 150000,
|
||||
gasPrice: parseInt(utils.parseUnits("1", "gwei"))
|
||||
}
|
||||
},
|
||||
solidity: {
|
||||
compilers: [
|
||||
{
|
||||
version: "0.7.6"
|
||||
},
|
||||
{
|
||||
version: "0.7.3",
|
||||
},
|
||||
{
|
||||
version: "0.7.0",
|
||||
},
|
||||
{
|
||||
version: "0.6.10",
|
||||
},
|
||||
{
|
||||
version: "0.6.8",
|
||||
}
|
||||
]
|
||||
},
|
||||
etherscan: {
|
||||
apiKey: process.env.ETHERSCAN
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
21630
package-lock.json
generated
21630
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -11,11 +11,16 @@
|
|||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.2",
|
||||
"@nomiclabs/hardhat-etherscan": "^2.1.1",
|
||||
"@nomiclabs/hardhat-waffle": "^2.0.1",
|
||||
"@nomiclabs/hardhat-web3": "^2.0.0",
|
||||
"chai": "^4.3.4",
|
||||
"dotenv": "^7.0.0",
|
||||
"ethereum-waffle": "^3.3.0",
|
||||
"ethers": "^5.1.0",
|
||||
"hardhat": "^2.1.2",
|
||||
"hardhat-deploy": "^0.7.0-beta.44",
|
||||
"hardhat-deploy-ethers": "^0.3.0-beta.7",
|
||||
"solc": "0.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
84
scripts/deploy.js
Normal file
84
scripts/deploy.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
const hre = require("hardhat");
|
||||
const { ethers } = hre;
|
||||
|
||||
async function main() {
|
||||
let instaIndex
|
||||
if (hre.network.name === "mainnet") {
|
||||
console.log(
|
||||
"\n\n Deploying Contracts to mainnet. Hit ctrl + c to abort"
|
||||
);
|
||||
instaIndex = "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723"
|
||||
|
||||
const InstaEmptyImpl = await ethers.getContractFactory("InstaEmptyImpl");
|
||||
const instaEmptyImpl = await InstaEmptyImpl.deploy();
|
||||
await instaEmptyImpl.deployed();
|
||||
|
||||
console.log("InstaEmptyImpl deployed: ", instaEmptyImpl.address);
|
||||
|
||||
|
||||
const InstaMasterProxy = await ethers.getContractFactory("InstaMasterProxy");
|
||||
const instaMasterProxy = await InstaMasterProxy.deploy(instaIndex);
|
||||
await instaMasterProxy.deployed();
|
||||
|
||||
console.log("InstaMasterProxy deployed: ", instaMasterProxy.address);
|
||||
|
||||
const InstaAaveV2MigratorSender = await ethers.getContractFactory("InstaAaveV2MigratorSender");
|
||||
const instaAaveV2MigratorSender = await InstaAaveV2MigratorSender.deploy(instaEmptyImpl.address, instaMasterProxy.address, "0x");
|
||||
await instaAaveV2MigratorSender.deployed();
|
||||
|
||||
console.log("InstaAaveV2MigratorSender deployed: ", instaAaveV2MigratorSender.address);
|
||||
|
||||
await hre.run("verify:verify", {
|
||||
address: instaEmptyImpl.address,
|
||||
constructorArguments: [],
|
||||
contract: "contracts/proxy/dummyImpl.sol:InstaEmptyImpl"
|
||||
}
|
||||
)
|
||||
|
||||
await hre.run("verify:verify", {
|
||||
address: instaMasterProxy.address,
|
||||
constructorArguments: [instaIndex],
|
||||
}
|
||||
)
|
||||
|
||||
await hre.run("verify:verify", {
|
||||
address: instaAaveV2MigratorSender.address,
|
||||
constructorArguments: [instaEmptyImpl.address, instaMasterProxy.address, "0x"],
|
||||
contract: "contracts/proxy/senders.sol:InstaAaveV2MigratorSender"
|
||||
}
|
||||
)
|
||||
} else if (hre.network.name === "matic") {
|
||||
console.log(
|
||||
"\n\n Deploying Contracts to matic..."
|
||||
);
|
||||
instaIndex = "0xA9B99766E6C676Cf1975c0D3166F96C0848fF5ad"
|
||||
|
||||
|
||||
const InstaEmptyImpl = await ethers.getContractFactory("InstaEmptyImpl");
|
||||
const instaEmptyImpl = await InstaEmptyImpl.deploy();
|
||||
await instaEmptyImpl.deployed();
|
||||
|
||||
console.log("InstaEmptyImpl deployed: ", instaEmptyImpl.address);
|
||||
|
||||
|
||||
const InstaMasterProxy = await ethers.getContractFactory("InstaMasterProxy");
|
||||
const instaMasterProxy = await InstaMasterProxy.deploy(instaIndex);
|
||||
await instaMasterProxy.deployed();
|
||||
|
||||
console.log("InstaMasterProxy deployed: ", instaMasterProxy.address);
|
||||
|
||||
const InstaAaveV2MigratorReceiver = await ethers.getContractFactory("InstaAaveV2MigratorReceiver");
|
||||
const instaAaveV2MigratorReceiver = await InstaAaveV2MigratorReceiver.deploy(instaEmptyImpl.address, instaMasterProxy.address, "0x");
|
||||
await instaAaveV2MigratorReceiver.deployed();
|
||||
|
||||
console.log("InstaAaveV2MigratorReceiver deployed: ", instaAaveV2MigratorReceiver.address);
|
||||
console.log("Contracts deployed")
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
19
scripts/flatten.sh
Executable file
19
scripts/flatten.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
baseContractPath='contracts'
|
||||
function find() {
|
||||
for file in "$1"/*; do
|
||||
if [[ -d "$file" ]]; then
|
||||
# echo "directory $file"
|
||||
mkdir flatten/$file
|
||||
find $file
|
||||
elif [[ -f "$file" ]]; then
|
||||
echo "Created [`basename "$file"`]"
|
||||
npx hardhat flatten $file > flatten/$file
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
rm -rf flatten/$baseContractPath
|
||||
mkdir flatten/$baseContractPath
|
||||
find $baseContractPath
|
Loading…
Reference in New Issue
Block a user