Skip to content

Instantly share code, notes, and snippets.

View CoolCatsNFTPublic's full-sized avatar

CoolCats CoolCatsNFTPublic

View GitHub Profile
@CoolCatsNFTPublic
CoolCatsNFTPublic / dirtyRNG.sol
Created December 17, 2021 13:40
Quick and dirty random number
function dirtyRNG() public view return(uin256) {
return uint256(keccak256(abi.encodePacked(msg.sender, block.timestamp));
}
@CoolCatsNFTPublic
CoolCatsNFTPublic / coolcats.sol
Created August 26, 2021 15:19
Cool Cats contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract CoolCats is ERC721Enumerable, Ownable {
using Strings for uint256;
@CoolCatsNFTPublic
CoolCatsNFTPublic / estimatingGas.js
Last active December 30, 2021 20:50
Estimating gas for a transaction
// Get the estimated gas from the adopt method
try {
methodGasPrice = await this.contract.methods.adopt(adoptNum).estimateGas({
value: price,
from: account
});
} catch (err) {
console.log("ERROR Method Gas Price");
}
@CoolCatsNFTPublic
CoolCatsNFTPublic / stonerCats.sol
Created July 27, 2021 08:47
Some changes to help stonercats out - NEEDS testing
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
// @title: Stoner Cats
// @author: bighead.club
////////////////////////////////////////////////////////////////////////
// //
// __ =^..^= //
@CoolCatsNFTPublic
CoolCatsNFTPublic / combineSnapShots.js
Last active December 9, 2022 03:25
Combine all snapshots
// THE GIST CONTAINS A DELIBERATE ERROR FOR THE PURPOSES
// OF THE ARTICLE - DO NOT BLINDLY COPY AND PASTE
// Combine snapshots.
async function combineSnapShots() {
// Step 1 - Gathering addresses
const l1 = JSON.parse(fs.readFileSync('./snapshots/cxllabsHolders.json', 'utf8'));
const l2 = JSON.parse(fs.readFileSync('./snapshots/ghxstHolders.json', 'utf8'));
const l3 = JSON.parse(fs.readFileSync('./snapshots/ghxstsCxltureHolders.json', 'utf8'));
const l4 = JSON.parse(fs.readFileSync('./snapshots/holders.json', 'utf8'));
@CoolCatsNFTPublic
CoolCatsNFTPublic / snapShop.js
Created July 25, 2021 17:15
Snapshotting Opensea collections
async function snapShot(slug, address, totalTokens) {
const API_KEY = ""
// Step 1 - Pagination
const pages = Math.ceil(totalTokens / 50); // Paginate to account for OpenSea api call limits.
let offSet = 0;
let num = 0;
let totalOwned = 0;
let foundTokens = 0;
@CoolCatsNFTPublic
CoolCatsNFTPublic / getAllHolders.js
Last active July 27, 2021 09:35
Get all Cool Cat holders
// THE GIST CONTAINS A DELIBERATE ERROR FOR THE PURPOSES
// OF THE ARTICLE - DO NOT BLINDLY COPY AND PASTE
async getAllHolders() {
// Step 1 - Get the total population
const totalSupply = await this.contract.methods.totalSupply().call();
// Step 2 - Iterate over live tokens and log owners
const holder = {};
for(let i = 0; i < totalSupply; i++){