-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
315 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/Openzeppelin/openzeppelin-contracts | ||
[submodule "lib/solmate"] | ||
path = lib/solmate | ||
url = https://github.com/transmissions11/solmate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,148 +1,66 @@ | ||
``` | ||
___ ___ ___ ___ | ||
/ /\ / /\ / /\ /__/\ | ||
/ /::\ / /::\ / /:/_ \ \:\ | ||
/ /:/\:\ / /:/\:\ / /:/ /\ \ \:\ | ||
/ /:/ \:\ / /:/~/:/ / /:/ /:/_ _____\__\:\ | ||
/__/:/ \__\:\ /__/:/ /:/ /__/:/ /:/ /\ /__/::::::::\ | ||
\ \:\ / /:/ \ \:\/:/ \ \:\/:/ /:/ \ \:\~~\~~\/ | ||
\ \:\ /:/ \ \::/ \ \::/ /:/ \ \:\ ~~~ | ||
\ \:\/:/ \ \:\ \ \:\/:/ \ \:\ | ||
\ \::/ \ \:\ \ \::/ \ \:\ | ||
\__\/ \__\/ \__\/ \__\/ | ||
___ ___ ___ | ||
/__/\ / /\ ___ / /\ | ||
\ \:\ / /:/_ / /\ / /:/_ | ||
\ \:\ / /:/ /\ / /:/ / /:/ /\ | ||
_____\__\:\ / /:/ /:/ / /:/ / /:/ /::\ | ||
/__/::::::::\ /__/:/ /:/ / /::\ /__/:/ /:/\:\ | ||
\ \:\~~\~~\/ \ \:\/:/ /__/:/\:\ \ \:\/:/~/:/ | ||
\ \:\ ~~~ \ \::/ \__\/ \:\ \ \::/ /:/ | ||
\ \:\ \ \:\ \ \:\ \__\/ /:/ | ||
\ \:\ \ \:\ \__\/ /__/:/ | ||
\__\/ \__\/ \__\/ | ||
``` | ||
|
||
# OpenNFTs | ||
|
||
*OpenNFTs is the NFT lego* : a library of smarcontract components, enabling the development of numerous NFT Collections | ||
|
||
|
||
The general architeture of this library is mainly visible via the inheritance graph of the main OpenNFTs component: | ||
|
||
``` | ||
// | ||
// OpenERC165 | ||
// (supports) | ||
// | | ||
// —————————————————————————————————————————————————————————————————————— | ||
// | | | | | ||
// OpenERC721 OpenERC2981 OpenERC173 OpenCloneable | ||
// (NFT) (RoyaltyInfo) (ownable) | | ||
// | | | | | ||
// —————————————————————————————————————— | ———————— | | ||
// | | | | | | | | ||
// OpenERC721Metadata OpenERC721Enumerable | ——————— | | | ||
// | | | | | | | ||
// | | OpenMarketable OpenPauseable | | ||
// | | | | | | ||
// —————————————————————————————————————————————————————————————————————— | ||
// | | ||
// OpenNFTs —— IOpenNFTs | ||
// | ||
``` | ||
|
||
_These components have been initially created by the [Kredeum NFTs](https://github.com/Kredeum/kredeum) project_ | ||
|
||
### Install | ||
|
||
Install with npm : | ||
|
||
`npm install Kredeum/OpenNFTs` | ||
|
||
or forge : | ||
## Foundry | ||
|
||
`forge install Kredeum/OpenNFTs` | ||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** | ||
|
||
### Components | ||
Foundry consists of: | ||
|
||
Components are abstracted smartcontracts to be inherited from : | ||
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). | ||
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. | ||
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. | ||
- **Chisel**: Fast, utilitarian, and verbose solidity REPL. | ||
|
||
#### OpenERC | ||
OpenERC extension pack, implementation of some of NFT relative ERCs | ||
- OpenERC165.sol : [EIP-165 'supportsInterface' standard](https://eips.ethereum.org/EIPS/eip-165) | ||
- OpenERC173.sol : [EIP-173 'ownable' standard](https://eips.ethereum.org/EIPS/eip-173) | ||
- OpenERC721.sol : [EIP-721 'NFT' standard](https://eips.ethereum.org/EIPS/eip-721) | ||
- OpenERC721Enumerable.sol : EIP-721 Enumerable option | ||
- OpenERC721Metadata.sol : : EIP-721 Metadata option | ||
- OpenERC721TokenReceiver.sol : EIP-721 TokenReceiver option | ||
- OpenERC2981.sol : [EIP-2981 'NFT Royalty' standard](https://eips.ethereum.org/EIPS/eip-2981) | ||
## Documentation | ||
|
||
#### OpenNFTs | ||
OpenNFTs main pack, to be used by your NFT template | ||
- OpenGuard.sol : Guard from reentrancy attack | ||
- OpenMarketable.sol : AutoMarket component, to sell your NFT at a defined price with royalties (conformant to | ||
EIP-2981) with no need of a centralized MarketPlace | ||
- OpenNFT.sol : Generic NFT components | ||
- OpenPauseable.sol : Pausable extension, obviously allows to pause smartcontract | ||
https://book.getfoundry.sh/ | ||
|
||
#### OpenResolve | ||
OpenResolve extension pack, to read whatever NFTs infos : free, no gas required ! | ||
- OpenChecker.sol : Checkable extension, to check multiple ERC165 extensions | ||
- OpenGetter.sol : Get infos from whatever NFT Collection and list of minted NFTs | ||
- OpenRegistry.sol : Register your favorite NFT Collections, to be queried multiple times | ||
- OpenResolver.sol : Resolve all the infos from a set of Collections | ||
## Usage | ||
|
||
#### OpenClone | ||
OpenClone extension pack, via the use of EIP-1167 "Minimal Proxy" | ||
- OpenCloner.sol : inherited by factory cloner | ||
- OpenCloneable.sol : inherited by template smartcontracts to be cloned | ||
### Build | ||
|
||
### Examples | ||
|
||
Here are some smartcontracts given as example on howto "compose" components to make usable NFT Collections: | ||
|
||
- OpenNFTsEx : a generic NFT template | ||
|
||
- OpenAutoMarketEx : a template with AutoMarket | ||
|
||
- OpenResolverEx : a generic Resolver to get NFT infos | ||
|
||
- OpenBoundEx : a multichain SoulBound NFT template | ||
|
||
- OpenClonerEx : a NFTs Factory template | ||
|
||
*Be carefull, these templates are not production ready.* | ||
```shell | ||
$ forge build | ||
``` | ||
|
||
### Tests | ||
### Test | ||
|
||
A full set of solidity 'forge' tests are available to validate components and templates, to run them : | ||
```shell | ||
$ forge test | ||
``` | ||
|
||
`forge test` | ||
### Format | ||
|
||
Those tests are very generic and enable you to test whatever NFTs smartcontracts, with few added code. | ||
```shell | ||
$ forge fmt | ||
``` | ||
|
||
### Misc | ||
### Gas Snapshots | ||
|
||
**This is still beta software, and has not been audited yet, so use at your own risks.** | ||
```shell | ||
$ forge snapshot | ||
``` | ||
|
||
We are welcoming any help via PR to develop new components. Like, for example, | ||
ERC1155 support or a OpenMuliMintable component (enabling minting of multiple NFTs in a single transaction). | ||
### Anvil | ||
|
||
OpenNFTs is not "gas optimized", so deploy it carefully on Ethereum mainnet. That's why it's more dedicated to | ||
templates, to be cloned mutliple times, than for a unique NFT Collection deployment. | ||
```shell | ||
$ anvil | ||
``` | ||
|
||
*You can also use [Kredeum Dapp](https://beta.kredeum.com) to create NFT Collection without any coding.* | ||
### Deploy | ||
|
||
```shell | ||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> | ||
``` | ||
|
||
### Acknowledgments | ||
### Cast | ||
|
||
This OpenSource project has been developped with the help of : | ||
```shell | ||
$ cast <subcommand> | ||
``` | ||
|
||
- [ETH Global](https://ethglobal.com/): via various Hackathons and prices | ||
- [Polygon](https://polygon.technology/funds/): via a grant on the multichain NFT feature | ||
- [GitCoin and all donators](https://gitcoin.co/grants/4186/kredeum-decentralized-nfts-factory): via Grant Rounds 12 to 15 | ||
- [OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts): _OpenNFTs is heavily inspired by the more generic OpenZeppelin contracts_ | ||
### Help | ||
|
||
Thanks to all of them. | ||
```shell | ||
$ forge --help | ||
$ anvil --help | ||
$ cast --help | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenGuard | ||
// | ||
pragma solidity ^0.8.0; | ||
|
||
abstract contract OpenTBA { | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Submodule openzeppelin-contracts
deleted from
0a25c1
Submodule solmate
deleted from
0384db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.