© 2022

Posts

February 17, 2024

ERC-2612 tutorial and adoption research

Browsing the crypto Twitter/X, I found a service smolrefuel.com, (tweet), which solves the problem of obtaining a gas token on Ethereum networks if you don’t have one, for example when you withdraw a stablecoin from an exchange. I did a little research on how it works. A high-level overview: ERC-2612 The foundation of this is […]

January 31, 2023

Swapping ERC20 tokens – sweepToken Uniswap’s SwapRouter MEV opportunity

After previous article about Uniswap’s SwapRouter bug that permits unspent ETH to be left in SwapRouter and then picked up by a MEV bot, I got replies on Twitter that there is also a possibility to left funds in SwapRouter when swapping ERC-20 tokens. To sweep ERC20 tokens that may have left in SwapRouter after […]

January 24, 2023

Uniswap’s SwapRouter refund bug – how much MEV bots can earn

Inspired by the post of Jeiwan about Uniswap’s SwapRouter bug (or feature?), I became curious to calculate how much MEV bots have earned so far exploiting this behaviour. A short recap, the bug/feature is that some unfortunate user can construct such a call to SwapRouter so that some ETH will be left in the SwapRouter […]

December 5, 2022

Go (Golang) fix network issues: «read: connection reset by peer», «http: server closed idle connection», EOF

Error I was getting a floating error “read tcp [::1]:60674->[::1]:8090: read: connection reset by peer” in my Go code when making a HTTP POST request to another service at localhost:8090 with pretty standard http.Post method: Fix turned out to be tricky and a simple one at the same time. Reproducing error Let’s try to reproduce […]

August 1, 2022

Ethereum development tools online

Here are the tools for Ethereum development I created: ABI Encoding and decoding online for Solidity smart contracts  

July 29, 2022

Uniswap V3 SDK Swap Tutorial 5/5 – Execute a swap

This is the part 5 of Uniswap V3 SDK Swap Tutorial, full source code. In this part of the tutorial we will make actual swap having a route we obtained from Uniswap in previous part. Approving token for Uniswap to spend There is a important nuance we need to handle. While Uniswap (and more precisely, Uniswap […]

July 29, 2022

Uniswap V3 SDK Swap Tutorial 4/5 – Get swap route

This is the part 4 of Uniswap V3 SDK Swap Tutorial, full source code. A crucial part of making a swap is creating a swap route. This is the optimal path with swap parameters which Uniswap constructs to make the desired swap. How to conduct token swap in Uniswap Swap is conducted in the following […]

July 18, 2022

Uniswap V3 SDK Swap Tutorial 3/5 – Get quote

This is the part 3 of Uniswap V3 SDK Swap Tutorial, full source code. In this part we’ll call Quoter interface with ethers.js to get quote for a swap. First we format inAmountStr according to decimals of this token. ethers.js has very handy functions for it. Always use the number of decimals after the decimal point you […]

July 18, 2022

Uniswap V3 SDK Swap Tutorial 2/5 – Get pool information

This is the second part of Uniswap V3 SDK Swap Tutorial, full source code. In this part we’ll download and print out pool information. Pool is just a smart contract, responsible for swapping one token for another, for example, WETH-USDT pool (more about pools). Get Uniswap pool smart contract address To get pool smart contract […]

July 13, 2022

Uniswap V3 SDK Swap Tutorial 1/5 – Load token balances

This is the first part of Uniswap V3 SDK Swap Tutorial, full source code In this part of tutorial we’ll create TypeScript application and connect to Ethereum-compatible blockchain to load token balances. For the sake of simplicity, we’ll omit “import” statements, parametrising the program by command line arguments and environment variables (you can find full […]

About Web3 and blockchain developer.
Interests: Ethereum, Uniswap and DeFi, TypeScript and Go.
more