Contract 0x3c3d457f1522D3540AB3325Aa5f1864E34cBA9D0

 
 
Txn Hash
Method
Block
From
To
Value
0xbbb83e19308fc9a6c3b7e7103bb35092898b71dd14fdb8486832599d724a5b1cSubmit Recover C...163167552023-01-02 4:39:1136 days 11 hrs ago0x9fa2acb21d32c4784d9cd1a0ca258b74e03676de IN  0x3c3d457f1522d3540ab3325aa5f1864e34cba9d00 Ether0.00035354 13.9174278
0x1d548f461dd05601dd2d8abdebb7aab4bcfcad6d6b8c71e3bfb996a997ba7ab9Submit Contract ...162802652022-12-28 2:28:2341 days 13 hrs ago0x78884725dfb890346bb26be37b510a9f5019c063 IN  0x3c3d457f1522d3540ab3325aa5f1864e34cba9d00 Ether0.00033399 13.63806198
0xd2919f6502e8628ba6509fab16d3f6c91532ba094de0d8ea33b40dab5339aad9Initialize160508662022-11-26 1:25:5973 days 14 hrs ago0x859999b8a25352a326487a0f1f36e3a4fea45540 IN  0x3c3d457f1522d3540ab3325aa5f1864e34cba9d00 Ether0.0005566 11.44025202
0xe957ce70d0c6ee8352e273c3618e0b5676eb5b7b9e6db6af4bcbeabb4f5b5661Initialize160505342022-11-26 0:19:2373 days 15 hrs ago0x859999b8a25352a326487a0f1f36e3a4fea45540 IN  0x3c3d457f1522d3540ab3325aa5f1864e34cba9d00 Ether0.00041654 8.56146127
0x8047fcc462ad35734bc70ec3a20e7d323bb3cff097acf6259f3a24a274a94f5eInitialize160505262022-11-26 0:17:4773 days 15 hrs ago0x859999b8a25352a326487a0f1f36e3a4fea45540 IN  0x3c3d457f1522d3540ab3325aa5f1864e34cba9d00 Ether0.00042659 8.76818597
0x7a020985f2e08d1016977f4d37b6fc141479e77ec7a00ffca65c9e2f25649ef70x60806040155050522022-09-09 21:31:42150 days 18 hrs agoWormhole: Deployer IN  Create: Implementation0 Ether0.0701589122.9545902
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
Implementation

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 13 : ERC1967Upgrade.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.2;

import "../beacon/IBeacon.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967Upgrade {
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallSecure(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        address oldImplementation = _getImplementation();

        // Initial upgrade and setup call
        _setImplementation(newImplementation);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(newImplementation, data);
        }

        // Perform rollback test if not already in progress
        StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);
        if (!rollbackTesting.value) {
            // Trigger rollback using upgradeTo from the new implementation
            rollbackTesting.value = true;
            Address.functionDelegateCall(
                newImplementation,
                abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
            );
            rollbackTesting.value = false;
            // Check rollback was effective
            require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
            // Finally reset to the new implementation and log the upgrade
            _upgradeTo(newImplementation);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            Address.isContract(IBeacon(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        }
    }
}

File 2 of 13 : IBeacon.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 3 of 13 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 4 of 13 : StorageSlot.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly {
            r.slot := slot
        }
    }
}

File 5 of 13 : Getters.sol
// contracts/Getters.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

import "./State.sol";

contract Getters is State {
    function getGuardianSet(uint32 index) public view returns (Structs.GuardianSet memory) {
        return _state.guardianSets[index];
    }

    function getCurrentGuardianSetIndex() public view returns (uint32) {
        return _state.guardianSetIndex;
    }

    function getGuardianSetExpiry() public view returns (uint32) {
        return _state.guardianSetExpiry;
    }

    function governanceActionIsConsumed(bytes32 hash) public view returns (bool) {
        return _state.consumedGovernanceActions[hash];
    }

    function isInitialized(address impl) public view returns (bool) {
        return _state.initializedImplementations[impl];
    }

    function chainId() public view returns (uint16) {
        return _state.provider.chainId;
    }

    function evmChainId() public view returns (uint256) {
        return _state.evmChainId;
    }

    function isFork() public view returns (bool) {
        return evmChainId() != block.chainid;
    }

    function governanceChainId() public view returns (uint16){
        return _state.provider.governanceChainId;
    }

    function governanceContract() public view returns (bytes32){
        return _state.provider.governanceContract;
    }

    function messageFee() public view returns (uint256) {
        return _state.messageFee;
    }

    function nextSequence(address emitter) public view returns (uint64) {
        return _state.sequences[emitter];
    }
}

File 6 of 13 : Governance.sol
// contracts/Governance.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

import "./Structs.sol";
import "./GovernanceStructs.sol";
import "./Messages.sol";
import "./Setters.sol";

import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";

/**
 * @dev `Governance` defines a means to enacting changes to the core bridge contract,
 * guardianSets, message fees, and transfer fees
 */
abstract contract Governance is GovernanceStructs, Messages, Setters, ERC1967Upgrade {
    event ContractUpgraded(address indexed oldContract, address indexed newContract);
    event GuardianSetAdded(uint32 indexed index);

    // "Core" (left padded)
    bytes32 constant module = 0x00000000000000000000000000000000000000000000000000000000436f7265;

    /**
     * @dev Upgrades a contract via Governance VAA/VM
     */
    function submitContractUpgrade(bytes memory _vm) public {
        require(!isFork(), "invalid fork");

        Structs.VM memory vm = parseVM(_vm);

        // Verify the VAA is valid before processing it
        (bool isValid, string memory reason) = verifyGovernanceVM(vm);
        require(isValid, reason);

        GovernanceStructs.ContractUpgrade memory upgrade = parseContractUpgrade(vm.payload);

        // Verify the VAA is for this module
        require(upgrade.module == module, "Invalid Module");

        // Verify the VAA is for this chain
        require(upgrade.chain == chainId(), "Invalid Chain");

        // Record the governance action as consumed
        setGovernanceActionConsumed(vm.hash);

        // Upgrades the implementation to the new contract
        upgradeImplementation(upgrade.newContract);
    }

    /**
     * @dev Sets a `messageFee` via Governance VAA/VM
     */
    function submitSetMessageFee(bytes memory _vm) public {
        Structs.VM memory vm = parseVM(_vm);

        // Verify the VAA is valid before processing it
        (bool isValid, string memory reason) = verifyGovernanceVM(vm);
        require(isValid, reason);

        GovernanceStructs.SetMessageFee memory upgrade = parseSetMessageFee(vm.payload);

        // Verify the VAA is for this module
        require(upgrade.module == module, "Invalid Module");

        // Verify the VAA is for this chain
        require(upgrade.chain == chainId() && !isFork(), "Invalid Chain");

        // Record the governance action as consumed to prevent reentry
        setGovernanceActionConsumed(vm.hash);

        // Updates the messageFee
        setMessageFee(upgrade.messageFee);
    }

    /**
     * @dev Deploys a new `guardianSet` via Governance VAA/VM
     */
    function submitNewGuardianSet(bytes memory _vm) public {
        Structs.VM memory vm = parseVM(_vm);

        // Verify the VAA is valid before processing it
        (bool isValid, string memory reason) = verifyGovernanceVM(vm);
        require(isValid, reason);

        GovernanceStructs.GuardianSetUpgrade memory upgrade = parseGuardianSetUpgrade(vm.payload);

        // Verify the VAA is for this module
        require(upgrade.module == module, "invalid Module");

        // Verify the VAA is for this chain
        require((upgrade.chain == chainId() && !isFork()) || upgrade.chain == 0, "invalid Chain");

        // Verify the Guardian Set keys are not empty, this guards
        // against the accidential upgrade to an empty GuardianSet
        require(upgrade.newGuardianSet.keys.length > 0, "new guardian set is empty");

        // Verify that the index is incrementing via a predictable +1 pattern
        require(upgrade.newGuardianSetIndex == getCurrentGuardianSetIndex() + 1, "index must increase in steps of 1");

        // Record the governance action as consumed to prevent reentry
        setGovernanceActionConsumed(vm.hash);

        // Trigger a time-based expiry of current guardianSet
        expireGuardianSet(getCurrentGuardianSetIndex());

        // Add the new guardianSet to guardianSets
        storeGuardianSet(upgrade.newGuardianSet, upgrade.newGuardianSetIndex);

        // Makes the new guardianSet effective
        updateGuardianSetIndex(upgrade.newGuardianSetIndex);
    }

    /**
     * @dev Submits transfer fees to the recipient via Governance VAA/VM
     */
    function submitTransferFees(bytes memory _vm) public {
        Structs.VM memory vm = parseVM(_vm);

        // Verify the VAA is valid before processing it
        (bool isValid, string memory reason) = verifyGovernanceVM(vm);
        require(isValid, reason);

        // Obtains the transfer from the VAA payload
        GovernanceStructs.TransferFees memory transfer = parseTransferFees(vm.payload);

        // Verify the VAA is for this module
        require(transfer.module == module, "invalid Module");

        // Verify the VAA is for this chain
        require((transfer.chain == chainId() && !isFork()) || transfer.chain == 0, "invalid Chain");

        // Record the governance action as consumed to prevent reentry
        setGovernanceActionConsumed(vm.hash);

        // Obtains the recipient address to be paid transfer fees
        address payable recipient = payable(address(uint160(uint256(transfer.recipient))));

        // Transfers transfer fees to the recipient
        recipient.transfer(transfer.amount);
    }

    /**
    * @dev Updates the `chainId` and `evmChainId` on a forked chain via Governance VAA/VM
    */
    function submitRecoverChainId(bytes memory _vm) public {
        require(isFork(), "not a fork");

        Structs.VM memory vm = parseVM(_vm);

        // Verify the VAA is valid before processing it
        (bool isValid, string memory reason) = verifyGovernanceVM(vm);
        require(isValid, reason);

        GovernanceStructs.RecoverChainId memory rci = parseRecoverChainId(vm.payload);

        // Verify the VAA is for this module
        require(rci.module == module, "invalid Module");

        // Verify the VAA is for this chain
        require(rci.evmChainId == block.chainid, "invalid EVM Chain");

        // Record the governance action as consumed to prevent reentry
        setGovernanceActionConsumed(vm.hash);

        // Update the chainIds
        setEvmChainId(rci.evmChainId);
        setChainId(rci.newChainId);
    }

    /**
     * @dev Upgrades the `currentImplementation` with a `newImplementation`
     */
    function upgradeImplementation(address newImplementation) internal {
        address currentImplementation = _getImplementation();

        _upgradeTo(newImplementation);

        // Call initialize function of the new implementation
        (bool success, bytes memory reason) = newImplementation.delegatecall(abi.encodeWithSignature("initialize()"));

        require(success, string(reason));

        emit ContractUpgraded(currentImplementation, newImplementation);
    }

    /**
     * @dev Verifies a Governance VAA/VM is valid
     */
    function verifyGovernanceVM(Structs.VM memory vm) internal view returns (bool, string memory){
        // Verify the VAA is valid
        (bool isValid, string memory reason) = verifyVM(vm);
        if (!isValid){
            return (false, reason);
        }

        // only current guardianset can sign governance packets
        if (vm.guardianSetIndex != getCurrentGuardianSetIndex()) {
            return (false, "not signed by current guardian set");
        }

        // Verify the VAA is from the governance chain (Solana)
        if (uint16(vm.emitterChainId) != governanceChainId()) {
            return (false, "wrong governance chain");
        }

        // Verify the emitter contract is the governance contract (0x4 left padded)
        if (vm.emitterAddress != governanceContract()) {
            return (false, "wrong governance contract");
        }

        // Verify this governance action hasn't already been
        // consumed to prevent reentry and replay
        if (governanceActionIsConsumed(vm.hash)){
            return (false, "governance action already consumed");
        }

        // Confirm the governance VAA/VM is valid
        return (true, "");
    }
}

