-
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.
copy of smart contracts being used currently in the project
- Loading branch information
1 parent
00c3b88
commit 4378459
Showing
35 changed files
with
43,876 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false |
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,2 @@ | ||
PRIVATE_KEY= | ||
CMC_KEY= |
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,39 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
.env | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
#Hardhat files | ||
cache | ||
artifacts |
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,2 +1,49 @@ | ||
# contracts | ||
Solidity Smart Contracts | ||
# GRY.PH NFT Smart Contracts | ||
|
||
The contract defined here are to allow auditors to evaluate the contracts that | ||
are designed and specifically for the purpose of the GRY.PH project. It | ||
specifies the process of digitizing collectable designs. Some of the business | ||
requirements include the following. | ||
|
||
- Ability to cheaply define a set of tokens that can be minted for each design which include the following. | ||
- Design information | ||
- Token quantity limits | ||
- Royalty Fees | ||
- Ability to mint tokens cheaply or, | ||
- Ability to facilitate air drops off chain and, | ||
- Ability for buyers to redeem air drops and pay the minting costs. | ||
- Ability for holders to list tokens in a decentralized manner and, | ||
- Ability for buyers to purchase listed tokens on any NFT marketplace while having, | ||
- Ability to distribute royalties no matter where it was exchanged | ||
|
||
#### Compatibility | ||
|
||
Solidity ^0.8.0 | ||
|
||
- Recommended v0.8.4 | ||
|
||
## 1. Install | ||
|
||
```bash | ||
$ cp .env.sample to .env | ||
$ npm install | ||
``` | ||
|
||
You will need to provide an [Ethereum Private Key](https://www.myetherwallet.com/wallet/create/software?type=overview) | ||
to deploy to a test net and a [Coin Market Cap Key](https://coinmarketcap.com/api/pricing/) | ||
to see gas price conversions when testing. | ||
|
||
## 2. Testing | ||
|
||
Make sure in `hardhat.config.js` to set the `defaultNetwork` to `hardhat`. | ||
|
||
```bash | ||
npm test | ||
``` | ||
|
||
## 3. Documentation | ||
|
||
- [ERC721](./contracts/token/ERC721/README.md) | ||
- [ERC1155](./contracts/token/ERC1155/README.md) | ||
|
||
> WARNING: The contracts provided here are as is and GRY.PH does not warrant that these will work on a live environment. It is possible that these contracts are out dated and it is possible for GRY.PH to update these contracts without notification. Use at your own risk. |
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,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
//implementation of ERC721 | ||
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; | ||
|
||
contract ERC1155PresetVanilla is ERC1155 { | ||
constructor(string memory _uri) | ||
ERC1155(_uri) | ||
{} | ||
|
||
/** | ||
* @dev Creates `amount` new tokens for `to`, of token type `id`. | ||
*/ | ||
function mint(address to, uint256 id, uint256 amount, bytes memory data) | ||
public | ||
virtual | ||
{ | ||
_mint(to, id, amount, data); | ||
} | ||
|
||
/** | ||
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] variant of {mint}. | ||
*/ | ||
function mintBatch( | ||
address to, | ||
uint256[] memory ids, | ||
uint256[] memory amounts, | ||
bytes memory data | ||
) public virtual { | ||
_mintBatch(to, ids, amounts, data); | ||
} | ||
} |
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,72 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
//abstract implementation of ERC721 | ||
//used to allow destruction of an owned token (never to return) | ||
//usage: burn(tokenId) | ||
//see: https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#ERC721Burnable | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | ||
|
||
//custom abstract extension of ERC721 | ||
//used to add a contract URI on instantiation | ||
import "./extensions/ERC721ContractURI.sol"; | ||
|
||
//custom abstract implementation of ERC721 | ||
//used to configure zero trust air drop scenario | ||
import "./extensions/ERC721AirDroppable.sol"; | ||
|
||
//custom abstract extension of ERC721 | ||
//used to list tokens for sale and set royalties | ||
import "./extensions/ERC721ExchangableFees.sol"; | ||
|
||
contract ERC721AirDrop is | ||
ERC721Burnable, | ||
ERC721ContractURI, | ||
ERC721AirDroppable, | ||
ERC721ExchangableFees | ||
{ | ||
//in only the contract owner can add a fee | ||
address owner; | ||
|
||
modifier onlyContractOwner { | ||
require(msg.sender == owner, 'Restricted method access to only the contract owner'); | ||
_; | ||
} | ||
|
||
/** | ||
* @dev Constructor function | ||
*/ | ||
constructor ( | ||
string memory _name, | ||
string memory _symbol, | ||
string memory _uri, | ||
bytes32 merkleroot | ||
) | ||
ERC721(_name, _symbol) | ||
ERC721ContractURI(_uri) | ||
ERC721AirDroppable(merkleroot) | ||
{ | ||
owner = msg.sender; | ||
} | ||
|
||
/** | ||
* @dev Only the contract owner can add a fee | ||
*/ | ||
function setFee(address payable recipient, uint256 fee) | ||
public | ||
onlyContractOwner | ||
{ | ||
_setFee(recipient, fee); | ||
} | ||
|
||
/** | ||
* @dev Only the contract owner can remove a fee | ||
*/ | ||
function removeFee(address payable recipient) | ||
public | ||
onlyContractOwner | ||
{ | ||
_removeFee(recipient); | ||
} | ||
} |
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,84 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
//abstract implementation of ERC721 | ||
//used to allow destruction of an owned token (never to return) | ||
//usage: burn(tokenId) | ||
//see: https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#ERC721Burnable | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | ||
|
||
//custom abstract extension of ERC721 | ||
//used to add a contract URI on instantiation | ||
import "./extensions/ERC721ContractURI.sol"; | ||
|
||
//custom abstract extension of ERC721 | ||
//used to set a max quantity on instantiation | ||
import "./extensions/ERC721MaxQuantity.sol"; | ||
|
||
//custom abstract extension of ERC721 | ||
//used to list tokens for sale and set royalties | ||
import "./extensions/ERC721ExchangableFees.sol"; | ||
|
||
contract ERC721Exchange is | ||
ERC721Burnable, | ||
ERC721ContractURI, | ||
ERC721MaxQuantity, | ||
ERC721ExchangableFees | ||
{ | ||
//in only the contract owner can add a fee | ||
address owner; | ||
|
||
modifier onlyContractOwner { | ||
require(msg.sender == owner, 'Restricted method access to only the contract owner'); | ||
_; | ||
} | ||
|
||
/** | ||
* @dev Constructor function | ||
*/ | ||
constructor ( | ||
string memory _name, | ||
string memory _symbol, | ||
string memory _uri, | ||
uint256 _maxQuantity | ||
) | ||
ERC721(_name, _symbol) | ||
ERC721ContractURI(_uri) | ||
ERC721MaxQuantity(_maxQuantity) | ||
{ | ||
owner = msg.sender; | ||
} | ||
|
||
/** | ||
* @dev Only the contract owner can add a fee | ||
*/ | ||
function setFee(address payable recipient, uint256 fee) | ||
public | ||
onlyContractOwner | ||
{ | ||
_setFee(recipient, fee); | ||
} | ||
|
||
/** | ||
* @dev Only the contract owner can remove a fee | ||
*/ | ||
function removeFee(address payable recipient) | ||
public | ||
onlyContractOwner | ||
{ | ||
_removeFee(recipient); | ||
} | ||
|
||
/** | ||
* @dev Basic mint and transfer | ||
*/ | ||
function mint(address recipient) public returns (uint256) { | ||
_incrementTokenId(); | ||
|
||
uint256 tokenId = currentTokenId(); | ||
_mint(recipient, tokenId); | ||
|
||
return tokenId; | ||
} | ||
} |
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,72 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
//abstract implementation of ERC721 | ||
//used to allow destruction of an owned token (never to return) | ||
//usage: burn(tokenId) | ||
//see: https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#ERC721Burnable | ||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | ||
|
||
//custom abstract extension of ERC721 | ||
//used to add a contract URI on instantiation | ||
import "./extensions/ERC721ContractURI.sol"; | ||
|
||
//custom abstract extension of ERC721 | ||
//used to mint tokens and assign them to recipients on deploy | ||
import "./extensions/ERC721PreMintable.sol"; | ||
|
||
//custom abstract extension of ERC721 | ||
//used to list tokens for sale and set royalties | ||
import "./extensions/ERC721ExchangableFees.sol"; | ||
|
||
contract ERC721PreMint is | ||
ERC721Burnable, | ||
ERC721ContractURI, | ||
ERC721PreMintable, | ||
ERC721ExchangableFees | ||
{ | ||
//in only the contract owner can add a fee | ||
address owner; | ||
|
||
modifier onlyContractOwner { | ||
require(msg.sender == owner, 'Restricted method access to only the contract owner'); | ||
_; | ||
} | ||
|
||
/** | ||
* @dev Constructor function | ||
*/ | ||
constructor ( | ||
string memory _name, | ||
string memory _symbol, | ||
string memory _uri, | ||
address[] memory _recipients | ||
) | ||
ERC721(_name, _symbol) | ||
ERC721ContractURI(_uri) | ||
ERC721PreMintable(_recipients) | ||
{ | ||
owner = msg.sender; | ||
} | ||
|
||
/** | ||
* @dev Only the contract owner can add a fee | ||
*/ | ||
function setFee(address payable recipient, uint256 fee) | ||
public | ||
onlyContractOwner | ||
{ | ||
_setFee(recipient, fee); | ||
} | ||
|
||
/** | ||
* @dev Only the contract owner can remove a fee | ||
*/ | ||
function removeFee(address payable recipient) | ||
public | ||
onlyContractOwner | ||
{ | ||
_removeFee(recipient); | ||
} | ||
} |
Oops, something went wrong.