# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

# ---------------------------------------------------------------------------- #
#                                  Uniswap                                     #
# ---------------------------------------------------------------------------- #

# 0x06729eb2424da47898f935267bd4a62940de5105 - Uniswap V3: CEL
# 0x4c54ff7f1c424ff5487a32aad0b48b19cbaf087f - Uniswap V3: NEXO (to_address)
# 0x61247d8aca1c485a50728e1336d9b26c8339e701 - Uniswap V2: GUSD
# 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45 - Uniswap V3: Router 2
# 0x7a250d5630b4cf539739df2c5dacb4c659f2488d - Uniswap V2: Router 2
# 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640 - Uniswap V3: USDC 3
# 0x9a772018fbd77fcd2d25657e5c547baff3fd7d16 - Uniswap V3: WBTC-USDC 2
# 0xa5e79baee540f000ef6f23d067cd3ac22c7d9fe6 - Uniswap V2: CEL
# 0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc - Uniswap V2: USDC
# 0xe592427a0aece92de3edee1f18e0157c05861564 - Uniswap V3: Router
# 0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad - Uniswap V3: Universal Router
# 0xe42318eA3b998e8355a3Da364EB9D48eC725Eb45 - Uniswap V3: RPL 4
# 0x09d1d767edf8fa23a64c51fa559e0688e526812f - Uniswap V2: OLAS
# TODO: expand as needed

# BUY
if %from_address (^0x06729eb2424da47898f935267bd4a62940de5105$|^0x61247d8aca1c485a50728e1336d9b26c8339e701$|^0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45$|^0x7a250d5630b4cf539739df2c5dacb4c659f2488d$|^0x881d40237659c251811cec9c364ef91dc08d300c$|^0x9a772018fbd77fcd2d25657e5c547baff3fd7d16$|^0xa5e79baee540f000ef6f23d067cd3ac22c7d9fe6$|^0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc$|^0xe592427a0aece92de3edee1f18e0157c05861564$|^0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad$|^0xe42318ea3b998e8355a3da364eb9d48ec725eb45$|^0x09d1d767edf8fa23a64c51fa559e0688e526812f$)
& %blockchain ^ethereum$
& %type (^erc-20$|^internal$)
& %amount_ [1-9]
  account2 equity:%account_name:%subaccount_name:conversion:%blockchain:%symbol
  comment blockchain:%blockchain, type:%type, block:%block_number, blockid:%block_hash, index:%tx_index, swapper:uniswap, subaccount_address:%subaccount_address, contract_address:%contract_address, from_address:%from_address, to_address:%to_address, txid:%tx_hash, direction:%direction, taxed_as:MATCH
  comment2 %tx_hash,%date +0000,BUY,%account_name:%subaccount_name:%blockchain,%symbol,%amount_

# BUY (remove unused tags)
if %from_address (^0x06729eb2424da47898f935267bd4a62940de5105$|^0x61247d8aca1c485a50728e1336d9b26c8339e701$|^0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45$|^0x7a250d5630b4cf539739df2c5dacb4c659f2488d$|^0x881d40237659c251811cec9c364ef91dc08d300c$|^0x9a772018fbd77fcd2d25657e5c547baff3fd7d16$|^0xa5e79baee540f000ef6f23d067cd3ac22c7d9fe6$|^0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc$|^0xe592427a0aece92de3edee1f18e0157c05861564$|^0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad$|^0xe42318ea3b998e8355a3da364eb9d48ec725eb45$|^0x09d1d767edf8fa23a64c51fa559e0688e526812f$)
& %blockchain ^ethereum$
& %type ^internal$
& %amount_ [1-9]
  comment blockchain:%blockchain, type:%type, block:%block_number, swapper:uniswap, subaccount_address:%subaccount_address, from_address:%from_address, to_address:%to_address, txid:%tx_hash, direction:%direction, taxed_as:MATCH