File 7 of 13 : GovernanceStructs.sol
// contracts/GovernanceStructs.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

import "./libraries/external/BytesLib.sol";
import "./Structs.sol";

/**
 * @dev `GovernanceStructs` defines a set of structs and parsing functions
 * for minimal struct validation
 */
contract GovernanceStructs {
    using BytesLib for bytes;

    enum GovernanceAction {
        UpgradeContract,
        UpgradeGuardianset
    }

    struct ContractUpgrade {
        bytes32 module;
        uint8 action;
        uint16 chain;

        address newContract;
    }

    struct GuardianSetUpgrade {
        bytes32 module;
        uint8 action;
        uint16 chain;

        Structs.GuardianSet newGuardianSet;
        uint32 newGuardianSetIndex;
    }

    struct SetMessageFee {
        bytes32 module;
        uint8 action;
        uint16 chain;

        uint256 messageFee;
    }

    struct TransferFees {
        bytes32 module;
        uint8 action;
        uint16 chain;

        uint256 amount;
        bytes32 recipient;
    }

    struct RecoverChainId {
        bytes32 module;
        uint8 action;

        uint256 evmChainId;
        uint16 newChainId;
    }

    /// @dev Parse a contract upgrade (action 1) with minimal validation
    function parseContractUpgrade(bytes memory encodedUpgrade) public pure returns (ContractUpgrade memory cu) {
        uint index = 0;

        cu.module = encodedUpgrade.toBytes32(index);
        index += 32;

        cu.action = encodedUpgrade.toUint8(index);
        index += 1;

        require(cu.action == 1, "invalid ContractUpgrade");

        cu.chain = encodedUpgrade.toUint16(index);
        index += 2;

        cu.newContract = address(uint160(uint256(encodedUpgrade.toBytes32(index))));
        index += 32;

        require(encodedUpgrade.length == index, "invalid ContractUpgrade");
    }

    /// @dev Parse a guardianSet upgrade (action 2) with minimal validation
    function parseGuardianSetUpgrade(bytes memory encodedUpgrade) public pure returns (GuardianSetUpgrade memory gsu) {
        uint index = 0;

        gsu.module = encodedUpgrade.toBytes32(index);
        index += 32;

        gsu.action = encodedUpgrade.toUint8(index);
        index += 1;

        require(gsu.action == 2, "invalid GuardianSetUpgrade");

        gsu.chain = encodedUpgrade.toUint16(index);
        index += 2;

        gsu.newGuardianSetIndex = encodedUpgrade.toUint32(index);
        index += 4;

        uint8 guardianLength = encodedUpgrade.toUint8(index);
        index += 1;

        gsu.newGuardianSet = Structs.GuardianSet({
            keys : new address[](guardianLength),
            expirationTime : 0
        });

        for(uint i = 0; i < guardianLength; i++) {
            gsu.newGuardianSet.keys[i] = encodedUpgrade.toAddress(index);
            index += 20;
        }

        require(encodedUpgrade.length == index, "invalid GuardianSetUpgrade");
    }

    /// @dev Parse a setMessageFee (action 3) with minimal validation
    function parseSetMessageFee(bytes memory encodedSetMessageFee) public pure returns (SetMessageFee memory smf) {
        uint index = 0;

        smf.module = encodedSetMessageFee.toBytes32(index);
        index += 32;

        smf.action = encodedSetMessageFee.toUint8(index);
        index += 1;

        require(smf.action == 3, "invalid SetMessageFee");

        smf.chain = encodedSetMessageFee.toUint16(index);
        index += 2;

        smf.messageFee = encodedSetMessageFee.toUint256(index);
        index += 32;

        require(encodedSetMessageFee.length == index, "invalid SetMessageFee");
    }

    /// @dev Parse a transferFees (action 4) with minimal validation
    function parseTransferFees(bytes memory encodedTransferFees) public pure returns (TransferFees memory tf) {
        uint index = 0;

        tf.module = encodedTransferFees.toBytes32(index);
        index += 32;

        tf.action = encodedTransferFees.toUint8(index);
        index += 1;

        require(tf.action == 4, "invalid TransferFees");

        tf.chain = encodedTransferFees.toUint16(index);
        index += 2;

        tf.amount = encodedTransferFees.toUint256(index);
        index += 32;

        tf.recipient = encodedTransferFees.toBytes32(index);
        index += 32;

        require(encodedTransferFees.length == index, "invalid TransferFees");
    }

    /// @dev Parse a recoverChainId (action 5) with minimal validation
    function parseRecoverChainId(bytes memory encodedRecoverChainId) public pure returns (RecoverChainId memory rci) {
        uint index = 0;

        rci.module = encodedRecoverChainId.toBytes32(index);
        index += 32;

        rci.action = encodedRecoverChainId.toUint8(index);
        index += 1;

        require(rci.action == 5, "invalid RecoverChainId");

        rci.evmChainId = encodedRecoverChainId.toUint256(index);
        index += 32;

        rci.newChainId = encodedRecoverChainId.toUint16(index);
        index += 2;

        require(encodedRecoverChainId.length == index, "invalid RecoverChainId");
    }
}

File 8 of 13 : Implementation.sol
// contracts/Implementation.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

import "./Governance.sol";

import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol";

