Skip to content

Instantly share code, notes, and snippets.

View Theo6890's full-sized avatar

Théo RICHARD Theo6890

View GitHub Profile
@Theo6890
Theo6890 / cloudSettings
Last active January 2, 2021 01:32 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
{"lastUpload":"2021-01-02T01:32:22.133Z","extensionVersion":"v3.4.3"}
@Theo6890
Theo6890 / rarible_mint_sell.js
Created December 4, 2021 03:26
Lazy mint & list NFT asset with sell order using ethers & IPFS via Rarible SDK
require("dotenv").config();
const { EthersEthereum } = require("@rarible/ethers-ethereum");
const fetch = (...args) =>
import("node-fetch").then(({ default: fetch }) => fetch(...args));
global.FormData = require("form-data");
global.window = {
fetch: fetch,
dispatchEvent: () => {},
};
@Theo6890
Theo6890 / sign_message.js
Last active December 15, 2022 09:52
Sign message with etherjs using following ethereum format signature EIP-1271. If your signature contains complex data follow the EIP-712 to structure your signature & hash: this will allow end users to see the data they sign instead of an incomprehensible bytes32. For safe signatures follow these recommendations https://swcregistry.io/docs/SWC-121
const { ethers } = require('ethers');
/**
* @notice Path to where your .env file is. If the .env is at the root of your project,
* you can simply write `require('dotenv').config()`
*/
require('dotenv').config({ path: '../../.env' });
async function main() {
// instanciation can also be done using a private key
const wallet = new ethers.Wallet.fromMnemonic(process.env.SEED);
@Theo6890
Theo6890 / encode_struct_in_js
Last active April 21, 2023 15:57
Encode a solidity struct in using etherjs
// consider our struct to be:
/**
struct TaskReward {
uint256 igoId;
Tier tier;
address rewardee;
uint256 taskId;
}
*/
/**
*
* @param {ethers.Wallet} wallet
* @param {ethers.BigNumber} chainId
* @param {string} verifyingContract
* @returns {string} full signature
*
* rewards is an object: {
id: ethers.BigNumber,
amount: ethers.BigNumber,
@Theo6890
Theo6890 / Merkle_merkleRoot.t.sol
Created April 19, 2023 01:05
Fuzz & differential testing for Merkle Tree, passing array from foundry (solidity) test to js script. Contains JS code at the end of the file
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
import {MerkleProof} from "openzeppelin-contracts/utils/cryptography/MerkleProof.sol";
// install murky with: `forge install dmfxyz/murky --no-commit `
import {Strings2} from "murky/differential_testing/test/utils/Strings2.sol";
import {Strings} from "openzeppelin-contracts/utils/Strings.sol";
import "forge-std/Test.sol";

Audit Methodology

The Kaju Katli Approach

Notice the shape

  1. We start from the bottom, approach the middle become large and then again become narrow down going to the top.
  2. That means, I do not study the docs or try to get the larger picture about the protocol in the beginning.I completely avoid that.