Skip to content

Commit

Permalink
Commit 1
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavaparoksham committed Aug 13, 2021
1 parent e61258e commit 3327d5e
Show file tree
Hide file tree
Showing 19 changed files with 1,480 additions and 0 deletions.
162 changes: 162 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*


#Truffle build & cache
build/
contracts/.placeholder
test/.placeholder

# Debug log from npm
npm-debug.log

# Coverage directory used by tools like istanbul
coverage
coverage.json
coverageEnv


*.swp
*.swo


# macOS
.DS_Store

# truffle
.node-xmlhttprequest-*

# IntelliJ IDE
.idea

# docs artifacts
docs/modules/api

# only used to package @openzeppelin/contracts
contracts/build/
contracts/README.md

# temporary artifact from solidity-coverage
allFiredEvents
.coverage_artifacts
.coverage_cache
.coverage_contracts

# buidler
cache
artifacts

19 changes: 19 additions & 0 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Migrations {
address public owner = msg.sender;
uint public last_completed_migration;

modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}

function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
}
67 changes: 67 additions & 0 deletions contracts/generativeNFT.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

pragma solidity ^0.8.0;

// SPDX-License-Identifier: MIT

import "./subcontracts/ERC721URIStorage.sol";
import "./libraries/Ownable.sol";


contract generativeNFT is ERC721URIStorage, Ownable {

uint256 public nftsMinted;
uint256 public mintPrice;
uint256 public nftMintLimit;


constructor() ERC721 ("Generative NFT","GNFT") {
nftsMinted = 0;
nftMintLimit = 10000;
}

function mintNFT(string[] memory tokenURI, uint256 _numNFTs) public payable returns (uint256[] memory) {

require(_numNFTs > 0, "Cannot purchase 0 NFTs.");

require(tokenURI.length == _numNFTs, "tokenURI & numNFTs mismatch");

require((_numNFTs + nftsMinted) < nftMintLimit, "Can't mint more than 10,000 NFTs");

require(msg.value == (_numNFTs * mintPrice), "Insufficient ETH provided to mint NFTs.");

uint256[] memory newItemIds;


for (uint256 i = 0; i < _numNFTs; i++) {

newItemIds[i] = nftsMinted;
_safeMint(msg.sender, newItemIds[i]);
_setTokenURI(newItemIds[i], tokenURI[i]);
nftsMinted = nftsMinted + 1;

}

return newItemIds;

}


function transferETH(address _to, uint256 _amount) public onlyOwner {

require(_amount <= address(this).balance, "Transfer Amount is higher than contract balance");

payable(_to).transfer(_amount);

}




}







24 changes: 24 additions & 0 deletions contracts/interfaces/IERC165.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
Loading

0 comments on commit 3327d5e

Please sign in to comment.