Skip to content

Commit

Permalink
Merge pull request #46 from moonshotcollective/revert-45-rinkeby-deploy
Browse files Browse the repository at this point in the history
Revert "Rinkeby deploy from Supriya"
  • Loading branch information
codenamejason authored Mar 10, 2022
2 parents 1c1201e + 7cd52c3 commit 7587fef
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 369 deletions.
53 changes: 0 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,6 @@ yarn install
yarn chain
```

> Make a copy of `.sample.env` and rename to `.env` in `packages/react-app`. Don't forget to fill in the variables.
<table>
<thead>
<th>Variable</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td><code>REACT_APP_NETWORK</code></td>
<td>The ethereum network to run on, by default "mainnet"</td>
</tr>
<tr>
<td><code>REACT_APP_INFURA_ID</code></td>
<td>Your Infura project ID.</td>
</tr>
<tr>
<td><code>REACT_APP_ETHERSCAN_ID</code></td>
<td>Your Etherscan API key token.</td>
</tr>
<tr>
<td><code>REACT_APP_PROVIDER</code></td>
<td>Provider endpoint, typically Infura endpoint.</td>
</tr>
<tr>
<td><code>REACT_APP_MAINNET_RPC_ENDPOINT</code></td>
<td>Can be used to override the mainnet RPC provider endpoint (typically Alchemy endpoint).</td>
</tr>
</tbody>
</table>
> in a second terminal window, start your 📱 frontend:
```bash
Expand All @@ -57,30 +28,6 @@ yarn start
```

> Make a copy of `.sample.env` and rename to `.env` in `packages/hardhat`. Don't forget to fill in the variables.
<table>
<thead>
<th>Variable</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td><code>STREAM_FACTORY_OWNER</code></td>
<td>Owner address of the stream factory contract <code>packages/hardhat/contracts/StreamFactory.sol</code></td>
</tr>
<tr>
<td><code>STREAM_FACTORY_ADMINS</code></td>
<td>Admin addresses of the stream factory contract constructor arg <code>packages/hardhat/contracts/StreamFactory.sol</code></td>
</tr>
<tr>
<td><code>DEPLOY_ENDPOINT_RINKEBY</code></td>
<td>Your Infura / Alchemy endpoint for tokenstream on Rinkeby network</td>
</tr>
<tr>
<td><code>DEPLOY_ACCOUNT_RINKEBY</code></td>
<td>Your wallet account. For metamask, the private key can be extracted by clicking on the three dots button next to the account icon, then on "Account Details" and then on "Export private key".</td>
</tr>
</tbody>
</table>
> in a third terminal window, 🛰 deploy your contract:
```bash
Expand Down
7 changes: 3 additions & 4 deletions packages/hardhat/.sample.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
STREAM_FACTORY_OWNER=0x0000000000000000000000000000000000000000
STREAM_FACTORY_ADMINS=["0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000"]
DEPLOY_ENDPOINT_RINKEBY=https://rinkeby.infura.io/v3/[YOUR_ID]
DEPLOY_ACCOUNT_RINKEBY=my super secret key that i promise never ever to share
DEVELOPER=0x0000000000000000000000000000000000000000
MANAGER1=0x0000000000000000000000000000000000000000
MANAGER2=0x0000000000000000000000000000000000000000
13 changes: 7 additions & 6 deletions packages/hardhat/deploy/00_deploy_stream_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ module.exports = async ({ getNamedAccounts, getChainId, deployments }) => {
const { deployer } = await getNamedAccounts();
const chainId = await getChainId();

const admins = [];
const GTC = { address: "0xde30da39c46104798bb5aa3fe8b9e0e1f348163f" };

const owner = process.env.STREAM_FACTORY_OWNER;
const admins = JSON.parse(process.env.STREAM_FACTORY_ADMINS);
admins.push(owner); // the owner is also an admin
admins[0] = process.env.MANAGER1;
admins[1] = process.env.MANAGER2;
admins[2] = process.env.MANAGER3;

// // deploy dummy GTC on non-mainnet networks
// if (chainId !== "1") {
// GTC = await deploy("GTC", {
// from: deployer,
// args: [admins],
// args: [admins[2]],
// log: true,
// });
// }

// deploy the stream factory
const streamFactory = await deploy("StreamFactory", {
from: deployer,
args: [owner, admins],
args: [admins[1], admins],
log: true,
});

Expand All @@ -38,7 +39,7 @@ module.exports = async ({ getNamedAccounts, getChainId, deployments }) => {
await run("verify:verify", {
address: streamFactory.address,
contract: "contracts/StreamFactory.sol:StreamFactory",
constructorArguments: [owner, admins],
constructorArguments: [admins[1], admins],
});
}
};
Expand Down
9 changes: 4 additions & 5 deletions packages/hardhat/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const { utils } = require("ethers");
const fs = require("fs");
const chalk = require("chalk");

