false
true
0

Contract Address Details

0x29ceF591840d70fBB2024a705AB185e584516b85

Contract Name
TokenFactory
Creator
0xf71cba–f75eac at 0x5247be–fc8642
Balance
0 tPLS
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
26048723
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
TokenFactory




Optimization enabled
false
Compiler version
v0.8.28+commit.7893614a




EVM Version




Verified at
2026-11-21T15:05:52.656630Z

Constructor Arguments

0000000000000000000000001d04a3b144fb7c0392f1d5459134af87063513ea000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000075365706f6c696100000000000000000000000000000000000000000000000000

Arg [0] (address) : 0x1d04a3b144fb7c0392f1d5459134af87063513ea
Arg [1] (string) : Sepolia

              

src/hardened/mediator/TokenFactory.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import {BridgedToken} from "./BridgedToken.sol";
import {ITokenParameters} from "./ITokenParameters.sol";

/// @title TokenFactory
/// @notice Deploys the bridged copies of native tokens at addresses that can be computed. Only the mediator may call
/// `deploy`. The factory has no owner and no token image to change: every copy has the same code.
/// @dev The address of a copy is `CREATE2(factory, salt, creationCode)` with `salt = keccak256(abi.encode(homeChainId,
/// nativeToken))`. The creation code has no arguments, so the name, the symbol and the decimals do not change the
/// address. The factory holds them in storage during the deployment, and the token reads them in its constructor.
contract TokenFactory is ITokenParameters {
    /// @notice Only the mediator may deploy.
    error NotMediator(address caller);
    /// @notice The name of the home chain is longer than 32 bytes, so it does not fit in one immutable word.
    error HomeChainNameTooLong(uint256 length);

    /// @dev What the token constructor reads while a deployment runs.
    struct Parameters {
        string name;
        string symbol;
        uint8 decimals;
    }

    /// @notice The only account that may call `deploy`, and the only account that may mint and burn the copies.
    address public immutable mediator;

    /// @dev The name of the chain where the native tokens of this factory live, left aligned in one word, and its
    /// length. Both are immutable: they are part of the code, not of the storage.
    bytes32 private immutable _homeChainNameWord;
    uint256 private immutable _homeChainNameLength;

    Parameters private _pending;

    /// @param mediator_ The mediator that owns the factory.
    /// @param homeChainName_ The name of the other chain, where the native tokens live. At most 32 bytes.
    constructor(address mediator_, string memory homeChainName_) {
        uint256 length = bytes(homeChainName_).length;
        if (length > 32) revert HomeChainNameTooLong(length);
        mediator = mediator_;
        _homeChainNameWord = bytes32(bytes(homeChainName_));
        _homeChainNameLength = length;
    }

    /// @notice The name of the chain where the native tokens of this factory live. The mediator adds it to the name of
    /// each copy. It is set in the constructor and nothing changes it.
    function homeChainName() external view returns (string memory) {
        bytes memory name = abi.encodePacked(_homeChainNameWord);
        uint256 length = _homeChainNameLength;
        assembly ("memory-safe") {
            mstore(name, length)
        }
        return string(name);
    }

    /// @notice Deploys the copy of `nativeToken`. It reverts when the copy exists.
    /// @dev This is the OmniBridge signature `deploy(string,string,uint8,uint256)` with one more argument. A
    /// deterministic address needs the native token, and OmniBridge does not pass it. Its `chainId` argument is the
    /// chain of the permit domain. Here `chainId` is the home chain of the native token, which is the other half of
    /// the salt. The token reads `block.chainid` for its own permit domain.
    /// @param name The name of the copy.
    /// @param symbol The symbol of the copy.
    /// @param decimals The decimals of the copy.
    /// @param chainId The home chain of the native token.
    /// @param nativeToken The native token, on the home chain.
    /// @return token The address of the copy.
    function deploy(string calldata name, string calldata symbol, uint8 decimals, uint256 chainId, address nativeToken)
        external
        returns (address token)
    {
        if (msg.sender != mediator) revert NotMediator(msg.sender);
        _pending = Parameters(name, symbol, decimals);
        token = address(new BridgedToken{salt: _salt(chainId, nativeToken)}());
        delete _pending;
    }

    /// @notice The address where the copy of `nativeToken` is, or will be, deployed.
    /// @param chainId The home chain of the native token.
    /// @param nativeToken The native token, on the home chain.
    function predictAddress(uint256 chainId, address nativeToken) external view returns (address) {
        bytes32 hash = keccak256(
            abi.encodePacked(
                bytes1(0xff), address(this), _salt(chainId, nativeToken), keccak256(type(BridgedToken).creationCode)
            )
        );
        return address(uint160(uint256(hash)));
    }

    /// @inheritdoc ITokenParameters
    function parameters() external view returns (string memory, string memory, uint8, address) {
        return (_pending.name, _pending.symbol, _pending.decimals, mediator);
    }

    function _salt(uint256 chainId, address nativeToken) private pure returns (bytes32) {
        return keccak256(abi.encode(chainId, nativeToken));
    }
}
        

lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * Both values are immutable: they can only be set once during construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /// @inheritdoc IERC20
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /// @inheritdoc IERC20
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /// @inheritdoc IERC20
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation sets the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the `transferFrom` operation can force the flag to
     * true using the following override:
     *
     * ```solidity
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner`'s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance < type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}
          

lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also applies here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
          

lib/openzeppelin-contracts/contracts/utils/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;
    }
}
          

lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (interfaces/draft-IERC6093.sol)

pragma solidity >=0.8.4;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-721.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
          

src/hardened/mediator/BridgedToken.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
import {IERC677} from "./IERC677.sol";
import {IBurnableMintableERC677Token} from "./IBurnableMintableERC677Token.sol";
import {ITokenParameters} from "./ITokenParameters.sol";

/// @title BridgedToken
/// @notice The copy of a native token on the chain that the native token does not live on. It is an ERC-20 with the
/// transfer callback of ERC-677 (`transferAndCall`), the allowance helpers of OmniBridge, and `permit`.
/// @dev The mediator is the only account that can mint and burn. The token has no owner and no upgrade path. The
/// constructor takes no arguments: it reads name, symbol, decimals and mediator from the factory that deploys it
/// (`ITokenParameters`), so the address of a copy depends on the home chain and the native token only. The permit
/// domain uses the token name and the version `"1"`, as OmniBridge does. The permit code is written here and not taken
/// from the OpenZeppelin extension, because that extension imports a library that needs the `mcopy` instruction, which
/// the Shanghai target of this repository does not have.
contract BridgedToken is ERC20, IERC20Permit, IBurnableMintableERC677Token {
    /// @notice Only the mediator may call the function.
    error NotMediator(address caller);
    /// @notice The receiver of `transferAndCall` is a contract and its `onTokenTransfer` call failed.
    error TransferCallFailed(address receiver);
    /// @notice The permit deadline has passed.
    error PermitExpired(uint256 deadline);
    /// @notice The permit signature does not come from the owner.
    error PermitSignerInvalid(address signer, address owner);

    bytes32 private constant DOMAIN_TYPEHASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
    bytes32 private constant PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32 private constant VERSION_HASH = keccak256("1");
    /// @dev The upper bound of `s` that rejects the malleable twin of a signature.
    uint256 private constant HALF_CURVE_ORDER = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;

    mapping(address owner => uint256) public nonces;

    /// @notice The mediator, as OmniBridge names the bridge contract of a bridged token.
    address public immutable bridgeContract;
    uint8 private immutable _tokenDecimals;

    constructor() ERC20(_nameFromFactory(), _symbolFromFactory()) {
        (,, uint8 tokenDecimals, address mediator) = ITokenParameters(msg.sender).parameters();
        _tokenDecimals = tokenDecimals;
        bridgeContract = mediator;
    }

    modifier onlyMediator() {
        if (msg.sender != bridgeContract) revert NotMediator(msg.sender);
        _;
    }

    /// @inheritdoc ERC20
    function decimals() public view override returns (uint8) {
        return _tokenDecimals;
    }

    /// @inheritdoc IERC20Permit
    function DOMAIN_SEPARATOR() public view returns (bytes32) {
        return
            keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), VERSION_HASH, block.chainid, address(this)));
    }

    /// @inheritdoc IERC20Permit
    function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
        external
    {
        if (block.timestamp > deadline) revert PermitExpired(deadline);
        bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR(), structHash));
        address signer = uint256(s) > HALF_CURVE_ORDER ? address(0) : ecrecover(digest, v, r, s);
        if (signer == address(0) || signer != owner) revert PermitSignerInvalid(signer, owner);
        _approve(owner, spender, value);
    }

    /// @notice Mints tokens. Only the mediator may call it.
    function mint(address to, uint256 amount) external onlyMediator returns (bool) {
        _mint(to, amount);
        return true;
    }

    /// @notice Burns tokens of the caller. Only the mediator may call it, and it burns its own balance.
    function burn(uint256 value) external onlyMediator {
        _burn(msg.sender, value);
    }

    /// @inheritdoc IERC677
    /// @dev Moves the tokens, emits the data event, and then calls `onTokenTransfer(sender, value, data)` on a
    /// receiver that has code. A receiver whose call fails undoes the transfer.
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool) {
        _transfer(msg.sender, to, value);
        emit Transfer(msg.sender, to, value, data);
        if (to.code.length == 0) return true;
        (bool ok,) = to.call(abi.encodeWithSignature("onTokenTransfer(address,uint256,bytes)", msg.sender, value, data));
        if (!ok) revert TransferCallFailed(to);
        return true;
    }

    /// @inheritdoc IERC677
    function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
        _approve(msg.sender, spender, allowance(msg.sender, spender) + addedValue);
        return true;
    }

    /// @inheritdoc IERC677
    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
        uint256 current = allowance(msg.sender, spender);
        if (subtractedValue > current) revert ERC20InsufficientAllowance(spender, current, subtractedValue);
        _approve(msg.sender, spender, current - subtractedValue);
        return true;
    }

    function _nameFromFactory() private view returns (string memory name) {
        (name,,,) = ITokenParameters(msg.sender).parameters();
    }

    function _symbolFromFactory() private view returns (string memory symbol) {
        (, symbol,,) = ITokenParameters(msg.sender).parameters();
    }
}
          

