Onchain.Aave.Contracts (onchain_aave v0.2.0)

Copy Markdown View Source

Aave V3 + V4 contract address registry.

Pure-function lookup for known Aave protocol contract addresses. All other Aave modules (Pool, Oracle, UiPoolDataProvider) depend on this for addresses.

Supported Networks

Ethereum, Arbitrum, Optimism, Base, Polygon, Avalanche (all Aave V3 mainnet), and Sepolia (V3 testnet). Aave V4 is Ethereum-mainnet only as of 2026-04.

V4 Address Shape

V4's Hub-and-Spoke deployment exposes ~34 singleton contracts (infrastructure, Position Managers, Hubs, Spokes, per-Spoke oracles) plus 31 ERC-4626 Tokenization Spokes. Singletons use flat :v4_-prefixed atoms resolved by address/2 (e.g. :v4_core_hub, :v4_main_spoke, :v4_main_spoke_oracle). Tokenization Spokes use the nested v4_tokenization_spoke/3 lookup keyed by {hub, asset} to avoid flooding the atom registry with 31 flat keys.

V4 addresses are sourced from V4_SCOPING.md (the V4 source of truth).

Error Format

  • Unknown contract: {:error, {:unknown_contract, key}}
  • Unknown V4 hub: {:error, {:unknown_hub, hub}}
  • Unknown V4 tokenization spoke: {:error, {:unknown_tokenization_spoke, {hub, asset}}}
  • Unsupported network: {:error, {:unsupported_network, network}}

Functions

FunctionPurpose
address/2Look up a V3 or V4 singleton contract's checksummed address
address!/2Same, raises on error
v4_tokenization_spoke/3Look up a V4 ERC-4626 Tokenization Spoke by {hub, asset}
networks/0List supported networks
contracts/1List V3 contract keys for a network
v4_contracts/1List V4 singleton contract keys for a network

API Functions

FunctionArityDescriptionParam Kinds
v4_contracts1List available V4 singleton contract keys for a network.opts: value
contracts1List available contract keys for a network.opts: value
networks0List supported networks.-
v4_tokenization_spoke3Look up a V4 ERC-4626 Tokenization Spoke address by {hub, asset}.hub: value, asset: value, opts: value
address!2Look up a contract's checksummed address. Raises on error.contract: value, opts: value
address2Look up a V3 or V4 singleton contract's EIP-55 checksummed address.contract: value, opts: value

Summary

Functions

Look up a V3 or V4 singleton contract's EIP-55 checksummed address.

Look up a contract's checksummed address. Raises on error.

List available contract keys for a network.

List supported networks.

List available V4 singleton contract keys for a network.

Look up a V4 ERC-4626 Tokenization Spoke address by {hub, asset}.

Functions

address(contract, opts \\ [])

@spec address(
  atom(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

Look up a V3 or V4 singleton contract's EIP-55 checksummed address.

Parameters

  • contract - Contract key atom, e.g. :pool, :oracle, :v4_core_hub (value)
  • opts - Options: [network: :ethereum] (default: [], value)

Returns

Checksummed hex address ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: [network: :ethereum]",
      kind: :value
    },
    contract: %{
      description: "Contract key atom, e.g. :pool, :oracle, :v4_core_hub",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "Checksummed hex address",
    example: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
  }
}

address!(contract, opts \\ [])

@spec address!(
  atom(),
  keyword()
) :: String.t()

Look up a contract's checksummed address. Raises on error.

Parameters

  • contract - Contract key atom, e.g. :pool, :oracle (value)
  • opts - Options: [network: :ethereum] (default: [], value)

Returns

Checksummed hex address (string)

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: [network: :ethereum]",
      kind: :value
    },
    contract: %{
      description: "Contract key atom, e.g. :pool, :oracle",
      kind: :value
    }
  },
  returns: %{type: :string, description: "Checksummed hex address"}
}

contracts(opts \\ [])

@spec contracts(keyword()) ::
  {:ok, [atom()]} | {:error, {:unsupported_network, atom()}}

List available contract keys for a network.

Parameters

  • opts - Options: [network: :ethereum] (default: [], value)

Returns

List of contract key atoms ({:ok, [atom()]} | {:error, {:unsupported_network, atom()}})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: [network: :ethereum]",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, [atom()]} | {:error, {:unsupported_network, atom()}}",
    description: "List of contract key atoms"
  }
}

networks()

@spec networks() :: [atom()]

List supported networks.

Returns

List of network atoms ([atom()])

# descripex:contract
%{
  returns: %{
    type: "[atom()]",
    description: "List of network atoms",
    example: "[:ethereum]"
  }
}

v4_contracts(opts \\ [])

@spec v4_contracts(keyword()) ::
  {:ok, [atom()]} | {:error, {:unsupported_network, atom()}}

List available V4 singleton contract keys for a network.

Parameters

  • opts - Options: [network: :ethereum] (default: [], value)

Returns

List of V4 singleton contract key atoms ({:ok, [atom()]} | {:error, {:unsupported_network, atom()}})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: [network: :ethereum]",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, [atom()]} | {:error, {:unsupported_network, atom()}}",
    description: "List of V4 singleton contract key atoms"
  }
}

v4_tokenization_spoke(hub, asset, opts \\ [])

@spec v4_tokenization_spoke(atom(), atom(), keyword()) ::
  {:ok, String.t()} | {:error, term()}

Look up a V4 ERC-4626 Tokenization Spoke address by {hub, asset}.

Parameters

  • hub - Hub atom: :core, :prime, or :plus (value)
  • asset - Underlying asset atom, e.g. :weth, :usdc, :pt_susde (value)
  • opts - Options: [network: :ethereum] (default: [], value)

Returns

Checksummed Tokenization Spoke address ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: [network: :ethereum]",
      kind: :value
    },
    hub: %{description: "Hub atom: :core, :prime, or :plus", kind: :value},
    asset: %{
      description: "Underlying asset atom, e.g. :weth, :usdc, :pt_susde",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "Checksummed Tokenization Spoke address",
    example: "0x7320CF22Ac095bA2a2e0a652F77efB836c2E751b"
  }
}