Skip to content
Verified contractPartialUNLICENSED

SupplyReporter

Address0xea26e0df3d7eb68527108405e78e5e6ee9d4c4fb
Balance

0 ETH

 

Transactions

2

 

Compiler

solc 0.8.30

 

Same code

1 more contract

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
Via IR
yes
License
UNLICENSED
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,223,997
Creation transaction
0x6d01ac1461…bf6b2ff8a4

src/SupplyReporter.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;

interface IReportsSupply {
    function reportSupply(uint256 newSupply) external;
}

/// @title SupplyReporter
/// @notice The one address on each EVM chain that tokens accept supply reports from. Updater keys
///         (the delivery bot) call `report` to mirror a token's Solana supply into its
///         `totalSupply()`. The admin adds and removes updaters, so a key can be rotated without
///         touching any token. A report moves no balance: the token bounds it between its own
///         chain's supply and the launch total, and nothing else reads it.
contract SupplyReporter {
    address public admin;
    address public pendingAdmin;
    mapping(address => bool) public isUpdater;

    event UpdaterSet(address indexed updater, bool allowed);
    event AdminProposed(address indexed from, address indexed to);
    event AdminChanged(address indexed from, address indexed to);

    error NotAdmin();
    error NotUpdater();
    error NotPendingAdmin();
    error ZeroAddress();
    error LengthMismatch();

    constructor(address admin_) {
        if (admin_ == address(0)) revert ZeroAddress();
        admin = admin_;
        emit AdminChanged(address(0), admin_);
    }

    function setUpdater(address updater, bool allowed) external {
        if (msg.sender != admin) revert NotAdmin();
        if (updater == address(0)) revert ZeroAddress();
        isUpdater[updater] = allowed;
        emit UpdaterSet(updater, allowed);
    }

    function proposeAdmin(address to) external {
        if (msg.sender != admin) revert NotAdmin();
        if (to == address(0)) revert ZeroAddress();
        pendingAdmin = to;
        emit AdminProposed(admin, to);
    }

    function acceptAdmin() external {
        if (msg.sender != pendingAdmin) revert NotPendingAdmin();
        emit AdminChanged(admin, msg.sender);
        admin = msg.sender;
        pendingAdmin = address(0);
    }

    /// @notice Report one token's supply on this chain.
    function report(address token, uint256 newSupply) external {
        if (!isUpdater[msg.sender]) revert NotUpdater();
        IReportsSupply(token).reportSupply(newSupply);
    }

    /// @notice Report several tokens in one transaction. All or nothing.
    function reportMany(address[] calldata tokens, uint256[] calldata supplies) external {
        if (!isUpdater[msg.sender]) revert NotUpdater();
        if (tokens.length != supplies.length) revert LengthMismatch();
        for (uint256 i; i < tokens.length; ++i) {
            IReportsSupply(tokens[i]).reportSupply(supplies[i]);
        }
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@layerzerolabs/oft-evm/=lib/layerzero/oft-evm/",
    "@layerzerolabs/oapp-evm/=lib/layerzero/oapp-evm/",
    "@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero/protocol-v2/",
    "@uniswap/v4-core/=lib/uniswap-v4-core/",
    "solmate/=lib/solmate/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "layerzero/=lib/layerzero/",
    "uniswap-v4-core/=lib/uniswap-v4-core/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.