src/hardened/mediator/ITokenParameters.sol

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

/// @title ITokenParameters
/// @notice The factory exposes the parameters of the token that it is deploying. The token reads them in its
/// constructor. So the creation code of a bridged token has no arguments, and its address depends on the factory and
/// the salt only.
interface ITokenParameters {
    /// @return name The token name.
    /// @return symbol The token symbol.
    /// @return decimals The token decimals.
    /// @return mediator The mediator that may mint and burn the token.
    function parameters()
        external
        view
        returns (string memory name, string memory symbol, uint8 decimals, address mediator);
}
          

src/hardened/mediator/IERC677.sol

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

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/// @title IERC677
/// @notice A token that calls the receiver after a transfer (`transferAndCall`), with the allowance helpers of
/// OmniBridge (`omni/omnibridge`, `contracts/interfaces/IERC677.sol`).
interface IERC677 is IERC20 {
    /// @notice Emitted by `transferAndCall` in addition to the standard `Transfer`.
    event Transfer(address indexed from, address indexed to, uint256 value, bytes data);

    /// @notice Moves tokens, then calls `onTokenTransfer(msg.sender, value, data)` on `to` when `to` is a contract.
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /// @notice Raises the allowance of `spender`.
    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);

    /// @notice Lowers the allowance of `spender`.
    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
}
          

src/hardened/mediator/IBurnableMintableERC677Token.sol

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

import {IERC677} from "./IERC677.sol";

/// @title IBurnableMintableERC677Token
/// @notice The bridged token interface of OmniBridge without `claimTokens`, which is an owner function.
interface IBurnableMintableERC677Token is IERC677 {
    /// @notice Mints tokens. Only the mediator may call it.
    function mint(address to, uint256 amount) external returns (bool);

    /// @notice Burns tokens of the caller. Only the mediator may call it.
    function burn(uint256 value) external;
}
          

lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
          

lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity >=0.6.2;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
          

Compiler Settings

{"viaIR":false,"remappings":["@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","forge-std/=lib/forge-std/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"none","appendCBOR":false},"libraries":{},"evmVersion":"shanghai"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"mediator_","internalType":"address"},{"type":"string","name":"homeChainName_","internalType":"string"}]},{"type":"error","name":"HomeChainNameTooLong","inputs":[{"type":"uint256","name":"length","internalType":"uint256"}]},{"type":"error","name":"NotMediator","inputs":[{"type":"address","name":"caller","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"token","internalType":"address"}],"name":"deploy","inputs":[{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"},{"type":"uint8","name":"decimals","internalType":"uint8"},{"type":"uint256","name":"chainId","internalType":"uint256"},{"type":"address","name":"nativeToken","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"homeChainName","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"mediator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"},{"type":"string","name":"","internalType":"string"},{"type":"uint8","name":"","internalType":"uint8"},{"type":"address","name":"","internalType":"address"}],"name":"parameters","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"predictAddress","inputs":[{"type":"uint256","name":"chainId","internalType":"uint256"},{"type":"address","name":"nativeToken","internalType":"address"}]}]
              

Contract Creation Code

