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

Improvements #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#Live Link
https://emmanuel-umeh.github.io/dripto-ponks/

# Dripto Ponks
This is an exciting project. It is a marketplace where users can mint their tokens and also sell it to other users. There are two separate contracts, one for minting and another for the marketplace. The marketplace has functions for creating an NFT and for buying the NFT.
Users set the attributes such as Background color, complexion and hair color.
Expand Down Expand Up @@ -72,4 +75,4 @@ In this case, we are using a mnemonic from an account created on Metamask. You c
npx hardhat run --network alfajores scripts/deploy.js
```

This command will update the src/contract files with the deployed smart contract ABI and contract address.
This command will update the src/contract files with the deployed smart contract ABI and contract address.
4 changes: 2 additions & 2 deletions contracts/MyNft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract MyNFT is ERC721, Ownable, ERC721Enumerable, ERC721URIStorage{

Counters.Counter private _tokenIdCounter;

constructor() ERC721("Coolest NFT", "CNFT") {}
constructor() ERC721("DRIPTO PONKS", "DRPO") {}

uint _tokenId = 0;

Expand Down Expand Up @@ -57,4 +57,4 @@ contract MyNFT is ERC721, Ownable, ERC721Enumerable, ERC721URIStorage{
{
return super.supportsInterface(interfaceId);
}
}
}
33,071 changes: 0 additions & 33,071 deletions package-lock.json

This file was deleted.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "celo-react-boilerplate",
"name": "dripto-ponks",
"version": "0.1.0",
"homepage": "https://Emmanuel-umeh.github.io/dripto-ponks",
"private": true,
"dependencies": {
"@celo-tools/use-contractkit": "3.0.0-beta2",
Expand Down Expand Up @@ -32,7 +33,9 @@
"eject": "react-scripts eject",
"compile": "npx hardhat compile",
"deploy": "npx hardhat run --network alfajores scripts/deploy.js",
"test-contract": "npx hardhat test"
"test-contract": "npx hardhat test",
"predeploy": "npm run build",
"deploy-prod": "npm run predeploy && gh-pages -d build"
},
"eslintConfig": {
"extends": [
Expand All @@ -58,6 +61,7 @@
"chai": "^4.2.0",
"ethereum-waffle": "^3.0.0",
"ethers": "^5.0.0",
"gh-pages": "^3.2.3",
"hardhat": "^2.8.2",
"react-error-overlay": "^6.0.9"
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Wallet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Dropdown, Stack, Spinner } from "react-bootstrap";
import { formatBigNumber, truncateAddress } from "./../utils";
import { formatBigNumber, truncateAddress } from "../utils";
import Identicon from "./ui/Identicon";

const Wallet = ({ address, amount, symbol, destroy }) => {
Expand Down
31 changes: 15 additions & 16 deletions src/components/minter/nfts/Add.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Button, Modal, Form, FloatingLabel } from "react-bootstrap";
import { uploadToIpfs } from "../../../utils/minter";

const COLORS = ["Red", "Green", "White", "Blue", "Yellow", "Purple"];
const SHAPES = ["Circle", "Square", "Triangle"];

const AddNfts = ({ save, address }) => {
const [name, setName] = useState("");
Expand Down Expand Up @@ -59,7 +58,7 @@ const AddNfts = ({ save, address }) => {
className="rounded-pill px-0"
style={{ width: "38px" }}
>
<i className="bi bi-plus"></i>
<i className="bi bi-plus"/>
</Button>

{/* Modal */}
Expand Down Expand Up @@ -115,18 +114,18 @@ const AddNfts = ({ save, address }) => {
</FloatingLabel>

<Form.Control
type="file"
className={"mb-3"}
onChange={async (e) => {
const imageUrl = await uploadToIpfs(e);
if (!imageUrl) {
alert("failed to upload image");
return;
}
setIpfsImage(imageUrl);
}}
placeholder="Product name"
></Form.Control>
type="file"
className={"mb-3"}
onChange={async (e) => {
const imageUrl = await uploadToIpfs(e);
if (!imageUrl) {
alert("failed to upload image");
return;
}
setIpfsImage(imageUrl);
}}
placeholder="Product name"
/>
<Form.Label>
<h5>Properties</h5>
</Form.Label>
Expand Down Expand Up @@ -220,5 +219,5 @@ AddNfts.propTypes = {
save: PropTypes.func.isRequired,
address: PropTypes.string.isRequired,
};
export default AddNfts;

export default AddNfts;
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ReactDOM.render(
}}
dapp={{
name: "Dripto Ponks",
description: "A React Boilerplate for Celo Dapps",
description: "An NFT Marketplace",
}}
>
<App />
Expand Down
14 changes: 6 additions & 8 deletions src/utils/minter.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ export const getNfts = async (minterContract, marketContract) => {
export const fetchNftMeta = async (ipfsUrl) => {
try {
if (!ipfsUrl) return null;
const meta = await axios.get(ipfsUrl);
return meta;
return await axios.get(ipfsUrl);
} catch (e) {
console.log({ e });
}
Expand All @@ -121,8 +120,7 @@ export const fetchNftOwner = async (minterContract, index) => {

export const fetchNftContractOwner = async (minterContract) => {
try {
let owner = await minterContract.methods.owner().call();
return owner;
return await minterContract.methods.owner().call();
} catch (e) {
console.log({ e });
}
Expand All @@ -135,16 +133,16 @@ export const buyNft = async (marketContract, performActions, index) => {
console.log(marketContract, index);
const { defaultAccount } = kit;
const listing = await marketContract.methods.getListing(index).call();

await marketContract.methods
.buyToken(index)
.send({ from: defaultAccount, value: listing.price });
} catch (error) {
console.log({ error });
}
});
});
} catch (error) {
console.log(error)
console.log(error)
}

};