contract Implementation is Governance {
    event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel);

    // Publish a message to be attested by the Wormhole network
    function publishMessage(
        uint32 nonce,
        bytes memory payload,
        uint8 consistencyLevel
    ) public payable returns (uint64 sequence) {
        // check fee
        require(msg.value == messageFee(), "invalid fee");

        sequence = useSequence(msg.sender);
        // emit log
        emit LogMessagePublished(msg.sender, sequence, nonce, payload, consistencyLevel);
    }

    function useSequence(address emitter) internal returns (uint64 sequence) {
        sequence = nextSequence(emitter);
        setNextSequence(emitter, sequence + 1);
    }

    function initialize() initializer public virtual {
        // this function needs to be exposed for an upgrade to pass
        uint256 evmChainId;
        uint16 chain = chainId();

        // Wormhole chain ids explicitly enumerated
        if        (chain == 2)  { evmChainId = 1;          // ethereum
        } else if (chain == 4)  { evmChainId = 56;         // bsc
        } else if (chain == 5)  { evmChainId = 137;        // polygon
        } else if (chain == 6)  { evmChainId = 43114;      // avalanche
        } else if (chain == 7)  { evmChainId = 42262;      // oasis
        } else if (chain == 9)  { evmChainId = 1313161554; // aurora
        } else if (chain == 10) { evmChainId = 250;        // fantom
        } else if (chain == 11) { evmChainId = 686;        // karura
        } else if (chain == 12) { evmChainId = 787;        // acala
        } else if (chain == 13) { evmChainId = 8217;       // klaytn
        } else if (chain == 14) { evmChainId = 42220;      // celo
        } else if (chain == 16) { evmChainId = 1284;       // moonbeam
        } else if (chain == 17) { evmChainId = 245022934;  // neon
        } else if (chain == 23) { evmChainId = 42161;      // arbitrum
        } else if (chain == 24) { evmChainId = 10;         // optimism
        } else if (chain == 25) { evmChainId = 100;        // gnosis
        } else {
            revert("Unknown chain id.");
        }

        setEvmChainId(evmChainId);
    }

    modifier initializer() {
        address implementation = ERC1967Upgrade._getImplementation();

        require(
            !isInitialized(implementation),
            "already initialized"
        );

        setInitialized(implementation);

        _;
    }

    fallback() external payable {revert("unsupported");}

    receive() external payable {revert("the Wormhole contract does not accept assets");}
}

File 9 of 13 : Messages.sol
// contracts/Messages.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

import "./Getters.sol";
import "./Structs.sol";
import "./libraries/external/BytesLib.sol";


contract Messages is Getters {
    using BytesLib for bytes;

    /// @dev parseAndVerifyVM serves to parse an encodedVM and wholy validate it for consumption
    function parseAndVerifyVM(bytes calldata encodedVM) public view returns (Structs.VM memory vm, bool valid, string memory reason) {
        vm = parseVM(encodedVM);
        (valid, reason) = verifyVM(vm);
    }

   /**
    * @dev `verifyVM` serves to validate an arbitrary vm against a valid Guardian set
    *  - it aims to make sure the VM is for a known guardianSet
    *  - it aims to ensure the guardianSet is not expired
    *  - it aims to ensure the VM has reached quorum
    *  - it aims to verify the signatures provided against the guardianSet
    */
    function verifyVM(Structs.VM memory vm) public view returns (bool valid, string memory reason) {
        /// @dev Obtain the current guardianSet for the guardianSetIndex provided
        Structs.GuardianSet memory guardianSet = getGuardianSet(vm.guardianSetIndex);

       /**
        * @dev Checks whether the guardianSet has zero keys
        * WARNING: This keys check is critical to ensure the guardianSet has keys present AND to ensure
        * that guardianSet key size doesn't fall to zero and negatively impact quorum assessment.  If guardianSet
        * key length is 0 and vm.signatures length is 0, this could compromise the integrity of both vm and
        * signature verification.
        */
        if(guardianSet.keys.length == 0){
            return (false, "invalid guardian set");
        }

        /// @dev Checks if VM guardian set index matches the current index (unless the current set is expired).
        if(vm.guardianSetIndex != getCurrentGuardianSetIndex() && guardianSet.expirationTime < block.timestamp){
            return (false, "guardian set has expired");
        }

       /**
        * @dev We're using a fixed point number transformation with 1 decimal to deal with rounding.
        *   WARNING: This quorum check is critical to assessing whether we have enough Guardian signatures to validate a VM
        *   if making any changes to this, obtain additional peer review. If guardianSet key length is 0 and
        *   vm.signatures length is 0, this could compromise the integrity of both vm and signature verification.
        */
        if (vm.signatures.length < quorum(guardianSet.keys.length)){
            return (false, "no quorum");
        }

        /// @dev Verify the proposed vm.signatures against the guardianSet
        (bool signaturesValid, string memory invalidReason) = verifySignatures(vm.hash, vm.signatures, guardianSet);
        if(!signaturesValid){
            return (false, invalidReason);
        }

        /// If we are here, we've validated the VM is a valid multi-sig that matches the guardianSet.
        return (true, "");
    }

    /**
     * @dev verifySignatures serves to validate arbitrary sigatures against an arbitrary guardianSet
     *  - it intentionally does not solve for expectations within guardianSet (you should use verifyVM if you need these protections)
     *  - it intentioanlly does not solve for quorum (you should use verifyVM if you need these protections)
     *  - it intentionally returns true when signatures is an empty set (you should use verifyVM if you need these protections)
     */
    function verifySignatures(bytes32 hash, Structs.Signature[] memory signatures, Structs.GuardianSet memory guardianSet) public pure returns (bool valid, string memory reason) {
        uint8 lastIndex = 0;
        uint256 guardianCount = guardianSet.keys.length;
        for (uint i = 0; i < signatures.length; i++) {
            Structs.Signature memory sig = signatures[i];

            /// Ensure that provided signature indices are ascending only
            require(i == 0 || sig.guardianIndex > lastIndex, "signature indices must be ascending");
            lastIndex = sig.guardianIndex;

            /// @dev Ensure that the provided signature index is within the
            /// bounds of the guardianSet. This is implicitly checked by the array
            /// index operation below, so this check is technically redundant.
            /// However, reverting explicitly here ensures that a bug is not
            /// introduced accidentally later due to the nontrivial storage
            /// semantics of solidity.
            require(sig.guardianIndex < guardianCount, "guardian index out of bounds");

            /// Check to see if the signer of the signature does not match a specific Guardian key at the provided index
            if(ecrecover(hash, sig.v, sig.r, sig.s) != guardianSet.keys[sig.guardianIndex]){
                return (false, "VM signature invalid");
            }
        }

        /// If we are here, we've validated that the provided signatures are valid for the provided guardianSet
        return (true, "");
    }

    /**
     * @dev parseVM serves to parse an encodedVM into a vm struct
     *  - it intentionally performs no validation functions, it simply parses raw into a struct
     */
    function parseVM(bytes memory encodedVM) public pure virtual returns (Structs.VM memory vm) {
        uint index = 0;

        vm.version = encodedVM.toUint8(index);
        index += 1;
        // SECURITY: Note that currently the VM.version is not part of the hash 
        // and for reasons described below it cannot be made part of the hash. 
        // This means that this field's integrity is not protected and cannot be trusted. 
        // This is not a problem today since there is only one accepted version, but it 
        // could be a problem if we wanted to allow other versions in the future. 
        require(vm.version == 1, "VM version incompatible"); 

        vm.guardianSetIndex = encodedVM.toUint32(index);
        index += 4;

        // Parse Signatures
        uint256 signersLen = encodedVM.toUint8(index);
        index += 1;
        vm.signatures = new Structs.Signature[](signersLen);
        for (uint i = 0; i < signersLen; i++) {
            vm.signatures[i].guardianIndex = encodedVM.toUint8(index);
            index += 1;

            vm.signatures[i].r = encodedVM.toBytes32(index);
            index += 32;
            vm.signatures[i].s = encodedVM.toBytes32(index);
            index += 32;
            vm.signatures[i].v = encodedVM.toUint8(index) + 27;
            index += 1;
        }

        /*
        Hash the body

        SECURITY: Do not change the way the hash of a VM is computed! 
        Changing it could result into two different hashes for the same observation. 
        But xDapps rely on the hash of an observation for replay protection.
        */
        bytes memory body = encodedVM.slice(index, encodedVM.length - index);
        vm.hash = keccak256(abi.encodePacked(keccak256(body)));

        // Parse the body
        vm.timestamp = encodedVM.toUint32(index);
        index += 4;

        vm.nonce = encodedVM.toUint32(index);
        index += 4;

        vm.emitterChainId = encodedVM.toUint16(index);
        index += 2;

        vm.emitterAddress = encodedVM.toBytes32(index);
        index += 32;

        vm.sequence = encodedVM.toUint64(index);
        index += 8;

        vm.consistencyLevel = encodedVM.toUint8(index);
        index += 1;

        vm.payload = encodedVM.slice(index, encodedVM.length - index);
    }

    /**
     * @dev quorum serves solely to determine the number of signatures required to acheive quorum
     */
    function quorum(uint numGuardians) public pure virtual returns (uint numSignaturesRequiredForQuorum) {
        // The max number of guardians is 255
        require(numGuardians < 256, "too many guardians");
        return ((numGuardians * 2) / 3) + 1;
    }
}

File 10 of 13 : Setters.sol
// contracts/Setters.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

import "./State.sol";

