Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to master #14

Merged
merged 15 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 38 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
# Basic Sample Hardhat Project
# Moonswap

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts.

Try running some of the following tasks:
# Mission
Enable DAOs to swap tokens to create shared interests and long term partnerships

```shell
npx hardhat accounts
npx hardhat compile
npx hardhat clean
npx hardhat test
npx hardhat node
node scripts/sample-script.js
npx hardhat help
# Get Started

Prerequisites: [Node](https://nodejs.org/en/download/) plus [Yarn](https://classic.yarnpkg.com/en/docs/install/) and [Git](https://git-scm.com/downloads)

> clone/fork Moonswap:

```bash
git clone https://github.com/moonshotcollective/moonswap.git app
```

> install and start your 👷‍ Hardhat chain:

```bash
cd app
yarn install
yarn chain
```

> in a second terminal window, start your 📱 frontend:

```bash
cd app
yarn start
```

> in a third terminal window, 🛰 deploy your contract:

```bash
cd app
yarn deploy
```


# 📚 Documentation

Documentation, tutorials, challenges, and many more resources, visit: [docs.scaffoldeth.io](https://docs.scaffoldeth.io)
17 changes: 17 additions & 0 deletions packages/hardhat/contracts/dETH.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// todo: Do we not need any other functionality here? JR

// dummyToken Contract to test out TokenDistribution locally
contract dETH is ERC20 {
constructor() public ERC20("dummyETH", "dETH") {
_mint(msg.sender, 10000000e18);
}

function mint4Me(uint256 amount) public {
_mint(msg.sender, amount);
}
}
17 changes: 17 additions & 0 deletions packages/hardhat/contracts/dGTC.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// todo: Do we not need any other functionality here? JR

// dummyToken Contract to test out TokenDistribution locally
contract dGTC is ERC20 {
constructor() public ERC20("dummyGTC", "dGTC") {
_mint(msg.sender, 10000000e18);
}

function mint4Me(uint256 amount) public {
_mint(msg.sender, amount);
}
}
37 changes: 35 additions & 2 deletions packages/hardhat/deploy/00_deploy_your_contract.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
// deploy/00_deploy_your_contract.js

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

module.exports = async ({ getNamedAccounts, getChainId, deployments }) => {
const frontendAddress = process.env.FRONTENDADDRESS;
const receiverAddress = process.env.RECEIVERADDRESS;


module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = await getChainId();
const deployerWallet = ethers.provider.getSigner();

const confirmationRequirement = chainId === "31337" ? 1 : 3;

await deploy("MoonSwap", {
// Learn more about args here: https://www.npmjs.com/package/hardhat-deploy#deploymentsdeploy
from: deployer,
Expand Down Expand Up @@ -47,5 +56,29 @@ module.exports = async ({ getNamedAccounts, deployments }) => {
LibraryName: **LibraryAddress**
});
*/
// run this if not for production deployment
if (chainId !== "1") {
// send test ETH to developer address on localhost
const developerAddress = process.env.DEVELOPER;

if (chainId === "31337" && developerAddress) {
const devTransfer = await deployerWallet.sendTransaction({
to: developerAddress,
value: ethers.utils.parseEther("0.15"),
});

await devTransfer.wait(confirmationRequirement);
}

await deploy("dGTC", {
from: deployer,
log: true,
});

await deploy("dETH", {
from: deployer,
log: true,
});
}
};
module.exports.tags = ["MoonSwapV1"];
2 changes: 1 addition & 1 deletion packages/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"axios": "^0.21.4",
"bnc-notify": "^1.5.0",
"dotenv": "^8.2.0",
"eth-hooks": "2.3.8",
"eth-hooks": "2.3.9",
"ethers": "^5.4.1",
"fortmatic": "^2.2.1",
"graphiql": "^1.0.5",
Expand Down
Loading