# SELL/FEE
if %to_address (^0x06729eb2424da47898f935267bd4a62940de5105$|^0x4c54ff7f1c424ff5487a32aad0b48b19cbaf087f$|^0x61247d8aca1c485a50728e1336d9b26c8339e701$|^0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45$|^0x7a250d5630b4cf539739df2c5dacb4c659f2488d$|^0x881d40237659c251811cec9c364ef91dc08d300c$|^0x9a772018fbd77fcd2d25657e5c547baff3fd7d16$|^0xa5e79baee540f000ef6f23d067cd3ac22c7d9fe6$|^0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc$|^0xe592427a0aece92de3edee1f18e0157c05861564$|^0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad$|^0xe42318ea3b998e8355a3da364eb9d48ec725eb45$|^0x09d1d767edf8fa23a64c51fa559e0688e526812f$)
& %blockchain ^ethereum$
& %type (^erc-20$|^normal$)
& %fees [1-9]
  account2 equity:%account_name:%subaccount_name:conversion:%blockchain:%symbol
  comment blockchain:%blockchain, type:%type, block:%block_number, blockid:%block_hash, index:%tx_index, method:%method_id, swapper:uniswap, subaccount_address:%subaccount_address, contract_address:%contract_address, from_address:%from_address, to_address:%to_address, txid:%tx_hash, direction:%direction, taxed_as:MATCH
  comment2 %tx_hash,%date +0000,SELL,%account_name:%subaccount_name:%blockchain,%symbol,%amount_
  comment3 %tx_hash,%date +0000,FEE,%account_name:%subaccount_name:%blockchain,%symbol,%fees

# SELL/FEE (remove accounts with 0 amounts)
if %to_address (^0x06729eb2424da47898f935267bd4a62940de5105$|^0x4c54ff7f1c424ff5487a32aad0b48b19cbaf087f$|^0x61247d8aca1c485a50728e1336d9b26c8339e701$|^0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45$|^0x7a250d5630b4cf539739df2c5dacb4c659f2488d$|^0x881d40237659c251811cec9c364ef91dc08d300c$|^0x9a772018fbd77fcd2d25657e5c547baff3fd7d16$|^0xa5e79baee540f000ef6f23d067cd3ac22c7d9fe6$|^0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc$|^0xe592427a0aece92de3edee1f18e0157c05861564$|^0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad$|^0xe42318ea3b998e8355a3da364eb9d48ec725eb45$|^0x09d1d767edf8fa23a64c51fa559e0688e526812f$)
& %blockchain ^ethereum$
& %type (^erc-20$|^normal$)
& %amount_ ^[^1-9]*$
& %fees [1-9]
  account1
  account2

# SELL/FEE (remove unused tag)
# NOTE: only needed for ERC-20
if %to_address (^0x06729eb2424da47898f935267bd4a62940de5105$|^0x4c54ff7f1c424ff5487a32aad0b48b19cbaf087f$|^0x61247d8aca1c485a50728e1336d9b26c8339e701$|^0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45$|^0x7a250d5630b4cf539739df2c5dacb4c659f2488d$|^0x881d40237659c251811cec9c364ef91dc08d300c$|^0x9a772018fbd77fcd2d25657e5c547baff3fd7d16$|^0xa5e79baee540f000ef6f23d067cd3ac22c7d9fe6$|^0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc$|^0xe592427a0aece92de3edee1f18e0157c05861564$|^0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad$|^0xe42318ea3b998e8355a3da364eb9d48ec725eb45$|^0x09d1d767edf8fa23a64c51fa559e0688e526812f$)
& %blockchain ^ethereum$
& %type ^erc-20$
& %fees [1-9]
  comment blockchain:%blockchain, type:%type, block:%block_number, blockid:%block_hash, index:%tx_index, swapper:uniswap, subaccount_address:%subaccount_address, contract_address:%contract_address, from_address:%from_address, to_address:%to_address, txid:%tx_hash, direction:%direction, taxed_as:MATCH

# vim: sw=2 sts=2 si ai et
