Skip to content

Instantly share code, notes, and snippets.

View fassko's full-sized avatar
👋
Hi! I'm Kristaps - Web3 and iOS Swift developer. Let's chat!

Kristaps Grinbergs fassko

👋
Hi! I'm Kristaps - Web3 and iOS Swift developer. Let's chat!
View GitHub Profile
@fassko
fassko / contracts...Snowflake.sol
Last active March 28, 2024 02:21
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.25+commit.b61c2a91.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";
contract Snowflake is ERC721 {
uint256 private _nextTokenId;
@fassko
fassko / contracts...NestedMapping.sol
Created February 28, 2024 03:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.24+commit.e11b9ed9.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
contract NestedMapping {
struct Employee {
string name;
uint256 salary;
}
mapping(string => mapping(address => Employee)) private employees;
@fassko
fassko / contracts...TxOriginMsgSender.sol
Created January 6, 2024 09:16
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.23+commit.f704f362.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "hardhat/console.sol";
contract EntryContract {
IUnderlyingContract private underlyingContract;
@fassko
fassko / contracts...Structs.sol
Created September 21, 2023 19:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.21+commit.d9974bed.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
contract Employees {
struct Employee {
string name;
uint256 salary;
}
@fassko
fassko / contracts...CustomError.sol
Created August 11, 2023 18:20
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.21+commit.d9974bed.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
contract NumberGame {
error ToLowerThanFrom(uint256 from, uint256 to);
error NumberTooHigh(uint256 from, uint256 number);
@fassko
fassko / contracts...Set.sol
Created July 26, 2023 15:39
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.21+commit.d9974bed.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
contract Set {
// holds items
// can enumerate over objects
uint256[] public elements;
// holds ids
@fassko
fassko / contracts...Set.sol
Created July 26, 2023 14:52
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.21+commit.d9974bed.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
contract Set {
// holds items
// can enumerate over objects
uint256[] public items;
// holds ids
@fassko
fassko / contracts...Set.sol
Created July 26, 2023 06:32
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.21+commit.d9974bed.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
import "hardhat/console.sol";
contract Set {
// holds items
// can enumerate over objects
uint256[] public items;
@fassko
fassko / contracts...GasSaverNFT.sol
Created May 14, 2023 19:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;
import "erc721a/contracts/ERC721A.sol";
contract GasSaverNFT is ERC721A {
constructor(
string memory name_,
string memory symbol_
@fassko
fassko / contracts...RoyaltiesNFT.sol
Created March 29, 2023 11:31
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
contract Royalties is ERC721Royalty {
constructor(address _receiver, uint96 feeNumerator) ERC721("Royalties", "RYLT") {
_setDefaultRoyalty(_receiver, feeNumerator);
}