contract Setters is State {
    function updateGuardianSetIndex(uint32 newIndex) internal {
        _state.guardianSetIndex = newIndex;
    }

    function expireGuardianSet(uint32 index) internal {
        _state.guardianSets[index].expirationTime = uint32(block.timestamp) + 86400;
    }

    function storeGuardianSet(Structs.GuardianSet memory set, uint32 index) internal {
        _state.guardianSets[index] = set;
    }

    function setInitialized(address implementatiom) internal {
        _state.initializedImplementations[implementatiom] = true;
    }

    function setGovernanceActionConsumed(bytes32 hash) internal {
        _state.consumedGovernanceActions[hash] = true;
    }

    function setChainId(uint16 chainId) internal {
        _state.provider.chainId = chainId;
    }

    function setGovernanceChainId(uint16 chainId) internal {
        _state.provider.governanceChainId = chainId;
    }

    function setGovernanceContract(bytes32 governanceContract) internal {
        _state.provider.governanceContract = governanceContract;
    }

    function setMessageFee(uint256 newFee) internal {
        _state.messageFee = newFee;
    }

    function setNextSequence(address emitter, uint64 sequence) internal {
        _state.sequences[emitter] = sequence;
    }

    function setEvmChainId(uint256 evmChainId) internal {
        require(evmChainId == block.chainid, "invalid evmChainId");
        _state.evmChainId = evmChainId;
    }
}

File 11 of 13 : State.sol
// contracts/State.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

import "./Structs.sol";

contract Events {
    event LogGuardianSetChanged(
        uint32 oldGuardianIndex,
        uint32 newGuardianIndex
    );

    event LogMessagePublished(
        address emitter_address,
        uint32 nonce,
        bytes payload
    );
}

contract Storage {
    struct WormholeState {
        Structs.Provider provider;

        // Mapping of guardian_set_index => guardian set
        mapping(uint32 => Structs.GuardianSet) guardianSets;

        // Current active guardian set index
        uint32 guardianSetIndex;

        // Period for which a guardian set stays active after it has been replaced
        uint32 guardianSetExpiry;

        // Sequence numbers per emitter
        mapping(address => uint64) sequences;

        // Mapping of consumed governance actions
        mapping(bytes32 => bool) consumedGovernanceActions;

        // Mapping of initialized implementations
        mapping(address => bool) initializedImplementations;

        uint256 messageFee;

        // EIP-155 Chain ID
        uint256 evmChainId;
    }
}

contract State {
    Storage.WormholeState _state;
}

File 12 of 13 : Structs.sol
// contracts/Structs.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

interface Structs {
	struct Provider {
		uint16 chainId;
		uint16 governanceChainId;
		bytes32 governanceContract;
	}

	struct GuardianSet {
		address[] keys;
		uint32 expirationTime;
	}

	struct Signature {
		bytes32 r;
		bytes32 s;
		uint8 v;
		uint8 guardianIndex;
	}

	struct VM {
		uint8 version;
		uint32 timestamp;
		uint32 nonce;
		uint16 emitterChainId;
		bytes32 emitterAddress;
		uint64 sequence;
		uint8 consistencyLevel;
		bytes payload;

		uint32 guardianSetIndex;
		Signature[] signatures;

		bytes32 hash;
	}
}

File 13 of 13 : BytesLib.sol
// SPDX-License-Identifier: Unlicense
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity >=0.8.0 <0.9.0;


library BytesLib {
    function concat(
        bytes memory _preBytes,
        bytes memory _postBytes
    )
        internal
        pure
        returns (bytes memory)
    {
        bytes memory tempBytes;

        assembly {
            // Get a location of some free memory and store it in tempBytes as
            // Solidity does for memory variables.
            tempBytes := mload(0x40)

            // Store the length of the first bytes array at the beginning of
            // the memory for tempBytes.
            let length := mload(_preBytes)
            mstore(tempBytes, length)

            // Maintain a memory counter for the current write location in the
            // temp bytes array by adding the 32 bytes for the array length to
            // the starting location.
            let mc := add(tempBytes, 0x20)
            // Stop copying when the memory counter reaches the length of the
            // first bytes array.
            let end := add(mc, length)

            for {
                // Initialize a copy counter to the start of the _preBytes data,
                // 32 bytes into its memory.
                let cc := add(_preBytes, 0x20)
            } lt(mc, end) {
                // Increase both counters by 32 bytes each iteration.
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                // Write the _preBytes data into the tempBytes memory 32 bytes
                // at a time.
                mstore(mc, mload(cc))
            }

            // Add the length of _postBytes to the current length of tempBytes
            // and store it as the new length in the first 32 bytes of the
            // tempBytes memory.
            length := mload(_postBytes)
            mstore(tempBytes, add(length, mload(tempBytes)))

            // Move the memory counter back from a multiple of 0x20 to the
            // actual end of the _preBytes data.
            mc := end
            // Stop copying when the memory counter reaches the new combined
            // length of the arrays.
            end := add(mc, length)

            for {
                let cc := add(_postBytes, 0x20)
            } lt(mc, end) {
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                mstore(mc, mload(cc))
            }

            // Update the free-memory pointer by padding our last write location
            // to 32 bytes: add 31 bytes to the end of tempBytes to move to the
            // next 32 byte block, then round down to the nearest multiple of
            // 32. If the sum of the length of the two arrays is zero then add
            // one before rounding down to leave a blank 32 bytes (the length block with 0).
            mstore(0x40, and(
              add(add(end, iszero(add(length, mload(_preBytes)))), 31),
              not(31) // Round down to the nearest 32 bytes.
            ))
        }

        return tempBytes;
    }

    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
        assembly {
            // Read the first 32 bytes of _preBytes storage, which is the length
            // of the array. (We don't need to use the offset into the slot
            // because arrays use the entire slot.)
            let fslot := sload(_preBytes.slot)
            // Arrays of 31 bytes or less have an even value in their slot,
            // while longer arrays have an odd value. The actual length is
            // the slot divided by two for odd values, and the lowest order
            // byte divided by two for even values.
            // If the slot is even, bitwise and the slot with 255 and divide by
            // two to get the length. If the slot is odd, bitwise and the slot
            // with -1 and divide by two.
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)
            let newlength := add(slength, mlength)
            // slength can contain both the length and contents of the array
            // if length < 32 bytes so let's prepare for that
            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
            switch add(lt(slength, 32), lt(newlength, 32))
            case 2 {
                // Since the new array still fits in the slot, we just need to
                // update the contents of the slot.
                // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
                sstore(
                    _preBytes.slot,
                    // all the modifications to the slot are inside this
                    // next block
                    add(
                        // we can just add to the slot contents because the
                        // bytes we want to change are the LSBs
                        fslot,
                        add(
                            mul(
                                div(
                                    // load the bytes from memory
                                    mload(add(_postBytes, 0x20)),
                                    // zero all bytes to the right
                                    exp(0x100, sub(32, mlength))
                                ),
                                // and now shift left the number of bytes to
                                // leave space for the length in the slot
                                exp(0x100, sub(32, newlength))
                            ),
                            // increase length by the double of the memory
                            // bytes length
                            mul(mlength, 2)
                        )
                    )
                )
            }
            case 1 {
                // The stored value fits in the slot, but the combined value
                // will exceed it.
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

                // The contents of the _postBytes array start 32 bytes into
                // the structure. Our first read should obtain the `submod`
                // bytes that can fit into the unused space in the last word
                // of the stored array. To get this, we read 32 bytes starting
                // from `submod`, so the data we read overlaps with the array
                // contents by `submod` bytes. Masking the lowest-order
                // `submod` bytes allows us to add that value directly to the
                // stored value.

                let submod := sub(32, slength)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(
                    sc,
                    add(
                        and(
                            fslot,
                            0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
                        ),
                        and(mload(mc), mask)
                    )
                )

                for {
                    mc := add(mc, 0x20)
                    sc := add(sc, 1)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
            default {
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                // Start copying to the last used word of the stored array.
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

                // Copy over the first `submod` bytes of the new data as in
                // case 1 above.
                let slengthmod := mod(slength, 32)
                let mlengthmod := mod(mlength, 32)
                let submod := sub(32, slengthmod)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(sc, add(sload(sc), and(mload(mc), mask)))

                for {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
        }
    }

    function slice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    )
        internal
        pure
        returns (bytes memory)
    {
        require(_length + 31 >= _length, "slice_overflow");
        require(_bytes.length >= _start + _length, "slice_outOfBounds");

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
                // Get a location of some free memory and store it in tempBytes as
                // Solidity does for memory variables.
                tempBytes := mload(0x40)

                // The first word of the slice result is potentially a partial
                // word read from the original array. To read it, we calculate
                // the length of that partial word and start copying that many
                // bytes into the array. The first word we copy will start with
                // data we don't care about, but the last `lengthmod` bytes will
                // land at the beginning of the contents of the new array. When
                // we're done copying, we overwrite the full first word with
                // the actual length of the slice.
                let lengthmod := and(_length, 31)

                // The multiplication in the next line is necessary
                // because when slicing multiples of 32 bytes (lengthmod == 0)
                // the following copy loop was copying the origin's length
                // and then ending prematurely not copying everything it should.
                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                let end := add(mc, _length)

                for {
                    // The multiplication in the next line has the same exact purpose
                    // as the one above.
                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

                //update free-memory pointer
                //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)
                //zero out the 32 bytes slice we are about to return
                //we need to do it because Solidity does not garbage collect
                mstore(tempBytes, 0)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
        require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }

    function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {
        require(_bytes.length >= _start + 1 , "toUint8_outOfBounds");
        uint8 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x1), _start))
        }

        return tempUint;
    }

    function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {
        require(_bytes.length >= _start + 2, "toUint16_outOfBounds");
        uint16 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x2), _start))
        }

        return tempUint;
    }

    function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {
        require(_bytes.length >= _start + 4, "toUint32_outOfBounds");
        uint32 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x4), _start))
        }

        return tempUint;
    }

    function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {
        require(_bytes.length >= _start + 8, "toUint64_outOfBounds");
        uint64 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x8), _start))
        }

        return tempUint;
    }

    function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {
        require(_bytes.length >= _start + 12, "toUint96_outOfBounds");
        uint96 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0xc), _start))
        }

        return tempUint;
    }

    function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {
        require(_bytes.length >= _start + 16, "toUint128_outOfBounds");
        uint128 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x10), _start))
        }

        return tempUint;
    }

    function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {
        require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
        uint256 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
        }

        return tempUint;
    }

    function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {
        require(_bytes.length >= _start + 32, "toBytes32_outOfBounds");
        bytes32 tempBytes32;

        assembly {
            tempBytes32 := mload(add(add(_bytes, 0x20), _start))
        }

        return tempBytes32;
    }

    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

            // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
                // cb is a circuit breaker in the for loop since there's
                //  no said feature for inline assembly loops
                // cb = 1 - don't breaker
                // cb = 0 - break
                let cb := 1

                let mc := add(_preBytes, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(_postBytes, 0x20)
                // the next line is the loop condition:
                // while(uint256(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                        // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equalStorage(
        bytes storage _preBytes,
        bytes memory _postBytes
    )
        internal
        view
        returns (bool)
    {
        bool success = true;

        assembly {
            // we know _preBytes_offset is 0
            let fslot := sload(_preBytes.slot)
            // Decode the length of the stored array like in concatStorage().
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)

            // if lengths don't match the arrays are not equal
            switch eq(slength, mlength)
            case 1 {
                // slength can contain both the length and contents of the array
                // if length < 32 bytes so let's prepare for that
                // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
                if iszero(iszero(slength)) {
                    switch lt(slength, 32)
                    case 1 {
                        // blank the last byte which is the length
                        fslot := mul(div(fslot, 0x100), 0x100)

                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
                            // unsuccess:
                            success := 0
                        }
                    }
                    default {
                        // cb is a circuit breaker in the for loop since there's
                        //  no said feature for inline assembly loops
                        // cb = 1 - don't breaker
                        // cb = 0 - break
                        let cb := 1

                        // get the keccak hash to get the contents of the array
                        mstore(0x0, _preBytes.slot)
                        let sc := keccak256(0x0, 0x20)

                        let mc := add(_postBytes, 0x20)
                        let end := add(mc, mlength)

                        // the next line is the loop condition:
                        // while(uint256(mc < end) + cb == 2)
                        for {} eq(add(lt(mc, end), cb), 2) {
                            sc := add(sc, 1)
                            mc := add(mc, 0x20)
                        } {
                            if iszero(eq(sload(sc), mload(mc))) {
                                // unsuccess:
                                success := 0
                                cb := 0
                            }
                        }
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldContract","type":"address"},{"indexed":true,"internalType":"address","name":"newContract","type":"address"}],"name":"ContractUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"index","type":"uint32"}],"name":"GuardianSetAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint64","name":"sequence","type":"uint64"},{"indexed":false,"internalType":"uint32","name":"nonce","type":"uint32"},{"indexed":false,"internalType":"bytes","name":"payload","type":"bytes"},{"indexed":false,"internalType":"uint8","name":"consistencyLevel","type":"uint8"}],"name":"LogMessagePublished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"chainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"evmChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentGuardianSetIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"index","type":"uint32"}],"name":"getGuardianSet","outputs":[{"components":[{"internalType":"address[]","name":"keys","type":"address[]"},{"internalType":"uint32","name":"expirationTime","type":"uint32"}],"internalType":"struct Structs.GuardianSet","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGuardianSetExpiry","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"governanceActionIsConsumed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceChainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceContract","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isFork","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"impl","type":"address"}],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"emitter","type":"address"}],"name":"nextSequence","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedVM","type":"bytes"}],"name":"parseAndVerifyVM","outputs":[{"components":[{"internalType":"uint8","name":"version","type":"uint8"},{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint16","name":"emitterChainId","type":"uint16"},{"internalType":"bytes32","name":"emitterAddress","type":"bytes32"},{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"uint8","name":"consistencyLevel","type":"uint8"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint32","name":"guardianSetIndex","type":"uint32"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint8","name":"guardianIndex","type":"uint8"}],"internalType":"struct Structs.Signature[]","name":"signatures","type":"tuple[]"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"internalType":"struct Structs.VM","name":"vm","type":"tuple"},{"internalType":"bool","name":"valid","type":"bool"},{"internalType":"string","name":"reason","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpgrade","type":"bytes"}],"name":"parseContractUpgrade","outputs":[{"components":[{"internalType":"bytes32","name":"module","type":"bytes32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"uint16","name":"chain","type":"uint16"},{"internalType":"address","name":"newContract","type":"address"}],"internalType":"struct GovernanceStructs.ContractUpgrade","name":"cu","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpgrade","type":"bytes"}],"name":"parseGuardianSetUpgrade","outputs":[{"components":[{"internalType":"bytes32","name":"module","type":"bytes32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"uint16","name":"chain","type":"uint16"},{"components":[{"internalType":"address[]","name":"keys","type":"address[]"},{"internalType":"uint32","name":"expirationTime","type":"uint32"}],"internalType":"struct Structs.GuardianSet","name":"newGuardianSet","type":"tuple"},{"internalType":"uint32","name":"newGuardianSetIndex","type":"uint32"}],"internalType":"struct GovernanceStructs.GuardianSetUpgrade","name":"gsu","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedRecoverChainId","type":"bytes"}],"name":"parseRecoverChainId","outputs":[{"components":[{"internalType":"bytes32","name":"module","type":"bytes32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"uint256","name":"evmChainId","type":"uint256"},{"internalType":"uint16","name":"newChainId","type":"uint16"}],"internalType":"struct GovernanceStructs.RecoverChainId","name":"rci","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedSetMessageFee","type":"bytes"}],"name":"parseSetMessageFee","outputs":[{"components":[{"internalType":"bytes32","name":"module","type":"bytes32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"uint16","name":"chain","type":"uint16"},{"internalType":"uint256","name":"messageFee","type":"uint256"}],"internalType":"struct GovernanceStructs.SetMessageFee","name":"smf","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedTransferFees","type":"bytes"}],"name":"parseTransferFees","outputs":[{"components":[{"internalType":"bytes32","name":"module","type":"bytes32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"uint16","name":"chain","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"recipient","type":"bytes32"}],"internalType":"struct GovernanceStructs.TransferFees","name":"tf","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedVM","type":"bytes"}],"name":"parseVM","outputs":[{"components":[{"internalType":"uint8","name":"version","type":"uint8"},{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint16","name":"emitterChainId","type":"uint16"},{"internalType":"bytes32","name":"emitterAddress","type":"bytes32"},{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"uint8","name":"consistencyLevel","type":"uint8"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint32","name":"guardianSetIndex","type":"uint32"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint8","name":"guardianIndex","type":"uint8"}],"internalType":"struct Structs.Signature[]","name":"signatures","type":"tuple[]"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"internalType":"struct Structs.VM","name":"vm","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint8","name":"consistencyLevel","type":"uint8"}],"name":"publishMessage","outputs":[{"internalType":"uint64","name":"sequence","type":"uint64"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numGuardians","type":"uint256"}],"name":"quorum","outputs":[{"internalType":"uint256","name":"numSignaturesRequiredForQuorum","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_vm","type":"bytes"}],"name":"submitContractUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_vm","type":"bytes"}],"name":"submitNewGuardianSet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_vm","type":"bytes"}],"name":"submitRecoverChainId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_vm","type":"bytes"}],"name":"submitSetMessageFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_vm","type":"bytes"}],"name":"submitTransferFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint8","name":"guardianIndex","type":"uint8"}],"internalType":"struct Structs.Signature[]","name":"signatures","type":"tuple[]"},{"components":[{"internalType":"address[]","name":"keys","type":"address[]"},{"internalType":"uint32","name":"expirationTime","type":"uint32"}],"internalType":"struct Structs.GuardianSet","name":"guardianSet","type":"tuple"}],"name":"verifySignatures","outputs":[{"internalType":"bool","name":"valid","type":"bool"},{"internalType":"string","name":"reason","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"version","type":"uint8"},{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint16","name":"emitterChainId","type":"uint16"},{"internalType":"bytes32","name":"emitterAddress","type":"bytes32"},{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"uint8","name":"consistencyLevel","type":"uint8"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint32","name":"guardianSetIndex","type":"uint32"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"uint8","name":"guardianIndex","type":"uint8"}],"internalType":"struct Structs.Signature[]","name":"signatures","type":"tuple[]"},{"internalType":"bytes32","name":"hash","type":"bytes32"}],"internalType":"struct Structs.VM","name":"vm","type":"tuple"}],"name":"verifyVM","outputs":[{"internalType":"bool","name":"valid","type":"bool"},{"internalType":"string","name":"reason","type":"string"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50613650806100206000396000f3fe6080604052600436106101c65760003560e01c806393df337e116100f7578063cb4cfea811610095578063f42bc64111610064578063f42bc64114610712578063f8ce560a14610732578063f951975a14610752578063fbe3c2cd1461077f5761022d565b8063cb4cfea814610647578063d60b347f146106a1578063e039f224146106da578063eb8d3f12146106ef5761022d565b8063a9e11893116100d1578063a9e11893146105c3578063b172b222146105f0578063b19a437e14610605578063c0fd8bde146106185761022d565b806393df337e1461055b5780639a8a05921461057b578063a0cce1b3146105a35761022d565b80634fdc60fa1161016457806364d42b171161013e57806364d42b17146104e35780636606b4e0146104f85780638129fc1c14610518578063875be02a1461052d5761022d565b80634fdc60fa14610406578063515f3247146104695780635cb8cae2146104c35761022d565b80631a90a219116101a05780631a90a219146103245780631cfe7951146103435780632c3c02a41461036f5780634cf842b5146103af5761022d565b80630319e59c1461026357806304ca84cf146102d5578063178149e7146103025761022d565b3661022d5760405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201526b63636570742061737365747360a01b60648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152600b60248201526a1d5b9cdd5c1c1bdc9d195960aa1b6044820152606401610224565b34801561026f57600080fd5b5061028361027e366004612ea8565b61079e565b6040516102cc9190600060a0820190508251825260ff602084015116602083015261ffff6040840151166040830152606083015160608301526080830151608083015292915050565b60405180910390f35b3480156102e157600080fd5b506102f56102f0366004612ea8565b6108f4565b6040516102cc91906132c6565b34801561030e57600080fd5b5061032261031d366004612ea8565b610b27565b005b34801561033057600080fd5b506007545b6040519081526020016102cc565b34801561034f57600080fd5b5060035463ffffffff165b60405163ffffffff90911681526020016102cc565b34801561037b57600080fd5b5061039f61038a366004612d1d565b60009081526005602052604090205460ff1690565b60405190151581526020016102cc565b3480156103bb57600080fd5b506103ee6103ca366004612cfc565b6001600160a01b03166000908152600460205260409020546001600160401b031690565b6040516001600160401b0390911681526020016102cc565b34801561041257600080fd5b50610426610421366004612ea8565b610c60565b6040516102cc91908151815260208083015160ff169082015260408083015161ffff16908201526060918201516001600160a01b03169181019190915260800190565b34801561047557600080fd5b50610489610484366004612ea8565b610d9c565b6040516102cc91908151815260208083015160ff169082015260408083015161ffff16908201526060918201519181019190915260800190565b3480156104cf57600080fd5b506103226104de366004612ea8565b610ecb565b3480156104ef57600080fd5b50600854610335565b34801561050457600080fd5b50610322610513366004612ea8565b611010565b34801561052457600080fd5b50610322611220565b34801561053957600080fd5b5061054d610548366004612ee2565b6114ac565b6040516102cc929190613270565b34801561056757600080fd5b50610322610576366004612ea8565b61160f565b34801561058757600080fd5b5060005461ffff165b60405161ffff90911681526020016102cc565b3480156105af57600080fd5b5061054d6105be366004612d35565b61174b565b3480156105cf57600080fd5b506105e36105de366004612ea8565b611985565b6040516102cc9190613336565b3480156105fc57600080fd5b50600154610335565b6103ee61061336600461301b565b611d63565b34801561062457600080fd5b50610638610633366004612e3c565b611e03565b6040516102cc93929190613349565b34801561065357600080fd5b50610667610662366004612ea8565b611e65565b6040516102cc91908151815260208083015160ff16908201526040808301519082015260609182015161ffff169181019190915260800190565b3480156106ad57600080fd5b5061039f6106bc366004612cfc565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156106e657600080fd5b5061039f611f96565b3480156106fb57600080fd5b50600354640100000000900463ffffffff1661035a565b34801561071e57600080fd5b5061032261072d366004612ea8565b611fa9565b34801561073e57600080fd5b5061033561074d366004612d1d565b6120bb565b34801561075e57600080fd5b5061077261076d366004613001565b61212b565b6040516102cc9190613323565b34801561078b57600080fd5b5060005462010000900461ffff16610590565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052906107d383826121ca565b82526107e0602082613482565b90506107ec8382612228565b60ff1660208301526107ff600182613482565b9050816020015160ff1660041461084f5760405162461bcd60e51b8152602060048201526014602482015273696e76616c6964205472616e736665724665657360601b6044820152606401610224565b6108598382612284565b61ffff16604083015261086d600282613482565b905061087983826122e1565b6060830152610889602082613482565b905061089583826121ca565b60808301526108a5602082613482565b9050808351146108ee5760405162461bcd60e51b8152602060048201526014602482015273696e76616c6964205472616e736665724665657360601b6044820152606401610224565b50919050565b6108fc612a4a565b600061090883826121ca565b8252610915602082613482565b90506109218382612228565b60ff166020830152610934600182613482565b9050816020015160ff1660021461098d5760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420477561726469616e536574557067726164650000000000006044820152606401610224565b6109978382612284565b61ffff1660408301526109ab600282613482565b90506109b78382612336565b63ffffffff1660808301526109cd600482613482565b905060006109db8483612228565b90506109e8600183613482565b915060405180604001604052808260ff166001600160401b03811115610a1e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610a47578160200160208202803683370190505b5081526000602090910181905260608501919091525b8160ff16811015610acf57610a728584612393565b606085015151805183908110610a9857634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152610abb601484613482565b925080610ac78161358f565b915050610a5d565b5081845114610b205760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420477561726469616e536574557067726164650000000000006044820152606401610224565b5050919050565b610b2f611f96565b610b685760405162461bcd60e51b815260206004820152600a6024820152696e6f74206120666f726b60b01b6044820152606401610224565b6000610b7382611985565b9050600080610b81836123f8565b91509150818190610ba55760405162461bcd60e51b8152600401610224919061328b565b506000610bb58460e00151611e65565b805190915063436f726514610bdc5760405162461bcd60e51b81526004016102249061329e565b46816040015114610c235760405162461bcd60e51b815260206004820152601160248201527034b73b30b634b21022ab269021b430b4b760791b6044820152606401610224565b610c3184610140015161256e565b610c3e8160400151612589565b60608101516000805461ffff191661ffff9092169190911790555b5050505050565b604080516080810182526000808252602082018190529181018290526060810182905290610c8e83826121ca565b8252610c9b602082613482565b9050610ca78382612228565b60ff166020830152610cba600182613482565b9050816020015160ff16600114610d0d5760405162461bcd60e51b8152602060048201526017602482015276696e76616c696420436f6e74726163745570677261646560481b6044820152606401610224565b610d178382612284565b61ffff166040830152610d2b600282613482565b9050610d3783826121ca565b6001600160a01b03166060830152610d50602082613482565b9050808351146108ee5760405162461bcd60e51b8152602060048201526017602482015276696e76616c696420436f6e74726163745570677261646560481b6044820152606401610224565b604080516080810182526000808252602082018190529181018290526060810182905290610dca83826121ca565b8252610dd7602082613482565b9050610de38382612228565b60ff166020830152610df6600182613482565b9050816020015160ff16600314610e475760405162461bcd60e51b8152602060048201526015602482015274696e76616c6964205365744d65737361676546656560581b6044820152606401610224565b610e518382612284565b61ffff166040830152610e65600282613482565b9050610e7183826122e1565b6060830152610e81602082613482565b9050808351146108ee5760405162461bcd60e51b8152602060048201526015602482015274696e76616c6964205365744d65737361676546656560581b6044820152606401610224565b610ed3611f96565b15610f0f5760405162461bcd60e51b815260206004820152600c60248201526b696e76616c696420666f726b60a01b6044820152606401610224565b6000610f1a82611985565b9050600080610f28836123f8565b91509150818190610f4c5760405162461bcd60e51b8152600401610224919061328b565b506000610f5c8460e00151610c60565b805190915063436f726514610fa45760405162461bcd60e51b815260206004820152600e60248201526d496e76616c6964204d6f64756c6560901b6044820152606401610224565b60005461ffff1661ffff16816040015161ffff1614610ff55760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21021b430b4b760991b6044820152606401610224565b61100384610140015161256e565b610c5981606001516125d2565b600061101b82611985565b9050600080611029836123f8565b9150915081819061104d5760405162461bcd60e51b8152600401610224919061328b565b50600061105d8460e001516108f4565b805190915063436f7265146110845760405162461bcd60e51b81526004016102249061329e565b60005461ffff1661ffff16816040015161ffff161480156110aa57506110a8611f96565b155b806110bb5750604081015161ffff16155b6110f75760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b21021b430b4b760991b6044820152606401610224565b6060810151515161114a5760405162461bcd60e51b815260206004820152601960248201527f6e657720677561726469616e2073657420697320656d707479000000000000006044820152606401610224565b60035463ffffffff1661115e90600161349a565b63ffffffff16816080015163ffffffff16146111c65760405162461bcd60e51b815260206004820152602160248201527f696e646578206d75737420696e63726561736520696e207374657073206f66206044820152603160f81b6064820152608401610224565b6111d484610140015161256e565b6111eb6111e660035463ffffffff1690565b6126ff565b6111fd81606001518260800151612737565b60808101516003805463ffffffff191663ffffffff909216919091179055610c59565b60006112537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b9050611277816001600160a01b031660009081526006602052604090205460ff1690565b156112ba5760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610224565b6112e2816001600160a01b03166000908152600660205260409020805460ff19166001179055565b6000806112f260005461ffff1690565b90508061ffff166002141561130a576001915061149e565b8061ffff1660041415611320576038915061149e565b8061ffff1660051415611336576089915061149e565b8061ffff166006141561134d5761a86a915061149e565b8061ffff16600714156113645761a516915061149e565b8061ffff166009141561137d57634e454152915061149e565b8061ffff16600a14156113935760fa915061149e565b8061ffff16600b14156113aa576102ae915061149e565b8061ffff16600c14156113c157610313915061149e565b8061ffff16600d14156113d857612019915061149e565b8061ffff16600e14156113ef5761a4ec915061149e565b8061ffff166010141561140657610504915061149e565b8061ffff166011141561141f57630e9ac0d6915061149e565b8061ffff16601714156114365761a4b1915061149e565b8061ffff166018141561144c57600a915061149e565b8061ffff1660191415611462576064915061149e565b60405162461bcd60e51b81526020600482015260116024820152702ab735b737bbb71031b430b4b71034b21760791b6044820152606401610224565b6114a782612589565b505050565b6000606060006114c084610100015161212b565b805151909150611503576000604051806040016040528060148152602001731a5b9d985b1a590819dd585c991a585b881cd95d60621b8152509250925050915091565b60035463ffffffff1663ffffffff1684610100015163ffffffff1614158015611535575042816020015163ffffffff16105b1561157c5760006040518060400160405280601881526020017f677561726469616e2073657420686173206578706972656400000000000000008152509250925050915091565b805151611588906120bb565b8461012001515110156115c3576000604051806040016040528060098152602001686e6f2071756f72756d60b81b8152509250925050915091565b6000806115db8661014001518761012001518561174b565b91509150816115f1576000969095509350505050565b60016040518060200160405280600081525094509450505050915091565b600061161a82611985565b9050600080611628836123f8565b9150915081819061164c5760405162461bcd60e51b8152600401610224919061328b565b50600061165c8460e0015161079e565b805190915063436f7265146116835760405162461bcd60e51b81526004016102249061329e565b60005461ffff1661ffff16816040015161ffff161480156116a957506116a7611f96565b155b806116ba5750604081015161ffff16155b6116f65760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b21021b430b4b760991b6044820152606401610224565b61170484610140015161256e565b608081015160608201516040516001600160a01b0383169180156108fc02916000818181858888f19350505050158015611742573d6000803e3d6000fd5b50505050505050565b8051516000906060908290815b865181101561196357600087828151811061178357634e487b7160e01b600052603260045260246000fd5b6020026020010151905081600014806117a557508360ff16816060015160ff16115b6117fd5760405162461bcd60e51b815260206004820152602360248201527f7369676e617475726520696e6469636573206d75737420626520617363656e64604482015262696e6760e81b6064820152608401610224565b6060810151935060ff841683116118565760405162461bcd60e51b815260206004820152601c60248201527f677561726469616e20696e646578206f7574206f6620626f756e6473000000006044820152606401610224565b8660000151816060015160ff168151811061188157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031660018a836040015184600001518560200151604051600081526020016040526040516118da949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa1580156118fc573d6000803e3d6000fd5b505050602060405103516001600160a01b031614611950576000604051806040016040528060148152602001731593481cda59db985d1d5c99481a5b9d985b1a5960621b815250955095505050505061197d565b508061195b8161358f565b915050611758565b506001604051806020016040528060008152509350935050505b935093915050565b61198d612aa4565b60006119998382612228565b60ff1682526119a9600182613482565b9050816000015160ff16600114611a025760405162461bcd60e51b815260206004820152601760248201527f564d2076657273696f6e20696e636f6d70617469626c650000000000000000006044820152606401610224565b611a0c8382612336565b63ffffffff16610100830152611a23600482613482565b90506000611a318483612228565b60ff169050611a41600183613482565b9150806001600160401b03811115611a6957634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611abb57816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181611a875790505b5061012084015260005b81811015611c2a57611ad78584612228565b8461012001518281518110611afc57634e487b7160e01b600052603260045260246000fd5b602090810291909101015160ff909116606090910152611b1d600184613482565b9250611b2985846121ca565b8461012001518281518110611b4e57634e487b7160e01b600052603260045260246000fd5b60200260200101516000018181525050602083611b6b9190613482565b9250611b7785846121ca565b8461012001518281518110611b9c57634e487b7160e01b600052603260045260246000fd5b60200260200101516020018181525050602083611bb99190613482565b9250611bc58584612228565b611bd090601b6134e4565b8461012001518281518110611bf557634e487b7160e01b600052603260045260246000fd5b602090810291909101015160ff909116604090910152611c16600184613482565b925080611c228161358f565b915050611ac5565b506000611c4683848751611c3e9190613548565b87919061278b565b90508080519060200120604051602001611c6291815260200190565b60408051601f198184030181529190528051602090910120610140850152611c8a8584612336565b63ffffffff166020850152611ca0600484613482565b9250611cac8584612336565b63ffffffff166040850152611cc2600484613482565b9250611cce8584612284565b61ffff166060850152611ce2600284613482565b9250611cee85846121ca565b6080850152611cfe602084613482565b9250611d0a8584612898565b6001600160401b031660a0850152611d23600884613482565b9250611d2f8584612228565b60ff1660c0850152611d42600184613482565b9250611d5583848751611c3e9190613548565b60e085015250919392505050565b6000611d6e60075490565b3414611daa5760405162461bcd60e51b815260206004820152600b60248201526a696e76616c69642066656560a81b6044820152606401610224565b611db3336128f5565b9050336001600160a01b03167f6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b282868686604051611df49493929190613380565b60405180910390a29392505050565b611e0b612aa4565b60006060611e4e85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061198592505050565b9250611e59836114ac565b93969095509293505050565b604080516080810182526000808252602082018190529181018290526060810182905290611e9383826121ca565b8252611ea0602082613482565b9050611eac8382612228565b60ff166020830152611ebf600182613482565b9050816020015160ff16600514611f115760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a5908149958dbdd995c90da185a5b925960521b6044820152606401610224565b611f1b83826122e1565b6040830152611f2b602082613482565b9050611f378382612284565b61ffff166060830152611f4b600282613482565b9050808351146108ee5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a5908149958dbdd995c90da185a5b925960521b6044820152606401610224565b600046611fa260085490565b1415905090565b6000611fb482611985565b9050600080611fc2836123f8565b91509150818190611fe65760405162461bcd60e51b8152600401610224919061328b565b506000611ff68460e00151610d9c565b805190915063436f72651461203e5760405162461bcd60e51b815260206004820152600e60248201526d496e76616c6964204d6f64756c6560901b6044820152606401610224565b60005461ffff1661ffff16816040015161ffff161480156120645750612062611f96565b155b6120a05760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21021b430b4b760991b6044820152606401610224565b6120ae84610140015161256e565b610c598160600151600755565b600061010082106121035760405162461bcd60e51b8152602060048201526012602482015271746f6f206d616e7920677561726469616e7360701b6044820152606401610224565b6003612110836002613529565b61211a9190613509565b612125906001613482565b92915050565b60408051808201825260608082526000602080840182905263ffffffff861682526002815290849020845181549283028101840186529485018281529394939092849284918401828280156121a957602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161218b575b50505091835250506001919091015463ffffffff1660209091015292915050565b60006121d7826020613482565b8351101561221f5760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606401610224565b50016020015190565b6000612235826001613482565b8351101561227b5760405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606401610224565b50016001015190565b6000612291826002613482565b835110156122d85760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606401610224565b50016002015190565b60006122ee826020613482565b8351101561221f5760405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b6044820152606401610224565b6000612343826004613482565b8351101561238a5760405162461bcd60e51b8152602060048201526014602482015273746f55696e7433325f6f75744f66426f756e647360601b6044820152606401610224565b50016004015190565b60006123a0826014613482565b835110156123e85760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606401610224565b500160200151600160601b900490565b60006060600080612408856114ac565b915091508161241d5760009590945092505050565b60035463ffffffff1663ffffffff1685610100015163ffffffff16146124635760006040518060600160405280602281526020016135d760229139935093505050915091565b60005462010000900461ffff1661ffff16856060015161ffff16146124be576000604051806040016040528060168152602001753bb937b7339033b7bb32b93730b731b29031b430b4b760511b815250935093505050915091565b60015485608001511461250e5760006040518060400160405280601981526020017f77726f6e6720676f7665726e616e636520636f6e747261637400000000000000815250935093505050915091565b61014085015160009081526005602052604090205460ff16156125515760006040518060600160405280602281526020016135f960229139935093505050915091565b600160405180602001604052806000815250935093505050915091565b6000908152600560205260409020805460ff19166001179055565b4681146125cd5760405162461bcd60e51b81526020600482015260126024820152711a5b9d985b1a5908195d9b50da185a5b925960721b6044820152606401610224565b600855565b60006126057f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905061261082612965565b60408051600481526024810182526020810180516001600160e01b031663204a7f0760e21b179052905160009182916001600160a01b0386169161265391613254565b600060405180830381855af49150503d806000811461268e576040519150601f19603f3d011682016040523d82523d6000602084013e612693565b606091505b50915091508181906126b85760405162461bcd60e51b8152600401610224919061328b565b50836001600160a01b0316836001600160a01b03167f2e4cc16c100f0b55e2df82ab0b1a7e294aa9cbd01b48fbaf622683fbc0507a4960405160405180910390a350505050565b61270c426201518061349a565b63ffffffff9182166000908152600260205260409020600101805463ffffffff191691909216179055565b63ffffffff81166000908152600260209081526040909120835180518593612763928492910190612aff565b50602091909101516001909101805463ffffffff191663ffffffff9092169190911790555050565b60608161279981601f613482565b10156127d85760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610224565b6127e28284613482565b845110156128265760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610224565b606082158015612845576040519150600082526020820160405261288f565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561287e578051835260209283019201612866565b5050858452601f01601f1916604052505b50949350505050565b60006128a5826008613482565b835110156128ec5760405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b6044820152606401610224565b50016008015190565b6001600160a01b0381166000908152600460205260409020546001600160401b0316612960826129268360016134c2565b6001600160a01b03919091166000908152600460205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b919050565b61296e816129a5565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b803b612a095760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610224565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6040518060a0016040528060008019168152602001600060ff168152602001600061ffff168152602001612a97604051806040016040528060608152602001600063ffffffff1681525090565b8152600060209091015290565b604080516101608101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e08201819052610100820183905261012082015261014081019190915290565b828054828255906000526020600020908101928215612b54579160200282015b82811115612b5457825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612b1f565b50612b60929150612b64565b5090565b5b80821115612b605760008155600101612b65565b80356001600160a01b038116811461296057600080fd5b600082601f830112612ba0578081fd5b81356020612bb5612bb08361345f565b61342f565b80838252828201915082860187848660071b8901011115612bd4578586fd5b855b85811015612c3757608080838b031215612bee578788fd5b612bf66133c2565b8335815286840135878201526040612c0f818601612ceb565b908201526060612c20858201612ceb565b908201528552938501939190910190600101612bd6565b5090979650505050505050565b600082601f830112612c54578081fd5b81356001600160401b03811115612c6d57612c6d6135c0565b612c80601f8201601f191660200161342f565b818152846020838601011115612c94578283fd5b816020850160208301379081016020019190915292915050565b803561ffff8116811461296057600080fd5b803563ffffffff8116811461296057600080fd5b80356001600160401b038116811461296057600080fd5b803560ff8116811461296057600080fd5b600060208284031215612d0d578081fd5b612d1682612b79565b9392505050565b600060208284031215612d2e578081fd5b5035919050565b600080600060608486031215612d49578182fd5b833592506020808501356001600160401b0380821115612d67578485fd5b612d7388838901612b90565b94506040870135915080821115612d88578384fd5b9086019060408289031215612d9b578384fd5b612da36133ea565b823582811115612db1578586fd5b83019150601f82018913612dc3578485fd5b8135612dd1612bb08261345f565b8082825286820191508685018c888560051b8801011115612df0578889fd5b8895505b83861015612e1957612e0581612b79565b835260019590950194918701918701612df4565b50835250612e2a9050838501612cc0565b84820152809450505050509250925092565b60008060208385031215612e4e578182fd5b82356001600160401b0380821115612e64578384fd5b818501915085601f830112612e77578384fd5b813581811115612e85578485fd5b866020828501011115612e96578485fd5b60209290920196919550909350505050565b600060208284031215612eb9578081fd5b81356001600160401b03811115612ece578182fd5b612eda84828501612c44565b949350505050565b600060208284031215612ef3578081fd5b81356001600160401b0380821115612f09578283fd5b908301906101608286031215612f1d578283fd5b612f2561340c565b612f2e83612ceb565b8152612f3c60208401612cc0565b6020820152612f4d60408401612cc0565b6040820152612f5e60608401612cae565b606082015260808301356080820152612f7960a08401612cd4565b60a0820152612f8a60c08401612ceb565b60c082015260e083013582811115612fa0578485fd5b612fac87828601612c44565b60e083015250610100612fc0818501612cc0565b908201526101208381013583811115612fd7578586fd5b612fe388828701612b90565b91830191909152506101409283013592810192909252509392505050565b600060208284031215613012578081fd5b612d1682612cc0565b60008060006060848603121561302f578081fd5b61303884612cc0565b925060208401356001600160401b03811115613052578182fd5b61305e86828701612c44565b92505061306d60408501612ceb565b90509250925092565b6000815180845260208085019450808401835b838110156130ce57815180518852838101518489015260408082015160ff908116918a0191909152606091820151169088015260809096019590820190600101613089565b509495945050505050565b600081518084526130f181602086016020860161355f565b601f01601f19169290920160200192915050565b805160408084528151908401819052600091602091908201906060860190845b8181101561314a5783516001600160a01b031683529284019291840191600101613125565b50509382015163ffffffff16949091019390935250919050565b805160ff16825260006101606020830151613187602086018263ffffffff169052565b50604083015161319f604086018263ffffffff169052565b5060608301516131b5606086018261ffff169052565b506080830151608085015260a08301516131da60a08601826001600160401b03169052565b5060c08301516131ef60c086018260ff169052565b5060e08301518160e0860152613207828601826130d9565b915050610100808401516132228287018263ffffffff169052565b5050610120808401518583038287015261323c8382613076565b61014095860151969095019590955250919392505050565b6000825161326681846020870161355f565b9190910192915050565b8215158152604060208201526000612eda60408301846130d9565b602081526000612d1660208301846130d9565b6020808252600e908201526d696e76616c6964204d6f64756c6560901b604082015260600190565b602081528151602082015260ff602083015116604082015261ffff60408301511660608201526000606083015160a0608084015261330760c0840182613105565b905063ffffffff60808501511660a08401528091505092915050565b602081526000612d166020830184613105565b602081526000612d166020830184613164565b60608152600061335c6060830186613164565b8415156020840152828103604084015261337681856130d9565b9695505050505050565b6001600160401b038516815263ffffffff841660208201526080604082015260006133ae60808301856130d9565b905060ff8316606083015295945050505050565b604051608081016001600160401b03811182821017156133e4576133e46135c0565b60405290565b604080519081016001600160401b03811182821017156133e4576133e46135c0565b60405161016081016001600160401b03811182821017156133e4576133e46135c0565b604051601f8201601f191681016001600160401b0381118282101715613457576134576135c0565b604052919050565b60006001600160401b03821115613478576134786135c0565b5060051b60200190565b60008219821115613495576134956135aa565b500190565b600063ffffffff8083168185168083038211156134b9576134b96135aa565b01949350505050565b60006001600160401b038083168185168083038211156134b9576134b96135aa565b600060ff821660ff84168060ff03821115613501576135016135aa565b019392505050565b60008261352457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615613543576135436135aa565b500290565b60008282101561355a5761355a6135aa565b500390565b60005b8381101561357a578181015183820152602001613562565b83811115613589576000848401525b50505050565b60006000198214156135a3576135a36135aa565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe6e6f74207369676e65642062792063757272656e7420677561726469616e20736574676f7665726e616e636520616374696f6e20616c726561647920636f6e73756d6564a2646970667358221220c2526c2dfb10f43e8111077b320dec15d073342ecf155df1f47424ac504df46064736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

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.