Skip to content

Instantly share code, notes, and snippets.

View ether-wan's full-sized avatar
🎯
Focusing

ether1 ether-wan

🎯
Focusing
View GitHub Profile
@ether-wan
ether-wan / overrideBalance.ts
Last active August 1, 2024 20:54
Override ERC-20 balance for an address using Viem & simulateContract
import { createPublicClient, keccak256, numberToHex, pad, toHex, erc20Abi } from "viem";
import { mainnet } from 'viem/chains'
const publicClient = createPublicClient({
chain: mainnet,
transport: http()
});
const overrideBalance = async (balanceSlotIndex : number, walletToOverride : `0x${string}`, newBalanceAmount : bigint, tokenAddress : string) => {
// Convert the address to a 32-byte hex string
@ether-wan
ether-wan / hello.js
Created October 12, 2023 10:07
hello world
console.log("Hello World !");