ETH Price: $1,957.04 (+1.54%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit219743802025-03-04 15:20:23363 days ago1741101623IN
0x53D8bC32...F1A73EFaa
0.0003 ETH0.000677843.5930003
Deposit219688212025-03-03 20:43:23364 days ago1741034603IN
0x53D8bC32...F1A73EFaa
0.0003 ETH0.000954355.05864063
Deposit211851162024-11-14 9:43:23474 days ago1731577403IN
0x53D8bC32...F1A73EFaa
0.0003 ETH0.0047157222.91745774
Admin Change Fee190917422024-01-26 15:42:23766 days ago1706283743IN
0x53D8bC32...F1A73EFaa
0 ETH0.0007178824.42527895
Admin Set Resour...190470502024-01-20 9:02:11773 days ago1705741331IN
0x53D8bC32...F1A73EFaa
0 ETH0.0019500616.25463233

Latest 3 internal transactions

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer219743802025-03-04 15:20:23363 days ago1741101623
0x53D8bC32...F1A73EFaa
0.0003 ETH
Transfer219688212025-03-03 20:43:23364 days ago1741034603
0x53D8bC32...F1A73EFaa
0.0003 ETH
Transfer211851162024-11-14 9:43:23474 days ago1731577403
0x53D8bC32...F1A73EFaa
0.0003 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Contract Source Code Verified (Exact Match)

Contract Name:
BSPTBridge

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./utils/AccessControl.sol";
import "./interfaces/IDepositExecute.sol";
import "./interfaces/IERCHandler.sol";
import "./interfaces/IGenericHandler.sol";

/**
    @title Facilitates deposits, creation and voting of deposit proposals, and deposit executions.
    @author Stafi Protocol.
 */
contract BSPTBridge is Pausable, AccessControl {
    using SafeCast for *;

    // Limit relayers number because proposal can fit only so much votes
    uint256 constant public MAX_RELAYERS = 200;

    uint8 public immutable _chainID;
    uint40 public immutable _expiry;
    address payable immutable _feeRecipient;
    uint8 public _relayerThreshold;
    uint128 public _fee;

    enum ProposalStatus {Inactive, Active, Executed, Cancelled}

    struct Proposal {
        ProposalStatus _status;
        uint200 _yesVotes;      // bitmap, 200 maximum votes
        uint8 _yesVotesTotal;
        uint40 _proposedBlock; // 1099511627775 maximum block
    }

    // destinationChainID => number of deposits
    mapping(uint8 => uint64) public _depositCounts;

    // resourceID => handler address
    mapping(bytes32 => address) public _resourceIDToHandlerAddress;

    // destinationChainID + depositNonce => dataHash => Proposal
    mapping(uint72 => mapping(bytes32 => Proposal)) public _proposals;

    // original deposit ChainID => oldDepositNonce
    mapping(uint8 => uint64)  public _oldDepositNonce;

    event RelayerThresholdChanged(uint256 indexed newThreshold);

    event RelayerAdded(address indexed relayer);

    event RelayerRemoved(address indexed relayer);

    event Deposit(
        uint8 indexed destinationChainID,
        bytes32 indexed resourceID,
        uint64 indexed depositNonce
    );

    event ProposalEvent(
        uint8 indexed originChainID,
        uint64 indexed depositNonce,
        ProposalStatus indexed status,
        bytes32 dataHash
    );

    event ProposalVote(
        uint8 indexed originChainID,
        uint64 indexed depositNonce,
        ProposalStatus indexed status,
        bytes32 dataHash
    );

    bytes32 public constant RELAYER_ROLE = keccak256("RELAYER_ROLE");

    modifier onlyAdmin() {
        _onlyAdmin();
        _;
    }

    modifier onlyAdminOrRelayer() {
        _onlyAdminOrRelayer();
        _;
    }

    modifier onlyRelayers() {
        _onlyRelayers();
        _;
    }

    function _onlyAdminOrRelayer() private view {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(RELAYER_ROLE, msg.sender),
            "sender is not relayer or admin");
    }

    function _onlyAdmin() private view {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "sender doesn't have admin role");
    }

    function _onlyRelayers() private view {
        require(hasRole(RELAYER_ROLE, msg.sender), "sender doesn't have relayer role");
    }

    function _relayerBit(address relayer) private view returns (uint) {
        return uint(1) << (AccessControl.getRoleMemberIndex(RELAYER_ROLE, relayer));
    }

    function _hasVoted(Proposal memory proposal, address relayer) private view returns (bool) {
        return (_relayerBit(relayer) & uint(proposal._yesVotes)) > 0;
    }

    /**
        @notice Initializes Bridge, creates and grants {msg.sender} the admin role,
        creates and grants {initialRelayers} the relayer role.
        @param chainID ID of chain the Bridge contract exists on.
        @param initialRelayers Addresses that should be initially granted the relayer role.
        @param initialRelayerThreshold Number of votes needed for a deposit proposal to be considered passed.
     */
    constructor (address defaultAdmin, uint8 chainID, address[] memory initialRelayers, uint256 initialRelayerThreshold, uint256 fee, uint256 expiry, address feeRecipient) {
        _chainID = chainID;
        _relayerThreshold = initialRelayerThreshold.toUint8();
        _fee = fee.toUint128();
        _feeRecipient = payable(feeRecipient);
        _expiry = expiry.toUint40();

        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);

        uint256 initialRelayerCount = initialRelayers.length;
        for (uint256 i; i < initialRelayerCount; i++) {
            grantRole(RELAYER_ROLE, initialRelayers[i]);
        }
        _setupRole(DEFAULT_ADMIN_ROLE, defaultAdmin);
    }

    /**
        @notice Returns true if {relayer} has voted on {destNonce} {dataHash} proposal.
        @notice Naming left unchanged for backward compatibility.
        @param destNonce destinationChainID + depositNonce of the proposal.
        @param dataHash Hash of data to be provided when deposit proposal is executed.
        @param relayer Address to check.
     */
    function _hasVotedOnProposal(uint72 destNonce, bytes32 dataHash, address relayer) public view returns (bool) {
        return _hasVoted(_proposals[destNonce][dataHash], relayer);
    }

    /**
        @notice Returns true if {relayer} has the relayer role.
        @param relayer Address to check.
     */
    function isRelayer(address relayer) external view returns (bool) {
        return hasRole(RELAYER_ROLE, relayer);
    }

    /**
        @notice Removes admin role from {msg.sender} and grants it to {newAdmin}.
        @notice Only callable by an address that currently has the admin role.
        @param newAdmin Address that admin role will be granted to.
     */
    function renounceAdmin(address newAdmin) external onlyAdmin {
        require(msg.sender != newAdmin, 'Cannot renounce oneself');
        grantRole(DEFAULT_ADMIN_ROLE, newAdmin);
        renounceRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    /**
        @notice Pauses deposits, proposal creation and voting, and deposit executions.
        @notice Only callable by an address that currently has the admin role.
     */
    function adminPauseTransfers() external onlyAdmin {
        _pause();
    }

    /**
        @notice Unpauses deposits, proposal creation and voting, and deposit executions.
        @notice Only callable by an address that currently has the admin role.
     */
    function adminUnpauseTransfers() external onlyAdmin {
        _unpause();
    }

    /**
        @notice Modifies the number of votes required for a proposal to be considered passed.
        @notice Only callable by an address that currently has the admin role.
        @param newThreshold Value {_relayerThreshold} will be changed to.
        @notice Emits {RelayerThresholdChanged} event.
     */
    function adminChangeRelayerThreshold(uint256 newThreshold) external onlyAdmin {
        _relayerThreshold = newThreshold.toUint8();
        emit RelayerThresholdChanged(newThreshold);
    }

    function adminSetOldDepositNonce(uint8 chainId, uint64 oldDepositNonce) external onlyAdmin {
        _oldDepositNonce[chainId] = oldDepositNonce;
    }

    function adminSetDepositCount(uint8 chainId, uint64 depositCount) external onlyAdmin {
        _depositCounts[chainId] = depositCount;
    }

    function adminSetResourceAndBurnable(
        address handlerAddress,
        bytes32[] memory resourceIDs,
        address[] memory tokenContractAddresses,
        address[] memory burnablTokenContractAddresses) external onlyAdmin {

        uint256 resourceIDsLength = resourceIDs.length;
        uint256 burnableContractAddressesLength = burnablTokenContractAddresses.length;
        require(resourceIDsLength == tokenContractAddresses.length,
            "resourceIDs and tokenContractAddresses len mismatch");

        IERCHandler handler = IERCHandler(handlerAddress);

        for (uint256 i = 0; i < resourceIDsLength; i++) {
            _resourceIDToHandlerAddress[resourceIDs[i]] = handlerAddress;
            handler.setResource(resourceIDs[i], tokenContractAddresses[i]);
        }

        for (uint256 i = 0; i < burnableContractAddressesLength; i++) {
            handler.setBurnable(burnablTokenContractAddresses[i]);
        }
    }

    /**
        @notice Grants {relayerAddress} the relayer role.
        @notice Only callable by an address that currently has the admin role, which is
                checked in grantRole().
        @param relayerAddress Address of relayer to be added.
        @notice Emits {RelayerAdded} event.
     */
    function adminAddRelayer(address relayerAddress) external {
        require(!hasRole(RELAYER_ROLE, relayerAddress), "addr already has relayer role!");
        require(_totalRelayers() < MAX_RELAYERS, "relayers limit reached");
        grantRole(RELAYER_ROLE, relayerAddress);
        emit RelayerAdded(relayerAddress);
    }

    /**
        @notice Removes relayer role for {relayerAddress}.
        @notice Only callable by an address that currently has the admin role, which is
                checked in revokeRole().
        @param relayerAddress Address of relayer to be removed.
        @notice Emits {RelayerRemoved} event.
     */
    function adminRemoveRelayer(address relayerAddress) external {
        require(hasRole(RELAYER_ROLE, relayerAddress), "addr doesn't have relayer role!");
        revokeRole(RELAYER_ROLE, relayerAddress);
        emit RelayerRemoved(relayerAddress);
    }

    /**
        @notice Sets a new resource for handler contracts that use the IGenericHandler interface,
        and maps the {handlerAddress} to {resourceID} in {_resourceIDToHandlerAddress}.
        @notice Only callable by an address that currently has the admin role.
        @param handlerAddress Address of handler resource will be set for.
        @param resourceID ResourceID to be used when making deposits.
        @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
     */
    function adminSetGenericResource(
        address handlerAddress,
        bytes32 resourceID,
        address contractAddress,
        bytes4 depositFunctionSig,
        uint256 depositFunctionDepositerOffset,
        bytes4 executeFunctionSig
    ) external onlyAdmin {
        _resourceIDToHandlerAddress[resourceID] = handlerAddress;
        IGenericHandler handler = IGenericHandler(handlerAddress);
        handler.setResource(resourceID, contractAddress, depositFunctionSig, depositFunctionDepositerOffset, executeFunctionSig);
    }

    /**
        @notice Returns a proposal.
        @param originChainID Chain ID deposit originated from.
        @param depositNonce ID of proposal generated by proposal's origin Bridge contract.
        @param dataHash Hash of data to be provided when deposit proposal is executed.
        @return Proposal which consists of:
        - _dataHash Hash of data to be provided when deposit proposal is executed.
        - _yesVotes Number of votes in favor of proposal.
        - _noVotes Number of votes against proposal.
        - _status Current status of proposal.
     */
    function getProposal(uint8 originChainID, uint64 depositNonce, bytes32 dataHash) external view returns (Proposal memory) {
        uint72 nonceAndID = (uint72(depositNonce) << 8) | uint72(originChainID);
        return _proposals[nonceAndID][dataHash];
    }

    /**
        @notice Returns total relayers number.
        @notice Added for backwards compatibility.
     */
    function _totalRelayers() public view returns (uint) {
        return AccessControl.getRoleMemberCount(RELAYER_ROLE);
    }

    /**
        @notice Changes deposit fee.
        @notice Only callable by admin.
        @param newFee Value {_fee} will be updated to.
     */
    function adminChangeFee(uint256 newFee) external onlyAdmin {
        require(_fee != newFee, "Current fee is equal to new fee");
        _fee = newFee.toUint128();
    }

    /**
        @notice Used to manually withdraw funds from ERC safes.
        @param handlerAddress Address of handler to withdraw from.
        @param tokenAddress Address of token to withdraw.
        @param recipient Address to withdraw tokens to.
        @param amountOrTokenID Either the amount of ERC20 tokens or the ERC721 token ID to withdraw.
     */
    function adminWithdraw(
        address handlerAddress,
        address tokenAddress,
        address recipient,
        uint256 amountOrTokenID
    ) external onlyAdmin {
        IERCHandler handler = IERCHandler(handlerAddress);
        handler.withdraw(tokenAddress, recipient, amountOrTokenID);
    }

    /**
        @notice Initiates a transfer using a specified handler contract.
        @notice Only callable when Bridge is not paused.
        @param destinationChainID ID of chain deposit will be bridged to.
        @param resourceID ResourceID used to find address of handler to be used for deposit.
        @param data Additional data to be passed to specified handler.
        @notice Emits {Deposit} event.
     */
    function deposit(uint8 destinationChainID, bytes32 resourceID, bytes calldata data) external payable whenNotPaused {
        require(msg.value == _fee, "Incorrect fee supplied");
        require(destinationChainID != _chainID, "destinationChainID cannot be equal to chainID");

        // Transfer fee to _feeRecipient
        _feeRecipient.transfer(_fee);

        address handler = _resourceIDToHandlerAddress[resourceID];
        require(handler != address(0), "resourceID not mapped to handler");

        uint64 depositNonce = ++_depositCounts[destinationChainID];

        IDepositExecute depositHandler = IDepositExecute(handler);
        depositHandler.deposit(resourceID, destinationChainID, depositNonce, msg.sender, data);

        emit Deposit(destinationChainID, resourceID, depositNonce);
    }

    /**
        @notice When called, {msg.sender} will be marked as voting in favor of proposal.
        @notice Only callable by relayers when Bridge is not paused.
        @param chainID ID of chain deposit originated from.
        @param depositNonce ID of deposited generated by origin Bridge contract.
        @param data Data originally provided when deposit was made.
        @notice Proposal must not have already been passed or executed.
        @notice {msg.sender} must not have already voted on proposal.
        @notice Emits {ProposalEvent} event with status indicating the proposal status.
        @notice Emits {ProposalVote} event.
     */
    function voteProposal(uint8 chainID, uint64 depositNonce, bytes32 resourceID, bytes calldata data) external onlyRelayers whenNotPaused {
        address handler = _resourceIDToHandlerAddress[resourceID];
        bytes32 dataHash = keccak256(abi.encodePacked(handler, data));
        uint72 nonceAndID = (uint72(depositNonce) << 8) | uint72(chainID);
        Proposal memory proposal = _proposals[nonceAndID][dataHash];

        require(depositNonce > _oldDepositNonce[chainID], "depositNoce is old");
        require(handler != address(0), "no handler for resourceID");
        require(uint(proposal._status) <= 1, "proposal already executed/cancelled");
        require(!_hasVoted(proposal, msg.sender), "relayer already voted");

        if (proposal._status == ProposalStatus.Inactive) {
            proposal = Proposal({
                _status: ProposalStatus.Active,
                _yesVotes: 0,
                _yesVotesTotal: 0,
                _proposedBlock: uint40(block.number) // Overflow is desired.
            });
            emit ProposalEvent(chainID, depositNonce, ProposalStatus.Active, dataHash);
        } else if (uint40(block.number - proposal._proposedBlock) > _expiry) {
            // if the number of blocks that has passed since this proposal was
            // submitted exceeds the expiry threshold set, cancel the proposal
            proposal._status = ProposalStatus.Cancelled;
            emit ProposalEvent(chainID, depositNonce, ProposalStatus.Cancelled, dataHash);
        }

        if (proposal._status != ProposalStatus.Cancelled) {
            proposal._yesVotes = (proposal._yesVotes | _relayerBit(msg.sender)).toUint200();
            proposal._yesVotesTotal++; // TODO: check if bit counting is cheaper.
            emit ProposalVote(chainID, depositNonce, proposal._status, dataHash);

            // Finalize if _relayerThreshold has been reached
            if (proposal._yesVotesTotal >= _relayerThreshold) {
                proposal._status = ProposalStatus.Executed;

                IDepositExecute depositHandler = IDepositExecute(handler);
                depositHandler.executeProposal(resourceID, data);

                emit ProposalEvent(chainID, depositNonce, ProposalStatus.Executed, dataHash);
            }
        }
        _proposals[nonceAndID][dataHash] = proposal;

    }

    /**
        @notice Cancels a deposit proposal that has not been executed yet.
        @notice Only callable by relayers when Bridge is not paused.
        @param chainID ID of chain deposit originated from.
        @param depositNonce ID of deposited generated by origin Bridge contract.
        @param dataHash Hash of data originally provided when deposit was made.
        @notice Proposal must be past expiry threshold.
        @notice Emits {ProposalEvent} event with status {Cancelled}.
     */
    function cancelProposal(uint8 chainID, uint64 depositNonce, bytes32 dataHash) public onlyAdminOrRelayer {
        uint72 nonceAndID = (uint72(depositNonce) << 8) | uint72(chainID);
        Proposal memory proposal = _proposals[nonceAndID][dataHash];
        ProposalStatus currentStatus = proposal._status;

        require(currentStatus == ProposalStatus.Active,
            "Proposal cannot be cancelled");
        require(uint40(block.number - proposal._proposedBlock) > _expiry, "Proposal not at expiry threshold");

        proposal._status = ProposalStatus.Cancelled;
        _proposals[nonceAndID][dataHash] = proposal;
        emit ProposalEvent(chainID, depositNonce, ProposalStatus.Cancelled, dataHash);
    }

    /**
        @notice Transfers eth in the contract to the specified addresses. The parameters addrs and amounts are mapped 1-1.
        This means that the address at index 0 for addrs will receive the amount (in WEI) from amounts at index 0.
        @param addrs Array of addresses to transfer {amounts} to.
        @param amounts Array of amonuts to transfer to {addrs}.
     */
    function transferFunds(address payable[] calldata addrs, uint[] calldata amounts) external onlyAdmin {
        uint256 addrCount = addrs.length;
        for (uint256 i = 0; i < addrCount; i++) {
            addrs[i].transfer(amounts[i]);
        }
    }

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (metatx/ERC2771Context.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Context variant with ERC2771 support.
 *
 * WARNING: Avoid using this pattern in contracts that rely in a specific calldata length as they'll
 * be affected by any forwarder whose `msg.data` is suffixed with the `from` address according to the ERC2771
 * specification adding the address size in bytes (20) to the calldata size. An example of an unexpected
 * behavior could be an unintended fallback (or another function) invocation while trying to invoke the `receive`
 * function only accessible if `msg.data.length == 0`.
 */
abstract contract ERC2771Context is Context {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable _trustedForwarder;

    /**
     * @dev Initializes the contract with a trusted forwarder, which will be able to
     * invoke functions on this contract on behalf of other accounts.
     *
     * NOTE: The trusted forwarder can be replaced by overriding {trustedForwarder}.
     */
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(address trustedForwarder_) {
        _trustedForwarder = trustedForwarder_;
    }

    /**
     * @dev Returns the address of the trusted forwarder.
     */
    function trustedForwarder() public view virtual returns (address) {
        return _trustedForwarder;
    }

    /**
     * @dev Indicates whether any particular address is the trusted forwarder.
     */
    function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
        return forwarder == trustedForwarder();
    }

    /**
     * @dev Override for `msg.sender`. Defaults to the original `msg.sender` whenever
     * a call is not performed by the trusted forwarder or the calldata length is less than
     * 20 bytes (an address length).
     */
    function _msgSender() internal view virtual override returns (address sender) {
        if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {
            // The assembly code is more direct than the Solidity version using `abi.decode`.
            /// @solidity memory-safe-assembly
            assembly {
                sender := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            return super._msgSender();
        }
    }

    /**
     * @dev Override for `msg.data`. Defaults to the original `msg.data` whenever
     * a call is not performed by the trusted forwarder or the calldata length is less than
     * 20 bytes (an address length).
     */
    function _msgData() internal view virtual override returns (bytes calldata) {
        if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {
            return msg.data[:msg.data.length - 20];
        } else {
            return super._msgData();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (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;
    }
}

File 5 of 11 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position is the index of the value in the `values` array plus 1.
        // Position 0 is used to mean a value is not in the set.
        mapping(bytes32 value => uint256) _positions;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._positions[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We cache the value's position to prevent multiple reads from the same storage slot
        uint256 position = set._positions[value];

        if (position != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 valueIndex = position - 1;
            uint256 lastIndex = set._values.length - 1;

            if (valueIndex != lastIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._positions[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

/**
    @title Interface for handler contracts that support deposits and deposit executions.
    @author Stafi Protocol.
 */
interface IDepositExecute {
    /**
        @notice It is intended that deposit are made using the Bridge contract.
        @param destinationChainID Chain ID deposit is expected to be bridged to.
        @param depositNonce This value is generated as an ID by the Bridge contract.
        @param depositer Address of account making the deposit in the Bridge contract.
        @param data Consists of additional data needed for a specific deposit.
     */
    function deposit(bytes32 resourceID, uint8 destinationChainID, uint64 depositNonce, address depositer, bytes calldata data) external;

    /**
        @notice It is intended that proposals are executed by the Bridge contract.
        @param data Consists of additional data needed for a specific deposit execution.
     */
    function executeProposal(bytes32 resourceID, bytes calldata data) external;
}

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

/**
    @title Interface to be used with handlers that support ERC20s and ERC721s.
    @author Stafi Protocol.
 */
interface IERCHandler {
    /**
        @notice Correlates {resourceID} with {contractAddress}.
        @param resourceID ResourceID to be used when making deposits.
        @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
     */
    function setResource(bytes32 resourceID, address contractAddress) external;
    /**
        @notice Marks {contractAddress} as mintable/burnable.
        @param contractAddress Address of contract to be used when making or executing deposits.
     */
    function setBurnable(address contractAddress) external;
    /**
        @notice Used to manually release funds from ERC safes.
        @param tokenAddress Address of token contract to release.
        @param recipient Address to release tokens to.
        @param amountOrTokenID Either the amount of ERC20 tokens or the ERC721 token ID to release.
     */
    function withdraw(address tokenAddress, address recipient, uint256 amountOrTokenID) external;
}

File 10 of 11 : IGenericHandler.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.20;

/**
    @title Interface for handler that handles generic deposits and deposit executions.
    @author Stafi Protocol.
 */
interface IGenericHandler {
    /**
        @notice Correlates {resourceID} with {contractAddress}, {depositFunctionSig}, and {executeFunctionSig}.
        @param resourceID ResourceID to be used when making deposits.
        @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
        @param depositFunctionSig Function signature of method to be called in {contractAddress} when a deposit is made.
        @param depositFunctionDepositerOffset Depositer address position offset in the metadata, in bytes.
        @param executeFunctionSig Function signature of method to be called in {contractAddress} when a deposit is executed.
     */
    function setResource(
        bytes32 resourceID,
        address contractAddress,
        bytes4 depositFunctionSig,
        uint256 depositFunctionDepositerOffset,
        bytes4 executeFunctionSig) external;
}

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

// This is adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/access/AccessControl.sol
// The only difference is added getRoleMemberIndex(bytes32 role, address account) function.

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/metatx/ERC2771Context.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the index of the account that have `role`.
     */
    function getRoleMemberIndex(bytes32 role, address account) public view returns (uint256) {
        uint256 memberCount = getRoleMemberCount(role);
        for (uint256 i = 0; i < memberCount; i++) {
            if (getRoleMember(role, i) == account) {
                return i;
            }
        }

        return memberCount;
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"defaultAdmin","type":"address"},{"internalType":"uint8","name":"chainID","type":"uint8"},{"internalType":"address[]","name":"initialRelayers","type":"address[]"},{"internalType":"uint256","name":"initialRelayerThreshold","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"destinationChainID","type":"uint8"},{"indexed":true,"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"indexed":true,"internalType":"uint64","name":"depositNonce","type":"uint64"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"originChainID","type":"uint8"},{"indexed":true,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":true,"internalType":"enum BSPTBridge.ProposalStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"ProposalEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"originChainID","type":"uint8"},{"indexed":true,"internalType":"uint64","name":"depositNonce","type":"uint64"},{"indexed":true,"internalType":"enum BSPTBridge.ProposalStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"ProposalVote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"RelayerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"RelayerThresholdChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_RELAYERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_chainID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"_depositCounts","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_expiry","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_fee","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint72","name":"destNonce","type":"uint72"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"_hasVotedOnProposal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"_oldDepositNonce","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint72","name":"","type":"uint72"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_proposals","outputs":[{"internalType":"enum BSPTBridge.ProposalStatus","name":"_status","type":"uint8"},{"internalType":"uint200","name":"_yesVotes","type":"uint200"},{"internalType":"uint8","name":"_yesVotesTotal","type":"uint8"},{"internalType":"uint40","name":"_proposedBlock","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_relayerThreshold","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"_resourceIDToHandlerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalRelayers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayerAddress","type":"address"}],"name":"adminAddRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"adminChangeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"adminChangeRelayerThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminPauseTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"relayerAddress","type":"address"}],"name":"adminRemoveRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"chainId","type":"uint8"},{"internalType":"uint64","name":"depositCount","type":"uint64"}],"name":"adminSetDepositCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bytes4","name":"depositFunctionSig","type":"bytes4"},{"internalType":"uint256","name":"depositFunctionDepositerOffset","type":"uint256"},{"internalType":"bytes4","name":"executeFunctionSig","type":"bytes4"}],"name":"adminSetGenericResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"chainId","type":"uint8"},{"internalType":"uint64","name":"oldDepositNonce","type":"uint64"}],"name":"adminSetOldDepositNonce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"bytes32[]","name":"resourceIDs","type":"bytes32[]"},{"internalType":"address[]","name":"tokenContractAddresses","type":"address[]"},{"internalType":"address[]","name":"burnablTokenContractAddresses","type":"address[]"}],"name":"adminSetResourceAndBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminUnpauseTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"handlerAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOrTokenID","type":"uint256"}],"name":"adminWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"chainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"cancelProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"destinationChainID","type":"uint8"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"originChainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"getProposal","outputs":[{"components":[{"internalType":"enum BSPTBridge.ProposalStatus","name":"_status","type":"uint8"},{"internalType":"uint200","name":"_yesVotes","type":"uint200"},{"internalType":"uint8","name":"_yesVotesTotal","type":"uint8"},{"internalType":"uint40","name":"_proposedBlock","type":"uint40"}],"internalType":"struct BSPTBridge.Proposal","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"getRoleMemberIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"relayer","type":"address"}],"name":"isRelayer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"renounceAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"addrs","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"transferFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"chainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"voteProposal","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e06040523480156200001157600080fd5b50604051620032d9380380620032d98339810160408190526200003491620003c6565b6000805460ff1916905560ff8616608052620000508462000152565b6002805460ff191660ff929092169190911790556200006f836200018a565b600280546001600160801b039290921661010002610100600160881b03199092169190911790556001600160a01b03811660c052620000ae82620001c0565b64ffffffffff1660a052620000c5600033620001f4565b845160005b818110156200013657620001217fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc48883815181106200010d576200010d620004f7565b60200260200101516200020460201b60201c565b806200012d816200050d565b915050620000ca565b5062000144600089620001f4565b505050505050505062000535565b600060ff82111562000186576040516306dfcc6560e41b815260086004820152602481018390526044015b60405180910390fd5b5090565b60006001600160801b0382111562000186576040516306dfcc6560e41b815260806004820152602481018390526044016200017d565b600064ffffffffff82111562000186576040516306dfcc6560e41b815260286004820152602481018390526044016200017d565b62000200828262000288565b5050565b600082815260016020526040902060020154620002229033620002e4565b620001f45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b60648201526084016200017d565b6000828152600160205260409020620002a2908262000307565b15620002005760405133906001600160a01b0383169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b6000828152600160205260408120620002fe90836200031e565b90505b92915050565b6000620002fe836001600160a01b03841662000341565b6001600160a01b03811660009081526001830160205260408120541515620002fe565b60008181526001830160205260408120546200038a5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000301565b50600062000301565b80516001600160a01b0381168114620003ab57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080600080600060e0888a031215620003e257600080fd5b620003ed8862000393565b965060208089015160ff811681146200040557600080fd5b60408a01519097506001600160401b03808211156200042357600080fd5b818b0191508b601f8301126200043857600080fd5b8151818111156200044d576200044d620003b0565b8060051b604051601f19603f83011681018181108582111715620004755762000475620003b0565b60405291825284820192508381018501918e8311156200049457600080fd5b938501935b82851015620004bd57620004ad8562000393565b8452938501939285019262000499565b809a50505050505050606088015193506080880151925060a08801519150620004e960c0890162000393565b905092959891949750929550565b634e487b7160e01b600052603260045260246000fd5b6000600182016200052e57634e487b7160e01b600052601160045260246000fd5b5060010190565b60805160a05160c051612d5f6200057a600039600061096501526000818161079e01528181610ea80152611abb0152600081816106fb01526108cc0152612d5f6000f3fe60806040526004361061023b5760003560e01c806380ae1c281161012e578063a9cf69fa116100ab578063ca15c8731161006f578063ca15c873146107d6578063cdb0f73a146107f6578063d547741f14610816578063d7a9cd7914610836578063ffaac0eb1461085057600080fd5b8063a9cf69fa146106bc578063beab7131146106e9578063c0331b3e1461072f578063c5b37c221461074f578063c5ec89701461078c57600080fd5b806391d14854116100f257806391d1485414610630578063926d7d7f146106505780639d82dd63146106725780639debb3bd14610692578063a217fddf146106a757600080fd5b806380ae1c281461056d57806384db809f146105825780638a412d67146105d05780639010d07c146105f057806391c404ac1461061057600080fd5b80634e056005116101bc5780635c975abb116101805780635c975abb146104e05780635e1fab0f146104f8578063780cf004146105185780637febe63f14610538578063802aabe81461055857600080fd5b80634e056005146103dc5780634e0df3f6146103fc578063505987191461041c578063541d5548146104905780635a1ad87c146104c057600080fd5b8063263dcade11610203578063263dcade146102f85780632f2ff15d1461034657806336568abe146103665780634603ae38146103865780634b0b919d146103a657600080fd5b806305e2ca17146102405780630d724dbe146102555780631209998c1461027557806317f03ce514610295578063248a9ca3146102b5575b600080fd5b61025361024e3660046124e6565b610865565b005b34801561026157600080fd5b50610253610270366004612631565b610b1f565b34801561028157600080fd5b50610253610290366004612739565b610d5a565b3480156102a157600080fd5b506102536102b036600461276c565b610d96565b3480156102c157600080fd5b506102e56102d03660046127a8565b60009081526001602052604090206002015490565b6040519081526020015b60405180910390f35b34801561030457600080fd5b5061032e6103133660046127c1565b6006602052600090815260409020546001600160401b031681565b6040516001600160401b0390911681526020016102ef565b34801561035257600080fd5b506102536103613660046127dc565b611032565b34801561037257600080fd5b506102536103813660046127dc565b6110c0565b34801561039257600080fd5b506102536103a1366004612850565b61113a565b3480156103b257600080fd5b5061032e6103c13660046127c1565b6003602052600090815260409020546001600160401b031681565b3480156103e857600080fd5b506102536103f73660046127a8565b6111e0565b34801561040857600080fd5b506102e56104173660046127dc565b611233565b34801561042857600080fd5b506104806104373660046128c8565b600560209081526000928352604080842090915290825290205460ff8082169161010081046001600160c81b031691600160d01b82041690600160d81b900464ffffffffff1684565b6040516102ef949392919061292a565b34801561049c57600080fd5b506104b06104ab366004612966565b611293565b60405190151581526020016102ef565b3480156104cc57600080fd5b506102536104db36600461299b565b6112ad565b3480156104ec57600080fd5b5060005460ff166104b0565b34801561050457600080fd5b50610253610513366004612966565b611363565b34801561052457600080fd5b50610253610533366004612a05565b6113dc565b34801561054457600080fd5b506104b0610553366004612a56565b611458565b34801561056457600080fd5b506102e56114fe565b34801561057957600080fd5b5061025361151c565b34801561058e57600080fd5b506105b861059d3660046127a8565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102ef565b3480156105dc57600080fd5b506102536105eb366004612739565b61152e565b3480156105fc57600080fd5b506105b861060b366004612a96565b61156a565b34801561061c57600080fd5b5061025361062b3660046127a8565b611589565b34801561063c57600080fd5b506104b061064b3660046127dc565b611623565b34801561065c57600080fd5b506102e5600080516020612d0a83398151915281565b34801561067e57600080fd5b5061025361068d366004612966565b61163b565b34801561069e57600080fd5b506102e560c881565b3480156106b357600080fd5b506102e5600081565b3480156106c857600080fd5b506106dc6106d736600461276c565b6116ee565b6040516102ef9190612ab8565b3480156106f557600080fd5b5061071d7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016102ef565b34801561073b57600080fd5b5061025361074a366004612b01565b6117bc565b34801561075b57600080fd5b506002546107749061010090046001600160801b031681565b6040516001600160801b0390911681526020016102ef565b34801561079857600080fd5b506107c07f000000000000000000000000000000000000000000000000000000000000000081565b60405164ffffffffff90911681526020016102ef565b3480156107e257600080fd5b506102e56107f13660046127a8565b611d71565b34801561080257600080fd5b50610253610811366004612966565b611d88565b34801561082257600080fd5b506102536108313660046127dc565b611e8c565b34801561084257600080fd5b5060025461071d9060ff1681565b34801561085c57600080fd5b50610253611f0d565b61086d611f1d565b60025461010090046001600160801b031634146108ca5760405162461bcd60e51b8152602060048201526016602482015275125b98dbdc9c9958dd08199959481cdd5c1c1b1a595960521b60448201526064015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000060ff168460ff16036109555760405162461bcd60e51b815260206004820152602d60248201527f64657374696e6174696f6e436861696e49442063616e6e6f742062652065717560448201526c185b081d1bc818da185a5b9251609a1b60648201526084016108c1565b6002546040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160801b036101009091041680156108fc02916000818181858888f193505050501580156109bb573d6000803e3d6000fd5b506000838152600460205260409020546001600160a01b031680610a215760405162461bcd60e51b815260206004820181905260248201527f7265736f757263654944206e6f74206d617070656420746f2068616e646c657260448201526064016108c1565b60ff8516600090815260036020526040812080548290610a49906001600160401b0316612b85565b91906101000a8154816001600160401b0302191690836001600160401b03160217905590506000829050806001600160a01b03166338995da9878985338a8a6040518763ffffffff1660e01b8152600401610aa996959493929190612bd4565b600060405180830381600087803b158015610ac357600080fd5b505af1158015610ad7573d6000803e3d6000fd5b50505050816001600160401b0316868860ff167fdbb69440df8433824a026ef190652f29929eb64b4d1d5d2a69be8afe3e6eaed860405160405180910390a450505050505050565b610b27611f41565b8251815183518214610b975760405162461bcd60e51b815260206004820152603360248201527f7265736f7572636549447320616e6420746f6b656e436f6e74726163744164646044820152720e4cae6e6cae640d8cadc40dad2e6dac2e8c6d606b1b60648201526084016108c1565b8560005b83811015610cab578760046000898481518110610bba57610bba612c23565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b031663b8fa3736888381518110610c1557610c15612c23565b6020026020010151888481518110610c2f57610c2f612c23565b60200260200101516040518363ffffffff1660e01b8152600401610c669291909182526001600160a01b0316602082015260400190565b600060405180830381600087803b158015610c8057600080fd5b505af1158015610c94573d6000803e3d6000fd5b505050508080610ca390612c39565b915050610b9b565b5060005b82811015610d5057816001600160a01b03166307b7ed99868381518110610cd857610cd8612c23565b60200260200101516040518263ffffffff1660e01b8152600401610d0b91906001600160a01b0391909116815260200190565b600060405180830381600087803b158015610d2557600080fd5b505af1158015610d39573d6000803e3d6000fd5b505050508080610d4890612c39565b915050610caf565b5050505050505050565b610d62611f41565b60ff919091166000908152600360205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b610d9e611f98565b60ff838116600884901b68ffffffffffffffff0016176000818152600560209081526040808320868452909152808220815160808101909252805493949293919290918391166003811115610df557610df56128f2565b6003811115610e0657610e066128f2565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015280519091506001816003811115610e5957610e596128f2565b14610ea65760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2063616e6e6f742062652063616e63656c6c65640000000060448201526064016108c1565b7f000000000000000000000000000000000000000000000000000000000000000064ffffffffff16826060015164ffffffffff1643610ee59190612c52565b64ffffffffff1611610f395760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c206e6f7420617420657870697279207468726573686f6c6460448201526064016108c1565b600380835268ffffffffffffffffff841660009081526005602090815260408083208884529091529020835181548593839160ff1916906001908490811115610f8457610f846128f2565b021790555060208201518154604084015160609094015164ffffffffff16600160d81b026001600160d81b0360ff909516600160d01b0260ff60d01b196001600160c81b039094166101000293909316610100600160d81b03199092169190911791909117929092169190911790556003856001600160401b03168760ff16600080516020612cea8339815191528760405161102291815260200190565b60405180910390a4505050505050565b60008281526001602052604090206002015461104e9033611623565b6110b25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b60648201526084016108c1565b6110bc828261200d565b5050565b6001600160a01b03811633146111305760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108c1565b6110bc8282612066565b611142611f41565b8260005b818110156111d85785858281811061116057611160612c23565b90506020020160208101906111759190612966565b6001600160a01b03166108fc85858481811061119357611193612c23565b905060200201359081150290604051600060405180830381858888f193505050501580156111c5573d6000803e3d6000fd5b50806111d081612c39565b915050611146565b505050505050565b6111e8611f41565b6111f1816120bf565b6002805460ff191660ff9290921691909117905560405181907fa20d6b84cd798a24038be305eff8a45ca82ef54a2aa2082005d8e14c0a4746c890600090a250565b60008061123f84611d71565b905060005b8181101561128957836001600160a01b0316611260868361156a565b6001600160a01b03160361127757915061128d9050565b8061128181612c39565b915050611244565b5090505b92915050565b600061128d600080516020612d0a83398151915283611623565b6112b5611f41565b60008581526004602081905260409182902080546001600160a01b0319166001600160a01b038a8116918217909255925163de319d9960e01b8152918201889052861660248201526001600160e01b03198086166044830152606482018590528316608482015287919063de319d999060a401600060405180830381600087803b15801561134257600080fd5b505af1158015611356573d6000803e3d6000fd5b5050505050505050505050565b61136b611f41565b6001600160a01b03811633036113c35760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f742072656e6f756e6365206f6e6573656c6600000000000000000060448201526064016108c1565b6113ce600082611032565b6113d96000336110c0565b50565b6113e4611f41565b604051636ce5768960e11b81526001600160a01b03848116600483015283811660248301526044820183905285919082169063d9caed1290606401600060405180830381600087803b15801561143957600080fd5b505af115801561144d573d6000803e3d6000fd5b505050505050505050565b68ffffffffffffffffff8316600090815260056020908152604080832085845290915280822081516080810190925280546114f6929190829060ff1660038111156114a5576114a56128f2565b60038111156114b6576114b66128f2565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff16606090910152836120f1565b949350505050565b6000611517600080516020612d0a833981519152611d71565b905090565b611524611f41565b61152c612114565b565b611536611f41565b60ff919091166000908152600660205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b6000828152600160205260408120611582908361216e565b9392505050565b611591611f41565b60025461010090046001600160801b03168190036115f15760405162461bcd60e51b815260206004820152601f60248201527f43757272656e742066656520697320657175616c20746f206e6577206665650060448201526064016108c1565b6115fa8161217a565b600260016101000a8154816001600160801b0302191690836001600160801b0316021790555050565b600082815260016020526040812061158290836121ae565b611653600080516020612d0a83398151915282611623565b61169f5760405162461bcd60e51b815260206004820152601f60248201527f6164647220646f65736e277420686176652072656c6179657220726f6c65210060448201526064016108c1565b6116b7600080516020612d0a83398151915282611e8c565b6040516001600160a01b038216907f10e1f7ce9fd7d1b90a66d13a2ab3cb8dd7f29f3f8d520b143b063ccfbab6906b90600090a250565b60408051608081018252600080825260208201819052918101829052606081019190915260ff848116600885901b68ffffffffffffffff00161760008181526005602090815260408083208784529091529081902081516080810190925280549293919290918391166003811115611768576117686128f2565b6003811115611779576117796128f2565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015295945050505050565b6117c46121d0565b6117cc611f1d565b60008381526004602090815260408083205490516001600160a01b0390911692916117fd9184918791879101612c65565b60408051808303601f19018152828252805160209182012060ff8b811660088c901b68ffffffffffffffff001617600081815260058552858120848252909452848420608087019095528454929650949293918391166003811115611864576118646128f2565b6003811115611875576118756128f2565b8152905461010081046001600160c81b0316602080840191909152600160d01b820460ff908116604080860191909152600160d81b90930464ffffffffff16606090940193909352918c16600090815260069092529020549091506001600160401b03908116908916116119205760405162461bcd60e51b815260206004820152601260248201527119195c1bdcda5d139bd8d9481a5cc81bdb1960721b60448201526064016108c1565b6001600160a01b0384166119765760405162461bcd60e51b815260206004820152601960248201527f6e6f2068616e646c657220666f72207265736f7572636549440000000000000060448201526064016108c1565b8051600190600381111561198c5761198c6128f2565b11156119e65760405162461bcd60e51b815260206004820152602360248201527f70726f706f73616c20616c72656164792065786563757465642f63616e63656c6044820152621b195960ea1b60648201526084016108c1565b6119f081336120f1565b15611a355760405162461bcd60e51b81526020600482015260156024820152741c995b185e595c88185b1c9958591e481d9bdd1959605a1b60448201526064016108c1565b600081516003811115611a4a57611a4a6128f2565b03611ab95760408051608081019091528060018152600060208201819052604082015264ffffffffff431660609091015290506001886001600160401b03168a60ff16600080516020612cea83398151915286604051611aac91815260200190565b60405180910390a4611b3c565b7f000000000000000000000000000000000000000000000000000000000000000064ffffffffff16816060015164ffffffffff1643611af89190612c52565b64ffffffffff161115611b3c5760038082526040518481526001600160401b038a169060ff8c1690600080516020612cea8339815191529060200160405180910390a45b600381516003811115611b5157611b516128f2565b14611cb057611b76611b6233612234565b82602001516001600160c81b031617612258565b6001600160c81b0316602082015260408101805190611b9482612c91565b60ff1690525080516003811115611bad57611bad6128f2565b886001600160401b03168a60ff167f25f8daaa4635a7729927ba3f5b3d59cc3320aca7c32c9db4e7ca7b957434364086604051611bec91815260200190565b60405180910390a4600254604082015160ff918216911610611cb0576002815260405163712467f960e11b815284906001600160a01b0382169063e248cff290611c3e908b908b908b90600401612cb0565b600060405180830381600087803b158015611c5857600080fd5b505af1158015611c6c573d6000803e3d6000fd5b5060029250611c79915050565b896001600160401b03168b60ff16600080516020612cea83398151915287604051611ca691815260200190565b60405180910390a4505b68ffffffffffffffffff8216600090815260056020908152604080832086845290915290208151815483929190829060ff19166001836003811115611cf757611cf76128f2565b021790555060208201518154604084015160609094015164ffffffffff16600160d81b026001600160d81b0360ff909516600160d01b0260ff60d01b196001600160c81b039094166101000293909316610100600160d81b0319909216919091179190911792909216919091179055505050505050505050565b600081815260016020526040812061128d9061228c565b611da0600080516020612d0a83398151915282611623565b15611ded5760405162461bcd60e51b815260206004820152601e60248201527f6164647220616c7265616479206861732072656c6179657220726f6c6521000060448201526064016108c1565b60c8611df76114fe565b10611e3d5760405162461bcd60e51b81526020600482015260166024820152751c995b185e595c9cc81b1a5b5a5d081c995858da195960521b60448201526064016108c1565b611e55600080516020612d0a83398151915282611032565b6040516001600160a01b038216907f03580ee9f53a62b7cb409a2cb56f9be87747dd15017afc5cef6eef321e4fb2c590600090a250565b600082815260016020526040902060020154611ea89033611623565b6111305760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b60648201526084016108c1565b611f15611f41565b61152c612296565b60005460ff161561152c5760405163d93c066560e01b815260040160405180910390fd5b611f4c600033611623565b61152c5760405162461bcd60e51b815260206004820152601e60248201527f73656e64657220646f65736e277420686176652061646d696e20726f6c65000060448201526064016108c1565b611fa3600033611623565b80611fc15750611fc1600080516020612d0a83398151915233611623565b61152c5760405162461bcd60e51b815260206004820152601e60248201527f73656e646572206973206e6f742072656c61796572206f722061646d696e000060448201526064016108c1565b600082815260016020526040902061202590826122cf565b156110bc5760405133906001600160a01b0383169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b600082815260016020526040902061207e90826122e4565b156110bc5760405133906001600160a01b0383169084907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90600090a45050565b600060ff8211156120ed576040516306dfcc6560e41b815260086004820152602481018390526044016108c1565b5090565b60008083602001516001600160c81b031661210b84612234565b16119392505050565b61211c611f1d565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121513390565b6040516001600160a01b03909116815260200160405180910390a1565b600061158283836122f9565b60006001600160801b038211156120ed576040516306dfcc6560e41b815260806004820152602481018390526044016108c1565b6001600160a01b03811660009081526001830160205260408120541515611582565b6121e8600080516020612d0a83398151915233611623565b61152c5760405162461bcd60e51b815260206004820181905260248201527f73656e64657220646f65736e277420686176652072656c6179657220726f6c6560448201526064016108c1565b600061224e600080516020612d0a83398151915283611233565b6001901b92915050565b60006001600160c81b038211156120ed576040516306dfcc6560e41b815260c86004820152602481018390526044016108c1565b600061128d825490565b61229e612323565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612151565b6000611582836001600160a01b038416612346565b6000611582836001600160a01b038416612395565b600082600001828154811061231057612310612c23565b9060005260206000200154905092915050565b60005460ff1661152c57604051638dfc202b60e01b815260040160405180910390fd5b600081815260018301602052604081205461238d5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561128d565b50600061128d565b6000818152600183016020526040812054801561247e5760006123b9600183612c52565b85549091506000906123cd90600190612c52565b90508082146124325760008660000182815481106123ed576123ed612c23565b906000526020600020015490508087600001848154811061241057612410612c23565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061244357612443612cd3565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061128d565b600091505061128d565b803560ff8116811461249957600080fd5b919050565b60008083601f8401126124b057600080fd5b5081356001600160401b038111156124c757600080fd5b6020830191508360208285010111156124df57600080fd5b9250929050565b600080600080606085870312156124fc57600080fd5b61250585612488565b93506020850135925060408501356001600160401b0381111561252757600080fd5b6125338782880161249e565b95989497509550505050565b6001600160a01b03811681146113d957600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561259257612592612554565b604052919050565b60006001600160401b038211156125b3576125b3612554565b5060051b60200190565b600082601f8301126125ce57600080fd5b813560206125e36125de8361259a565b61256a565b82815260059290921b8401810191818101908684111561260257600080fd5b8286015b848110156126265780356126198161253f565b8352918301918301612606565b509695505050505050565b6000806000806080858703121561264757600080fd5b84356126528161253f565b93506020858101356001600160401b038082111561266f57600080fd5b818801915088601f83011261268357600080fd5b81356126916125de8261259a565b81815260059190911b8301840190848101908b8311156126b057600080fd5b938501935b828510156126ce578435825293850193908501906126b5565b9750505060408801359250808311156126e657600080fd5b6126f289848a016125bd565b9450606088013592508083111561270857600080fd5b5050612716878288016125bd565b91505092959194509250565b80356001600160401b038116811461249957600080fd5b6000806040838503121561274c57600080fd5b61275583612488565b915061276360208401612722565b90509250929050565b60008060006060848603121561278157600080fd5b61278a84612488565b925061279860208501612722565b9150604084013590509250925092565b6000602082840312156127ba57600080fd5b5035919050565b6000602082840312156127d357600080fd5b61158282612488565b600080604083850312156127ef57600080fd5b8235915060208301356128018161253f565b809150509250929050565b60008083601f84011261281e57600080fd5b5081356001600160401b0381111561283557600080fd5b6020830191508360208260051b85010111156124df57600080fd5b6000806000806040858703121561286657600080fd5b84356001600160401b038082111561287d57600080fd5b6128898883890161280c565b909650945060208701359150808211156128a257600080fd5b506125338782880161280c565b803568ffffffffffffffffff8116811461249957600080fd5b600080604083850312156128db57600080fd5b6128e4836128af565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6004811061292657634e487b7160e01b600052602160045260246000fd5b9052565b608081016129388287612908565b6001600160c81b0394909416602082015260ff92909216604083015264ffffffffff16606090910152919050565b60006020828403121561297857600080fd5b81356115828161253f565b80356001600160e01b03198116811461249957600080fd5b60008060008060008060c087890312156129b457600080fd5b86356129bf8161253f565b95506020870135945060408701356129d68161253f565b93506129e460608801612983565b9250608087013591506129f960a08801612983565b90509295509295509295565b60008060008060808587031215612a1b57600080fd5b8435612a268161253f565b93506020850135612a368161253f565b92506040850135612a468161253f565b9396929550929360600135925050565b600080600060608486031215612a6b57600080fd5b612a74846128af565b9250602084013591506040840135612a8b8161253f565b809150509250925092565b60008060408385031215612aa957600080fd5b50508035926020909101359150565b6000608082019050612acb828451612908565b60018060c81b03602084015116602083015260ff604084015116604083015264ffffffffff606084015116606083015292915050565b600080600080600060808688031215612b1957600080fd5b612b2286612488565b9450612b3060208701612722565b93506040860135925060608601356001600160401b03811115612b5257600080fd5b612b5e8882890161249e565b969995985093965092949392505050565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b03808316818103612ba157612ba1612b6f565b6001019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b86815260ff861660208201526001600160401b03851660408201526001600160a01b038416606082015260a060808201819052600090612c179083018486612bab565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201612c4b57612c4b612b6f565b5060010190565b8181038181111561128d5761128d612b6f565b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b600060ff821660ff8103612ca757612ca7612b6f565b60010192915050565b838152604060208201526000612cca604083018486612bab565b95945050505050565b634e487b7160e01b600052603160045260246000fdfe968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d5e2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4a2646970667358221220b91dd6168cb3ff907b1660108279266e530c48df82bd60dc6759583306f036d664736f6c634300081400330000000000000000000000006db2842ff2652a847422cca257a50e89fb3d63ca000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000746a52880000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000a1f125c99c63f9155c15e1585e33bd9c1b4924840000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a1f125c99c63f9155c15e1585e33bd9c1b492484

Deployed Bytecode

0x60806040526004361061023b5760003560e01c806380ae1c281161012e578063a9cf69fa116100ab578063ca15c8731161006f578063ca15c873146107d6578063cdb0f73a146107f6578063d547741f14610816578063d7a9cd7914610836578063ffaac0eb1461085057600080fd5b8063a9cf69fa146106bc578063beab7131146106e9578063c0331b3e1461072f578063c5b37c221461074f578063c5ec89701461078c57600080fd5b806391d14854116100f257806391d1485414610630578063926d7d7f146106505780639d82dd63146106725780639debb3bd14610692578063a217fddf146106a757600080fd5b806380ae1c281461056d57806384db809f146105825780638a412d67146105d05780639010d07c146105f057806391c404ac1461061057600080fd5b80634e056005116101bc5780635c975abb116101805780635c975abb146104e05780635e1fab0f146104f8578063780cf004146105185780637febe63f14610538578063802aabe81461055857600080fd5b80634e056005146103dc5780634e0df3f6146103fc578063505987191461041c578063541d5548146104905780635a1ad87c146104c057600080fd5b8063263dcade11610203578063263dcade146102f85780632f2ff15d1461034657806336568abe146103665780634603ae38146103865780634b0b919d146103a657600080fd5b806305e2ca17146102405780630d724dbe146102555780631209998c1461027557806317f03ce514610295578063248a9ca3146102b5575b600080fd5b61025361024e3660046124e6565b610865565b005b34801561026157600080fd5b50610253610270366004612631565b610b1f565b34801561028157600080fd5b50610253610290366004612739565b610d5a565b3480156102a157600080fd5b506102536102b036600461276c565b610d96565b3480156102c157600080fd5b506102e56102d03660046127a8565b60009081526001602052604090206002015490565b6040519081526020015b60405180910390f35b34801561030457600080fd5b5061032e6103133660046127c1565b6006602052600090815260409020546001600160401b031681565b6040516001600160401b0390911681526020016102ef565b34801561035257600080fd5b506102536103613660046127dc565b611032565b34801561037257600080fd5b506102536103813660046127dc565b6110c0565b34801561039257600080fd5b506102536103a1366004612850565b61113a565b3480156103b257600080fd5b5061032e6103c13660046127c1565b6003602052600090815260409020546001600160401b031681565b3480156103e857600080fd5b506102536103f73660046127a8565b6111e0565b34801561040857600080fd5b506102e56104173660046127dc565b611233565b34801561042857600080fd5b506104806104373660046128c8565b600560209081526000928352604080842090915290825290205460ff8082169161010081046001600160c81b031691600160d01b82041690600160d81b900464ffffffffff1684565b6040516102ef949392919061292a565b34801561049c57600080fd5b506104b06104ab366004612966565b611293565b60405190151581526020016102ef565b3480156104cc57600080fd5b506102536104db36600461299b565b6112ad565b3480156104ec57600080fd5b5060005460ff166104b0565b34801561050457600080fd5b50610253610513366004612966565b611363565b34801561052457600080fd5b50610253610533366004612a05565b6113dc565b34801561054457600080fd5b506104b0610553366004612a56565b611458565b34801561056457600080fd5b506102e56114fe565b34801561057957600080fd5b5061025361151c565b34801561058e57600080fd5b506105b861059d3660046127a8565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102ef565b3480156105dc57600080fd5b506102536105eb366004612739565b61152e565b3480156105fc57600080fd5b506105b861060b366004612a96565b61156a565b34801561061c57600080fd5b5061025361062b3660046127a8565b611589565b34801561063c57600080fd5b506104b061064b3660046127dc565b611623565b34801561065c57600080fd5b506102e5600080516020612d0a83398151915281565b34801561067e57600080fd5b5061025361068d366004612966565b61163b565b34801561069e57600080fd5b506102e560c881565b3480156106b357600080fd5b506102e5600081565b3480156106c857600080fd5b506106dc6106d736600461276c565b6116ee565b6040516102ef9190612ab8565b3480156106f557600080fd5b5061071d7f000000000000000000000000000000000000000000000000000000000000000181565b60405160ff90911681526020016102ef565b34801561073b57600080fd5b5061025361074a366004612b01565b6117bc565b34801561075b57600080fd5b506002546107749061010090046001600160801b031681565b6040516001600160801b0390911681526020016102ef565b34801561079857600080fd5b506107c07f00000000000000000000000000000000000000000000000000000000000f424081565b60405164ffffffffff90911681526020016102ef565b3480156107e257600080fd5b506102e56107f13660046127a8565b611d71565b34801561080257600080fd5b50610253610811366004612966565b611d88565b34801561082257600080fd5b506102536108313660046127dc565b611e8c565b34801561084257600080fd5b5060025461071d9060ff1681565b34801561085c57600080fd5b50610253611f0d565b61086d611f1d565b60025461010090046001600160801b031634146108ca5760405162461bcd60e51b8152602060048201526016602482015275125b98dbdc9c9958dd08199959481cdd5c1c1b1a595960521b60448201526064015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000160ff168460ff16036109555760405162461bcd60e51b815260206004820152602d60248201527f64657374696e6174696f6e436861696e49442063616e6e6f742062652065717560448201526c185b081d1bc818da185a5b9251609a1b60648201526084016108c1565b6002546040516001600160a01b037f000000000000000000000000a1f125c99c63f9155c15e1585e33bd9c1b49248416916001600160801b036101009091041680156108fc02916000818181858888f193505050501580156109bb573d6000803e3d6000fd5b506000838152600460205260409020546001600160a01b031680610a215760405162461bcd60e51b815260206004820181905260248201527f7265736f757263654944206e6f74206d617070656420746f2068616e646c657260448201526064016108c1565b60ff8516600090815260036020526040812080548290610a49906001600160401b0316612b85565b91906101000a8154816001600160401b0302191690836001600160401b03160217905590506000829050806001600160a01b03166338995da9878985338a8a6040518763ffffffff1660e01b8152600401610aa996959493929190612bd4565b600060405180830381600087803b158015610ac357600080fd5b505af1158015610ad7573d6000803e3d6000fd5b50505050816001600160401b0316868860ff167fdbb69440df8433824a026ef190652f29929eb64b4d1d5d2a69be8afe3e6eaed860405160405180910390a450505050505050565b610b27611f41565b8251815183518214610b975760405162461bcd60e51b815260206004820152603360248201527f7265736f7572636549447320616e6420746f6b656e436f6e74726163744164646044820152720e4cae6e6cae640d8cadc40dad2e6dac2e8c6d606b1b60648201526084016108c1565b8560005b83811015610cab578760046000898481518110610bba57610bba612c23565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b031663b8fa3736888381518110610c1557610c15612c23565b6020026020010151888481518110610c2f57610c2f612c23565b60200260200101516040518363ffffffff1660e01b8152600401610c669291909182526001600160a01b0316602082015260400190565b600060405180830381600087803b158015610c8057600080fd5b505af1158015610c94573d6000803e3d6000fd5b505050508080610ca390612c39565b915050610b9b565b5060005b82811015610d5057816001600160a01b03166307b7ed99868381518110610cd857610cd8612c23565b60200260200101516040518263ffffffff1660e01b8152600401610d0b91906001600160a01b0391909116815260200190565b600060405180830381600087803b158015610d2557600080fd5b505af1158015610d39573d6000803e3d6000fd5b505050508080610d4890612c39565b915050610caf565b5050505050505050565b610d62611f41565b60ff919091166000908152600360205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b610d9e611f98565b60ff838116600884901b68ffffffffffffffff0016176000818152600560209081526040808320868452909152808220815160808101909252805493949293919290918391166003811115610df557610df56128f2565b6003811115610e0657610e066128f2565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015280519091506001816003811115610e5957610e596128f2565b14610ea65760405162461bcd60e51b815260206004820152601c60248201527f50726f706f73616c2063616e6e6f742062652063616e63656c6c65640000000060448201526064016108c1565b7f00000000000000000000000000000000000000000000000000000000000f424064ffffffffff16826060015164ffffffffff1643610ee59190612c52565b64ffffffffff1611610f395760405162461bcd60e51b815260206004820181905260248201527f50726f706f73616c206e6f7420617420657870697279207468726573686f6c6460448201526064016108c1565b600380835268ffffffffffffffffff841660009081526005602090815260408083208884529091529020835181548593839160ff1916906001908490811115610f8457610f846128f2565b021790555060208201518154604084015160609094015164ffffffffff16600160d81b026001600160d81b0360ff909516600160d01b0260ff60d01b196001600160c81b039094166101000293909316610100600160d81b03199092169190911791909117929092169190911790556003856001600160401b03168760ff16600080516020612cea8339815191528760405161102291815260200190565b60405180910390a4505050505050565b60008281526001602052604090206002015461104e9033611623565b6110b25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b60648201526084016108c1565b6110bc828261200d565b5050565b6001600160a01b03811633146111305760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108c1565b6110bc8282612066565b611142611f41565b8260005b818110156111d85785858281811061116057611160612c23565b90506020020160208101906111759190612966565b6001600160a01b03166108fc85858481811061119357611193612c23565b905060200201359081150290604051600060405180830381858888f193505050501580156111c5573d6000803e3d6000fd5b50806111d081612c39565b915050611146565b505050505050565b6111e8611f41565b6111f1816120bf565b6002805460ff191660ff9290921691909117905560405181907fa20d6b84cd798a24038be305eff8a45ca82ef54a2aa2082005d8e14c0a4746c890600090a250565b60008061123f84611d71565b905060005b8181101561128957836001600160a01b0316611260868361156a565b6001600160a01b03160361127757915061128d9050565b8061128181612c39565b915050611244565b5090505b92915050565b600061128d600080516020612d0a83398151915283611623565b6112b5611f41565b60008581526004602081905260409182902080546001600160a01b0319166001600160a01b038a8116918217909255925163de319d9960e01b8152918201889052861660248201526001600160e01b03198086166044830152606482018590528316608482015287919063de319d999060a401600060405180830381600087803b15801561134257600080fd5b505af1158015611356573d6000803e3d6000fd5b5050505050505050505050565b61136b611f41565b6001600160a01b03811633036113c35760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f742072656e6f756e6365206f6e6573656c6600000000000000000060448201526064016108c1565b6113ce600082611032565b6113d96000336110c0565b50565b6113e4611f41565b604051636ce5768960e11b81526001600160a01b03848116600483015283811660248301526044820183905285919082169063d9caed1290606401600060405180830381600087803b15801561143957600080fd5b505af115801561144d573d6000803e3d6000fd5b505050505050505050565b68ffffffffffffffffff8316600090815260056020908152604080832085845290915280822081516080810190925280546114f6929190829060ff1660038111156114a5576114a56128f2565b60038111156114b6576114b66128f2565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff16606090910152836120f1565b949350505050565b6000611517600080516020612d0a833981519152611d71565b905090565b611524611f41565b61152c612114565b565b611536611f41565b60ff919091166000908152600660205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b6000828152600160205260408120611582908361216e565b9392505050565b611591611f41565b60025461010090046001600160801b03168190036115f15760405162461bcd60e51b815260206004820152601f60248201527f43757272656e742066656520697320657175616c20746f206e6577206665650060448201526064016108c1565b6115fa8161217a565b600260016101000a8154816001600160801b0302191690836001600160801b0316021790555050565b600082815260016020526040812061158290836121ae565b611653600080516020612d0a83398151915282611623565b61169f5760405162461bcd60e51b815260206004820152601f60248201527f6164647220646f65736e277420686176652072656c6179657220726f6c65210060448201526064016108c1565b6116b7600080516020612d0a83398151915282611e8c565b6040516001600160a01b038216907f10e1f7ce9fd7d1b90a66d13a2ab3cb8dd7f29f3f8d520b143b063ccfbab6906b90600090a250565b60408051608081018252600080825260208201819052918101829052606081019190915260ff848116600885901b68ffffffffffffffff00161760008181526005602090815260408083208784529091529081902081516080810190925280549293919290918391166003811115611768576117686128f2565b6003811115611779576117796128f2565b8152905461010081046001600160c81b03166020830152600160d01b810460ff166040830152600160d81b900464ffffffffff1660609091015295945050505050565b6117c46121d0565b6117cc611f1d565b60008381526004602090815260408083205490516001600160a01b0390911692916117fd9184918791879101612c65565b60408051808303601f19018152828252805160209182012060ff8b811660088c901b68ffffffffffffffff001617600081815260058552858120848252909452848420608087019095528454929650949293918391166003811115611864576118646128f2565b6003811115611875576118756128f2565b8152905461010081046001600160c81b0316602080840191909152600160d01b820460ff908116604080860191909152600160d81b90930464ffffffffff16606090940193909352918c16600090815260069092529020549091506001600160401b03908116908916116119205760405162461bcd60e51b815260206004820152601260248201527119195c1bdcda5d139bd8d9481a5cc81bdb1960721b60448201526064016108c1565b6001600160a01b0384166119765760405162461bcd60e51b815260206004820152601960248201527f6e6f2068616e646c657220666f72207265736f7572636549440000000000000060448201526064016108c1565b8051600190600381111561198c5761198c6128f2565b11156119e65760405162461bcd60e51b815260206004820152602360248201527f70726f706f73616c20616c72656164792065786563757465642f63616e63656c6044820152621b195960ea1b60648201526084016108c1565b6119f081336120f1565b15611a355760405162461bcd60e51b81526020600482015260156024820152741c995b185e595c88185b1c9958591e481d9bdd1959605a1b60448201526064016108c1565b600081516003811115611a4a57611a4a6128f2565b03611ab95760408051608081019091528060018152600060208201819052604082015264ffffffffff431660609091015290506001886001600160401b03168a60ff16600080516020612cea83398151915286604051611aac91815260200190565b60405180910390a4611b3c565b7f00000000000000000000000000000000000000000000000000000000000f424064ffffffffff16816060015164ffffffffff1643611af89190612c52565b64ffffffffff161115611b3c5760038082526040518481526001600160401b038a169060ff8c1690600080516020612cea8339815191529060200160405180910390a45b600381516003811115611b5157611b516128f2565b14611cb057611b76611b6233612234565b82602001516001600160c81b031617612258565b6001600160c81b0316602082015260408101805190611b9482612c91565b60ff1690525080516003811115611bad57611bad6128f2565b886001600160401b03168a60ff167f25f8daaa4635a7729927ba3f5b3d59cc3320aca7c32c9db4e7ca7b957434364086604051611bec91815260200190565b60405180910390a4600254604082015160ff918216911610611cb0576002815260405163712467f960e11b815284906001600160a01b0382169063e248cff290611c3e908b908b908b90600401612cb0565b600060405180830381600087803b158015611c5857600080fd5b505af1158015611c6c573d6000803e3d6000fd5b5060029250611c79915050565b896001600160401b03168b60ff16600080516020612cea83398151915287604051611ca691815260200190565b60405180910390a4505b68ffffffffffffffffff8216600090815260056020908152604080832086845290915290208151815483929190829060ff19166001836003811115611cf757611cf76128f2565b021790555060208201518154604084015160609094015164ffffffffff16600160d81b026001600160d81b0360ff909516600160d01b0260ff60d01b196001600160c81b039094166101000293909316610100600160d81b0319909216919091179190911792909216919091179055505050505050505050565b600081815260016020526040812061128d9061228c565b611da0600080516020612d0a83398151915282611623565b15611ded5760405162461bcd60e51b815260206004820152601e60248201527f6164647220616c7265616479206861732072656c6179657220726f6c6521000060448201526064016108c1565b60c8611df76114fe565b10611e3d5760405162461bcd60e51b81526020600482015260166024820152751c995b185e595c9cc81b1a5b5a5d081c995858da195960521b60448201526064016108c1565b611e55600080516020612d0a83398151915282611032565b6040516001600160a01b038216907f03580ee9f53a62b7cb409a2cb56f9be87747dd15017afc5cef6eef321e4fb2c590600090a250565b600082815260016020526040902060020154611ea89033611623565b6111305760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b60648201526084016108c1565b611f15611f41565b61152c612296565b60005460ff161561152c5760405163d93c066560e01b815260040160405180910390fd5b611f4c600033611623565b61152c5760405162461bcd60e51b815260206004820152601e60248201527f73656e64657220646f65736e277420686176652061646d696e20726f6c65000060448201526064016108c1565b611fa3600033611623565b80611fc15750611fc1600080516020612d0a83398151915233611623565b61152c5760405162461bcd60e51b815260206004820152601e60248201527f73656e646572206973206e6f742072656c61796572206f722061646d696e000060448201526064016108c1565b600082815260016020526040902061202590826122cf565b156110bc5760405133906001600160a01b0383169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b600082815260016020526040902061207e90826122e4565b156110bc5760405133906001600160a01b0383169084907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90600090a45050565b600060ff8211156120ed576040516306dfcc6560e41b815260086004820152602481018390526044016108c1565b5090565b60008083602001516001600160c81b031661210b84612234565b16119392505050565b61211c611f1d565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121513390565b6040516001600160a01b03909116815260200160405180910390a1565b600061158283836122f9565b60006001600160801b038211156120ed576040516306dfcc6560e41b815260806004820152602481018390526044016108c1565b6001600160a01b03811660009081526001830160205260408120541515611582565b6121e8600080516020612d0a83398151915233611623565b61152c5760405162461bcd60e51b815260206004820181905260248201527f73656e64657220646f65736e277420686176652072656c6179657220726f6c6560448201526064016108c1565b600061224e600080516020612d0a83398151915283611233565b6001901b92915050565b60006001600160c81b038211156120ed576040516306dfcc6560e41b815260c86004820152602481018390526044016108c1565b600061128d825490565b61229e612323565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612151565b6000611582836001600160a01b038416612346565b6000611582836001600160a01b038416612395565b600082600001828154811061231057612310612c23565b9060005260206000200154905092915050565b60005460ff1661152c57604051638dfc202b60e01b815260040160405180910390fd5b600081815260018301602052604081205461238d5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561128d565b50600061128d565b6000818152600183016020526040812054801561247e5760006123b9600183612c52565b85549091506000906123cd90600190612c52565b90508082146124325760008660000182815481106123ed576123ed612c23565b906000526020600020015490508087600001848154811061241057612410612c23565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061244357612443612cd3565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061128d565b600091505061128d565b803560ff8116811461249957600080fd5b919050565b60008083601f8401126124b057600080fd5b5081356001600160401b038111156124c757600080fd5b6020830191508360208285010111156124df57600080fd5b9250929050565b600080600080606085870312156124fc57600080fd5b61250585612488565b93506020850135925060408501356001600160401b0381111561252757600080fd5b6125338782880161249e565b95989497509550505050565b6001600160a01b03811681146113d957600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561259257612592612554565b604052919050565b60006001600160401b038211156125b3576125b3612554565b5060051b60200190565b600082601f8301126125ce57600080fd5b813560206125e36125de8361259a565b61256a565b82815260059290921b8401810191818101908684111561260257600080fd5b8286015b848110156126265780356126198161253f565b8352918301918301612606565b509695505050505050565b6000806000806080858703121561264757600080fd5b84356126528161253f565b93506020858101356001600160401b038082111561266f57600080fd5b818801915088601f83011261268357600080fd5b81356126916125de8261259a565b81815260059190911b8301840190848101908b8311156126b057600080fd5b938501935b828510156126ce578435825293850193908501906126b5565b9750505060408801359250808311156126e657600080fd5b6126f289848a016125bd565b9450606088013592508083111561270857600080fd5b5050612716878288016125bd565b91505092959194509250565b80356001600160401b038116811461249957600080fd5b6000806040838503121561274c57600080fd5b61275583612488565b915061276360208401612722565b90509250929050565b60008060006060848603121561278157600080fd5b61278a84612488565b925061279860208501612722565b9150604084013590509250925092565b6000602082840312156127ba57600080fd5b5035919050565b6000602082840312156127d357600080fd5b61158282612488565b600080604083850312156127ef57600080fd5b8235915060208301356128018161253f565b809150509250929050565b60008083601f84011261281e57600080fd5b5081356001600160401b0381111561283557600080fd5b6020830191508360208260051b85010111156124df57600080fd5b6000806000806040858703121561286657600080fd5b84356001600160401b038082111561287d57600080fd5b6128898883890161280c565b909650945060208701359150808211156128a257600080fd5b506125338782880161280c565b803568ffffffffffffffffff8116811461249957600080fd5b600080604083850312156128db57600080fd5b6128e4836128af565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6004811061292657634e487b7160e01b600052602160045260246000fd5b9052565b608081016129388287612908565b6001600160c81b0394909416602082015260ff92909216604083015264ffffffffff16606090910152919050565b60006020828403121561297857600080fd5b81356115828161253f565b80356001600160e01b03198116811461249957600080fd5b60008060008060008060c087890312156129b457600080fd5b86356129bf8161253f565b95506020870135945060408701356129d68161253f565b93506129e460608801612983565b9250608087013591506129f960a08801612983565b90509295509295509295565b60008060008060808587031215612a1b57600080fd5b8435612a268161253f565b93506020850135612a368161253f565b92506040850135612a468161253f565b9396929550929360600135925050565b600080600060608486031215612a6b57600080fd5b612a74846128af565b9250602084013591506040840135612a8b8161253f565b809150509250925092565b60008060408385031215612aa957600080fd5b50508035926020909101359150565b6000608082019050612acb828451612908565b60018060c81b03602084015116602083015260ff604084015116604083015264ffffffffff606084015116606083015292915050565b600080600080600060808688031215612b1957600080fd5b612b2286612488565b9450612b3060208701612722565b93506040860135925060608601356001600160401b03811115612b5257600080fd5b612b5e8882890161249e565b969995985093965092949392505050565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b03808316818103612ba157612ba1612b6f565b6001019392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b86815260ff861660208201526001600160401b03851660408201526001600160a01b038416606082015260a060808201819052600090612c179083018486612bab565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201612c4b57612c4b612b6f565b5060010190565b8181038181111561128d5761128d612b6f565b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b600060ff821660ff8103612ca757612ca7612b6f565b60010192915050565b838152604060208201526000612cca604083018486612bab565b95945050505050565b634e487b7160e01b600052603160045260246000fdfe968626a768e76ba1363efe44e322a6c4900c5f084e0b45f35e294dfddaa9e0d5e2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4a2646970667358221220b91dd6168cb3ff907b1660108279266e530c48df82bd60dc6759583306f036d664736f6c63430008140033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000006db2842ff2652a847422cca257a50e89fb3d63ca000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000746a52880000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000a1f125c99c63f9155c15e1585e33bd9c1b4924840000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a1f125c99c63f9155c15e1585e33bd9c1b492484

-----Decoded View---------------
Arg [0] : defaultAdmin (address): 0x6dB2842FF2652A847422CCa257A50e89Fb3D63Ca
Arg [1] : chainID (uint8): 1
Arg [2] : initialRelayers (address[]): 0xA1f125C99C63F9155c15e1585e33bd9C1b492484
Arg [3] : initialRelayerThreshold (uint256): 1
Arg [4] : fee (uint256): 500000000000
Arg [5] : expiry (uint256): 1000000
Arg [6] : feeRecipient (address): 0xA1f125C99C63F9155c15e1585e33bd9C1b492484

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000006db2842ff2652a847422cca257a50e89fb3d63ca
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [4] : 000000000000000000000000000000000000000000000000000000746a528800
Arg [5] : 00000000000000000000000000000000000000000000000000000000000f4240
Arg [6] : 000000000000000000000000a1f125c99c63f9155c15e1585e33bd9c1b492484
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [8] : 000000000000000000000000a1f125c99c63f9155c15e1585e33bd9c1b492484


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ 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.