ETH Price: $3,340.66 (-2.37%)

Contract

0x53547867Cf5164E322E3f2Db62c7Ba3DEF7Cb932
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x608060401170075922024-03-05 4:46:01111 days ago1709613961IN
 Create: FarcasterBoundTokenManager
0 ETH0.000004960.01097384

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FarcasterBoundTokenManager

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 8 : FarcasterBoundTokenManager.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;

import "../utils/Ownable.sol";
import "./InterfaceSupportTokenManager.sol";
import "./interfaces/IPostTransfer.sol";
import "./interfaces/IFarcaster.sol";

/**
 * @author highlight.xyz
 * @notice A basic token manager that prevents transfers to addresses without a Farcaster ID
 */
contract FarcasterBoundTokenManager is ITokenManager, IPostTransfer, InterfaceSupportTokenManager {
    /**
     * @notice See {ITokenManager-canUpdateMetadata}
     */
    function canUpdateMetadata(
        address sender,
        uint256 /* id */,
        bytes calldata /* newTokenUri */
    ) external view override returns (bool) {
        return Ownable(msg.sender).owner() == sender;
    }

    /**
     * @notice See {ITokenManager-canSwap}
     */
    function canSwap(
        address sender,
        uint256 /* id */,
        address /* newTokenManager */
    ) external view override returns (bool) {
        return Ownable(msg.sender).owner() == sender;
    }

    /**
     * @notice See {ITokenManager-canRemoveItself}
     */
    function canRemoveItself(address sender, uint256 /* id */) external view override returns (bool) {
        return Ownable(msg.sender).owner() == sender;
    }

    /**
     * @notice See {IPostTransfer-postSafeTransferFrom}
     */
    function postSafeTransferFrom(
        address /* operator */,
        address /* from */,
        address to,
        uint256 /* id */,
        bytes memory /* data */
    ) external view override {
        if (IFarcaster(0x00000000Fc6c5F01Fc30151999387Bb99A9f489b).idOf(to) == 0) {
            revert("Can only transfer to a Farcaster user");
        }
    }

    /**
     * @notice See {IPostTransfer-postTransferFrom}
     */
    function postTransferFrom(
        address /* operator */,
        address /* from */,
        address to,
        uint256 /* id */
    ) external view override {
        if (IFarcaster(0x00000000Fc6c5F01Fc30151999387Bb99A9f489b).idOf(to) == 0) {
            revert("Can only transfer to a Farcaster user");
        }
    }

    /**
     * @notice See {IERC165-supportsInterface}.
     */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(InterfaceSupportTokenManager) returns (bool) {
        return
            interfaceId == type(IPostTransfer).interfaceId ||
            InterfaceSupportTokenManager.supportsInterface(interfaceId);
    }
}

File 2 of 8 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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;
    }
}

File 3 of 8 : IFarcaster.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

/**
 * @author highlight.xyz
 * @notice Interact with idOf on the farcaster id registry
 */
interface IFarcaster {
    function idOf(address user) external view returns (uint256);
}

File 4 of 8 : IPostTransfer.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

/**
 * @author highlight.xyz
 * @notice If token managers implement this, transfer actions will call
 *      postSafeTransferFrom or postTransferFrom on the token manager.
 */
interface IPostTransfer {
    /**
     * @notice Hook called by community after safe transfers, if token manager of transferred token implements this
     *      interface.
     * @param operator Operator transferring tokens
     * @param from Token(s) sender
     * @param to Token(s) recipient
     * @param id Transferred token's id
     * @param data Arbitrary data
     */
    function postSafeTransferFrom(address operator, address from, address to, uint256 id, bytes memory data) external;

    /**
     * @notice Hook called by community after transfers, if token manager of transferred token implements
     *         this interface.
     * @param operator Operator transferring tokens
     * @param from Token(s) sender
     * @param to Token(s) recipient
     * @param id Transferred token's id
     */
    function postTransferFrom(address operator, address from, address to, uint256 id) external;
}

File 5 of 8 : ITokenManager.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;

/**
 * @title ITokenManager
 * @author highlight.xyz
 * @notice Enables interfacing with custom token managers
 */
