Amoy Testnet

Contract

0xf652BEc2f8f4c20d1FbB8F3DC84F9199A9278479

Overview

POL Balance

Polygon PoS Chain Amoy LogoPolygon PoS Chain Amoy LogoPolygon PoS Chain Amoy Logo0 POL

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x4Ae3915A...cE58331Df
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ContentAPI

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 3 : ContentAPI.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol";

contract ContentAPI is Ownable {
    address private API;
    mapping(address => bool) private allowList;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error UnauthorizedAccount(address account);

    /**
     * @dev Emitted when the API address is updated.
     */
    event APIAddressUpdated(address indexed oldAPI, address indexed newAPI);

    /**
     * @dev Emitted when a user's allowlist state is updated.
     */
    event UserStateUpdated(address indexed user, bool state);

    /**
     * @dev Throws if called by any account other than the set API.
     */
    modifier onlyAPI() {
        _isAPI();
        _;
    }

    constructor(address _API) Ownable(msg.sender) {
        updateAPIAddress(_API);
    }

    /**
     * @dev Throws if the sender is not the API.
     */
    function _isAPI() internal view {
        if (API != _msgSender()) {
            revert UnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Updates the API address. Only the contract owner can call this.
     */
    function updateAPIAddress(address _API) public onlyOwner {
        require(_API != address(0), "Invalid API address");
        emit APIAddressUpdated(API, _API);
        API = _API;
    }

    /**
     * @dev Sets the allowlist state for a user. Can only be called by the API.
     */
    function setUserState(address user, bool state) public onlyAPI {
        allowList[user] = state;
        emit UserStateUpdated(user, state);
    }

    /**
     * @dev Authenticates a user based on the allowlist.
     */
    function auth(bytes32, address user) public view returns (bool) {
        return allowList[user];
    }

    /**
     * @dev Returns the current API address.
     */
    function getAPIAddress() external view returns (address) {
        return API;
    }
}

File 2 of 3 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 3 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "none",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false,
  "libraries": {}
}

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_API","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"UnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAPI","type":"address"},{"indexed":true,"internalType":"address","name":"newAPI","type":"address"}],"name":"APIAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bool","name":"state","type":"bool"}],"name":"UserStateUpdated","type":"event"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"user","type":"address"}],"name":"auth","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAPIAddress","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":"user","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"setUserState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_API","type":"address"}],"name":"updateAPIAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561000f575f80fd5b506004361061007a575f3560e01c8063715018a611610058578063715018a6146100e8578063884d6d80146100f05780638da5cb5b14610115578063f2fde38b14610125575f80fd5b80630f2265571461007e5780632b6fb5ba14610093578063516a166a146100a6575b5f80fd5b61009161008c366004610365565b610138565b005b6100916100a1366004610385565b6101ec565b6100d36100b43660046103be565b6001600160a01b03165f9081526002602052604090205460ff16919050565b60405190151581526020015b60405180910390f35b610091610252565b6001546001600160a01b03165b6040516001600160a01b0390911681526020016100df565b5f546001600160a01b03166100fd565b610091610133366004610365565b610265565b6101406102a2565b6001600160a01b0381166101915760405162461bcd60e51b8152602060048201526013602482015272496e76616c696420415049206164647265737360681b60448201526064015b60405180910390fd5b6001546040516001600160a01b038084169216907f0c0d0d9b278edcde793606ad3ee4c9680cdd6d9894c106a660df703965db5746905f90a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6101f46102ce565b6001600160a01b0382165f81815260026020908152604091829020805460ff191685151590811790915591519182527f9d573262a9f42449d9b0d4e9db3de5b5b0b2e7e6dd7c931e0e1a0af96647927c910160405180910390a25050565b61025a6102a2565b6102635f6102fb565b565b61026d6102a2565b6001600160a01b03811661029657604051631e4fbdf760e01b81525f6004820152602401610188565b61029f816102fb565b50565b5f546001600160a01b031633146102635760405163118cdaa760e01b8152336004820152602401610188565b6001546001600160a01b03163314610263576040516332b2baa360e01b8152336004820152602401610188565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b0381168114610360575f80fd5b919050565b5f60208284031215610375575f80fd5b61037e8261034a565b9392505050565b5f8060408385031215610396575f80fd5b61039f8361034a565b9150602083013580151581146103b3575f80fd5b809150509250929050565b5f80604083850312156103cf575f80fd5b823591506103df6020840161034a565b9050925092905056fea164736f6c6343000819000a

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.