Skip to content

Instantly share code, notes, and snippets.

View grampabacon's full-sized avatar
💭
Typing Furiously

Adam Goodman grampabacon

💭
Typing Furiously
View GitHub Profile
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
solidity: {
compilers: [{ version: "0.8.0", settings: {} }],
},
networks: {
hardhat: {},
localhost: {},
rinkeby: {
url: `https://rinkeby.infura.io/v3/${INFURA_API_KEY}`,
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract PaperCats is ERC721Enumerable, Ownable {
string _baseTokenURI;
bool public _paused = true;
function adopt(uint256 amount) public payable {
require(amount < 4, "You can adopt a maximum of 3 Paper Cats");
require(!_paused, "Sale paused");
require(msg.value == _price * amount, "Ether sent is not correct");
for (uint256 i; i < amount; i++) {
_safeMint(msg.sender, totalSupply());
}
}
function walletOfOwner(address _owner) public view returns(uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
uint256[] memory tokensId = new uint256[](tokenCount);
for(uint256 i; i < tokenCount; i++) {
tokensId[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokensId;
}
bool public _paused = true;
function pause(bool val) public onlyOwner {
_paused = val;
}
uint256 public _price = 0.0005 ether;
address _communityWallet = 0xB93A6D9D539e7EDB0858Eb53a3e1501d51935752;
function setPrice(uint256 _newPrice) public onlyOwner {
_price = _newPrice;
}
function withdrawAll() public onlyOwner {
require(payable(_communityWallet).send(address(this).balance));
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract PaperCats is ERC721Enumerable, Ownable {
string _baseTokenURI;
constructor(string memory baseURI) ERC721("Paper Cats", "PCATS") {
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract PaperCats is ERC721Enumerable, Ownable {
}
@grampabacon
grampabacon / main.py
Last active September 28, 2021 14:38
create_cat_random_heart
from PIL import Image, ImageDraw
import pathlib
def create_cat_with_heart(id):
image = Image.open("Paper_Cat_Transparent.png")
path = "heart_cats/"
new_image = Image.new("RGB", image.size, get_background_colour())
import pathlib
from PIL import Image
# Layer the transparent Paper Cat onto a random solid coloured background.
def create_cat(id):
image = Image.open("Paper_Cat_Transparent.png")
path = "cats/"
new_image = Image.new("RGB", image.size, get_background_colour())