Incentives Proxy

This proxy follows the EIP-1967 pattern with an immutable admin. It:

  • Delegates calls to an implementation contract.

  • Lets the admin upgrade the implementation.

  • Provides an optional initializer for first setup.

Essentially, this is the upgradeable backbone used by the protocol components.

Constructor

  • constructor(address admin) Sets the immutable proxy admin. This admin controls future upgrades.


Functions

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

  • implementation() → address Returns the current implementation address behind the proxy. ⚠️ Also restricted to the admin.

  • initialize(address _logic, bytes _data) (payable) Initializes the proxy with an implementation (_logic) and optionally executes a call (_data) on it. Used at deployment to bootstrap the proxied contract.

  • upgradeTo(address newImplementation) Upgrades the proxy to a new implementation contract. Admin-only.

  • upgradeToAndCall(address newImplementation, bytes data) (payable) Upgrades the proxy to a new implementation and executes a function on it with the provided calldata. Commonly used to both upgrade and initialize new logic in one transaction.


Fallback

  • fallback() payable Delegates any unknown function calls to the current implementation.


Events

  • Upgraded(address implementation) Emitted when the proxy is upgraded to a new implementation contract.

[
  {
    "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?