ETH Price: $3,363.61 (+2.59%)

Contract

0x7556085E8e6A1Dabbc528fbcA2C7699fA5Ee6e11
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit214690102024-12-24 1:19:591 hr ago1735003199IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.000617326.82732032
Deposit214683382024-12-23 23:03:353 hrs ago1734995015IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0010086912.47703928
Deposit214678992024-12-23 21:35:234 hrs ago1734989723IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0015142617.64635422
Deposit214677702024-12-23 21:09:235 hrs ago1734988163IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0017853720.8056757
Deposit214677472024-12-23 21:04:355 hrs ago1734987875IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0016772720.75009258
Deposit214589382024-12-22 15:29:4734 hrs ago1734881387IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.000822229.60186947
Deposit214572482024-12-22 9:49:3540 hrs ago1734860975IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.000634597.40973863
Deposit214527422024-12-21 18:42:232 days ago1734806543IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.000815889.52779736
Deposit214510002024-12-21 12:51:352 days ago1734785495IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.000744228.68972269
Deposit214498152024-12-21 8:53:472 days ago1734771227IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.000794049.27401711
Deposit214470912024-12-20 23:43:113 days ago1734738191IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.000724388.9589904
Deposit214464492024-12-20 21:34:233 days ago1734730463IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0012466614.55434764
Deposit214460542024-12-20 20:15:113 days ago1734725711IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0015541418.14658565
Deposit214456052024-12-20 18:45:113 days ago1734720311IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0015094717.62741611
Deposit214451242024-12-20 17:08:353 days ago1734714515IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0018429321.51854386
Deposit214434462024-12-20 11:30:353 days ago1734694235IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0031550836.83949195
Deposit214417432024-12-20 5:47:593 days ago1734673679IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0009813811.45886915
Deposit214412222024-12-20 4:03:353 days ago1734667415IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.000814649.51193972
Deposit214406542024-12-20 2:09:234 days ago1734660563IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0008835610.92764257
Deposit214402172024-12-20 0:41:474 days ago1734655307IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0010203511.91222236
Deposit214392322024-12-19 21:24:234 days ago1734643463IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0028289333.03127891
Deposit214391032024-12-19 20:58:114 days ago1734641891IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0031602736.900081
Deposit214389982024-12-19 20:37:114 days ago1734640631IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0043356950.63168756
Deposit214355512024-12-19 9:03:594 days ago1734599039IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0009589811.19737752
Deposit214345842024-12-19 5:49:114 days ago1734587351IN
0x7556085E...fA5Ee6e11
0.0003 ETH0.0008826210.30570344
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
214690102024-12-24 1:19:591 hr ago1735003199
0x7556085E...fA5Ee6e11
0.0003 ETH
214683382024-12-23 23:03:353 hrs ago1734995015
0x7556085E...fA5Ee6e11
0.0003 ETH
214678992024-12-23 21:35:234 hrs ago1734989723
0x7556085E...fA5Ee6e11
0.0003 ETH
214677702024-12-23 21:09:235 hrs ago1734988163
0x7556085E...fA5Ee6e11
0.0003 ETH
214677472024-12-23 21:04:355 hrs ago1734987875
0x7556085E...fA5Ee6e11
0.0003 ETH
214589382024-12-22 15:29:4734 hrs ago1734881387
0x7556085E...fA5Ee6e11
0.0003 ETH
214572482024-12-22 9:49:3540 hrs ago1734860975
0x7556085E...fA5Ee6e11
0.0003 ETH
214527422024-12-21 18:42:232 days ago1734806543
0x7556085E...fA5Ee6e11
0.0003 ETH
214510002024-12-21 12:51:352 days ago1734785495
0x7556085E...fA5Ee6e11
0.0003 ETH
214498152024-12-21 8:53:472 days ago1734771227
0x7556085E...fA5Ee6e11
0.0003 ETH
214470912024-12-20 23:43:113 days ago1734738191
0x7556085E...fA5Ee6e11
0.0003 ETH
214464492024-12-20 21:34:233 days ago1734730463
0x7556085E...fA5Ee6e11
0.0003 ETH
214460542024-12-20 20:15:113 days ago1734725711
0x7556085E...fA5Ee6e11
0.0003 ETH
214456052024-12-20 18:45:113 days ago1734720311
0x7556085E...fA5Ee6e11
0.0003 ETH
214451242024-12-20 17:08:353 days ago1734714515
0x7556085E...fA5Ee6e11
0.0003 ETH
214434462024-12-20 11:30:353 days ago1734694235
0x7556085E...fA5Ee6e11
0.0003 ETH
214417432024-12-20 5:47:593 days ago1734673679
0x7556085E...fA5Ee6e11
0.0003 ETH
214412222024-12-20 4:03:353 days ago1734667415
0x7556085E...fA5Ee6e11
0.0003 ETH
214406542024-12-20 2:09:234 days ago1734660563
0x7556085E...fA5Ee6e11
0.0003 ETH
214402172024-12-20 0:41:474 days ago1734655307
0x7556085E...fA5Ee6e11
0.0003 ETH
214392322024-12-19 21:24:234 days ago1734643463
0x7556085E...fA5Ee6e11
0.0003 ETH
214391032024-12-19 20:58:114 days ago1734641891
0x7556085E...fA5Ee6e11
0.0003 ETH
214389982024-12-19 20:37:114 days ago1734640631
0x7556085E...fA5Ee6e11
0.0003 ETH
214355512024-12-19 9:03:594 days ago1734599039
0x7556085E...fA5Ee6e11
0.0003 ETH
214345842024-12-19 5:49:114 days ago1734587351
0x7556085E...fA5Ee6e11
0.0003 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RootTokenPeg

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Apache-2.0 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2023-11-13
*/

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.17;

// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

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

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

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

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

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

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

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

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

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

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

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

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

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

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

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

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

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

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

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @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, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * 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.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @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`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// Proof of a witnessed event by validators
struct EventProof {
    // The Id (nonce) of the event
    uint256 eventId;
    // The validator set Id which witnessed the event
    uint32 validatorSetId;
    // v,r,s are sparse arrays expected to align w public key in 'validators'
    // i.e. v[i], r[i], s[i] matches the i-th validator[i]
    // v part of validator signatures
    uint8[] v;
    // r part of validator signatures
    bytes32[] r;
    // s part of validator signatures
    bytes32[] s;
    // The validator addresses
    address[] validators;
}

interface IBridge {
    // A sent message event
    event SendMessage(uint messageId, address source, address destination, bytes message, uint256 fee);
    // Receive a bridge message from the remote chain
    function receiveMessage(address source, address destination, bytes calldata message, EventProof calldata proof) external payable;
    // Send a bridge message to the remote chain
    function sendMessage(address destination, bytes calldata message) external payable;
    // Send message fee - used by sendMessage caller to obtain required fee for sendMessage
    function sendMessageFee() external view returns (uint256);
}

interface IBridgeReceiver {
    // Handle a bridge message received from the remote chain
    // It is guaranteed to be valid
    function onMessageReceived(address source, bytes calldata message) external;
}

/// @title ERC20 Peg contract on ethereum
/// @author Root Network
/// @notice Provides an Eth/ERC20/GA Root network peg
///  - depositing: lock Eth/ERC20 tokens to redeem Root network "generic asset" (GA) 1:1
///  - withdrawing: burn or lock GAs to redeem Eth/ERC20 tokens 1:1
contract RootTokenPeg is Ownable, IBridgeReceiver, ReentrancyGuard, ERC165 {
    using SafeERC20 for IERC20;

    address public rootToken;

    // whether the peg is accepting deposits
    bool public depositsActive;
    // whether the peg is accepting withdrawals
    bool public withdrawalsActive;
    //  Bridge contract address
    IBridge public bridge;
    // the (pseudo) pallet address this contract is paired with on root
    address public palletAddress =
        address(0x6D6f646c65726332307065670000000000000000);

    event DepositActiveStatus(bool indexed active);
    event WithdrawalActiveStatus(bool indexed active);
    event BridgeAddressUpdated(address indexed bridge);
    event PalletAddressUpdated(address indexed palletAddress);
    event Endowed(uint256 indexed amount);
    event Deposit(
        address indexed _address,
        address indexed tokenAddress,
        uint128 indexed amount,
        address destination
    );
    event Withdraw(
        address indexed _address,
        address indexed tokenAddress,
        uint128 indexed amount
    );
    event AdminWithdraw(
        address indexed _address,
        address indexed tokenAddress,
        uint128 indexed amount
    );

    event RootTokenUpdated(address indexed rootToken);

    constructor(IBridge _bridge, address _rootToken) {
        bridge = _bridge;
        rootToken = _rootToken;
    }

    /// @notice Deposit amount of tokenAddress the pegged version of the token will be claim-able on Root network.
    function deposit(
        address _tokenAddress,
        uint128 _amount,
        address _destination
    ) external payable {
        require(depositsActive, "RTP: Deposits paused");
        require(_tokenAddress == rootToken, "RTP: Only ROOT token allowed");

        uint256 bridgeMessageFee = msg.value;

        require(
            msg.value >= bridge.sendMessageFee(),
            "RTP: Should include a fee"
        );
        IERC20(_tokenAddress).safeTransferFrom(
            msg.sender,
            address(this),
            _amount
        );

        emit Deposit(msg.sender, _tokenAddress, _amount, _destination);

        // send message to bridge - with fee to feeRecipient via bridge
        bytes memory message = abi.encode(_tokenAddress, _amount, _destination);

        bridge.sendMessage{value: bridgeMessageFee}(palletAddress, message);
    }

    function onMessageReceived(
        address _source,
        bytes calldata _message
    ) external override {
        // only accept calls from the bridge contract
        require(msg.sender == address(bridge), "RTP: Only bridge can call");
        // only accept messages from the peg pallet
        require(_source == palletAddress, "RTP: must be peg pallet address");

        (address tokenAddress, uint128 amount, address recipient) = abi.decode(
            _message,
            (address, uint128, address)
        );

        require(tokenAddress == rootToken, "RTP: Only ROOT token allowed");

        _withdraw(tokenAddress, amount, recipient);
    }

    /// @notice Withdraw tokens from this contract
    /// Requires signatures from a threshold of current Root network validators.
    function _withdraw(
        address _tokenAddress,
        uint128 _amount,
        address _recipient
    ) internal nonReentrant {
        require(withdrawalsActive, "RTP: Withdrawals paused");

        SafeERC20.safeTransfer(IERC20(_tokenAddress), _recipient, _amount);

        emit Withdraw(_recipient, _tokenAddress, _amount);
    }

    /// @dev See {IERC165-supportsInterface}. Docs: https://docs.openzeppelin.com/contracts/4.x/api/utils#IERC165
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override returns (bool) {
        return
            interfaceId == type(IBridgeReceiver).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    // ============================================================================================================= //
    // ============================================== Admin functions ============================================== //
    // ============================================================================================================= //

    /// @dev Endow the contract with ether
    function endow() external payable onlyOwner {
        require(msg.value > 0, "RTP: Must endow nonzero");
        emit Endowed(msg.value);
    }

    function setDepositsActive(bool _active) external onlyOwner {
        depositsActive = _active;
        emit DepositActiveStatus(_active);
    }

    function setWithdrawalsActive(bool _active) external onlyOwner {
        withdrawalsActive = _active;
        emit WithdrawalActiveStatus(_active);
    }

    function setBridgeAddress(IBridge _bridge) external onlyOwner {
        bridge = _bridge;
        emit BridgeAddressUpdated(address(_bridge));
    }

    function setPalletAddress(address _palletAddress) external onlyOwner {
        palletAddress = _palletAddress;
        emit PalletAddressUpdated(_palletAddress);
    }

    function adminEmergencyWithdraw(
        address _tokenAddress,
        uint128 _amount,
        address _recipient
    ) external onlyOwner {
        _withdraw(_tokenAddress, _amount, _recipient);
        emit AdminWithdraw(_recipient, _tokenAddress, _amount);
    }

    function setRootToken(address _rootToken) external onlyOwner {
        rootToken = _rootToken;
        emit RootTokenUpdated(_rootToken);
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IBridge","name":"_bridge","type":"address"},{"internalType":"address","name":"_rootToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_address","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint128","name":"amount","type":"uint128"}],"name":"AdminWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bridge","type":"address"}],"name":"BridgeAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_address","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"active","type":"bool"}],"name":"DepositActiveStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Endowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"palletAddress","type":"address"}],"name":"PalletAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rootToken","type":"address"}],"name":"RootTokenUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_address","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint128","name":"amount","type":"uint128"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"active","type":"bool"}],"name":"WithdrawalActiveStatus","type":"event"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint128","name":"_amount","type":"uint128"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"adminEmergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"contract IBridge","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint128","name":"_amount","type":"uint128"},{"internalType":"address","name":"_destination","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"depositsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endow","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_source","type":"address"},{"internalType":"bytes","name":"_message","type":"bytes"}],"name":"onMessageReceived","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"palletAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rootToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBridge","name":"_bridge","type":"address"}],"name":"setBridgeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_active","type":"bool"}],"name":"setDepositsActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_palletAddress","type":"address"}],"name":"setPalletAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rootToken","type":"address"}],"name":"setRootToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_active","type":"bool"}],"name":"setWithdrawalsActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawalsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

6080604052600480546001600160a01b031916736d6f646c6572633230706567000000000000000017905534801561003657600080fd5b506040516112f33803806112f3833981016040819052610055916100fb565b61005e33610093565b60018055600380546001600160a01b039384166001600160a01b03199182161790915560028054929093169116179055610135565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146100f857600080fd5b50565b6000806040838503121561010e57600080fd5b8251610119816100e3565b602084015190925061012a816100e3565b809150509250929050565b6111af806101446000396000f3fe6080604052600436106101095760003560e01c80637f5a22f911610095578063c9a9735811610064578063c9a97358146102b9578063e78cea92146102d9578063ea82e228146102f9578063f275c0ce1461030c578063f2fde38b1461032d57600080fd5b80637f5a22f91461023b57806384045be61461025b5780638da5cb5b1461027b578063c6c0f59e1461029957600080fd5b80632ee111ed116100dc5780632ee111ed146101a55780634500ca4d146101c5578063565764a6146101e6578063650bd36414610206578063715018a61461022657600080fd5b806301ffc9a71461010e57806306e30dfc146101435780631f2d00651461014d5780632acc664614610185575b600080fd5b34801561011a57600080fd5b5061012e610129366004610f28565b61034d565b60405190151581526020015b60405180910390f35b61014b610384565b005b34801561015957600080fd5b5060025461016d906001600160a01b031681565b6040516001600160a01b03909116815260200161013a565b34801561019157600080fd5b5061014b6101a0366004610f6e565b61040e565b3480156101b157600080fd5b5061014b6101c0366004610f6e565b610460565b3480156101d157600080fd5b5060025461012e90600160a81b900460ff1681565b3480156101f257600080fd5b5061014b610201366004610f99565b6104b2565b34801561021257600080fd5b5061014b610221366004610fb6565b610503565b34801561023257600080fd5b5061014b610642565b34801561024757600080fd5b5061014b610256366004610f6e565b610656565b34801561026757600080fd5b5061014b610276366004611057565b6106a8565b34801561028757600080fd5b506000546001600160a01b031661016d565b3480156102a557600080fd5b5060045461016d906001600160a01b031681565b3480156102c557600080fd5b5061014b6102d4366004610f99565b61070a565b3480156102e557600080fd5b5060035461016d906001600160a01b031681565b61014b610307366004611057565b61075b565b34801561031857600080fd5b5060025461012e90600160a01b900460ff1681565b34801561033957600080fd5b5061014b610348366004610f6e565b6109d9565b60006001600160e01b03198216631942f4d960e21b148061037e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61038c610a52565b600034116103e15760405162461bcd60e51b815260206004820152601760248201527f5254503a204d75737420656e646f77206e6f6e7a65726f00000000000000000060448201526064015b60405180910390fd5b60405134907f840be946bba3df0d184eb7e6cd7c9e57bb380cf6078516c7441db5709d58509890600090a2565b610416610a52565b600280546001600160a01b0319166001600160a01b0383169081179091556040517ffcf20591c0754520cb3363b01c0fedd61d114e5b8a718915f2b0cd5b4d9b3e6c90600090a250565b610468610a52565b600480546001600160a01b0319166001600160a01b0383169081179091556040517f679cb5acfebd038830b61daadd5f2f74e2114862b1c289a5d2db82bc6eda32a690600090a250565b6104ba610a52565b6002805460ff60a81b1916600160a81b831515908102919091179091556040517f2dd4e84c86f1d0ec949d1582751c7d8242fe120578eeece179a92603c8390ec690600090a250565b6003546001600160a01b0316331461055d5760405162461bcd60e51b815260206004820152601960248201527f5254503a204f6e6c79206272696467652063616e2063616c6c0000000000000060448201526064016103d8565b6004546001600160a01b038481169116146105ba5760405162461bcd60e51b815260206004820152601f60248201527f5254503a206d757374206265207065672070616c6c657420616464726573730060448201526064016103d8565b600080806105ca84860186611057565b60025492955090935091506001600160a01b0380851691161461062f5760405162461bcd60e51b815260206004820152601c60248201527f5254503a204f6e6c7920524f4f5420746f6b656e20616c6c6f7765640000000060448201526064016103d8565b61063a838383610aac565b505050505050565b61064a610a52565b6106546000610b79565b565b61065e610a52565b600380546001600160a01b0319166001600160a01b0383169081179091556040517fe5be83d44a251cb79ef6eb972655ca2528f5bb94376d7c2cb221c44d7bef6a8890600090a250565b6106b0610a52565b6106bb838383610aac565b816001600160801b0316836001600160a01b0316826001600160a01b03167f35581ac10323fb0300d485a0a3bd1bac90d3f96e3fc635bfabfdd8f584c6dc4760405160405180910390a4505050565b610712610a52565b6002805460ff60a01b1916600160a01b831515908102919091179091556040517f2c009dd90a018abf2687d6137dd2e32b025c58eb76dfc41a63f233f39a0b937e90600090a250565b600254600160a01b900460ff166107ab5760405162461bcd60e51b81526020600482015260146024820152731495140e8811195c1bdcda5d1cc81c185d5cd95960621b60448201526064016103d8565b6002546001600160a01b038481169116146108085760405162461bcd60e51b815260206004820152601c60248201527f5254503a204f6e6c7920524f4f5420746f6b656e20616c6c6f7765640000000060448201526064016103d8565b600354604080516350dcb02760e01b8152905134926001600160a01b0316916350dcb0279160048083019260209291908290030181865afa158015610851573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087591906110a0565b3410156108c45760405162461bcd60e51b815260206004820152601960248201527f5254503a2053686f756c6420696e636c7564652061206665650000000000000060448201526064016103d8565b6108e26001600160a01b03851633306001600160801b038716610bc9565b6040516001600160a01b0383811682526001600160801b038516919086169033907f6c1d053057c267c256657713ed64b4713d4391c73733b7d03028a68028e5143f9060200160405180910390a4604080516001600160a01b0386811660208301526001600160801b0386168284015284811660608084019190915283518084039091018152608083019384905260035460045463bb5ddb0f60e01b90955290939082169263bb5ddb0f9286926109a0929116908690608401611109565b6000604051808303818588803b1580156109b957600080fd5b505af11580156109cd573d6000803e3d6000fd5b50505050505050505050565b6109e1610a52565b6001600160a01b038116610a465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103d8565b610a4f81610b79565b50565b6000546001600160a01b031633146106545760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103d8565b610ab4610c3a565b600254600160a81b900460ff16610b0d5760405162461bcd60e51b815260206004820152601760248201527f5254503a205769746864726177616c732070617573656400000000000000000060448201526064016103d8565b610b218382846001600160801b0316610c93565b816001600160801b0316836001600160a01b0316826001600160a01b03167ff7c94207a71e9e28815faa70ca42021f47a1d25c25fbec0973eb7beb92f4219260405160405180910390a4610b7460018055565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052610c349085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610cc3565b50505050565b600260015403610c8c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103d8565b6002600155565b6040516001600160a01b038316602482015260448101829052610b7490849063a9059cbb60e01b90606401610bfd565b6000610d18826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d989092919063ffffffff16565b9050805160001480610d39575080806020019051810190610d39919061112d565b610b745760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103d8565b6060610da78484600085610daf565b949350505050565b606082471015610e105760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103d8565b600080866001600160a01b03168587604051610e2c919061114a565b60006040518083038185875af1925050503d8060008114610e69576040519150601f19603f3d011682016040523d82523d6000602084013e610e6e565b606091505b5091509150610e7f87838387610e8a565b979650505050505050565b60608315610ef9578251600003610ef2576001600160a01b0385163b610ef25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103d8565b5081610da7565b610da78383815115610f0e5781518083602001fd5b8060405162461bcd60e51b81526004016103d89190611166565b600060208284031215610f3a57600080fd5b81356001600160e01b031981168114610f5257600080fd5b9392505050565b6001600160a01b0381168114610a4f57600080fd5b600060208284031215610f8057600080fd5b8135610f5281610f59565b8015158114610a4f57600080fd5b600060208284031215610fab57600080fd5b8135610f5281610f8b565b600080600060408486031215610fcb57600080fd5b8335610fd681610f59565b9250602084013567ffffffffffffffff80821115610ff357600080fd5b818601915086601f83011261100757600080fd5b81358181111561101657600080fd5b87602082850101111561102857600080fd5b6020830194508093505050509250925092565b80356001600160801b038116811461105257600080fd5b919050565b60008060006060848603121561106c57600080fd5b833561107781610f59565b92506110856020850161103b565b9150604084013561109581610f59565b809150509250925092565b6000602082840312156110b257600080fd5b5051919050565b60005b838110156110d45781810151838201526020016110bc565b50506000910152565b600081518084526110f58160208601602086016110b9565b601f01601f19169290920160200192915050565b6001600160a01b0383168152604060208201819052600090610da7908301846110dd565b60006020828403121561113f57600080fd5b8151610f5281610f8b565b6000825161115c8184602087016110b9565b9190910192915050565b602081526000610f5260208301846110dd56fea264697066735822122009538e73b33d348e1e7e6c56bdf235a4ed2dc0a40b5409e904925e799d88364064736f6c63430008110033000000000000000000000000110fd9a44a056cb418d07f7d9957d0303f0020e400000000000000000000000069b2d8beef1aac40a7192195d726b5ffbb5a8cb8

Deployed Bytecode

0x6080604052600436106101095760003560e01c80637f5a22f911610095578063c9a9735811610064578063c9a97358146102b9578063e78cea92146102d9578063ea82e228146102f9578063f275c0ce1461030c578063f2fde38b1461032d57600080fd5b80637f5a22f91461023b57806384045be61461025b5780638da5cb5b1461027b578063c6c0f59e1461029957600080fd5b80632ee111ed116100dc5780632ee111ed146101a55780634500ca4d146101c5578063565764a6146101e6578063650bd36414610206578063715018a61461022657600080fd5b806301ffc9a71461010e57806306e30dfc146101435780631f2d00651461014d5780632acc664614610185575b600080fd5b34801561011a57600080fd5b5061012e610129366004610f28565b61034d565b60405190151581526020015b60405180910390f35b61014b610384565b005b34801561015957600080fd5b5060025461016d906001600160a01b031681565b6040516001600160a01b03909116815260200161013a565b34801561019157600080fd5b5061014b6101a0366004610f6e565b61040e565b3480156101b157600080fd5b5061014b6101c0366004610f6e565b610460565b3480156101d157600080fd5b5060025461012e90600160a81b900460ff1681565b3480156101f257600080fd5b5061014b610201366004610f99565b6104b2565b34801561021257600080fd5b5061014b610221366004610fb6565b610503565b34801561023257600080fd5b5061014b610642565b34801561024757600080fd5b5061014b610256366004610f6e565b610656565b34801561026757600080fd5b5061014b610276366004611057565b6106a8565b34801561028757600080fd5b506000546001600160a01b031661016d565b3480156102a557600080fd5b5060045461016d906001600160a01b031681565b3480156102c557600080fd5b5061014b6102d4366004610f99565b61070a565b3480156102e557600080fd5b5060035461016d906001600160a01b031681565b61014b610307366004611057565b61075b565b34801561031857600080fd5b5060025461012e90600160a01b900460ff1681565b34801561033957600080fd5b5061014b610348366004610f6e565b6109d9565b60006001600160e01b03198216631942f4d960e21b148061037e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61038c610a52565b600034116103e15760405162461bcd60e51b815260206004820152601760248201527f5254503a204d75737420656e646f77206e6f6e7a65726f00000000000000000060448201526064015b60405180910390fd5b60405134907f840be946bba3df0d184eb7e6cd7c9e57bb380cf6078516c7441db5709d58509890600090a2565b610416610a52565b600280546001600160a01b0319166001600160a01b0383169081179091556040517ffcf20591c0754520cb3363b01c0fedd61d114e5b8a718915f2b0cd5b4d9b3e6c90600090a250565b610468610a52565b600480546001600160a01b0319166001600160a01b0383169081179091556040517f679cb5acfebd038830b61daadd5f2f74e2114862b1c289a5d2db82bc6eda32a690600090a250565b6104ba610a52565b6002805460ff60a81b1916600160a81b831515908102919091179091556040517f2dd4e84c86f1d0ec949d1582751c7d8242fe120578eeece179a92603c8390ec690600090a250565b6003546001600160a01b0316331461055d5760405162461bcd60e51b815260206004820152601960248201527f5254503a204f6e6c79206272696467652063616e2063616c6c0000000000000060448201526064016103d8565b6004546001600160a01b038481169116146105ba5760405162461bcd60e51b815260206004820152601f60248201527f5254503a206d757374206265207065672070616c6c657420616464726573730060448201526064016103d8565b600080806105ca84860186611057565b60025492955090935091506001600160a01b0380851691161461062f5760405162461bcd60e51b815260206004820152601c60248201527f5254503a204f6e6c7920524f4f5420746f6b656e20616c6c6f7765640000000060448201526064016103d8565b61063a838383610aac565b505050505050565b61064a610a52565b6106546000610b79565b565b61065e610a52565b600380546001600160a01b0319166001600160a01b0383169081179091556040517fe5be83d44a251cb79ef6eb972655ca2528f5bb94376d7c2cb221c44d7bef6a8890600090a250565b6106b0610a52565b6106bb838383610aac565b816001600160801b0316836001600160a01b0316826001600160a01b03167f35581ac10323fb0300d485a0a3bd1bac90d3f96e3fc635bfabfdd8f584c6dc4760405160405180910390a4505050565b610712610a52565b6002805460ff60a01b1916600160a01b831515908102919091179091556040517f2c009dd90a018abf2687d6137dd2e32b025c58eb76dfc41a63f233f39a0b937e90600090a250565b600254600160a01b900460ff166107ab5760405162461bcd60e51b81526020600482015260146024820152731495140e8811195c1bdcda5d1cc81c185d5cd95960621b60448201526064016103d8565b6002546001600160a01b038481169116146108085760405162461bcd60e51b815260206004820152601c60248201527f5254503a204f6e6c7920524f4f5420746f6b656e20616c6c6f7765640000000060448201526064016103d8565b600354604080516350dcb02760e01b8152905134926001600160a01b0316916350dcb0279160048083019260209291908290030181865afa158015610851573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087591906110a0565b3410156108c45760405162461bcd60e51b815260206004820152601960248201527f5254503a2053686f756c6420696e636c7564652061206665650000000000000060448201526064016103d8565b6108e26001600160a01b03851633306001600160801b038716610bc9565b6040516001600160a01b0383811682526001600160801b038516919086169033907f6c1d053057c267c256657713ed64b4713d4391c73733b7d03028a68028e5143f9060200160405180910390a4604080516001600160a01b0386811660208301526001600160801b0386168284015284811660608084019190915283518084039091018152608083019384905260035460045463bb5ddb0f60e01b90955290939082169263bb5ddb0f9286926109a0929116908690608401611109565b6000604051808303818588803b1580156109b957600080fd5b505af11580156109cd573d6000803e3d6000fd5b50505050505050505050565b6109e1610a52565b6001600160a01b038116610a465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103d8565b610a4f81610b79565b50565b6000546001600160a01b031633146106545760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103d8565b610ab4610c3a565b600254600160a81b900460ff16610b0d5760405162461bcd60e51b815260206004820152601760248201527f5254503a205769746864726177616c732070617573656400000000000000000060448201526064016103d8565b610b218382846001600160801b0316610c93565b816001600160801b0316836001600160a01b0316826001600160a01b03167ff7c94207a71e9e28815faa70ca42021f47a1d25c25fbec0973eb7beb92f4219260405160405180910390a4610b7460018055565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052610c349085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610cc3565b50505050565b600260015403610c8c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103d8565b6002600155565b6040516001600160a01b038316602482015260448101829052610b7490849063a9059cbb60e01b90606401610bfd565b6000610d18826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d989092919063ffffffff16565b9050805160001480610d39575080806020019051810190610d39919061112d565b610b745760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103d8565b6060610da78484600085610daf565b949350505050565b606082471015610e105760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103d8565b600080866001600160a01b03168587604051610e2c919061114a565b60006040518083038185875af1925050503d8060008114610e69576040519150601f19603f3d011682016040523d82523d6000602084013e610e6e565b606091505b5091509150610e7f87838387610e8a565b979650505050505050565b60608315610ef9578251600003610ef2576001600160a01b0385163b610ef25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103d8565b5081610da7565b610da78383815115610f0e5781518083602001fd5b8060405162461bcd60e51b81526004016103d89190611166565b600060208284031215610f3a57600080fd5b81356001600160e01b031981168114610f5257600080fd5b9392505050565b6001600160a01b0381168114610a4f57600080fd5b600060208284031215610f8057600080fd5b8135610f5281610f59565b8015158114610a4f57600080fd5b600060208284031215610fab57600080fd5b8135610f5281610f8b565b600080600060408486031215610fcb57600080fd5b8335610fd681610f59565b9250602084013567ffffffffffffffff80821115610ff357600080fd5b818601915086601f83011261100757600080fd5b81358181111561101657600080fd5b87602082850101111561102857600080fd5b6020830194508093505050509250925092565b80356001600160801b038116811461105257600080fd5b919050565b60008060006060848603121561106c57600080fd5b833561107781610f59565b92506110856020850161103b565b9150604084013561109581610f59565b809150509250925092565b6000602082840312156110b257600080fd5b5051919050565b60005b838110156110d45781810151838201526020016110bc565b50506000910152565b600081518084526110f58160208601602086016110b9565b601f01601f19169290920160200192915050565b6001600160a01b0383168152604060208201819052600090610da7908301846110dd565b60006020828403121561113f57600080fd5b8151610f5281610f8b565b6000825161115c8184602087016110b9565b9190910192915050565b602081526000610f5260208301846110dd56fea264697066735822122009538e73b33d348e1e7e6c56bdf235a4ed2dc0a40b5409e904925e799d88364064736f6c63430008110033

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

000000000000000000000000110fd9a44a056cb418d07f7d9957d0303f0020e400000000000000000000000069b2d8beef1aac40a7192195d726b5ffbb5a8cb8

-----Decoded View---------------
Arg [0] : _bridge (address): 0x110fd9a44a056cb418D07F7d9957D0303F0020e4
Arg [1] : _rootToken (address): 0x69b2D8bEEF1aac40A7192195d726B5ffBb5a8cb8

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000110fd9a44a056cb418d07f7d9957d0303f0020e4
Arg [1] : 00000000000000000000000069b2d8beef1aac40a7192195d726b5ffbb5a8cb8


Deployed Bytecode Sourcemap

45241:5660:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;48996:247;;;;;;;;;;-1:-1:-1;48996:247:0;;;;;:::i;:::-;;:::i;:::-;;;470:14:1;;463:22;445:41;;433:2;418:18;48996:247:0;;;;;;;;49660:146;;;:::i;:::-;;45358:24;;;;;;;;;;-1:-1:-1;45358:24:0;;;;-1:-1:-1;;;;;45358:24:0;;;;;;-1:-1:-1;;;;;661:32:1;;;643:51;;631:2;616:18;45358:24:0;497:203:1;50752:146:0;;;;;;;;;;-1:-1:-1;50752:146:0;;;;;:::i;:::-;;:::i;50292:170::-;;;;;;;;;;-1:-1:-1;50292:170:0;;;;;:::i;:::-;;:::i;45519:29::-;;;;;;;;;;-1:-1:-1;45519:29:0;;;;-1:-1:-1;;;45519:29:0;;;;;;49969:156;;;;;;;;;;-1:-1:-1;49969:156:0;;;;;:::i;:::-;;:::i;47705:678::-;;;;;;;;;;-1:-1:-1;47705:678:0;;;;;:::i;:::-;;:::i;2668:103::-;;;;;;;;;;;;;:::i;50133:151::-;;;;;;;;;;-1:-1:-1;50133:151:0;;;;;:::i;:::-;;:::i;50470:274::-;;;;;;;;;;-1:-1:-1;50470:274:0;;;;;:::i;:::-;;:::i;2027:87::-;;;;;;;;;;-1:-1:-1;2073:7:0;2100:6;-1:-1:-1;;;;;2100:6:0;2027:87;;45689:91;;;;;;;;;;-1:-1:-1;45689:91:0;;;;-1:-1:-1;;;;;45689:91:0;;;49814:147;;;;;;;;;;-1:-1:-1;49814:147:0;;;;;:::i;:::-;;:::i;45588:21::-;;;;;;;;;;-1:-1:-1;45588:21:0;;;;-1:-1:-1;;;;;45588:21:0;;;46803:894;;;;;;:::i;:::-;;:::i;45437:26::-;;;;;;;;;;-1:-1:-1;45437:26:0;;;;-1:-1:-1;;;45437:26:0;;;;;;2926:201;;;;;;;;;;-1:-1:-1;2926:201:0;;;;;:::i;:::-;;:::i;48996:247::-;49097:4;-1:-1:-1;;;;;;49134:48:0;;-1:-1:-1;;;49134:48:0;;:101;;-1:-1:-1;;;;;;;;;;43462:40:0;;;49199:36;49114:121;48996:247;-1:-1:-1;;48996:247:0:o;49660:146::-;1913:13;:11;:13::i;:::-;49735:1:::1;49723:9;:13;49715:49;;;::::0;-1:-1:-1;;;49715:49:0;;3547:2:1;49715:49:0::1;::::0;::::1;3529:21:1::0;3586:2;3566:18;;;3559:30;3625:25;3605:18;;;3598:53;3668:18;;49715:49:0::1;;;;;;;;;49780:18;::::0;49788:9:::1;::::0;49780:18:::1;::::0;;;::::1;49660:146::o:0;50752:::-;1913:13;:11;:13::i;:::-;50824:9:::1;:22:::0;;-1:-1:-1;;;;;;50824:22:0::1;-1:-1:-1::0;;;;;50824:22:0;::::1;::::0;;::::1;::::0;;;50862:28:::1;::::0;::::1;::::0;-1:-1:-1;;50862:28:0::1;50752:146:::0;:::o;50292:170::-;1913:13;:11;:13::i;:::-;50372::::1;:30:::0;;-1:-1:-1;;;;;;50372:30:0::1;-1:-1:-1::0;;;;;50372:30:0;::::1;::::0;;::::1;::::0;;;50418:36:::1;::::0;::::1;::::0;-1:-1:-1;;50418:36:0::1;50292:170:::0;:::o;49969:156::-;1913:13;:11;:13::i;:::-;50043:17:::1;:27:::0;;-1:-1:-1;;;;50043:27:0::1;-1:-1:-1::0;;;50043:27:0;::::1;;::::0;;::::1;::::0;;;::::1;::::0;;;50086:31:::1;::::0;::::1;::::0;-1:-1:-1;;50086:31:0::1;49969:156:::0;:::o;47705:678::-;47913:6;;-1:-1:-1;;;;;47913:6:0;47891:10;:29;47883:67;;;;-1:-1:-1;;;47883:67:0;;3899:2:1;47883:67:0;;;3881:21:1;3938:2;3918:18;;;3911:30;3977:27;3957:18;;;3950:55;4022:18;;47883:67:0;3697:349:1;47883:67:0;48033:13;;-1:-1:-1;;;;;48022:24:0;;;48033:13;;48022:24;48014:68;;;;-1:-1:-1;;;48014:68:0;;4253:2:1;48014:68:0;;;4235:21:1;4292:2;4272:18;;;4265:30;4331:33;4311:18;;;4304:61;4382:18;;48014:68:0;4051:355:1;48014:68:0;48096:20;;;48155:86;;;;48180:8;48155:86;:::i;:::-;48278:9;;48095:146;;-1:-1:-1;48095:146:0;;-1:-1:-1;48095:146:0;-1:-1:-1;;;;;;48262:25:0;;;48278:9;;48262:25;48254:66;;;;-1:-1:-1;;;48254:66:0;;5096:2:1;48254:66:0;;;5078:21:1;5135:2;5115:18;;;5108:30;5174;5154:18;;;5147:58;5222:18;;48254:66:0;4894:352:1;48254:66:0;48333:42;48343:12;48357:6;48365:9;48333;:42::i;:::-;47817:566;;;47705:678;;;:::o;2668:103::-;1913:13;:11;:13::i;:::-;2733:30:::1;2760:1;2733:18;:30::i;:::-;2668:103::o:0;50133:151::-;1913:13;:11;:13::i;:::-;50206:6:::1;:16:::0;;-1:-1:-1;;;;;;50206:16:0::1;-1:-1:-1::0;;;;;50206:16:0;::::1;::::0;;::::1;::::0;;;50238:38:::1;::::0;::::1;::::0;-1:-1:-1;;50238:38:0::1;50133:151:::0;:::o;50470:274::-;1913:13;:11;:13::i;:::-;50626:45:::1;50636:13;50651:7;50660:10;50626:9;:45::i;:::-;50728:7;-1:-1:-1::0;;;;;50687:49:0::1;50713:13;-1:-1:-1::0;;;;;50687:49:0::1;50701:10;-1:-1:-1::0;;;;;50687:49:0::1;;;;;;;;;;;50470:274:::0;;;:::o;49814:147::-;1913:13;:11;:13::i;:::-;49885:14:::1;:24:::0;;-1:-1:-1;;;;49885:24:0::1;-1:-1:-1::0;;;49885:24:0;::::1;;::::0;;::::1;::::0;;;::::1;::::0;;;49925:28:::1;::::0;::::1;::::0;-1:-1:-1;;49925:28:0::1;49814:147:::0;:::o;46803:894::-;46952:14;;-1:-1:-1;;;46952:14:0;;;;46944:47;;;;-1:-1:-1;;;46944:47:0;;5453:2:1;46944:47:0;;;5435:21:1;5492:2;5472:18;;;5465:30;-1:-1:-1;;;5511:18:1;;;5504:50;5571:18;;46944:47:0;5251:344:1;46944:47:0;47027:9;;-1:-1:-1;;;;;47010:26:0;;;47027:9;;47010:26;47002:67;;;;-1:-1:-1;;;47002:67:0;;5096:2:1;47002:67:0;;;5078:21:1;5135:2;5115:18;;;5108:30;5174;5154:18;;;5147:58;5222:18;;47002:67:0;4894:352:1;47002:67:0;47166:6;;:23;;;-1:-1:-1;;;47166:23:0;;;;47109:9;;-1:-1:-1;;;;;47166:6:0;;:21;;:23;;;;;;;;;;;;;;:6;:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;47153:9;:36;;47131:111;;;;-1:-1:-1;;;47131:111:0;;5991:2:1;47131:111:0;;;5973:21:1;6030:2;6010:18;;;6003:30;6069:27;6049:18;;;6042:55;6114:18;;47131:111:0;5789:349:1;47131:111:0;47253:124;-1:-1:-1;;;;;47253:38:0;;47306:10;47339:4;-1:-1:-1;;;;;47253:124:0;;:38;:124::i;:::-;47395:57;;-1:-1:-1;;;;;661:32:1;;;643:51;;-1:-1:-1;;;;;47395:57:0;;;;;;;47403:10;;47395:57;;631:2:1;616:18;47395:57:0;;;;;;;47561:48;;;-1:-1:-1;;;;;6401:15:1;;;47561:48:0;;;6383:34:1;-1:-1:-1;;;;;6453:47:1;;6433:18;;;6426:75;6537:15;;;6517:18;;;;6510:43;;;;47561:48:0;;;;;;;;;;6318:18:1;;;47561:48:0;;;;47622:6;;47666:13;;-1:-1:-1;;;47622:67:0;;;47561:48;;47622:6;;;;:18;;47648:16;;47622:67;;47666:13;;;47561:48;;47622:67;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;46933:764;;46803:894;;;:::o;2926:201::-;1913:13;:11;:13::i;:::-;-1:-1:-1;;;;;3015:22:0;::::1;3007:73;;;::::0;-1:-1:-1;;;3007:73:0;;7615:2:1;3007:73:0::1;::::0;::::1;7597:21:1::0;7654:2;7634:18;;;7627:30;7693:34;7673:18;;;7666:62;-1:-1:-1;;;7744:18:1;;;7737:36;7790:19;;3007:73:0::1;7413:402:1::0;3007:73:0::1;3091:28;3110:8;3091:18;:28::i;:::-;2926:201:::0;:::o;2192:132::-;2073:7;2100:6;-1:-1:-1;;;;;2100:6:0;816:10;2256:23;2248:68;;;;-1:-1:-1;;;2248:68:0;;8022:2:1;2248:68:0;;;8004:21:1;;;8041:18;;;8034:30;8100:34;8080:18;;;8073:62;8152:18;;2248:68:0;7820:356:1;48525:348:0;22167:21;:19;:21::i;:::-;48679:17:::1;::::0;-1:-1:-1;;;48679:17:0;::::1;;;48671:53;;;::::0;-1:-1:-1;;;48671:53:0;;8383:2:1;48671:53:0::1;::::0;::::1;8365:21:1::0;8422:2;8402:18;;;8395:30;8461:25;8441:18;;;8434:53;8504:18;;48671:53:0::1;8181:347:1::0;48671:53:0::1;48737:66;48767:13;48783:10;48795:7;-1:-1:-1::0;;;;;48737:66:0::1;:22;:66::i;:::-;48857:7;-1:-1:-1::0;;;;;48821:44:0::1;48842:13;-1:-1:-1::0;;;;;48821:44:0::1;48830:10;-1:-1:-1::0;;;;;48821:44:0::1;;;;;;;;;;;22211:20:::0;21605:1;22731:22;;22548:213;22211:20;48525:348;;;:::o;3287:191::-;3361:16;3380:6;;-1:-1:-1;;;;;3397:17:0;;;-1:-1:-1;;;;;;3397:17:0;;;;;;3430:40;;3380:6;;;;;;;3430:40;;3361:16;3430:40;3350:128;3287:191;:::o;36096:205::-;36224:68;;-1:-1:-1;;;;;8791:15:1;;;36224:68:0;;;8773:34:1;8843:15;;8823:18;;;8816:43;8875:18;;;8868:34;;;36197:96:0;;36217:5;;-1:-1:-1;;;36247:27:0;8708:18:1;;36224:68:0;;;;-1:-1:-1;;36224:68:0;;;;;;;;;;;;;;-1:-1:-1;;;;;36224:68:0;-1:-1:-1;;;;;;36224:68:0;;;;;;;;;;36197:19;:96::i;:::-;36096:205;;;;:::o;22247:293::-;21649:1;22381:7;;:19;22373:63;;;;-1:-1:-1;;;22373:63:0;;9115:2:1;22373:63:0;;;9097:21:1;9154:2;9134:18;;;9127:30;9193:33;9173:18;;;9166:61;9244:18;;22373:63:0;8913:355:1;22373:63:0;21649:1;22514:7;:18;22247:293::o;35674:177::-;35784:58;;-1:-1:-1;;;;;9465:32:1;;35784:58:0;;;9447:51:1;9514:18;;;9507:34;;;35757:86:0;;35777:5;;-1:-1:-1;;;35807:23:0;9420:18:1;;35784:58:0;9273:274:1;39997:649:0;40421:23;40447:69;40475:4;40447:69;;;;;;;;;;;;;;;;;40455:5;-1:-1:-1;;;;;40447:27:0;;;:69;;;;;:::i;:::-;40421:95;;40535:10;:17;40556:1;40535:22;:56;;;;40572:10;40561:30;;;;;;;;;;;;:::i;:::-;40527:111;;;;-1:-1:-1;;;40527:111:0;;10004:2:1;40527:111:0;;;9986:21:1;10043:2;10023:18;;;10016:30;10082:34;10062:18;;;10055:62;-1:-1:-1;;;10133:18:1;;;10126:40;10183:19;;40527:111:0;9802:406:1;29556:229:0;29693:12;29725:52;29747:6;29755:4;29761:1;29764:12;29725:21;:52::i;:::-;29718:59;29556:229;-1:-1:-1;;;;29556:229:0:o;30642:455::-;30812:12;30870:5;30845:21;:30;;30837:81;;;;-1:-1:-1;;;30837:81:0;;10415:2:1;30837:81:0;;;10397:21:1;10454:2;10434:18;;;10427:30;10493:34;10473:18;;;10466:62;-1:-1:-1;;;10544:18:1;;;10537:36;10590:19;;30837:81:0;10213:402:1;30837:81:0;30930:12;30944:23;30971:6;-1:-1:-1;;;;;30971:11:0;30990:5;30997:4;30971:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30929:73;;;;31020:69;31047:6;31055:7;31064:10;31076:12;31020:26;:69::i;:::-;31013:76;30642:455;-1:-1:-1;;;;;;;30642:455:0:o;33215:644::-;33400:12;33429:7;33425:427;;;33457:10;:17;33478:1;33457:22;33453:290;;-1:-1:-1;;;;;27096:19:0;;;33667:60;;;;-1:-1:-1;;;33667:60:0;;11114:2:1;33667:60:0;;;11096:21:1;11153:2;11133:18;;;11126:30;11192:31;11172:18;;;11165:59;11241:18;;33667:60:0;10912:353:1;33667:60:0;-1:-1:-1;33764:10:0;33757:17;;33425:427;33807:33;33815:10;33827:12;34562:17;;:21;34558:388;;34794:10;34788:17;34851:15;34838:10;34834:2;34830:19;34823:44;34558:388;34921:12;34914:20;;-1:-1:-1;;;34914:20:0;;;;;;;;:::i;14:286:1:-;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;167:23;;-1:-1:-1;;;;;;219:32:1;;209:43;;199:71;;266:1;263;256:12;199:71;289:5;14:286;-1:-1:-1;;;14:286:1:o;705:131::-;-1:-1:-1;;;;;780:31:1;;770:42;;760:70;;826:1;823;816:12;841:247;900:6;953:2;941:9;932:7;928:23;924:32;921:52;;;969:1;966;959:12;921:52;1008:9;995:23;1027:31;1052:5;1027:31;:::i;1093:118::-;1179:5;1172:13;1165:21;1158:5;1155:32;1145:60;;1201:1;1198;1191:12;1216:241;1272:6;1325:2;1313:9;1304:7;1300:23;1296:32;1293:52;;;1341:1;1338;1331:12;1293:52;1380:9;1367:23;1399:28;1421:5;1399:28;:::i;1462:726::-;1541:6;1549;1557;1610:2;1598:9;1589:7;1585:23;1581:32;1578:52;;;1626:1;1623;1616:12;1578:52;1665:9;1652:23;1684:31;1709:5;1684:31;:::i;:::-;1734:5;-1:-1:-1;1790:2:1;1775:18;;1762:32;1813:18;1843:14;;;1840:34;;;1870:1;1867;1860:12;1840:34;1908:6;1897:9;1893:22;1883:32;;1953:7;1946:4;1942:2;1938:13;1934:27;1924:55;;1975:1;1972;1965:12;1924:55;2015:2;2002:16;2041:2;2033:6;2030:14;2027:34;;;2057:1;2054;2047:12;2027:34;2102:7;2097:2;2088:6;2084:2;2080:15;2076:24;2073:37;2070:57;;;2123:1;2120;2113:12;2070:57;2154:2;2150;2146:11;2136:21;;2176:6;2166:16;;;;;1462:726;;;;;:::o;2461:188::-;2529:20;;-1:-1:-1;;;;;2578:46:1;;2568:57;;2558:85;;2639:1;2636;2629:12;2558:85;2461:188;;;:::o;2654:462::-;2731:6;2739;2747;2800:2;2788:9;2779:7;2775:23;2771:32;2768:52;;;2816:1;2813;2806:12;2768:52;2855:9;2842:23;2874:31;2899:5;2874:31;:::i;:::-;2924:5;-1:-1:-1;2948:38:1;2982:2;2967:18;;2948:38;:::i;:::-;2938:48;;3038:2;3027:9;3023:18;3010:32;3051:33;3076:7;3051:33;:::i;:::-;3103:7;3093:17;;;2654:462;;;;;:::o;5600:184::-;5670:6;5723:2;5711:9;5702:7;5698:23;5694:32;5691:52;;;5739:1;5736;5729:12;5691:52;-1:-1:-1;5762:16:1;;5600:184;-1:-1:-1;5600:184:1:o;6564:250::-;6649:1;6659:113;6673:6;6670:1;6667:13;6659:113;;;6749:11;;;6743:18;6730:11;;;6723:39;6695:2;6688:10;6659:113;;;-1:-1:-1;;6806:1:1;6788:16;;6781:27;6564:250::o;6819:270::-;6860:3;6898:5;6892:12;6925:6;6920:3;6913:19;6941:76;7010:6;7003:4;6998:3;6994:14;6987:4;6980:5;6976:16;6941:76;:::i;:::-;7071:2;7050:15;-1:-1:-1;;7046:29:1;7037:39;;;;7078:4;7033:50;;6819:270;-1:-1:-1;;6819:270:1:o;7094:314::-;-1:-1:-1;;;;;7269:32:1;;7251:51;;7338:2;7333;7318:18;;7311:30;;;-1:-1:-1;;7358:44:1;;7383:18;;7375:6;7358:44;:::i;9552:245::-;9619:6;9672:2;9660:9;9651:7;9647:23;9643:32;9640:52;;;9688:1;9685;9678:12;9640:52;9720:9;9714:16;9739:28;9761:5;9739:28;:::i;10620:287::-;10749:3;10787:6;10781:13;10803:66;10862:6;10857:3;10850:4;10842:6;10838:17;10803:66;:::i;:::-;10885:16;;;;;10620:287;-1:-1:-1;;10620:287:1:o;11270:219::-;11419:2;11408:9;11401:21;11382:4;11439:44;11479:2;11468:9;11464:18;11456:6;11439:44;:::i

Swarm Source

ipfs://09538e73b33d348e1e7e6c56bdf235a4ed2dc0a40b5409e904925e799d883640

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.