Skip to content

Instantly share code, notes, and snippets.

View naiemk's full-sized avatar

Naiem Yeganeh naiemk

View GitHub Profile
@naiemk
naiemk / upgradeable_contracts.md
Created May 16, 2024 12:24
Upgradeable contracts

Cheatcode to make upgradeable contracts for Ferrum Team

How to structure the data (ERC1967-ERC7201).

  1. Define the implementation slot. One slot per major version
     bytes32 internal constant _IMPLEMENTATION_SLOT_V1 = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
     // This slot can be calculated using the following formula. The result is used as constant.
     // DO NOT use the calculation in the constant definition as there is no guarantee it may be executed.
 // keccak256(abi.encode(uint256(keccak256("ferrum.storage.QPERC20.001")) - 1)) & ~bytes32(uint256(0xff))
@naiemk
naiemk / deploy_ironsafe.md
Last active May 14, 2024 22:53
IronSafe deploying

How to deploy IronSafe

By calling deployOwnable on the FerrumDeployer contract on the target chain.

  1. Calculate the data field:

Go to the Abi Encoder. For the argument type enter:

@naiemk
naiemk / chess.py
Last active June 4, 2023 07:12
Silly Chess
import sys
from subprocess import call
from time import sleep
import readchar
BOARD_L1=[
'□■'*4,
'■□'*4,
]*4
@naiemk
naiemk / ecdsa-verify.html
Created March 30, 2023 21:35
Verify Ecdsa Signature
const elliptic = require('elliptic');
const EC = elliptic.ec;
const ec = new EC('secp256k1');
const digestHex = 'a02c88bd2a...';
const rHex = 'b086ec...';
const sHex = '00fd29...';
const vHex = 0x1c - 27;
const r = Buffer.from(rHex, 'hex');
@naiemk
naiemk / blockchain-mail.md
Last active October 30, 2022 15:57
Web3 Email

Blockchain mailing protocol

Benefits of on-chain email

Personal

  • No spam
  • Important people can demand $ and the email is guaranteed to be read and responded. E.g. VCs can identify and email and read and respond to your pitch deck guaranteed.
  • Email can be used directly for business (as means of payment). And the un-encrypted source can be used as evidence of payment.
@naiemk
naiemk / DeployUpgradableToken.md
Last active October 28, 2021 12:50
Deploying upgradable tokens using Ferrum Token Deployer

Contract addresses

  • Token Deployer: 0x890C7cf4f46591B78209794AE239de028609D364
  • Generic Token Contract: 0xda92199A311B6aa739a1a930843abAa84097B106
  • Generic Token Contract with New Total Supply: 0xe4600867d35FaB6561e0D9C549431aE11D140711

Deploy a new token

  1. Go to the Token Deployer contract. -> Write
@naiemk
naiemk / nginx DDoS protection.md
Last active November 24, 2020 18:40
nginx DDoS protection
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.