What Are Smart Contracts? (The Addresses That Control Your DeFi)

You're swapping tokens on Uniswap. The interface asks you to "approve" spending your USDC.

You click approve.

Your wallet pops up: "Allow 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 to spend your USDC?"

You think: "What the hell is 0x68b...? Is this a scam?"

It's not a scam. It's a smart contract.

If you've ever wondered what those long 0x... addresses are, why you have to approve them, and why they matter for taxes β€” this is your guide.

Traditional Finance vs. DeFi

Traditional Finance (Centralized)

When you deposit money at a bank:

  • Who holds it: The bank (JP Morgan, Wells Fargo, etc.)
  • How it works: Bank employees process transactions, managers approve loans, systems track balances
  • Trust model: You trust the institution and regulations
  • Control: The bank can freeze your account, reverse transactions, or deny withdrawals

All decisions are made by people and institutions.

DeFi (Decentralized Finance)

When you deposit crypto in a DeFi protocol:

  • Who holds it: A smart contract (code on the blockchain)
  • How it works: Code automatically executes when conditions are met
  • Trust model: You trust the code (and hopefully it's been audited)
  • Control: No single entity can freeze, reverse, or deny (unless coded to do so)

All decisions are made by code.

What Is a Smart Contract?

A smart contract is a program that runs on a blockchain.

Think of it like a vending machine:

  1. Traditional transaction: You go to a store, ask a clerk for a soda, pay, and they hand it to you.

    • Requires: Human clerk, trust, intermediary
  2. Smart contract transaction: You put money in a vending machine, press a button, and it gives you a soda automatically.

    • Requires: Just the machine (code)

Smart contracts are vending machines for finance.

Key Properties

  • Self-executing: When conditions are met, code runs automatically
  • Immutable: Once deployed, code can't be changed (usually)
  • Permissionless: Anyone can interact with public contracts
  • Transparent: All code and transactions are publicly visible
  • Trustless: You don't need to trust a person or company, just the code

How Smart Contracts Look

Every smart contract has an address that looks like this:

0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45

This is Uniswap's Universal Router β€” the contract that handles swaps on Uniswap.

It looks exactly like a wallet address because both use the same Ethereum address format.

The difference:

  • Wallet address: Controlled by a person with a private key
  • Contract address: Controlled by code

When you send funds to a contract, the code executes automatically.

Real Smart Contract Examples

Example 1: Uniswap Swap

What you want: Swap 1000 USDC for ETH

What happens:

  1. You approve Uniswap contract to spend your USDC
  2. You call the "swap" function on contract 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45
  3. Contract code:
    if (user approved >= 1000 USDC) {
      transfer 1000 USDC from user to pool
      calculate ETH amount based on pool ratio
      transfer ETH to user
    } else {
      revert (cancel transaction)
    }
    
  4. Transaction executes (or fails) automatically

No human involved. No intermediary. Just code.

Example 2: Arbitrum Bridge

What you want: Bridge 1 ETH from Ethereum to Arbitrum

What happens:

  1. You send 1 ETH to Arbitrum Bridge contract: 0x8315177aB297bA92A06054dE0bF30a3b0676Cf79
  2. Contract code:
    receive 1 ETH {
      lock ETH in escrow
      emit event: "User bridged 1 ETH"
      relay to Arbitrum: mint 1 ETH to user
    }
    
  3. Arbitrum sees the event and mints 1 ETH to your wallet

Your ETH is now locked in a contract on Ethereum, and you have ETH on Arbitrum.

Example 3: Aave Lending

What you want: Deposit 10,000 USDC to earn interest

What happens:

  1. Approve Aave contract to spend your USDC
  2. Call "deposit" function on Aave contract
  3. Contract code:
    deposit(amount) {
      transfer USDC from user to pool
      calculate aToken amount
      mint aUSDC to user (receipt token)
      start accruing interest
    }
    
  4. You receive aUSDC (Aave's USDC receipt token)
  5. Interest accrues automatically every block

Your USDC is in the contract earning interest. You hold aUSDC as proof of your deposit.

[Visual suggestion: Flowchart showing user β†’ approve β†’ contract execution β†’ result]

Why You Have to "Approve" Tokens

This is the most confusing part for newcomers.

The Approval System

Problem: Smart contracts can't just take your tokens. You have to give permission.

Solution: ERC-20 tokens have an "approve" function.

Two-Step Process

Step 1: Approve

  • You tell the USDC contract: "Allow Uniswap contract 0x68b... to spend up to 1000 of my USDC"
  • This is a blockchain transaction (costs gas)
  • You're not sending tokens yet, just giving permission

Step 2: Swap

  • You tell Uniswap: "Swap 1000 USDC for ETH"
  • Uniswap contract calls: transferFrom(your address, pool, 1000 USDC)
  • Since you approved, the transfer succeeds

Why It Feels Weird

In traditional finance, you just click "Pay" and it works.

In DeFi, you have to:

  1. Approve the contract to spend your tokens (1 transaction)
  2. Execute the swap/deposit/action (2nd transaction)

This costs 2x the gas, but it's more secure. You explicitly control what contracts can do with your tokens.

Unlimited Approvals

Many dApps ask for "unlimited approval" to avoid needing approval every time.

Instead of approving 1000 USDC, you approve:

115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,935

That's the maximum uint256 value. Basically unlimited.

Pros:

  • βœ… Only approve once
  • βœ… Save gas on future transactions

Cons:

  • ❌ Contract can spend all your USDC anytime
  • ❌ If contract is hacked, attacker has unlimited access

Best practice: Only give unlimited approval to trusted, audited contracts (Uniswap, Aave, etc.). Revoke approvals you no longer use.

You can check and revoke approvals at revoke.cash.

Types of Smart Contracts

πŸ”„ DEX Contracts (Uniswap, Curve, SushiSwap)

What they do: Facilitate token swaps using liquidity pools

Example addresses:

  • Uniswap V3 Router: 0xE592427A0AEce92De3Edee1F18E0157C05861564
  • Curve 3Pool: 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7
  • SushiSwap Router: 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F

Tax treatment: Swaps are taxable events (sale of one token, purchase of another)

πŸŒ‰ Bridge Contracts

What they do: Lock/burn tokens on one chain, mint/release on another

Example addresses:

  • Arbitrum Bridge: 0x8315177aB297bA92A06054dE0bF30a3b0676Cf79
  • Optimism Gateway: 0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1
  • Base Bridge: 0x49048044D57e1C92A77f79988d21Fa8fAF74E97e

Tax treatment: Non-taxable transfer (in most jurisdictions)

🏦 Lending Contracts (Aave, Compound)

What they do: Accept deposits, pay interest, facilitate borrowing

Example addresses:

  • Aave V3 Pool: 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2
  • Compound cUSDC: 0x39AA39c021dfbaE8faC545936693aC917d5E7563

Tax treatment: Complex (deposits may/may not be taxable, interest is income)

πŸ’§ Liquidity Pool Contracts

What they do: Hold token pairs for DEX swaps, distribute fees to LPs

Example addresses:

  • Uniswap V3 ETH/USDC Pool: 0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8
  • Curve stETH Pool: 0xDC24316b9AE028F1497c275EB9192a3Ea0f67022

Tax treatment: Complex (LP deposit may be taxable, fees may be income or deferred)

πŸ” Token Contracts

What they do: Define the rules for an ERC-20 token

Example addresses:

  • USDC: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
  • DAI: 0x6B175474E89094C44Da98b954EedeAC495271d0F
  • WETH: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

Tax treatment: Holding = no tax, transferring = may be gift/income, selling = capital gains

Why Smart Contracts Matter for Taxes

Here's the critical insight:

Different contracts = different tax treatments.

Example Scenario

You send 1 ETH to 0x8315...

Is this:

  1. A bridge (non-taxable transfer)?
  2. A DEX swap (taxable sale)?
  3. A lending deposit (taxable/non-taxable depending)?
  4. A transfer to a friend (gift)?

You can't tell from the transaction alone.

You need to know:

  • What contract is 0x8315...?
  • What function did you call?
  • What happened as a result?

This is where most tax software fails.

Bad Software Approach

  1. See: "Sent 1 ETH to 0x8315..."
  2. Label: "Send" (generic)
  3. Tax treatment: User must manually classify

Result: Hours of manual work looking up contract addresses.

Moonscape's Approach

  1. See: "Sent 1 ETH to 0x8315..."
  2. Check database: "0x8315... = Arbitrum Bridge"
  3. Auto-label: "Bridge to Arbitrum"
  4. Tax treatment: Non-taxable transfer
  5. Look for matching receive on Arbitrum
  6. Link transactions automatically

Result: Correct classification, zero manual work.

Moonscape's Smart Contract Database

We maintain a database of 1000+ important smart contracts:

Bridge Contracts (40+)

  • Arbitrum, Optimism, Base, Polygon, zkSync
  • Hop, Across, Stargate
  • Multichain, Synapse, Celer

DEX Contracts (100+)

  • Uniswap V2, V3, Universal Router
  • Curve (all pools)
  • SushiSwap, Balancer, 1inch

Lending Contracts (50+)

  • Aave V2, V3
  • Compound V2, V3
  • Maker, Euler

Liquidity Pools (500+)

  • Major Uniswap V3 pools
  • Curve pools
  • Balancer pools

Other Protocols (300+)

  • GMX, Radiant, Velodrome
  • Lido, Rocket Pool
  • OpenSea, Blur

When you import your wallet, every contract interaction is automatically labeled.

Instead of:

Sent 1000 USDC to 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45

You see:

Swapped 1000 USDC via Uniswap V3 Router

Correct tax treatment applied automatically.

Reading Contract Interactions on Block Explorers

When you view a transaction on Etherscan, you'll see:

Basic Info

  • From: Your wallet address
  • To: Contract address
  • Value: Amount of ETH sent (if any)

Advanced Info

  • Input Data: The function you called and its parameters
  • Logs: Events emitted by the contract
  • Internal Transactions: Token transfers that happened inside the contract

Example: Uniswap Swap

Transaction: 0xabc123...

Input Data:

Function: exactInputSingle
  tokenIn: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 (USDC)
  tokenOut: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 (WETH)
  amountIn: 1000000000 (1000 USDC with 6 decimals)
  amountOutMinimum: 500000000000000000 (0.5 WETH minimum)

Logs:

Transfer 1000 USDC from 0xYou to 0xPool
Transfer 0.523 WETH from 0xPool to 0xYou

Result: Swapped 1000 USDC for 0.523 ETH

Moonscape reads this data automatically and classifies it as a taxable swap.

The Bottom Line

Smart contracts are the infrastructure of DeFi. They're:

  • Programs on the blockchain that execute automatically
  • Identified by addresses like 0x8315...
  • Require approvals to spend your tokens
  • Critical for tax classification (different contracts = different tax treatments)

For DeFi users, understanding what contract you're interacting with isn't optional.

Every contract interaction has a different tax implication:

  • Bridge = non-taxable transfer
  • Swap = taxable sale
  • LP deposit = complex (potentially taxable)
  • Lending = complex (depends on protocol and jurisdiction)

Most tax software can't tell the difference. You're left manually classifying hundreds of transactions.


Auto-Classify Your Contract Interactions

Moonscape's smart contract database automatically labels 1000+ protocols.

βœ… Bridges, DEXs, lending, LP, NFT marketplaces
βœ… Correct tax classification
βœ… No manual lookups
βœ… Save hours of work

Try Moonscape β†’

Built for people who'd rather track than guess.
Moonscape β€” your crypto, your taxes, fully decoded.

Follow us on X (@MoonscapeHQ)


Related Reading


Tags: #SmartContracts #DeFi #Ethereum #CryptoTax #Uniswap #Bridges