Last active
April 8, 2022 17:42
-
-
Save elmariachi111/4df402dcefa4a86c78545e5e0a44bc6b to your computer and use it in GitHub Desktop.
OneOnOneNFT.sol
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
// contracts/Splice.sol | |
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.10; | |
import '@openzeppelin/contracts/utils/math/SafeMath.sol'; | |
contract OneOnOneNFTMarketPlace { | |
using SafeMath for uint256; | |
struct RoyaltyReceiver { | |
address creator; | |
uint8 royaltyPercent; | |
} | |
mapping(uint256 => RoyaltyReceiver) royalties; | |
function mint( | |
/*...mint args...*/ | |
uint8 _royaltyPercent | |
) public { | |
//... minting logic ... | |
uint256 token_id = 1; | |
royalties[token_id] = RoyaltyReceiver({ | |
creator: msg.sender, | |
royaltyPercent: _royaltyPercent | |
}); | |
} | |
function royaltyInfo(uint256 tokenId, uint256 salePrice) | |
public | |
view | |
returns (address receiver, uint256 royaltyAmount) | |
{ | |
receiver = royalties[tokenId].creator; | |
royaltyAmount = (royalties[tokenId].royaltyPercent * salePrice).div(100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment