Skip to content

Commit

Permalink
added event from Factory about new collections created
Browse files Browse the repository at this point in the history
  • Loading branch information
JackBekket committed Dec 8, 2022
1 parent 0827a33 commit 1c739f8
Show file tree
Hide file tree
Showing 15 changed files with 550 additions and 16 deletions.
5 changes: 3 additions & 2 deletions addresses.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Singleton Collection deployed to: 0xEf087AaF882c22350ABc6A287563cE037AC46b06
Factory NFT deployed to: 0x3d908DF3057fC6CE7c60e9Daf34B7e80F1B53479
Singleton Collection deployed to: 0x36Ed9bc9473F1316ec15BCca45f49f4481A63c5e
Factory NFT deployed to: 0xd2026ff372E52d1961276313dC4e3d202995c3Ef

1 change: 0 additions & 1 deletion artifacts/build-info/363ec643c0e21e60531e31b2a0665edc.json

This file was deleted.

1 change: 1 addition & 0 deletions artifacts/build-info/5ed3a01cf58c89bff6217a3c1839b687.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion artifacts/contracts/FactoryNFT.sol/FactoryNFT.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/363ec643c0e21e60531e31b2a0665edc.json"
"buildInfo": "../../build-info/5ed3a01cf58c89bff6217a3c1839b687.json"
}
42 changes: 40 additions & 2 deletions artifacts/contracts/FactoryNFT.sol/FactoryNFT.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion artifacts/contracts/SingletonNFT.sol/SingletonNFT.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/363ec643c0e21e60531e31b2a0665edc.json"
"buildInfo": "../../build-info/5ed3a01cf58c89bff6217a3c1839b687.json"
}
56 changes: 54 additions & 2 deletions artifacts/contracts/SingletonNFT.sol/SingletonNFT.json

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions contracts/FactoryNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import "@openzeppelin/contracts/access/Ownable.sol";
contract FactoryNFT is Ownable {


event CollectionCreated(address indexed creator, address collection);

// from creator to address
mapping (address => address) public Collections ;

address payable public treasure_fund;
//address singleton_nft;

Expand All @@ -35,6 +40,7 @@ constructor() {
*/
function CreateCollection(string memory name_, string memory smbl_, string[] memory file_ids) public returns (address) {
address collection_address = address(new SampleNFT(name_,smbl_,file_ids,msg.sender));
emit CollectionCreated(msg.sender,collection_address);
return collection_address;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/SampleNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

// in-direct imports
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
//import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";


Expand Down
5 changes: 3 additions & 2 deletions contracts/SingletonNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ pragma solidity ^0.8.0;
// in-direct imports

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
//import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";


// direct imports
//import "../node_modules/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
//import "../node_modules/@openzeppelin/contracts/utils/Counters.sol";
//import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";


/**
* Singleton NFT
* Each file is a record inside this single contract
*/
contract SingletonNFT is ERC721URIStorage{
contract SingletonNFT is ERC721URIStorage, Ownable{

using Counters for Counters.Counter;
Counters.Counter token_ids_count;
Expand Down
4 changes: 2 additions & 2 deletions dapp/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ const Home: NextPage = () => {
<Box mb={0} p={4} w='100%' borderWidth="1px" borderRadius="lg">
<Heading my={4} fontSize='xl'>Add Item to Singelton collection</Heading>
<CreateItemSingletonTG
addressContract='0xEf087AaF882c22350ABc6A287563cE037AC46b06'
addressContract='0x36Ed9bc9473F1316ec15BCca45f49f4481A63c5e'
currentAccount={currentAccount}
/>
</Box>
<Box mb={0} p={4} w='100%' borderWidth="1px" borderRadius="lg">
<Heading my={4} fontSize='xl'>Create New Collection</Heading>
<CreateCollectionTG
addressContract='0x3d908DF3057fC6CE7c60e9Daf34B7e80F1B53479'
addressContract='0xd2026ff372E52d1961276313dC4e3d202995c3Ef'
currentAccount={currentAccount}
/>
</Box>
Expand Down
178 changes: 177 additions & 1 deletion go/FactoryNFT/FactoryNFT.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 1c739f8

@vercel
Copy link

@vercel vercel bot commented on 1c739f8 Dec 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.