require("dotenv").config();
require("@nomiclabs/hardhat-waffle");
require("@tenderly/hardhat-tenderly");
require("hardhat-deploy");
Expand Down Expand Up @@ -35,11 +34,11 @@ module.exports = {
url: "http://localhost:8545",
},
rinkeby: {
url: process.env.DEPLOY_ENDPOINT_RINKEBY, // <---- YOUR INFURA ID! (or it won't work)
url: "https://rinkeby.infura.io/v3/460f40a260564ac4a4f4b3fffb032dad", // <---- YOUR INFURA ID! (or it won't work)
// url: "https://speedy-nodes-nyc.moralis.io/XXXXXXXXXXXXXXXXXXXXXXX/eth/rinkeby", // <---- YOUR MORALIS ID! (not limited to infura)
accounts: [
process.env.DEPLOY_ACCOUNT_RINKEBY
],
accounts: {
mnemonic: mnemonic(),
},
},
kovan: {
url: "https://kovan.infura.io/v3/460f40a260564ac4a4f4b3fffb032dad", // <---- YOUR INFURA ID! (or it won't work)
Expand Down
6 changes: 1 addition & 5 deletions packages/react-app/.sample.env
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
REACT_APP_INFURA_ID=INFURA-PROJECT-ID
REACT_APP_RINKEBY_PROVIDER=https://rinkeby.infura.io/v3/INFURA-PROJECT-ID
REACT_APP_ETHERSCAN_ID=YOUR Etherscan API key token
REACT_APP_MAINNET_RPC_ENDPOINT=https://eth-mainnet.alchemyapi.io/v2/ALCHEMY-ID
REACT_APP_NETWORK=rinkeby
REACT_APP_PROVIDER=https://rinkeby.infura.io/v3/2717afb6bf164045b5d5468031b93f87
18 changes: 8 additions & 10 deletions packages/react-app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,37 @@ import { Home, UserStream } from "./views";

const { ethers } = require("ethers");

const mainnetRpcEndpoint = process.env.REACT_APP_MAINNET_RPC_ENDPOINT || "https://eth-mainnet.alchemyapi.io/v2/W0XfQJvBYrDk6wxM2F3VEDns10TBTLzs";

/// 📡 What chain are your contracts deployed to?
const targetNetwork = NETWORKS[process.env.REACT_APP_NETWORK || "mainnet"]; // <------- select your target frontend network (localhost, rinkeby, xdai, mainnet)
const targetNetwork = NETWORKS.mainnet; // <------- select your target frontend network (localhost, rinkeby, xdai, mainnet)

// 😬 Sorry for all the console logging
const DEBUG = false;
const NETWORKCHECK = true;

// 🛰 providers
if (DEBUG) console.log("📡 Connecting to " + targetNetwork.network + " Ethereum");
if (DEBUG) console.log("📡 Connecting to Mainnet Ethereum");
// const mainnetProvider = getDefaultProvider("mainnet", { infura: INFURA_ID, etherscan: ETHERSCAN_KEY, quorum: 1 });
// const mainnetProvider = new InfuraProvider("mainnet",INFURA_ID);
//
// attempt to connect to our own scaffold eth rpc and if that fails fall back to infura...
// Using StaticJsonRpcProvider as the chainId won't change see https://github.com/ethers-io/ethers.js/issues/901
const scaffoldEthProvider = navigator.onLine
? new ethers.providers.StaticJsonRpcProvider(mainnetRpcEndpoint)
? new ethers.providers.StaticJsonRpcProvider("https://eth-mainnet.alchemyapi.io/v2/W0XfQJvBYrDk6wxM2F3VEDns10TBTLzs")
: null;
const poktMainnetProvider = navigator.onLine
? new ethers.providers.StaticJsonRpcProvider(
"https://eth-mainnet.gateway.pokt.network/v1/lb/611156b4a585a20035148406",
)
: null;
const mainnetInfura = navigator.onLine
? new ethers.providers.StaticJsonRpcProvider(mainnetRpcEndpoint)
? new ethers.providers.StaticJsonRpcProvider("https://eth-mainnet.alchemyapi.io/v2/W0XfQJvBYrDk6wxM2F3VEDns10TBTLzs")
: null;
// ( ⚠️ Getting "failed to meet quorum" errors? Check your INFURA_ID

// 🏠 Your local provider is usually pointed at your local blockchain
const localProviderUrl = targetNetwork.rpcUrl;
// as you deploy to other networks you can set REACT_APP_RINKEBY_PROVIDER=https://dai.poa.network in packages/react-app/.env
const localProviderUrlFromEnv = process.env.REACT_APP_RINKEBY_PROVIDER ? process.env.REACT_APP_RINKEBY_PROVIDER : localProviderUrl;
// as you deploy to other networks you can set REACT_APP_PROVIDER=https://dai.poa.network in packages/react-app/.env
const localProviderUrlFromEnv = process.env.REACT_APP_PROVIDER ? process.env.REACT_APP_PROVIDER : localProviderUrl;
if (DEBUG) console.log("🏠 Connecting to provider:", localProviderUrlFromEnv);
const localProvider = new ethers.providers.StaticJsonRpcProvider(localProviderUrlFromEnv);

Expand All @@ -76,7 +75,7 @@ const walletLinkProvider = walletLink.makeWeb3Provider(
Web3 modal helps us "connect" external wallets:
*/
const web3Modal = new SafeAppWeb3Modal({
network: targetNetwork.network, // Optional. If using WalletConnect on xDai, change network to "xdai" and add RPC info below for xDai chain.
network: "mainnet", // Optional. If using WalletConnect on xDai, change network to "xdai" and add RPC info below for xDai chain.
cacheProvider: true, // optional
theme: "light", // optional. Change to "dark" for a dark theme.
providerOptions: {
Expand All @@ -87,7 +86,6 @@ const web3Modal = new SafeAppWeb3Modal({
infuraId: INFURA_ID,
rpc: {
1: "https://eth-mainnet.alchemyapi.io/v2/oKxs-03sij-U_N0iOlrSsZFr29-IqbuF", // mainnet // For more WalletConnect providers: https://docs.walletconnect.org/quick-start/dapps/web3-provider#required
4: `https://rinkeby.infura.io/v3/${INFURA_ID}`,
42: `https://kovan.infura.io/v3/${INFURA_ID}`,
100: "https://dai.poa.network", // xDai
},
Expand Down
6 changes: 3 additions & 3 deletions packages/react-app/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// MY INFURA_ID, SWAP IN YOURS FROM https://infura.io/dashboard/ethereum
export const INFURA_ID = process.env.REACT_APP_INFURA_ID || "460f40a260564ac4a4f4b3fffb032dad";
export const INFURA_ID = "460f40a260564ac4a4f4b3fffb032dad";

// MY ETHERSCAN_ID, SWAP IN YOURS FROM https://etherscan.io/myapikey
export const ETHERSCAN_KEY = process.env.REACT_APP_ETHERSCAN_ID || "PSW8C433Q667DVEX5BCRMGNAH9FSGFZ7Q8";
export const ETHERSCAN_KEY = "PSW8C433Q667DVEX5BCRMGNAH9FSGFZ7Q8";

// BLOCKNATIVE ID FOR Notify.js:
export const BLOCKNATIVE_DAPPID = "0b58206a-f3c0-4701-a62f-73c7243e8c77";
Expand All @@ -20,7 +20,7 @@ export const NETWORKS = {
color: "#ff8b9e",
chainId: 1,
// rpcUrl: `https://mainnet.infura.io/v3/${INFURA_ID}`,
rpcUrl: process.env.REACT_APP_MAINNET_RPC_ENDPOINT || "https://eth-mainnet.alchemyapi.io/v2/W0XfQJvBYrDk6wxM2F3VEDns10TBTLzs",
rpcUrl: "https://eth-mainnet.alchemyapi.io/v2/W0XfQJvBYrDk6wxM2F3VEDns10TBTLzs",
blockExplorer: "https://etherscan.io/",
},
kovan: {
Expand Down
Loading

0 comments on commit 7587fef

Please sign in to comment.