Skip to content

Instantly share code, notes, and snippets.

View Theo6890's full-sized avatar

Théo RICHARD Theo6890

View GitHub Profile
@Theo6890
Theo6890 / BEST_PRACTICES.md
Last active February 19, 2026 17:25
Best practices to follow by AI agents in solidity - based on Foundry and Secureum best practices

Solidity — Naming Conventions & Test Patterns

1. Naming Conventions

1.1 Contracts

Category Convention Examples
Main contracts PascalCase, domain-prefixed TokenVault, TokenVaultFactory
Modules PascalCase, functional-role suffix VaultAdmin, VaultFundraise, VaultView
@Theo6890
Theo6890 / auto-approve-safe.json
Last active February 19, 2026 00:19
Agent Safe Auto-Approve Command List
"chat.tools.terminal.autoApprove": {
"nl": true,
// ============ PIPE CHAIN SUPPORT ============
"chat.tools.terminal.allowPipeChains": true,
"chat.tools.terminal.validatePipeSegments": true,
// ============ BASIC SYSTEM COMMANDS ============
"cd": true,
"echo": true,

List local stale branches:

git branch -vv | grep 'gone' | awk '{print $1}'

List and delete local stale branches

git branch -vv | grep "gone" | awk '{print $1}' | xargs git branch --delete
@Theo6890
Theo6890 / solidity-math-lib.md
Created April 21, 2025 22:54
Math lib solidity
Advantages Disadvantages
ABDKMath, Q64.64 • 64 decimals• should be the most gas efficient: what about casting uint256 => int128?
@Theo6890
Theo6890 / BGT.sol
Created January 2, 2025 15:08 — forked from larrythecucumber321/BGT.sol
PoL Contracts (Sep 22)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// chosen to use an initializer instead of a constructor
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
// chosen not to use Solady because EIP-2612 is not needed
import {
ERC20Upgradeable,
IERC20,
IERC20Metadata
@Theo6890
Theo6890 / Swap.sol
Last active November 4, 2024 16:12
EIP712 Solidity & JS
pragma solidity 0.8.23;
import {EIP712} from "openzeppelin-contracts/utils/cryptography/EIP712.sol";
import {ECDSA} from "openzeppelin-contracts/utils/cryptography/ECDSA.sol";
contract Swap is EIP712 {
constructor() EIP712("Hand 2 Hand Exchange", "1") {}
struct Data {
IERC721 nft;

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.
@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";
/**
*
* @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 / 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;
}
*/