-
Notifications
You must be signed in to change notification settings - Fork 34
Feat/eip-2981 royalties #112
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
6c4d5ff
5b7f17c
efd5948
ca885e5
e55183f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,15 @@ import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | |
| import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; | ||
| import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; | ||
| import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; | ||
| import "./@eip2981/ERC2981ContractWideRoyalties.sol"; | ||
|
|
||
| /// @author Developer DAO | ||
| /// @title The Pixel Avatar smart contract that is compliant to ERC721 standard and is upgradeable | ||
| contract PixelAvatars is | ||
| ERC721EnumerableUpgradeable, | ||
| ReentrancyGuardUpgradeable, | ||
| OwnableUpgradeable | ||
| OwnableUpgradeable, | ||
| ERC2981ContractWideRoyalties | ||
| { | ||
| string public baseURI; | ||
| uint256 public mintPrice; | ||
|
|
@@ -29,6 +31,8 @@ contract PixelAvatars is | |
| __ERC721_init("Pixel Avatars", "PXLDEV"); | ||
| __Ownable_init(); | ||
|
|
||
| setRoyalties(10000); // On initialize set 10% royalty fee | ||
|
||
|
|
||
| baseURI = "ipfs://QmZdT5R5XGQVwGnnpiS6dGjUHZh6z8JjpuHhsqcLMMeWiC/"; | ||
| mintPrice = 12 ether; | ||
|
|
||
|
|
@@ -37,8 +41,11 @@ contract PixelAvatars is | |
| // mintPrice = 0.01 ether; | ||
| } | ||
|
|
||
| function _baseURI() internal view virtual override returns (string memory) { | ||
| return baseURI; | ||
| /** | ||
| * @param amount The amount of royalties to be set. | ||
|
||
| */ | ||
| function setRoyalties(uint256 amount) external onlyOwner { | ||
| _setRoyalties(msg.sender, amount); | ||
| } | ||
|
|
||
| function setBaseURI(string memory _newBaseURI) external onlyOwner { | ||
|
|
@@ -103,4 +110,8 @@ contract PixelAvatars is | |
| function withdraw() external onlyOwner { | ||
| payable(msg.sender).transfer(address(this).balance); | ||
| } | ||
|
|
||
| function _baseURI() internal view virtual override returns (string memory) { | ||
| return baseURI; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to add
/// @author Developer DAOto all files you edited?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@noahliechti
For the ERC2981 was a code copied from a repo.
But what are your thinks if adding and @author tag on a code that wasn't originally created here?