interface ITokenManager {
    /**
     * @notice Returns whether metadata updater is allowed to update
     * @param sender Updater
     * @param id Token/edition who's uri is being updated
     *           If id is 0, implementation should decide behaviour for base uri update
     * @param newData Token's new uri if called by general contract, and any metadata field if called by editions
     * @return If invocation can update metadata
     */
    function canUpdateMetadata(address sender, uint256 id, bytes calldata newData) external returns (bool);

    /**
     * @notice Returns whether token manager can be swapped for another one by invocator
     * @notice Default token manager implementations should ignore id
     * @param sender Swapper
     * @param id Token grouping id (token id or edition id)
     * @param newTokenManager New token manager being swapped to
     * @return If invocation can swap token managers
     */
    function canSwap(address sender, uint256 id, address newTokenManager) external returns (bool);

    /**
     * @notice Returns whether token manager can be removed
     * @notice Default token manager implementations should ignore id
     * @param sender Swapper
     * @param id Token grouping id (token id or edition id)
     * @return If invocation can remove token manager
     */
    function canRemoveItself(address sender, uint256 id) external returns (bool);
}

File 6 of 8 : InterfaceSupportTokenManager.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;

import "./interfaces/ITokenManager.sol";
import "../utils/ERC165/IERC165.sol";

/**
 * @author highlight.xyz
 * @notice Abstract contract to be inherited by all valid token managers
 */
abstract contract InterfaceSupportTokenManager {
    /**
     * @notice See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(ITokenManager).interfaceId || _supportsERC165Interface(interfaceId);
    }

    /**
     * @notice Used to show support for IERC165, without inheriting contract from IERC165 implementations
     */
    function _supportsERC165Interface(bytes4 interfaceId) internal pure returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 7 of 8 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity 0.8.10;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 8 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity 0.8.10;

import "@openzeppelin/contracts/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.
 */
/* solhint-disable */
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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing 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);
    }
}

