Skip to content

Instantly share code, notes, and snippets.

@sicongzhao
Created January 27, 2022 05:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sicongzhao/81886ca422e46bffe4e668100c42b945 to your computer and use it in GitHub Desktop.
Save sicongzhao/81886ca422e46bffe4e668100c42b945 to your computer and use it in GitHub Desktop.
/***
By accepting the limited-edition Pepsi Mic Drop content ("Content") in the form of this non-fungible token ("NFT"), recipient acknowledges and agrees to the following terms and conditions (these "Terms"):
The Content is the property of or licensed to PepsiCo, Inc. ("Owner") and all right, title, and interest (including all copyright, trademark, name, likeness, art, design, drawings and/or other intellectual property) included in and/or associated with the Content are owned by Owner or its licensors. Receipt of the Content or this NFT does not give or grant recipient any right, license, or ownership in or to the Content other than the rights expressly set forth herein. Owner reserves all rights (including with respect to the copyright, trademark, name, likeness, art, design, drawings and/or other intellectual property) in and to the Content not expressly granted to recipient herein. Expressly conditioned on recipient's compliance with its obligations hereunder, recipient of this NFT is granted a limited, revocable, non-exclusive, non-transferable, non-sublicensable license to access, use, view, copy and display the Content and this NFT solely (i) for the duration of such recipient's ownership of this NFT, (ii) for recipient's own personal, non-commercial use and (iii) as part of a marketplace that permits the display, purchase and sale of NFTs, provided the marketplace has mechanisms in place to verify the owners' rights to display and sell such NFTs.
Recipient also may not nor permit any third party to, do or attempt any of the following without Owner's express prior written consent in each case:
* Display, copy or otherwise use this NFT or the Content, except for the limited use granted hereunder, if any, without Owner's prior express written approval for such use;
* Modify, edit, alter, manipulate, reproduce, commercialize, distribute or reuse the Content, in whole or in part, in any way, including without limitation, art, design, drawings and/or other intellectual property;
* Create, display, advertise, market, promote, display, distribute, reproduce, or sell any derivative works from the Content and/or any merchandise of any kind that includes, contains, uses, incorporates, or consists of the Content;
* Use, distribute, display, publicly perform or otherwise reproduce the Content, in whole or in part, to advertise, market, promote, reproduce, offer, sell, and/or distribute for commercial gain (including, without limitation, giving away in the hopes of eventual commercial gain) any product or service in any manner or media, whether for your own commercial benefit or that of any third party or otherwise;
* Use the Content in connection with any content, images, videos, or other forms of media that (i) depict hatred, intolerance, violence, cruelty, or anything else that could reasonably be found to constitute hate speech or be considered abusive, defamatory, ethnically or racially offensive, harassing, harmful, obscene, offensive, sexually explicit, threatening, or vulgar; (ii) contain any other material, products, or services that violate or encourage conduct that would violate any criminal or other applicable laws; (iii) violate or infringe on any third-party rights and/or (iv) makes any statement that is expressly or implicitly disparaging or otherwise harmful to Owner, any of Owner's subsidiaries or affiliates and/or any of Owner and/or its subsidiaries' or affiliates' products and/or services;
* Use the Content in any way that is expressly or implicitly disparaging or otherwise harmful to Owner, any of Owner's subsidiaries or affiliates and/or any of Owner and/or its subsidiaries' or affiliates' products and/or services;
* Use the Content in movies, videos, or any other forms of media, except to the limited extent that such use is solely for recipient's own personal, non-commercial purposes;
* Apply for, register, or otherwise use or attempt to use the Content, any other Owner intellectual property or intellectual property associated with Owner, its subsidiaries or affiliates and/or their respective products or services, in whole or in part, as a trademark, service mark, or any confusingly similar mark, anywhere in the world or attempt to copyright or otherwise acquire additional intellectual property rights in or to the Content; and/or
* Make any additional representations or warranties relating to the Content.
Recipient represents and warrants that it will comply with all laws, regulations, rules and guidelines in connection with its performance, display, distribution, marketing, sale and other use of the Content, including the laws of the United States relating to money laundering, the financing of terrorism, and economic sanctions (such as those administered by the Office of Foreign Assets Control).
Recipient understands and agrees that Owner is not liable for any inability of recipient to access the Content or this NFT for any reason, including as a result of any downtime, failure, obsolescence, removal, termination, or other disruption relating to the servers upon which the Content is stored, the blockchain on which the Content or this NFT is registered, any electronic wallet, or any other NFT application, market, or platform. If recipient sells or otherwise transfers this NFT, recipient agrees that it will not have any claims against Owner for any breach of these Terms by a purchaser. If recipient purchased this NFT, recipient hereby agrees to hold Owner and the seller of this NFT harmless from and against any and all violations or breaches of these Terms.
The limited license included in these Terms to use, view, copy or display the Content only continues so long as recipient continues to own the NFT, and shall be part of all subsequent sales of NFT in perpetuity, regardless of ownership of the corresponding blockchain. Recipient's rights in and to the NFT and Content immediately cease upon transfer of the NFT or termination of these Terms pursuant hereto.
Recipient further understands and agrees that any commercial exploitation of the Content or this NFT could subject recipient to claims of copyright infringement. If recipient violates these Terms, or otherwise uses the Content or this NFT, in a manner that infringes or otherwise violates Owner's rights or breaches any provision set forth hereunder, recipient agrees that Owner may take any action necessary to stop such infringement or other violation, at recipient's sole cost and expense, and/or immediately terminate these Terms. Upon any such termination, recipient will have no further rights to use the Content and all uses of the Content by recipient must immediately and permanently cease. All provisions set forth herein that by their express terms and/or nature would be expected to survive termination will so survive and will remain in full force and effect. Owner's termination of these Terms will be without prejudice to any other rights and remedies that it may have herein and at law and in equity. If recipient incurs liability due to infringement or other violation of Owner's rights, such liability survives expiration of this license.
THE LICENSE GRANTED IN THESE TERMS IS PROVIDED "AS IS." RECIPIENT ASSUMES THE ENTIRE RISK OF THEIR USE OF THE CONTENT AND THIS NFT. NO WARRANTIES ARE GIVEN, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES OF FITNESS FOR PARTICULAR PURPOSE, MERCHANTABILITY, NON-INFRINGEMENT OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. IN NO EVENT WILL OWNER BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR FOR ANY LIABILITY IN TORT, NEGLIGENCE, OR ANY OTHER LIABILITY INCURRED BY OR UNDER OR IN CONNECTION WITH THESE TERMS, THE CONTENT OR THIS NFT.
OWNER DOES NOT OWN OR CONTROL ANY OF THE SOFTWARE PROTOCOLS, SERVICES, EXCHANGES OR APPLICATIONS THAT MAY BE USED IN CONNECTION WITH THIS NFT, INCLUDING THE CRYPTOCURRENCY WALLET OR ANY NFT MARKETPLACE OR TRADING PLATFORM. ACCORDINGLY, OWNER DISCLAIMS ALL LIABILITY RELATING TO SUCH PROTOCOLS, SERVICES, EXCHANGES OR APPLICATIONS AND ANY PRICE FLUCTUATIONS IN NFT VALUATION, AND MAKES NO GUARANTEES REGARDING THE SECURITY, FUNCTIONALITY OR AVAILABILITY OF SUCH PROTOCOLS, SERVICES, EXCHANGES OR APPLICATIONS.
TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT WILL OWNER BE LIABLE TO RECIPIENT OR ANY THIRD PARTY FOR ANY LOST PROFIT OR ANY INDIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, SPECIAL OR PUNITIVE DAMAGES ARISING FROM THESE TERMS, THE CONTENT, THIS NFT, WHETHER CAUSED BY TORT (INCLUDING NEGLIGENCE), BREACH OF CONTRACT, OR OTHERWISE, EVEN IF FORESEEABLE AND EVEN IF OWNER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED HEREIN, IN NO EVENT SHALL THE MAXIMUM AGGREGATE LIABILITY OF OWNER ARISING OUT OF OR IN ANY WAY RELATED TO THESE TERMS, OR THE ACCESS TO OR USE OF THE CONTENT OR THIS NFT EXCEED $100.
These Terms will be governed by and construed in accordance with the laws of the State of New York applicable to contracts made and wholly performed therein, without regard to principles of conflicts of law. Any dispute arising out of and/or relating to these Terms will be subject to the exclusive jurisdiction and venue of the federal and state courts located in New York County, New York, and the parties each hereby irrevocably consents to personal jurisdiction in such courts. If a party breaches any provision of these Terms, the remedies available to the other party will include without limitation payment by the breaching party of all costs and expenses (including reasonable attorneys' fees) incurred by said other party, on trial and appeal, to enforce these Terms. These Terms contain the full understanding and agreement of the parties with respect to the subject matter hereof, and may not be modified except in a writing signed by the parties, or their respective approved agents. A party's delay or failure to exercise all or part of any right under these Terms will not constitute a waiver of that right or of any other right. No waiver of these Terms will be valid except in a writing signed by the parties, or their respective approved agents. If any provision of these Terms is deemed invalid that provision will be struck and the remaining provisions of these Terms will remain in full force and effect. These Terms are binding upon and will inure to the benefit and detriment, as applicable, of the parties and their respective licensees and assigns.
***/
/***
__ __ _______ _____ _ _ _ _
\ \ / / |__ __| | __ \(_) (_) | | |
\ \ /\ / /_ _ _ _| | ___ ___ | | | |_ __ _ _| |_ __ _| |
\ \/ \/ / _` | | | | |/ _ \ / _ \| | | | |/ _` | | __/ _` | |
\ /\ / (_| | |_| | | (_) | (_) | |__| | | (_| | | || (_| | |
\/ \/ \__,_|\__, |_|\___/ \___/|_____/|_|\__, |_|\__\__,_|_|
__/ | __/ |
|___/ |___/
***/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract PepsiMicDrop is ERC721Enumerable, Ownable {
using MerkleProof for bytes32[];
mapping(address => bool) public alreadyMinted;
uint16 private reserveMicDropsId;
uint16 private micDropsId;
bytes32 public merkleRoot;
bool public merkleEnabled = true;
string private baseURI;
bool private saleStarted = true;
uint256 public constant maxMint = 1893;
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
constructor() ERC721("Pepsi Mic Drop", "PEPSIMICDROP") {
reserveMicDropsId = 1; // item 1-50
micDropsId = 51; // item 51-1893
}
function setBaseURI(string memory _baseUri) public onlyOwner {
baseURI = _baseUri;
}
function mint(bytes32[] memory proof, bytes32 leaf) public returns (uint256) {
// merkle tree
if (merkleEnabled) {
require(keccak256(abi.encodePacked(msg.sender)) == leaf, "This leaf does not belong to the sender");
require(proof.verify(merkleRoot, leaf), "You are not in the list");
}
require(saleStarted == true, "The sale is paused");
require(msg.sender != address(0x0), "Public address is not correct");
require(alreadyMinted[msg.sender] == false, "Address already used");
require(micDropsId <= maxMint, "Mint limit reached");
_safeMint(msg.sender, micDropsId++);
alreadyMinted[msg.sender] = true;
return micDropsId;
}
function reserveMicDrops(address to, uint8 amount) public onlyOwner {
require(reserveMicDropsId + amount <= 51, "Out of stock");
for (uint8 i = 0; i < amount; i++) _safeMint(to, reserveMicDropsId++);
}
function startSale() public onlyOwner {
saleStarted = true;
}
function pauseSale() public onlyOwner {
saleStarted = false;
}
function setMerkleRoot(bytes32 _root) public onlyOwner {
merkleRoot = _root;
}
function startMerkle() public onlyOwner {
merkleEnabled = true;
}
function stopMerkle() public onlyOwner {
merkleEnabled = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment