-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from pappas999/feat/deploy-and-fund
Feat/deploy and fund
- Loading branch information
Showing
29 changed files
with
420 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export KOVAN_RPC_URL='NOOOOOO GARY' | ||
export PRIVATE_KEY='abcdef' | ||
export KOVAN_RPC_URL='www.infura.io/asdfadsfafdadf' | ||
export PRIVATE_KEY='0xabcdef' | ||
export ALCHEMY_MAINNET_RPC_URL="https://eth-mainnet.alchemyapi.io/v2/your-api-key" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const { networkConfig, autoFundCheck } = require('../helper-hardhat-config') | ||
const { ethers, getNamedAccounts } = require('hardhat') | ||
|
||
module.exports = async ({ | ||
getNamedAccounts, | ||
deployments | ||
}) => { | ||
const { deploy, log, get } = deployments | ||
const chainId = await getChainId() | ||
let linkTokenAddress | ||
let additionalMessage = "" | ||
//set log level to ignore non errors | ||
ethers.utils.Logger.setLogLevel(ethers.utils.Logger.levels.ERROR) | ||
const networkName = networkConfig[chainId]['name'] | ||
|
||
if (chainId == 31337) { | ||
linkToken = await get('LinkToken') | ||
MockOracle = await get('MockOracle') | ||
linkTokenAddress = linkToken.address | ||
oracle = MockOracle.address | ||
additionalMessage = " --linkaddress " + linkTokenAddress | ||
} else { | ||
linkTokenAddress = networkConfig[chainId]['linkToken'] | ||
oracle = networkConfig[chainId]['oracle'] | ||
} | ||
|
||
//Try Auto-fund APIConsumer contract with LINK | ||
const APIConsumer = await deployments.get('APIConsumer') | ||
const apiConsumer = await ethers.getContractAt('APIConsumer', APIConsumer.address) | ||
|
||
if (await autoFundCheck(apiConsumer.address, networkName, linkTokenAddress, additionalMessage)) { | ||
await hre.run("fund-link", { contract: apiConsumer.address, linkaddress: linkTokenAddress }) | ||
} else { | ||
log("Then run API Consumer contract with following command:") | ||
log("npx hardhat request-data --contract " + apiConsumer.address + " --network " + networkName) | ||
} | ||
log("----------------------------------------------------") | ||
|
||
|
||
//Now try Auto-fund VRFConsumer contract | ||
|
||
const RandomNumberConsumer = await deployments.get('RandomNumberConsumer') | ||
const randomNumberConsumer = await ethers.getContractAt('RandomNumberConsumer', RandomNumberConsumer.address) | ||
|
||
if (await autoFundCheck(apiConsumer.address, networkName, linkTokenAddress, additionalMessage)) { | ||
await hre.run("fund-link", { contract: randomNumberConsumer.address, linkaddress: linkTokenAddress }) | ||
} else { | ||
log("Then run RandomNumberConsumer contract with the following command:") | ||
log("npx hardhat request-random-number --contract " + randomNumberConsumer.address + " --network " + networkName) | ||
} | ||
log("----------------------------------------------------") | ||
|
||
} | ||
module.exports.tags = ['all'] |
Oops, something went wrong.