0x60e060405234801561000f575f5ffd5b50604051611e3a380380611e3a83398101604081905261002e91610091565b805160208111156100595760405163a63274c960e01b81526004810182905260240160405180910390fd5b6001600160a01b03831660805261006f82610175565b60a05260c0525061019b9050565b634e487b7160e01b5f52604160045260245ffd5b5f5f604083850312156100a2575f5ffd5b82516001600160a01b03811681146100b8575f5ffd5b60208401519092506001600160401b038111156100d3575f5ffd5b8301601f810185136100e3575f5ffd5b80516001600160401b038111156100fc576100fc61007d565b604051601f8201601f19908116603f011681016001600160401b038111828210171561012a5761012a61007d565b604052818152828201602001871015610141575f5ffd5b5f5b8281101561015f57602081850181015183830182015201610143565b505f602083830101528093505050509250929050565b80516020808301519190811015610195575f198160200360031b1b821691505b50919050565b60805160a05160c051611c686101d25f395f6104b001525f61047601525f8181605e015281816101b001526102fd0152611c685ff3fe608060405234801561000f575f5ffd5b5060043610610055575f3560e01c80636d0501f6146100595780637e25131e1461009d57806389035730146100b0578063cd94779f146100c8578063d820ce8b146100db575b5f5ffd5b6100807f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100806100ab366004610595565b6100f0565b6100b8610197565b6040516100949493929190610602565b6100806100d6366004610690565b6102f1565b6100e3610471565b604051610094919061072f565b5f806001600160f81b03193061010686866104d7565b6040516101156020820161051b565b6020820181038252601f19601f820116604052508051906020012060405160200161017794939291906001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60408051808303601f190181529190528051602090910120949350505050565b6002545f80546060928392918291829160019160ff16907f00000000000000000000000000000000000000000000000000000000000000009084906101db90610748565b80601f016020809104026020016040519081016040528092919081815260200182805461020790610748565b80156102525780601f1061022957610100808354040283529160200191610252565b820191905f5260205f20905b81548152906001019060200180831161023557829003601f168201915b5050505050935082805461026590610748565b80601f016020809104026020016040519081016040528092919081815260200182805461029190610748565b80156102dc5780601f106102b3576101008083540402835291602001916102dc565b820191905f5260205f20905b8154815290600101906020018083116102bf57829003601f168201915b50505050509250935093509350935090919293565b5f336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103415760405163460f964960e11b815233600482015260240160405180910390fd5b604051806060016040528089898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505090825250604080516020601f8a01819004810282018101909252888152918101919089908990819084018382808284375f92018290525093855250505060ff8716602090920191909152815181906103d890826107e0565b50602082015160018201906103ed90826107e0565b50604091909101516002909101805460ff191660ff90921691909117905561041583836104d7565b6040516104219061051b565b8190604051809103905ff590508015801561043e573d5f5f3e3d5ffd5b5090505f8061044d8180610528565b61045a600183015f610528565b50600201805460ff19169055979650505050505050565b60605f7f00000000000000000000000000000000000000000000000000000000000000006040516020016104a791815260200190565b604080519190527f0000000000000000000000000000000000000000000000000000000000000000815292915050565b5f82826040516020016104fd9291909182526001600160a01b0316602082015260400190565b60405160208183030381529060405280519060200120905092915050565b6113cc8061089c83390190565b50805461053490610748565b5f825580601f10610543575050565b601f0160209004905f5260205f209081019061055f9190610562565b50565b5b80821115610576575f8155600101610563565b5090565b80356001600160a01b0381168114610590575f5ffd5b919050565b5f5f604083850312156105a6575f5ffd5b823591506105b66020840161057a565b90509250929050565b5f81518084525f5b818110156105e3576020818501810151868301820152016105c7565b505f602082860101526020601f19601f83011685010191505092915050565b608081525f61061460808301876105bf565b828103602084015261062681876105bf565b60ff95909516604084015250506001600160a01b039190911660609091015292915050565b5f5f83601f84011261065b575f5ffd5b50813567ffffffffffffffff811115610672575f5ffd5b602083019150836020828501011115610689575f5ffd5b9250929050565b5f5f5f5f5f5f5f60a0888a0312156106a6575f5ffd5b873567ffffffffffffffff8111156106bc575f5ffd5b6106c88a828b0161064b565b909850965050602088013567ffffffffffffffff8111156106e7575f5ffd5b6106f38a828b0161064b565b909650945050604088013560ff8116811461070c575f5ffd5b9250606088013591506107216080890161057a565b905092959891949750929550565b602081525f61074160208301846105bf565b9392505050565b600181811c9082168061075c57607f821691505b60208210810361077a57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52604160045260245ffd5b601f8211156107db57805f5260205f20601f840160051c810160208510156107b95750805b601f840160051c820191505b818110156107d8575f81556001016107c5565b50505b505050565b815167ffffffffffffffff8111156107fa576107fa610780565b61080e816108088454610748565b84610794565b6020601f821160018114610840575f83156108295750848201515b5f19600385901b1c1916600184901b1784556107d8565b5f84815260208120601f198516915b8281101561086f578785015182556020948501946001909201910161084f565b508482101561088c57868401515f19600387901b60f8161c191681555b50505050600190811b0190555056fe60c060405234801561000f575f5ffd5b506100186100be565b61002061012b565b600361002c8382610230565b5060046100398282610230565b5050505f5f336001600160a01b031663890357306040518163ffffffff1660e01b81526004015f60405180830381865afa158015610079573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526100a09190810190610388565b60ff90911660a0526001600160a01b03166080525061042292505050565b6060336001600160a01b031663890357306040518163ffffffff1660e01b81526004015f60405180830381865afa1580156100fb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526101229190810190610388565b50919392505050565b6060336001600160a01b031663890357306040518163ffffffff1660e01b81526004015f60405180830381865afa158015610168573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261018f9190810190610388565b50909392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806101c057607f821691505b6020821081036101de57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561022b57805f5260205f20601f840160051c810160208510156102095750805b601f840160051c820191505b81811015610228575f8155600101610215565b50505b505050565b81516001600160401b0381111561024957610249610198565b61025d8161025784546101ac565b846101e4565b6020601f82116001811461028f575f83156102785750848201515b5f19600385901b1c1916600184901b178455610228565b5f84815260208120601f198516915b828110156102be578785015182556020948501946001909201910161029e565b50848210156102db57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f82601f8301126102f9575f5ffd5b81516001600160401b0381111561031257610312610198565b604051601f8201601f19908116603f011681016001600160401b038111828210171561034057610340610198565b604052818152838201602001851015610357575f5ffd5b5f5b8281101561037557602081860181015183830182015201610359565b505f918101602001919091529392505050565b5f5f5f5f6080858703121561039b575f5ffd5b84516001600160401b038111156103b0575f5ffd5b6103bc878288016102ea565b602087015190955090506001600160401b038111156103d9575f5ffd5b6103e5878288016102ea565b935050604085015160ff811681146103fb575f5ffd5b60608601519092506001600160a01b0381168114610417575f5ffd5b939692955090935050565b60805160a051610f7b6104515f395f61018201525f818161027c015281816105ba015261060f0152610f7b5ff3fe608060405234801561000f575f5ffd5b5060043610610111575f3560e01c806342966c681161009e578063a457c2d71161006e578063a457c2d714610251578063a9059cbb14610264578063cd59658314610277578063d505accf146102b6578063dd62ed3e146102c9575f5ffd5b806342966c68146101ed57806370a08231146102025780637ecebe001461022a57806395d89b4114610249575f5ffd5b8063313ce567116100e4578063313ce5671461017b5780633644e515146101ac57806339509351146101b45780634000aea0146101c757806340c10f19146101da575f5ffd5b806306fdde0314610115578063095ea7b31461013357806318160ddd1461015657806323b872dd14610168575b5f5ffd5b61011d6102dc565b60405161012a9190610c54565b60405180910390f35b610146610141366004610ca1565b61036c565b604051901515815260200161012a565b6002545b60405190815260200161012a565b610146610176366004610cc9565b610385565b60405160ff7f000000000000000000000000000000000000000000000000000000000000000016815260200161012a565b61015a6103a8565b6101466101c2366004610ca1565b61043c565b6101466101d5366004610d03565b610465565b6101466101e8366004610ca1565b6105ae565b6102006101fb366004610d86565b610604565b005b61015a610210366004610d9d565b6001600160a01b03165f9081526020819052604090205490565b61015a610238366004610d9d565b60056020525f908152604090205481565b61011d61065c565b61014661025f366004610ca1565b61066b565b610146610272366004610ca1565b6106c2565b61029e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161012a565b6102006102c4366004610dbd565b6106cf565b61015a6102d7366004610e2a565b6108d1565b6060600380546102eb90610e5b565b80601f016020809104026020016040519081016040528092919081815260200182805461031790610e5b565b80156103625780601f1061033957610100808354040283529160200191610362565b820191905f5260205f20905b81548152906001019060200180831161034557829003601f168201915b5050505050905090565b5f336103798185856108fb565b60019150505b92915050565b5f3361039285828561090d565b61039d858585610971565b506001949350505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6103d26102dc565b80516020918201206040805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b5f61045c33848461044d33886108d1565b6104579190610ea7565b6108fb565b50600192915050565b5f610471338686610971565b846001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168686866040516104b893929190610ee2565b60405180910390a3846001600160a01b03163b5f036104d9575060016105a6565b5f856001600160a01b0316338686866040516024016104fb9493929190610f04565b60408051601f198184030181529181526020820180516001600160e01b0316635260769b60e11b179052516105309190610f35565b5f604051808303815f865af19150503d805f8114610569576040519150601f19603f3d011682016040523d82523d5f602084013e61056e565b606091505b50509050806105a05760405163f4268e2360e01b81526001600160a01b03871660048201526024015b60405180910390fd5b60019150505b949350505050565b5f336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105fa5760405163460f964960e11b8152336004820152602401610597565b61045c83836109ce565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461064f5760405163460f964960e11b8152336004820152602401610597565b6106593382610a06565b50565b6060600480546102eb90610e5b565b5f5f61067733856108d1565b9050808311156106b357604051637dc7a0d960e11b81526001600160a01b03851660048201526024810182905260448101849052606401610597565b61037933856104578685610f50565b5f33610379818585610971565b834211156106f357604051639e96b26f60e01b815260048101859052602401610597565b6001600160a01b0387165f90815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a91908661073f83610f63565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f61079c6103a8565b60405161190160f01b60208201526022810191909152604281018390526062016040516020818303038152906040528051906020012090505f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0845f1c1161085d57604080515f81526020810180835284905260ff881691810191909152606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561084e573d5f5f3e3d5ffd5b5050506020604051035161085f565b5f5b90506001600160a01b03811615806108895750896001600160a01b0316816001600160a01b031614155b156108ba57604051630ce9b8df60e41b81526001600160a01b0380831660048301528b166024820152604401610597565b6108c58a8a8a6108fb565b50505050505050505050565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6109088383836001610a3a565b505050565b5f61091884846108d1565b90505f1981101561096b578181101561095d57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610597565b61096b84848484035f610a3a565b50505050565b6001600160a01b03831661099a57604051634b637e8f60e11b81525f6004820152602401610597565b6001600160a01b0382166109c35760405163ec442f0560e01b81525f6004820152602401610597565b610908838383610b0c565b6001600160a01b0382166109f75760405163ec442f0560e01b81525f6004820152602401610597565b610a025f8383610b0c565b5050565b6001600160a01b038216610a2f57604051634b637e8f60e11b81525f6004820152602401610597565b610a02825f83610b0c565b6001600160a01b038416610a635760405163e602df0560e01b81525f6004820152602401610597565b6001600160a01b038316610a8c57604051634a1406b160e11b81525f6004820152602401610597565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561096b57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610afe91815260200190565b60405180910390a350505050565b6001600160a01b038316610b36578060025f828254610b2b9190610ea7565b90915550610ba69050565b6001600160a01b0383165f9081526020819052604090205481811015610b885760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610597565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216610bc257600280548290039055610be0565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610c2591815260200190565b60405180910390a3505050565b5f5b83811015610c4c578181015183820152602001610c34565b50505f910152565b602081525f8251806020840152610c72816040850160208701610c32565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114610c9c575f5ffd5b919050565b5f5f60408385031215610cb2575f5ffd5b610cbb83610c86565b946020939093013593505050565b5f5f5f60608486031215610cdb575f5ffd5b610ce484610c86565b9250610cf260208501610c86565b929592945050506040919091013590565b5f5f5f5f60608587031215610d16575f5ffd5b610d1f85610c86565b935060208501359250604085013567ffffffffffffffff811115610d41575f5ffd5b8501601f81018713610d51575f5ffd5b803567ffffffffffffffff811115610d67575f5ffd5b876020828401011115610d78575f5ffd5b949793965060200194505050565b5f60208284031215610d96575f5ffd5b5035919050565b5f60208284031215610dad575f5ffd5b610db682610c86565b9392505050565b5f5f5f5f5f5f5f60e0888a031215610dd3575f5ffd5b610ddc88610c86565b9650610dea60208901610c86565b95506040880135945060608801359350608088013560ff81168114610e0d575f5ffd5b9699959850939692959460a0840135945060c09093013592915050565b5f5f60408385031215610e3b575f5ffd5b610e4483610c86565b9150610e5260208401610c86565b90509250929050565b600181811c90821680610e6f57607f821691505b602082108103610e8d57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561037f5761037f610e93565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b838152604060208201525f610efb604083018486610eba565b95945050505050565b60018060a01b0385168152836020820152606060408201525f610f2b606083018486610eba565b9695505050505050565b5f8251610f46818460208701610c32565b9190910192915050565b8181038181111561037f5761037f610e93565b5f60018201610f7457610f74610e93565b5060010190560000000000000000000000001d04a3b144fb7c0392f1d5459134af87063513ea000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000075365706f6c696100000000000000000000000000000000000000000000000000

