Skip to content

Instantly share code, notes, and snippets.

View CJ42's full-sized avatar

Jean Cvllr CJ42

View GitHub Profile
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract EcoCoin is ERC20, ERC20Burnable, Ownable {
constructor(
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract TimeCapsulez is ERC721, ERC721Burnable, Ownable {
constructor(
opcode description gas cost
LOG0 (0xa0) Append log record with no topics 375
LOG1 (0xa1) Append log record with one topic 750
LOG2 (0xa2) Append log record with two topics 1125
LOG3 (0xa3) Append log record with three topics 1500
LOG4 (0xa4) Append log record with four topics 1875
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.17;
import {LSP7Mintable} from "./LSP7DigitalAsset/presets/LSP7Mintable.sol";
import {LSP7Burnable} from "./LSP7DigitalAsset/extensions/LSP7Burnable.sol";
// for overriding internal _mint function
import {
LSP7DigitalAsset,
LSP7DigitalAssetCore
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.4;
// interfaces
import {
IERC725Y
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
import {ILSP1UniversalReceiver} from "../ILSP1UniversalReceiver.sol";
import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";

Standardised Recipes (Examples)

Easy to understand. Folder inside the LSP repository to explain these different recipes and combination of standards = Standardised Recipes. Could also put them in the docs/, inside the Standards section.

Recipe 1: a 🆙 Universal Profile = LSP0 + LSP1 + LSP6

Recipe 2: Vault

LSP6 with LSP7 token

Here are the stats of the deployment cost and runtime cost of a LSP6 Key Manager (= "LSP6TokenManager") that is built with only the funtionalities to manage a LSP7/8 Token (only the path for the setData selectors, no reentrancy checks as it is not applicable to a token and no isValidSignature(...) function with check on permission SIGN, as a token does not have that).

Base: Current Key Manager

beforeLSP7LSP6

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.5;
// interfaces
import {
IERC725Y
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
import {ILSP6KeyManager} from "./ILSP6KeyManager.sol";
// modules

ERC725

  • The link to specs for each methods has an error. It states: « LSP-725-undefined »

image

  • The link to the contract does not match. It points to the lukso-network repository, instead of the ERC725 repository.


@CJ42
CJ42 / SolidityErrorTypes.sol
Created April 9, 2023 18:12
Code snippet to show the different type of Solidity errors when debugging their selector (first 4 bytes of keccak256 hash of the error type string)
pragma solidity ^0.8.0;
contract SolidityErrors {
error InsufficientBalance(
uint256 amount,
uint256 balance
);
function testRevertErrorEmpty()