Skip to content

Instantly share code, notes, and snippets.

View korrio's full-sized avatar
👽

kOrriO korrio

👽
  • Hal Finney Co.,Ltd.
  • mempool
  • X @korrio
View GitHub Profile
@korrio
korrio / swap_on_uniswap_v3.py
Created October 22, 2024 06:25
swap_on_uniswap_v3.py
async def swap_on_uniswap_v3(w3, router_contract, token_in, token_out, amount, wallet_address, private_key, deadline):
try:
account = w3.eth.account.from_key(private_key)
# ใช้ quoteExactInputSingle เพื่อประมาณการ amounts_out
quoter_v3 = w3.eth.contract(address=QUOTER_ADDRESS, abi=quoter_abi)
quote = quoter_v3.functions.quoteExactInputSingle(
token_in,
token_out,
3000, # 0.3% fee tier
@korrio
korrio / V3.sol
Created October 22, 2024 06:21
V3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IQuoter.sol";
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
contract CrossDexAtomicSwap is Ownable {
@korrio
korrio / SweepNSwap.sol
Last active October 22, 2024 04:15
SweepNSwap.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
@korrio
korrio / arb.go
Created October 2, 2024 08:13
arb.go
package main
import (
"context"
"fmt"
"log"
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
@korrio
korrio / arb.rs
Created October 2, 2024 06:52
arb.rs
use web3::types::{H160, U256};
use web3::contract::{Contract, Options};
use std::str::FromStr;
use std::time::Duration;
use tokio::time;
// Define DEX struct
struct DEX {
name: String,
router_address: H160,
@korrio
korrio / comment_tiktok.py
Created September 25, 2024 09:14
comment_tiktok.py
from adbkit import ADBTools
from kthread_sleep import sleep
from mydevice import deviceserial
def get_uiautomator_frame(screenshotfolder='c:\\ttscreenshots'):
if screenshotfolder:
adb.aa_update_screenshot()
df = adb.aa_get_all_displayed_items_from_uiautomator(
screenshotfolder=screenshotfolder, # screenshots will be saved here
max_variation_percent_x=10,
@korrio
korrio / config.py
Created September 11, 2024 01:20
config.py
from web3 import Web3
import os
from dotenv import load_dotenv
from web3.middleware import geth_poa_middleware
# from web3.middleware import (
# async_geth_poa_middleware,
# )
import asyncio
# Load environment variables
@korrio
korrio / fetchPrice.js
Created August 7, 2024 08:35
fetchPrice on-chain from pair
const fetchTokenPrice = async () => {
const tokenAddress = '0xB96D0f29a0aC9AF4a32835e90EC6531389765089';
const tokenAddress2 = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c';
const data1 = await publicClient.readContract({
address: '0x93accdaf2a9bb95d83d28cd19bc00d08be8741f9',
abi: pancakePairAbi,
functionName: 'getReserves',
});
@korrio
korrio / bot4.py
Created August 7, 2024 04:18
bot4.py
import asyncio
import time
from web3 import Web3
from web3.middleware import geth_poa_middleware
import aiohttp
from colorama import Fore, Style, init
import ssl
import certifi
from decimal import Decimal
@korrio
korrio / bot3.py
Created August 5, 2024 03:34
bot3.py
import asyncio
import aiohttp
from web3 import Web3
from web3.middleware import geth_poa_middleware
from colorama import Fore, Back, Style, init
# Initialize colorama
init(autoreset=True)
# กำหนดค่าการเชื่อมต่อกับ Polygon network