Skip to content
Verified contractExactMIT

TrueoSanctionsList

Address0x21cfcfc3d8f98fc728f48341d10ad8283f6eb7ab
Balance

0 ETH

 

Transactions

2

 

Compiler

solc 0.8.30

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
Yes, 200 runs
EVM version
prague
Via IR
yes
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,437,651
Creation transaction
0x3ae346d598…199ff66d38

src/TrueoSanctionsList.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "./interfaces/ISanctionsList.sol";

string constant TRUEO_SANCTIONS_LIST_NAME = "Trueo sanctions list";

/// @title TrueoSanctionsList
/// @notice A list of sanctioned addresses maintained by Trueo. Queried the same way as the
///         Chainalysis SanctionsList: `isSanctioned(address)`.
/// @notice Only the owner changes the list. Adding a listed address or removing an unlisted one
///         leaves it unchanged and does not fail the batch.
/// @notice `sanctionedCount` is the number of listed addresses.
contract TrueoSanctionsList is ISanctionsList, Ownable2Step {
    mapping(address => bool) private _sanctioned;

    /// @notice Number of listed addresses.
    uint256 public sanctionedCount;

    error OwnershipCannotBeRenounced();

    /// @notice Carries the batch exactly as passed, as Chainalysis does, including addresses that
    ///         were already listed (or, for removal, already unlisted) and so did not change. Replay
    ///         the events in order to get the set; do not count array entries as changes.
    event SanctionedAddressesAdded(address[] addrs);
    /// @notice See `SanctionedAddressesAdded`: the full input, no-op entries included.
    event SanctionedAddressesRemoved(address[] addrs);
    event SanctionedAddress(address indexed addr);
    event NonSanctionedAddress(address indexed addr);

    function name() external pure returns (string memory) {
        return TRUEO_SANCTIONS_LIST_NAME;
    }

    function addToSanctionsList(address[] calldata newSanctions) external onlyOwner {
        uint256 added;
        for (uint256 i; i < newSanctions.length; ++i) {
            address addr = newSanctions[i];
            if (!_sanctioned[addr]) {
                _sanctioned[addr] = true;
                ++added;
            }
        }
        if (added != 0) sanctionedCount += added;
        emit SanctionedAddressesAdded(newSanctions);
    }

    function removeFromSanctionsList(address[] calldata removeSanctions) external onlyOwner {
        uint256 removed;
        for (uint256 i; i < removeSanctions.length; ++i) {
            address addr = removeSanctions[i];
            if (_sanctioned[addr]) {
                _sanctioned[addr] = false;
                ++removed;
            }
        }
        if (removed != 0) sanctionedCount -= removed;
        emit SanctionedAddressesRemoved(removeSanctions);
    }

    function isSanctioned(address addr) external view override returns (bool) {
        return _sanctioned[addr];
    }

    /// @notice Not view: emits an event, as in Chainalysis' SanctionsList.
    function isSanctionedVerbose(address addr) external returns (bool) {
        bool sanctioned = _sanctioned[addr];
        if (sanctioned) {
            emit SanctionedAddress(addr);
        } else {
            emit NonSanctionedAddress(addr);
        }
        return sanctioned;
    }

    /// @notice Disabled: without an owner the list could never be updated again.
    function renounceOwnership() public pure override {
        revert OwnershipCannotBeRenounced();
    }
}

lib/openzeppelin-contracts/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../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.
 *
 * By default, the owner account will be the one that deploys the contract. 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;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @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 {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _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);
    }
}

lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

lib/openzeppelin-contracts/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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;
    }
}

src/interfaces/ISanctionsList.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @notice The query half of Chainalysis' SanctionsList, the only call TrueoNFT makes.
interface ISanctionsList {
    function isSanctioned(address addr) external view returns (bool);
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "prague",
  "remappings": [
    "ds-test/=lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "@uniswap/v3-core/contracts/=lib/v3-core/contracts/",
    "@uniswap/v4-core/=lib/v4-periphery/lib/v4-core/",
    "@uniswap/v3-periphery/=lib/v3-periphery/",
    "@uniswap/v4-periphery/=lib/v4-periphery/",
    "@uniswap/universal-router/=lib/universal-router/",
    "@uniswap/swap-router-contracts/=lib/swap-router-contracts/contracts/",
    "@ERC721A/=lib/ERC721A/contracts/",
    "@ensdomains/=lib/v4-periphery/lib/v4-core/node_modules/@ensdomains/",
    "@uniswap/v2-core/=lib/universal-router/node_modules/@uniswap/v2-core/",
    "ERC721A/=lib/ERC721A/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-gas-snapshot/=lib/permit2/lib/forge-gas-snapshot/src/",
    "hardhat/=lib/v4-periphery/lib/v4-core/node_modules/hardhat/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "permit2/=lib/permit2/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
    "solmate/=lib/universal-router/lib/solmate/",
    "swap-router-contracts/=lib/swap-router-contracts/contracts/",
    "universal-router/=lib/universal-router/",
    "v3-core/=lib/v3-core/",
    "v3-periphery/=lib/v3-periphery/contracts/",
    "v4-core/=lib/v4-periphery/lib/v4-core/src/",
    "v4-periphery/=lib/v4-periphery/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.