WrappedTokenGatewayV3

  • depositETH(address onBehalfOf, uint16 referralCode) (payable) Wraps the sent ETH into WETH and deposits into the Aave pool.

    • onBehalfOf: User who will receive the aTokens.

    • referralCode: Code for referral programs (usually 0).

  • withdrawETH(address asset, uint256 amount, address to) Withdraws WETH from the pool, unwraps it, and sends ETH to to.

  • withdrawETHWithPermit(address asset, uint256 amount, address to, uint256 deadline, uint8 v, bytes32 r, bytes32 s) Like withdrawETH, but uses an ERC20 permit signature for gasless approval.

  • borrowETH(address, uint256 amount, uint256 interestRateMode, uint16 referralCode) Borrows ETH from the pool (internally via WETH).

    • interestRateMode: Stable or variable debt.

    • referralCode: Referral tracking.

  • repayETH(address, uint256 amount, uint256 rateMode, address onBehalfOf) (payable) Repays borrowed ETH (wrapped as WETH, then repaid to the pool).

    • onBehalfOf: Allows repaying someone else’s debt.


Admin / Emergency

  • emergencyEtherTransfer(address to, uint256 amount) Allows the owner to transfer stuck ETH from the contract.

  • emergencyTokenTransfer(address token, address to, uint256 amount) Allows the owner to transfer stuck ERC20 tokens.

  • getWETHAddress() → address Returns the WETH token address used internally.

  • owner() → address Returns the current contract owner.

  • transferOwnership(address newOwner) Transfers contract ownership.

  • renounceOwnership() Allows the current owner to give up control.


Events

  • OwnershipTransferred(previousOwner, newOwner) Emitted when contract ownership is transferred to a new admin.

[
  {
    "inputs": [
      { "internalType": "address", "name": "weth", "type": "address" },
      { "internalType": "address", "name": "owner", "type": "address" },
      { "internalType": "contract IPool", "name": "pool", "type": "address" }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "anonymous": false,
    "inputs": [
      { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
      { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
    ],
    "name": "OwnershipTransferred",
    "type": "event"
  },
  { "stateMutability": "payable", "type": "fallback" },
  {
    "inputs": [
      { "internalType": "address", "name": "", "type": "address" },
      { "internalType": "uint256", "name": "amount", "type": "uint256" },
      { "internalType": "uint256", "name": "interestRateMode", "type": "uint256" },
      { "internalType": "uint16", "name": "referralCode", "type": "uint16" }
    ],
    "name": "borrowETH",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "", "type": "address" },
      { "internalType": "address", "name": "onBehalfOf", "type": "address" },
      { "internalType": "uint16", "name": "referralCode", "type": "uint16" }
    ],
    "name": "depositETH",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "to", "type": "address" },
      { "internalType": "uint256", "name": "amount", "type": "uint256" }
    ],
    "name": "emergencyEtherTransfer",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "token", "type": "address" },
      { "internalType": "address", "name": "to", "type": "address" },
      { "internalType": "uint256", "name": "amount", "type": "uint256" }
    ],
    "name": "emergencyTokenTransfer",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getWETHAddress",
    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "owner",
    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "renounceOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "", "type": "address" },
      { "internalType": "uint256", "name": "amount", "type": "uint256" },
      { "internalType": "uint256", "name": "rateMode", "type": "uint256" },
      { "internalType": "address", "name": "onBehalfOf", "type": "address" }
    ],
    "name": "repayETH",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
    "name": "transferOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "", "type": "address" },
      { "internalType": "uint256", "name": "amount", "type": "uint256" },
      { "internalType": "address", "name": "to", "type": "address" }
    ],
    "name": "withdrawETH",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      { "internalType": "address", "name": "", "type": "address" },
      { "internalType": "uint256", "name": "amount", "type": "uint256" },
      { "internalType": "address", "name": "to", "type": "address" },
      { "internalType": "uint256", "name": "deadline", "type": "uint256" },
      { "internalType": "uint8", "name": "permitV", "type": "uint8" },
      { "internalType": "bytes32", "name": "permitR", "type": "bytes32" },
      { "internalType": "bytes32", "name": "permitS", "type": "bytes32" }
    ],
    "name": "withdrawETHWithPermit",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  { "stateMutability": "payable", "type": "receive" }
]

Last updated

Was this helpful?