Deployed ByteCode

0x608060405234801561000f575f5ffd5b5060043610610055575f3560e01c80636d0501f6146100595780637e25131e1461009d57806389035730146100b0578063cd94779f146100c8578063d820ce8b146100db575b5f5ffd5b6100807f0000000000000000000000001d04a3b144fb7c0392f1d5459134af87063513ea81565b6040516001600160a01b0390911681526020015b60405180910390f35b6100806100ab366004610595565b6100f0565b6100b8610197565b6040516100949493929190610602565b6100806100d6366004610690565b6102f1565b6100e3610471565b604051610094919061072f565b5f806001600160f81b03193061010686866104d7565b6040516101156020820161051b565b6020820181038252601f19601f820116604052508051906020012060405160200161017794939291906001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60408051808303601f190181529190528051602090910120949350505050565b6002545f80546060928392918291829160019160ff16907f0000000000000000000000001d04a3b144fb7c0392f1d5459134af87063513ea9084906101db90610748565b80601f016020809104026020016040519081016040528092919081815260200182805461020790610748565b80156102525780601f1061022957610100808354040283529160200191610252565b820191905f5260205f20905b81548152906001019060200180831161023557829003601f168201915b5050505050935082805461026590610748565b80601f016020809104026020016040519081016040528092919081815260200182805461029190610748565b80156102dc5780601f106102b3576101008083540402835291602001916102dc565b820191905f5260205f20905b8154815290600101906020018083116102bf57829003601f168201915b50505050509250935093509350935090919293565b5f336001600160a01b037f0000000000000000000000001d04a3b144fb7c0392f1d5459134af87063513ea16146103415760405163460f964960e11b815233600482015260240160405180910390fd5b604051806060016040528089898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505090825250604080516020601f8a01819004810282018101909252888152918101919089908990819084018382808284375f92018290525093855250505060ff8716602090920191909152815181906103d890826107e0565b50602082015160018201906103ed90826107e0565b50604091909101516002909101805460ff191660ff90921691909117905561041583836104d7565b6040516104219061051b565b8190604051809103905ff590508015801561043e573d5f5f3e3d5ffd5b5090505f8061044d8180610528565b61045a600183015f610528565b50600201805460ff19169055979650505050505050565b60605f7f5365706f6c6961000000000000000000000000000000000000000000000000006040516020016104a791815260200190565b604080519190527f0000000000000000000000000000000000000000000000000000000000000007815292915050565b5f82826040516020016104fd9291909182526001600160a01b0316602082015260400190565b60405160208183030381529060405280519060200120905092915050565b6113cc8061089c83390190565b50805461053490610748565b5f825580601f10610543575050565b601f0160209004905f5260205f209081019061055f9190610562565b50565b5b80821115610576575f8155600101610563565b5090565b80356001600160a01b0381168114610590575f5ffd5b919050565b5f5f604083850312156105a6575f5ffd5b823591506105b66020840161057a565b90509250929050565b5f81518084525f5b818110156105e3576020818501810151868301820152016105c7565b505f602082860101526020601f19601f83011685010191505092915050565b608081525f61061460808301876105bf565b828103602084015261062681876105bf565b60ff95909516604084015250506001600160a01b039190911660609091015292915050565b5f5f83601f84011261065b575f5ffd5b50813567ffffffffffffffff811115610672575f5ffd5b602083019150836020828501011115610689575f5ffd5b9250929050565b5f5f5f5f5f5f5f60a0888a0312156106a6575f5ffd5b873567ffffffffffffffff8111156106bc575f5ffd5b6106c88a828b0161064b565b909850965050602088013567ffffffffffffffff8111156106e7575f5ffd5b6106f38a828b0161064b565b909650945050604088013560ff8116811461070c575f5ffd5b9250606088013591506107216080890161057a565b905092959891949750929550565b602081525f61074160208301846105bf565b9392505050565b600181811c9082168061075c57607f821691505b60208210810361077a57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52604160045260245ffd5b601f8211156107db57805f5260205f20601f840160051c810160208510156107b95750805b601f840160051c820191505b818110156107d8575f81556001016107c5565b50505b505050565b815167ffffffffffffffff8111156107fa576107fa610780565b61080e816108088454610748565b84610794565b6020601f821160018114610840575f83156108295750848201515b5f19600385901b1c1916600184901b1784556107d8565b5f84815260208120601f198516915b8281101561086f578785015182556020948501946001909201910161084f565b508482101561088c57868401515f19600387901b60f8161c191681555b50505050600190811b0190555056fe60c060405234801561000f575f5ffd5b506100186100be565b61002061012b565b600361002c8382610230565b5060046100398282610230565b5050505f5f336001600160a01b031663890357306040518163ffffffff1660e01b81526004015f60405180830381865afa158015610079573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526100a09190810190610388565b60ff90911660a0526001600160a01b03166080525061042292505050565b6060336001600160a01b031663890357306040518163ffffffff1660e01b81526004015f60405180830381865afa1580156100fb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526101229190810190610388565b50919392505050565b6060336001600160a01b031663890357306040518163ffffffff1660e01b81526004015f60405180830381865afa158015610168573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261018f9190810190610388565b50909392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806101c057607f821691505b6020821081036101de57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561022b57805f5260205f20601f840160051c810160208510156102095750805b601f840160051c820191505b81811015610228575f8155600101610215565b50505b505050565b81516001600160401b0381111561024957610249610198565b61025d8161025784546101ac565b846101e4565b6020601f82116001811461028f575f83156102785750848201515b5f19600385901b1c1916600184901b178455610228565b5f84815260208120601f198516915b828110156102be578785015182556020948501946001909201910161029e565b50848210156102db57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f82601f8301126102f9575f5ffd5b81516001600160401b0381111561031257610312610198565b604051601f8201601f19908116603f011681016001600160401b038111828210171561034057610340610198565b604052818152838201602001851015610357575f5ffd5b5f5b8281101561037557602081860181015183830182015201610359565b505f918101602001919091529392505050565b5f5f5f5f6080858703121561039b575f5ffd5b84516001600160401b038111156103b0575f5ffd5b6103bc878288016102ea565b602087015190955090506001600160401b038111156103d9575f5ffd5b6103e5878288016102ea565b935050604085015160ff811681146103fb575f5ffd5b60608601519092506001600160a01b0381168114610417575f5ffd5b939692955090935050565b60805160a051610f7b6104515f395f61018201525f818161027c015281816105ba015261060f0152610f7b5ff3fe608060405234801561000f575f5ffd5b5060043610610111575f3560e01c806342966c681161009e578063a457c2d71161006e578063a457c2d714610251578063a9059cbb14610264578063cd59658314610277578063d505accf146102b6578063dd62ed3e146102c9575f5ffd5b806342966c68146101ed57806370a08231146102025780637ecebe001461022a57806395d89b4114610249575f5ffd5b8063313ce567116100e4578063313ce5671461017b5780633644e515146101ac57806339509351146101b45780634000aea0146101c757806340c10f19146101da575f5ffd5b806306fdde0314610115578063095ea7b31461013357806318160ddd1461015657806323b872dd14610168575b5f5ffd5b61011d6102dc565b60405161012a9190610c54565b60405180910390f35b610146610141366004610ca1565b61036c565b604051901515815260200161012a565b6002545b60405190815260200161012a565b610146610176366004610cc9565b610385565b60405160ff7f000000000000000000000000000000000000000000000000000000000000000016815260200161012a565b61015a6103a8565b6101466101c2366004610ca1565b61043c565b6101466101d5366004610d03565b610465565b6101466101e8366004610ca1565b6105ae565b6102006101fb366004610d86565b610604565b005b61015a610210366004610d9d565b6001600160a01b03165f9081526020819052604090205490565b61015a610238366004610d9d565b60056020525f908152604090205481565b61011d61065c565b61014661025f366004610ca1565b61066b565b610146610272366004610ca1565b6106c2565b61029e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161012a565b6102006102c4366004610dbd565b6106cf565b61015a6102d7366004610e2a565b6108d1565b6060600380546102eb90610e5b565b80601f016020809104026020016040519081016040528092919081815260200182805461031790610e5b565b80156103625780601f1061033957610100808354040283529160200191610362565b820191905f5260205f20905b81548152906001019060200180831161034557829003601f168201915b5050505050905090565b5f336103798185856108fb565b60019150505b92915050565b5f3361039285828561090d565b61039d858585610971565b506001949350505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6103d26102dc565b80516020918201206040805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b5f61045c33848461044d33886108d1565b6104579190610ea7565b6108fb565b50600192915050565b5f610471338686610971565b846001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168686866040516104b893929190610ee2565b60405180910390a3846001600160a01b03163b5f036104d9575060016105a6565b5f856001600160a01b0316338686866040516024016104fb9493929190610f04565b60408051601f198184030181529181526020820180516001600160e01b0316635260769b60e11b179052516105309190610f35565b5f604051808303815f865af19150503d805f8114610569576040519150601f19603f3d011682016040523d82523d5f602084013e61056e565b606091505b50509050806105a05760405163f4268e2360e01b81526001600160a01b03871660048201526024015b60405180910390fd5b60019150505b949350505050565b5f336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105fa5760405163460f964960e11b8152336004820152602401610597565b61045c83836109ce565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461064f5760405163460f964960e11b8152336004820152602401610597565b6106593382610a06565b50565b6060600480546102eb90610e5b565b5f5f61067733856108d1565b9050808311156106b357604051637dc7a0d960e11b81526001600160a01b03851660048201526024810182905260448101849052606401610597565b61037933856104578685610f50565b5f33610379818585610971565b834211156106f357604051639e96b26f60e01b815260048101859052602401610597565b6001600160a01b0387165f90815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a91908661073f83610f63565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f61079c6103a8565b60405161190160f01b60208201526022810191909152604281018390526062016040516020818303038152906040528051906020012090505f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0845f1c1161085d57604080515f81526020810180835284905260ff881691810191909152606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561084e573d5f5f3e3d5ffd5b5050506020604051035161085f565b5f5b90506001600160a01b03811615806108895750896001600160a01b0316816001600160a01b031614155b156108ba57604051630ce9b8df60e41b81526001600160a01b0380831660048301528b166024820152604401610597565b6108c58a8a8a6108fb565b50505050505050505050565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6109088383836001610a3a565b505050565b5f61091884846108d1565b90505f1981101561096b578181101561095d57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610597565b61096b84848484035f610a3a565b50505050565b6001600160a01b03831661099a57604051634b637e8f60e11b81525f6004820152602401610597565b6001600160a01b0382166109c35760405163ec442f0560e01b81525f6004820152602401610597565b610908838383610b0c565b6001600160a01b0382166109f75760405163ec442f0560e01b81525f6004820152602401610597565b610a025f8383610b0c565b5050565b6001600160a01b038216610a2f57604051634b637e8f60e11b81525f6004820152602401610597565b610a02825f83610b0c565b6001600160a01b038416610a635760405163e602df0560e01b81525f6004820152602401610597565b6001600160a01b038316610a8c57604051634a1406b160e11b81525f6004820152602401610597565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561096b57826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610afe91815260200190565b60405180910390a350505050565b6001600160a01b038316610b36578060025f828254610b2b9190610ea7565b90915550610ba69050565b6001600160a01b0383165f9081526020819052604090205481811015610b885760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610597565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b038216610bc257600280548290039055610be0565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610c2591815260200190565b60405180910390a3505050565b5f5b83811015610c4c578181015183820152602001610c34565b50505f910152565b602081525f8251806020840152610c72816040850160208701610c32565b601f01601f19169190910160400192915050565b80356001600160a01b0381168114610c9c575f5ffd5b919050565b5f5f60408385031215610cb2575f5ffd5b610cbb83610c86565b946020939093013593505050565b5f5f5f60608486031215610cdb575f5ffd5b610ce484610c86565b9250610cf260208501610c86565b929592945050506040919091013590565b5f5f5f5f60608587031215610d16575f5ffd5b610d1f85610c86565b935060208501359250604085013567ffffffffffffffff811115610d41575f5ffd5b8501601f81018713610d51575f5ffd5b803567ffffffffffffffff811115610d67575f5ffd5b876020828401011115610d78575f5ffd5b949793965060200194505050565b5f60208284031215610d96575f5ffd5b5035919050565b5f60208284031215610dad575f5ffd5b610db682610c86565b9392505050565b5f5f5f5f5f5f5f60e0888a031215610dd3575f5ffd5b610ddc88610c86565b9650610dea60208901610c86565b95506040880135945060608801359350608088013560ff81168114610e0d575f5ffd5b9699959850939692959460a0840135945060c09093013592915050565b5f5f60408385031215610e3b575f5ffd5b610e4483610c86565b9150610e5260208401610c86565b90509250929050565b600181811c90821680610e6f57607f821691505b602082108103610e8d57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561037f5761037f610e93565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b838152604060208201525f610efb604083018486610eba565b95945050505050565b60018060a01b0385168152836020820152606060408201525f610f2b606083018486610eba565b9695505050505050565b5f8251610f46818460208701610c32565b9190910192915050565b8181038181111561037f5761037f610e93565b5f60018201610f7457610f74610e93565b506001019056