Skip to content

Instantly share code, notes, and snippets.

View Turupawn's full-sized avatar
🇭🇳
Karaoke veteran

Ahmed Castro Turupawn

🇭🇳
Karaoke veteran
View GitHub Profile
irenee@fedora:~/Projects/borrame/testi$ cat Cargo.toml
[package]
name = "testi"
version = "0.1.0"
edition = "2024"
[dependencies]
ghost-crab = "0.10.1"
irenee@fedora:~/Projects/borrame/testi$ cargo build
Compiling zstd-sys v2.0.15+zstd.1.5.7
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// IERC20 interface needed to interact with USDC and WETH
interface IERC20 {
function approve(address spender, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
@Turupawn
Turupawn / failed.md
Created June 16, 2025 21:38
failed sushi test

Swap Tokens on Sushi (Uniswap V2 Fork)

SushiSwap is a popular Uniswap V2 fork that allows for simple token swaps using the ISushiRouter interface. Below is an example of swapping an ERC20 token for ETH on Scroll Mainnet.

Learn more at UniV2 Docs.

        _approve(address(this), address(router), amountToSwap);
        router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            amountToSwap,
@Turupawn
Turupawn / failed.md
Created June 14, 2025 16:38
failed noir zk tutorial

import Aside from "../../../../../components/Aside.astro" import ClickToZoom from "../../../../../components/ClickToZoom.astro" import ToggleElement from "../../../../../components/ToggleElement.astro" import paymentDApp from "../../../../../assets/images/developers/stablecoin-payments-tutorial/payment-dapp.png" import nftRecipt from "../../../../../assets/images/developers/stablecoin-payments-tutorial/nft-recipt.png"

123

import { useAccount, useConnect, useDisconnect, useWriteContract, useConfig } from 'wagmi'
import { parseEther } from 'viem'
import { createPublicClient, http } from 'viem'
import { scrollSepolia } from 'viem/chains'
import { useEffect, useState } from 'react'
import { waitForTransactionReceipt } from '@wagmi/core'
export const publicClient = createPublicClient({
chain: scrollSepolia,
transport: http()
@Turupawn
Turupawn / start.js
Created May 30, 2025 17:00
wss real time backend
require('dotenv').config();
const express = require('express');
const Web3 = require('web3');
const app = express();
const port = process.env.PORT || 3000;
// Initialize Web3 with WebSocket provider
const web3 = new Web3(new Web3.providers.WebsocketProvider(process.env.WSS_URL));
const contractAddress = process.env.CONTRACT_ADDRESS;
const contractABI = require('../json_abi/MyContract.json');
@Turupawn
Turupawn / fe-v2-errors.bash
Created May 24, 2025 15:48
fe-v2-errors.bash
$ ~/Projects/fe/fe-v2/target/debug/fe check .
error: unexpected token while parsing field definition
┌─ /home/irenee/Projects/fe-token-demos/master/src/ERC20.fe:5:35
5 │ pub balance: solidity::Mapping<evm::Address, u256>,
│ ^ unexpected token
= expected a newline; found symbol `<` instead
error: unexpected token while parsing field definition
@Turupawn
Turupawn / P256Verifier.sol
Created May 22, 2025 15:45
Vibecoded RIP-7212
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract P256Verifier {
address constant P256_PRECOMPILE = address(0x0100);
/// @notice Verifies a secp256r1 signature using the EIP-7212 precompile.
/// @param hash The 32-byte message hash that was signed.
/// @param r The 32-byte r component of the signature.
/// @param s The 32-byte s component of the signature.
@Turupawn
Turupawn / NoirGettingStarted.md
Last active May 20, 2025 21:34
Getting started with Noir: Hello World

Install the dependencies

curl -L https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash
noirup
curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/heads/master/barretenberg/bbup/install | bash
bbup

Create a new project

use ingot::evm
use ingot::codec::{ Cursor, Encode, Decode }
use ingot::evm::{ MemBuffer }
use ingot::mydefault::{ MyDefault }
use ingot::option::{ Option }
// Constants for the hash table
const TABLE_SIZE: usize = 32 // Fixed size table
const EMPTY: u256 = 0
const DELETED: u256 = 1