Skip to content

Instantly share code, notes, and snippets.

View ipekt's full-sized avatar

Ipek Turgul ipekt

View GitHub Profile
{
"name": "Gigantic Lizards",
"symbol": "GLZ",
"description": "This is the Gigantic Lizards collection",
"image": "https://some-url",
"external_link": "https://some-url",
"contract_uri": "https://some-url",
"base_uri": "https://some-url"
}
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.20;
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {OperatorAllowlistEnforced} from "./OperatorAllowlistEnforced.sol";
contract ClashOfCatsERC1155Upgradable is ERC1155Upgradeable, OperatorAllowlistEnforced {
function initialize() public initializer {
__ERC1155_init("");
@ipekt
ipekt / ClashOfCatsERC1155.sol
Created June 5, 2024 06:34
OAL implementation example for ERC1155
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {OperatorAllowlistEnforced} from "@imtbl/contracts/contracts/allowlist/OperatorAllowlistEnforced.sol";
contract ClashOfCats1155 is ERC1155, Ownable, OperatorAllowlistEnforced {
constructor(
string memory baseTokenURI,
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.20;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {OperatorAllowlistEnforced} from "./OperatorAllowlistEnforced.sol";
contract ClashOfCats is ERC721Upgradeable, OperatorAllowlistEnforced {
function initialize() public initializer {
__ERC721_init("ClashOfCats", "CATs");
// Using "@imtbl/contracts": "2.2.7" - https://github.com/immutable/contracts/releases/tag/v2.2.7
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {OperatorAllowlistEnforced} from "@imtbl/contracts/contracts/allowlist/OperatorAllowlistEnforced.sol";
contract ClashOfCats is
@ipekt
ipekt / areThereDuplicates.js
Created March 29, 2021 20:45
Frequency Counter 2
function areThereDuplicates(...values) {
let counter = {};
for(let i=0; i<values.length; i++) {
if (counter[values[i]] === undefined) {
counter[values[i]] += 1;
} else {
return true;
}
}
return false;
@ipekt
ipekt / frequency-counter.js
Created March 29, 2021 20:35
Frequency Counter
function sameFrequency(num1, num2){
const num1Str = num1.toString();
const num2Str = num2.toString();
if (num1Str.length !== num2Str.length) {
return false;
}
// {1: 1, 8: 1, 2: 1}
let numbers = {};
public class YetAnotherStack<E> {
private List<? super E>[] elements;
private int size = 0;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
public YetAnotherStack() {
elements = (List<? super E>[]) new Object[DEFAULT_INITIAL_CAPACITY];
}
public class AnotherStack<E> {
private Either<? super E, String>[] elements;
private int size = 0;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
public AnotherStack() {
elements = (Either<? super E, String>[]) new Object[DEFAULT_INITIAL_CAPACITY];
}
public class Stack<E> {
private E[] elements;
private int size = 0;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
public Stack() {
elements = (E[]) new Object[DEFAULT_INITIAL_CAPACITY];
}