Pool Proxy

This contract is an upgradeable proxy. It doesn’t contain the business logic itself, but delegates calls to another contract (the implementation). The admin has special permissions to change which imp


🔹 Fallback

  • fallback() payable A generic handler that forwards all calls (that don’t match any defined function) to the current implementation contract using delegatecall. This is how the proxy “forwards” function calls to the logic contract.


🔹 Functions

  • admin() → address Returns the admin address of the proxy. ⚠️ Only callable by the admin, otherwise the call is forwarded to the implementation.

  • implementation() → address Returns the address of the current implementation contract. ⚠️ Only callable by the admin.

  • initialize(address _logic, bytes _data) (payable) Sets the initial implementation (_logic) and optionally calls an initialization function on it with the provided _data. This is usually used right after deployment.

  • upgradeTo(address newImplementation) Upgrades the proxy to a new implementation contract. Only the admin can call this.

  • upgradeToAndCall(address newImplementation, bytes data) (payable) Upgrades to a new implementation and immediately calls a function on it (using data). This is useful for initializing the new implementation in the same transaction.

[
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "admin",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "implementation",
        "type": "address"
      }
    ],
    "name": "Upgraded",
    "type": "event"
  },
  {
    "stateMutability": "payable",
    "type": "fallback"
  },
  {
    "inputs": [],
    "name": "admin",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "implementation",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_logic",
        "type": "address"
      },
      {
        "internalType": "bytes",
        "name": "_data",
        "type": "bytes"
      }
    ],
    "name": "initialize",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "newImplementation",
        "type": "address"
      }
    ],
    "name": "upgradeTo",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "newImplementation",
        "type": "address"
      },
      {
        "internalType": "bytes",
        "name": "data",
        "type": "bytes"
      }
    ],
    "name": "upgradeToAndCall",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  }
]

Last updated

Was this helpful?