Settings
{
  "metadata": {
    "bytecodeHash": "none"
  },
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"canRemoveItself","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"canSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"canUpdateMetadata","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"postSafeTransferFrom","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"postTransferFrom","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50610739806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806301ffc9a7146100675780633d820a4d1461008e5780637f1eaf85146100a157806385e335b6146100b65780638af6791b146100c9578063ce2003a5146100dc575b600080fd5b61007a610075366004610405565b6100ef565b604051901515815260200160405180910390f35b61007a61009c36600461044e565b61011a565b6100b46100af3660046104d6565b61019b565b005b61007a6100c4366004610527565b61023a565b6100b46100d736600461057f565b6102ba565b61007a6100ea366004610671565b610351565b60006001600160e01b03198216637af46b4f60e11b14806101145750610114826103d0565b92915050565b6000846001600160a01b0316336001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610164573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610188919061069d565b6001600160a01b03161495945050505050565b604051636ca7f41960e11b81526ffc6c5f01fc30151999387bb99a9f489b9063d94fe832906101ce9085906004016106ba565b602060405180830381865afa1580156101eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020f91906106ce565b6102345760405162461bcd60e51b815260040161022b906106e7565b60405180910390fd5b50505050565b6000836001600160a01b0316336001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a8919061069d565b6001600160a01b031614949350505050565b604051636ca7f41960e11b81526ffc6c5f01fc30151999387bb99a9f489b9063d94fe832906102ed9086906004016106ba565b602060405180830381865afa15801561030a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032e91906106ce565b61034a5760405162461bcd60e51b815260040161022b906106e7565b5050505050565b6000826001600160a01b0316336001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561039b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bf919061069d565b6001600160a01b0316149392505050565b60006001600160e01b03198216633b209e2f60e11b148061011457506301ffc9a760e01b6001600160e01b0319831614610114565b60006020828403121561041757600080fd5b81356001600160e01b03198116811461042f57600080fd5b9392505050565b6001600160a01b038116811461044b57600080fd5b50565b6000806000806060858703121561046457600080fd5b843561046f81610436565b93506020850135925060408501356001600160401b038082111561049257600080fd5b818701915087601f8301126104a657600080fd5b8135818111156104b557600080fd5b8860208285010111156104c757600080fd5b95989497505060200194505050565b600080600080608085870312156104ec57600080fd5b84356104f781610436565b9350602085013561050781610436565b9250604085013561051781610436565b9396929550929360600135925050565b60008060006060848603121561053c57600080fd5b833561054781610436565b925060208401359150604084013561055e81610436565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a0868803121561059757600080fd5b85356105a281610436565b945060208601356105b281610436565b935060408601356105c281610436565b92506060860135915060808601356001600160401b03808211156105e557600080fd5b818801915088601f8301126105f957600080fd5b81358181111561060b5761060b610569565b604051601f8201601f19908116603f0116810190838211818310171561063357610633610569565b816040528281528b602084870101111561064c57600080fd5b8260208601602083013760006020848301015280955050505050509295509295909350565b6000806040838503121561068457600080fd5b823561068f81610436565b946020939093013593505050565b6000602082840312156106af57600080fd5b815161042f81610436565b6001600160a01b0391909116815260200190565b6000602082840312156106e057600080fd5b5051919050565b60208082526025908201527f43616e206f6e6c79207472616e7366657220746f206120466172636173746572604082015264103ab9b2b960d91b60608201526080019056fea164736f6c634300080a000a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100625760003560e01c806301ffc9a7146100675780633d820a4d1461008e5780637f1eaf85146100a157806385e335b6146100b65780638af6791b146100c9578063ce2003a5146100dc575b600080fd5b61007a610075366004610405565b6100ef565b604051901515815260200160405180910390f35b61007a61009c36600461044e565b61011a565b6100b46100af3660046104d6565b61019b565b005b61007a6100c4366004610527565b61023a565b6100b46100d736600461057f565b6102ba565b61007a6100ea366004610671565b610351565b60006001600160e01b03198216637af46b4f60e11b14806101145750610114826103d0565b92915050565b6000846001600160a01b0316336001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610164573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610188919061069d565b6001600160a01b03161495945050505050565b604051636ca7f41960e11b81526ffc6c5f01fc30151999387bb99a9f489b9063d94fe832906101ce9085906004016106ba565b602060405180830381865afa1580156101eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020f91906106ce565b6102345760405162461bcd60e51b815260040161022b906106e7565b60405180910390fd5b50505050565b6000836001600160a01b0316336001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a8919061069d565b6001600160a01b031614949350505050565b604051636ca7f41960e11b81526ffc6c5f01fc30151999387bb99a9f489b9063d94fe832906102ed9086906004016106ba565b602060405180830381865afa15801561030a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032e91906106ce565b61034a5760405162461bcd60e51b815260040161022b906106e7565b5050505050565b6000826001600160a01b0316336001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561039b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bf919061069d565b6001600160a01b0316149392505050565b60006001600160e01b03198216633b209e2f60e11b148061011457506301ffc9a760e01b6001600160e01b0319831614610114565b60006020828403121561041757600080fd5b81356001600160e01b03198116811461042f57600080fd5b9392505050565b6001600160a01b038116811461044b57600080fd5b50565b6000806000806060858703121561046457600080fd5b843561046f81610436565b93506020850135925060408501356001600160401b038082111561049257600080fd5b818701915087601f8301126104a657600080fd5b8135818111156104b557600080fd5b8860208285010111156104c757600080fd5b95989497505060200194505050565b600080600080608085870312156104ec57600080fd5b84356104f781610436565b9350602085013561050781610436565b9250604085013561051781610436565b9396929550929360600135925050565b60008060006060848603121561053c57600080fd5b833561054781610436565b925060208401359150604084013561055e81610436565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a0868803121561059757600080fd5b85356105a281610436565b945060208601356105b281610436565b935060408601356105c281610436565b92506060860135915060808601356001600160401b03808211156105e557600080fd5b818801915088601f8301126105f957600080fd5b81358181111561060b5761060b610569565b604051601f8201601f19908116603f0116810190838211818310171561063357610633610569565b816040528281528b602084870101111561064c57600080fd5b8260208601602083013760006020848301015280955050505050509295509295909350565b6000806040838503121561068457600080fd5b823561068f81610436565b946020939093013593505050565b6000602082840312156106af57600080fd5b815161042f81610436565b6001600160a01b0391909116815260200190565b6000602082840312156106e057600080fd5b5051919050565b60208082526025908201527f43616e206f6e6c79207472616e7366657220746f206120466172636173746572604082015264103ab9b2b960d91b60608201526080019056fea164736f6c634300080a000a

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
[ Download: CSV Export  ]

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.