converted js files to ts

This commit is contained in:
bhavik-m 2022-02-14 08:28:00 +05:30
parent 4e94eb113d
commit eaa49c0c69
4 changed files with 7 additions and 159 deletions

View File

@ -1,95 +0,0 @@
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-ethers");
require("@tenderly/hardhat-tenderly");
require("@nomiclabs/hardhat-etherscan");
require("@nomiclabs/hardhat-web3");
require("hardhat-deploy");
require("hardhat-deploy-ethers");
require("dotenv").config();
const { utils } = require("ethers");
const PRIVATE_KEY = process.env.PRIVATE_KEY;
const ALCHEMY_ID = process.env.ALCHEMY_ID;
if (!process.env.ALCHEMY_ID) {
throw new Error("ENV Variable ALCHEMY_ID not set!");
}
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [
{
version: "0.7.6",
settings: {
optimizer: {
enabled: false,
runs: 200,
},
},
},
{
version: "0.6.0",
},
{
version: "0.6.2",
},
{
version: "0.6.5",
},
],
},
networks: {
kovan: {
url: `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_ID}`,
accounts: [`0x${PRIVATE_KEY}`],
},
mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
accounts: [`0x${PRIVATE_KEY}`],
timeout: 150000,
gasPrice: parseInt(utils.parseUnits("30", "gwei")),
},
hardhat: {
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
blockNumber: 12796965,
},
blockGasLimit: 12000000,
gasPrice: parseInt(utils.parseUnits("300", "gwei"))
},
matic: {
url: "https://rpc-mainnet.maticvigil.com/",
accounts: [`0x${PRIVATE_KEY}`],
timeout: 150000,
gasPrice: parseInt(utils.parseUnits("1", "gwei")),
},
arbitrum: {
chainId: 42161,
url: `https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_ID}`,
accounts: [`0x${PRIVATE_KEY}`],
timeout: 150000,
gasPrice: parseInt(utils.parseUnits("2", "gwei")),
},
fantom: {
chainId: 250,
url: `https://rpc.ftm.tools/`,
accounts: [`0x${PRIVATE_KEY}`],
timeout: 150000,
gasPrice: parseInt(utils.parseUnits("250", "gwei"))
}
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
tenderly: {
project: process.env.TENDERLY_PROJECT,
username: process.env.TENDERLY_USERNAME,
},
mocha: {
timeout: 100 * 1000,
},
};

View File

@ -23,7 +23,8 @@ const chainIds = {
avalanche: 43114,
polygon: 137,
arbitrum: 42161,
optimism: 10
optimism: 10,
fantom:250
};
const alchemyApiKey = process.env.ALCHEMY_API_KEY;
@ -36,6 +37,7 @@ const ETHERSCAN_API = process.env.ETHERSCAN_API_KEY;
const POLYGONSCAN_API = process.env.POLYGON_API_KEY;
const ARBISCAN_API = process.env.ARBISCAN_API_KEY;
const SNOWTRACE_API = process.env.SNOWTRACE_API_KEY;
const FANTOMSCAN_API = process.env.FANTOM_API_KEY;
const mnemonic =
process.env.MNEMONIC ??
"test test test test test test test test test test test junk";
@ -64,6 +66,8 @@ function getNetworkUrl(networkType: string) {
return `https://arb-mainnet.g.alchemy.com/v2/${alchemyApiKey}`;
else if (networkType === "optimism")
return `https://opt-mainnet.g.alchemy.com/v2/${alchemyApiKey}`;
else if(networkType === "fantom")
return `https://rpc.ftm.tools/`
else return `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}`;
}
@ -71,6 +75,7 @@ function getScanApiKey(networkType: string) {
if (networkType === "avalanche") return SNOWTRACE_API;
else if (networkType === "polygon") return POLYGONSCAN_API;
else if (networkType === "arbitrum") return ARBISCAN_API;
else if(networkType === "fantom") return FANTOMSCAN_API;
else return ETHERSCAN_API;
}
@ -115,6 +120,7 @@ const config: HardhatUserConfig = {
avalanche: createConfig("avalanche"),
arbitrum: createConfig("arbitrum"),
optimism: createConfig("optimism"),
fantom: createConfig("fantom"),
},
paths: {
artifacts: "./artifacts",

View File

@ -1,38 +0,0 @@
const hre = require("hardhat");
const { ethers } = hre;
const deployConnector = require("./deployConnector");
async function main() {
const accounts = await hre.ethers.getSigners()
const wallet = accounts[0]
const connectMapping = {
// '1INCH-A': 'ConnectV2OneInch',
// '1INCH-B': 'ConnectV2OneProto',
// 'AAVE-V1-A': 'ConnectV2AaveV1',
// 'AAVE-V2-A': 'ConnectV2AaveV2',
'AUTHORITY-A': 'ConnectV2AuthFantom',
'BASIC-A': 'ConnectV2BasicFantom',
// 'COMP-A': 'ConnectV2COMP',
// 'COMPOUND-A': 'ConnectV2Compound',
// 'DYDX-A': 'ConnectV2Dydx',
// 'FEE-A': 'ConnectV2Fee',
// 'GELATO-A': 'ConnectV2Gelato',
// 'MAKERDAO-A': 'ConnectV2Maker',
// 'UNISWAP-A': 'ConnectV2UniswapV2'
}
const addressMapping = {}
for (const key in connectMapping) {
addressMapping[key] = await deployConnector(connectMapping[key])
}
}
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});

View File

@ -1,25 +0,0 @@
const hre = require("hardhat");
const { ethers } = hre;
module.exports = async (connectorName) => {
// const Connector = await ethers.getContractFactory(connectorName);
// const connector = await Connector.deploy();
// await connector.deployed();
// console.log(`${connectorName} Deployed: ${connector.address}`);
try {
await hre.run("verify:verify", {
address: "0x9926955e0dd681dc303370c52f4ad0a4dd061687",
constructorArguments: [],
contract: "contracts/fantom/connectors/basic/main.sol:ConnectV2BasicFantom"
}
)
} catch (error) {
// console.log(`Failed to verify: ${connectorName}@${connector.address}`)
console.log(error)
console.log()
}
return connector.address
}