Sepolia Testnet

Contract

0x8cD66E1085b5F93FD0eA6E47672C5134289A9e44
Source Code Source Code

Overview

ETH Balance

0 ETH

More Info

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Amount

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x40B208E3...57406ce71
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Yaho

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;

import {IMessageRelay} from "./interfaces/IMessageRelay.sol";
import {Message} from "./interfaces/IMessageDispatcher.sol";
import {IYaho} from "./interfaces/IYaho.sol";
import {MessageHashCalculator} from "./utils/MessageHashCalculator.sol";

contract Yaho is IYaho, MessageHashCalculator {
    mapping(uint256 => bytes32) public hashes;
    uint256 private count;

    /// @dev Dispatches a batch of messages, putting their into storage and emitting their contents as an event.
    /// @param messages An array of Messages to be dispatched.
    /// @return messageIds An array of message IDs corresponding to the dispatched messages.
    function dispatchMessages(
        Message[] memory messages
    ) public payable returns (bytes32[] memory) {
        if (messages.length == 0) revert NoMessagesGiven(address(this));
        bytes32[] memory messageIds = new bytes32[](messages.length);
        for (uint256 i = 0; i < messages.length; i++) {
            uint256 id = count;
            hashes[id] = calculateHash(
                block.chainid,
                id,
                address(this),
                msg.sender,
                messages[i]
            );
            messageIds[i] = bytes32(id);
            emit MessageDispatched(
                bytes32(id),
                msg.sender,
                messages[i].toChainId,
                messages[i].to,
                messages[i].data
            );
            count++;
        }
        return messageIds;
    }

    /// @dev Relays hashes of the given messageIds to the given adapters.
    /// @param messageIds Array of IDs of the message hashes to relay to the given adapters.
    /// @param adapters Array of relay adapter addresses to which hashes should be relayed.
    /// @param destinationAdapters Array of oracle adapter addresses to receive hashes.
    /// @return adapterReciepts Reciepts from each of the relay adapters.
    function relayMessagesToAdapters(
        uint256[] memory messageIds,
        address[] memory adapters,
        address[] memory destinationAdapters
    ) external payable returns (bytes32[] memory) {
        if (messageIds.length == 0) revert NoMessageIdsGiven(address(this));
        if (adapters.length == 0) revert NoAdaptersGiven(address(this));
        if (adapters.length != destinationAdapters.length)
            revert UnequalArrayLengths(address(this));
        bytes32[] memory adapterReciepts = new bytes32[](adapters.length);
        for (uint256 i = 0; i < adapters.length; i++) {
            adapterReciepts[i] = IMessageRelay(adapters[i]).relayMessages(
                messageIds,
                destinationAdapters[i]
            );
        }
        return adapterReciepts;
    }

    /// @dev Dispatches an array of messages and relays their hashes to an array of relay adapters.
    /// @param messages An array of Messages to be dispatched.
    /// @param adapters Array of relay adapter addresses to which hashes should be relayed.
    /// @param destinationAdapters Array of oracle adapter addresses to receive hashes.
    /// @return messageIds An array of message IDs corresponding to the dispatched messages.
    /// @return adapterReciepts Reciepts from each of the relay adapters.
    function dispatchMessagesToAdapters(
        Message[] memory messages,
        address[] memory adapters,
        address[] memory destinationAdapters
    ) external payable returns (bytes32[] memory messageIds, bytes32[] memory) {
        if (adapters.length == 0) revert NoAdaptersGiven(address(this));
        messageIds = dispatchMessages(messages);
        uint256[] memory uintIds = new uint256[](messageIds.length);
        for (uint256 i = 0; i < messageIds.length; i++) {
            uintIds[i] = uint256(messageIds[i]);
        }
        bytes32[] memory adapterReciepts = new bytes32[](adapters.length);
        for (uint256 i = 0; i < adapters.length; i++) {
            adapterReciepts[i] = IMessageRelay(adapters[i]).relayMessages(
                uintIds,
                destinationAdapters[i]
            );
        }
        return (messageIds, adapterReciepts);
    }
}

File 2 of 6 : IMessage.sol
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;

struct Message {
    address to;
    uint256 toChainId;
    bytes data;
}

File 3 of 6 : IMessageDispatcher.sol
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;

import {Message} from "./IMessage.sol";

interface IMessageDispatcher {
    event MessageDispatched(
        bytes32 indexed messageId,
        address indexed from,
        uint256 indexed toChainId,
        address to,
        bytes data
    );

    function dispatchMessages(
        Message[] memory messages
    ) external payable returns (bytes32[] memory messageIds);
}

File 4 of 6 : IMessageRelay.sol
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;

interface IMessageRelay {
    function relayMessages(
        uint256[] memory messageIds,
        address adapter
    ) external payable returns (bytes32 receipts);
}

// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;

import {IMessageDispatcher, Message} from "./IMessageDispatcher.sol";

interface IYaho is IMessageDispatcher {
    error NoMessagesGiven(address emitter);
    error NoMessageIdsGiven(address emitter);
    error NoAdaptersGiven(address emitter);
    error UnequalArrayLengths(address emitter);

    function dispatchMessages(
        Message[] memory messages
    ) external payable returns (bytes32[] memory);

    function relayMessagesToAdapters(
        uint256[] memory messageIds,
        address[] memory adapters,
        address[] memory destinationAdapters
    ) external payable returns (bytes32[] memory);

    function dispatchMessagesToAdapters(
        Message[] memory messages,
        address[] memory adapters,
        address[] memory destinationAdapters
    ) external payable returns (bytes32[] memory messageIds, bytes32[] memory);

    function hashes(uint256) external view returns (bytes32);
}

File 6 of 6 : MessageHashCalculator.sol
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;

import {Message} from "../interfaces/IMessage.sol";

contract MessageHashCalculator {
    /// @dev Calculates the ID of a given message.
    /// @param chainId ID of the chain on which the message was/will be dispatched.
    /// @param id ID of the message that was/will be dispatched.
    /// @param origin Contract that did/will dispatch the given message.
    /// @param sender Sender of the message that was/will be dispatched.
    /// @param message Message that was/will be dispatched.
    function calculateHash(
        uint256 chainId,
        uint256 id,
        address origin,
        address sender,
        Message memory message
    ) public pure returns (bytes32 calculatedHash) {
        calculatedHash = keccak256(
            abi.encode(chainId, id, origin, sender, message)
        );
    }
}

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

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"emitter","type":"address"}],"name":"NoAdaptersGiven","type":"error"},{"inputs":[{"internalType":"address","name":"emitter","type":"address"}],"name":"NoMessageIdsGiven","type":"error"},{"inputs":[{"internalType":"address","name":"emitter","type":"address"}],"name":"NoMessagesGiven","type":"error"},{"inputs":[{"internalType":"address","name":"emitter","type":"address"}],"name":"UnequalArrayLengths","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"uint256","name":"toChainId","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"MessageDispatched","type":"event"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"origin","type":"address"},{"internalType":"address","name":"sender","type":"address"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"toChainId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Message","name":"message","type":"tuple"}],"name":"calculateHash","outputs":[{"internalType":"bytes32","name":"calculatedHash","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"toChainId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Message[]","name":"messages","type":"tuple[]"}],"name":"dispatchMessages","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"toChainId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Message[]","name":"messages","type":"tuple[]"},{"internalType":"address[]","name":"adapters","type":"address[]"},{"internalType":"address[]","name":"destinationAdapters","type":"address[]"}],"name":"dispatchMessagesToAdapters","outputs":[{"internalType":"bytes32[]","name":"messageIds","type":"bytes32[]"},{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"hashes","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"messageIds","type":"uint256[]"},{"internalType":"address[]","name":"adapters","type":"address[]"},{"internalType":"address[]","name":"destinationAdapters","type":"address[]"}],"name":"relayMessagesToAdapters","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"payable","type":"function"}]

0x60808060405234610016576109ca908161001c8239f35b600080fdfe6040608081526004908136101561001557600080fd5b6000803560e01c80631d3bf1e3146103225780633ced3d2a14610142578063501895ae14610117578063883d3f8f146100c85763f0edcc5c1461005757600080fd5b346100c55760a03660031901126100c5576001600160a01b03906044359082821682036100c55760643592831683036100c5576084359067ffffffffffffffff82116100c5575091602094916100b36100be943690850161055b565b926024359035610920565b9051908152f35b80fd5b5060203660031901126100c55782359067ffffffffffffffff82116100c557506100fb61011393610100923691016105fa565b6107d6565b90519182916020835260208301906106e1565b0390f35b50913461013e57602036600319011261013e57602092829135815280845220549051908152f35b8280fd5b5082606036600319011261031e5767ffffffffffffffff91813583811161031e573660238201121561031e57808301359261017c8461052a565b93610189875195866104f2565b8085526020928386016024809360051b830101913683116102aa5783869101915b83831061030e5750505050803586811161030a576101cb903690840161067b565b9560443590811161030a576101e3903690840161067b565b908551156102f7578651156102e45786518251036102d157506102068651610715565b94845b87518110156102bf578590856102556001600160a01b038061022b858e61076c565b511690610238858961076c565b51168d519586809481936343c0923d60e11b83528a8d84016108d3565b03925af180156102b5578790610280575b61027b9250610275828a61076c565b52610747565b610209565b50908581813d83116102ae575b61029781836104f2565b810103126102aa579061027b9151610266565b8680fd5b503d61028d565b8a513d89823e3d90fd5b8851858152806101138188018a6106e1565b875163018a4ee960e01b81523081850152fd5b8751639750033760e01b81523081850152fd5b87516365625ef560e01b81523081850152fd5b8480fd5b82358152918101918691016101aa565b5080fd5b5060603660031901126100c55767ffffffffffffffff91833583811161013e5761034f90369086016105fa565b926024358181116104ee57610367903690870161067b565b906044359081116104ee5761037f903690870161067b565b938151156104d857610390906107d6565b9283519561039d8761052a565b966103aa855198896104f2565b8088526103b9601f199161052a565b019060209136838a0137825b86518110156103ec57806103dc6103e7928961076c565b51610275828c61076c565b6103c5565b5086889695966103fc8651610715565b95855b81518110156104b15761044d90868b6001600160a01b03868b8a83610424888b61076c565b511693610431888d61076c565b51169451978895869485936343c0923d60e11b855284016108d3565b03925af180156104a7578890610472575b61046d9250610275828b61076c565b6103ff565b50908681813d83116104a0575b61048981836104f2565b8101031261049c579061046d915161045e565b8780fd5b503d61047f565b8b513d8a823e3d90fd5b888a610113888b6104cb84519585879687528601906106e1565b91848303908501526106e1565b8251639750033760e01b81523081880152602490fd5b8380fd5b90601f8019910116810190811067ffffffffffffffff82111761051457604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff81116105145760051b60200190565b35906001600160a01b038216820361055657565b600080fd5b91906060838203126105565760405167ffffffffffffffff90606081018281118282101761051457604052809461059181610542565b8252602090818101358284015260408101359084821161055657019084601f8301121561055657813593841161051457604051946105d8601f8601601f19168301876104f2565b8486528185840101116105565783604094826000940183880137850101520152565b9080601f83011215610556578135906106128261052a565b9261062060405194856104f2565b828452602092838086019160051b8301019280841161055657848301915b84831061064e5750505050505090565b823567ffffffffffffffff81116105565786916106708484809489010161055b565b81520192019161063e565b81601f82011215610556578035916106928361052a565b926106a060405194856104f2565b808452602092838086019260051b820101928311610556578301905b8282106106ca575050505090565b8380916106d684610542565b8152019101906106bc565b90815180825260208080930193019160005b828110610701575050505090565b8351855293810193928101926001016106f3565b9061071f8261052a565b61072c60405191826104f2565b828152809261073d601f199161052a565b0190602036910137565b60001981146107565760010190565b634e487b7160e01b600052601160045260246000fd5b80518210156107805760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b919082519283825260005b8481106107c2575050826000602080949584010152601f8019910116010190565b6020818301810151848301820152016107a1565b8051156108bb576107e78151610715565b600091825b81518110156108b4576108af906001805461081461080a848761076c565b5133308446610920565b818852602091888352604091828a20558061082f868a61076c565b527fe2f8f20ddbedfce5eb59a8b930077e7f4906a01300b9318db5f90d1c96c7b6d48361085c878a61076c565b510151936001600160a01b03610872888b61076c565b51511661089b856108838a8d61076c565b51015186805194859485528401523396830190610796565b0390a46108a88154610747565b9055610747565b6107ec565b5050905090565b60405163d6f3d11560e01b8152306004820152602490fd5b9092919260408201604083528151809152606083019060208093019060005b8482821061090c57505050509360018060a01b0316910152565b8351855293840193909201916001016108f2565b9360406109809161098e9495825196879560208701998a528487015260018060a01b039182809216606088015216608086015260a08086015281511660c0850152602081015160e085015201516060610100840152610120830190610796565b03601f1981018352826104f2565b5190209056fea264697066735822122061968af3d86c5bd5ec50b243e4ca100e916052e5569330008ec9a8aa5bfa495c64736f6c63430008140033

Deployed Bytecode

0x6040608081526004908136101561001557600080fd5b6000803560e01c80631d3bf1e3146103225780633ced3d2a14610142578063501895ae14610117578063883d3f8f146100c85763f0edcc5c1461005757600080fd5b346100c55760a03660031901126100c5576001600160a01b03906044359082821682036100c55760643592831683036100c5576084359067ffffffffffffffff82116100c5575091602094916100b36100be943690850161055b565b926024359035610920565b9051908152f35b80fd5b5060203660031901126100c55782359067ffffffffffffffff82116100c557506100fb61011393610100923691016105fa565b6107d6565b90519182916020835260208301906106e1565b0390f35b50913461013e57602036600319011261013e57602092829135815280845220549051908152f35b8280fd5b5082606036600319011261031e5767ffffffffffffffff91813583811161031e573660238201121561031e57808301359261017c8461052a565b93610189875195866104f2565b8085526020928386016024809360051b830101913683116102aa5783869101915b83831061030e5750505050803586811161030a576101cb903690840161067b565b9560443590811161030a576101e3903690840161067b565b908551156102f7578651156102e45786518251036102d157506102068651610715565b94845b87518110156102bf578590856102556001600160a01b038061022b858e61076c565b511690610238858961076c565b51168d519586809481936343c0923d60e11b83528a8d84016108d3565b03925af180156102b5578790610280575b61027b9250610275828a61076c565b52610747565b610209565b50908581813d83116102ae575b61029781836104f2565b810103126102aa579061027b9151610266565b8680fd5b503d61028d565b8a513d89823e3d90fd5b8851858152806101138188018a6106e1565b875163018a4ee960e01b81523081850152fd5b8751639750033760e01b81523081850152fd5b87516365625ef560e01b81523081850152fd5b8480fd5b82358152918101918691016101aa565b5080fd5b5060603660031901126100c55767ffffffffffffffff91833583811161013e5761034f90369086016105fa565b926024358181116104ee57610367903690870161067b565b906044359081116104ee5761037f903690870161067b565b938151156104d857610390906107d6565b9283519561039d8761052a565b966103aa855198896104f2565b8088526103b9601f199161052a565b019060209136838a0137825b86518110156103ec57806103dc6103e7928961076c565b51610275828c61076c565b6103c5565b5086889695966103fc8651610715565b95855b81518110156104b15761044d90868b6001600160a01b03868b8a83610424888b61076c565b511693610431888d61076c565b51169451978895869485936343c0923d60e11b855284016108d3565b03925af180156104a7578890610472575b61046d9250610275828b61076c565b6103ff565b50908681813d83116104a0575b61048981836104f2565b8101031261049c579061046d915161045e565b8780fd5b503d61047f565b8b513d8a823e3d90fd5b888a610113888b6104cb84519585879687528601906106e1565b91848303908501526106e1565b8251639750033760e01b81523081880152602490fd5b8380fd5b90601f8019910116810190811067ffffffffffffffff82111761051457604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff81116105145760051b60200190565b35906001600160a01b038216820361055657565b600080fd5b91906060838203126105565760405167ffffffffffffffff90606081018281118282101761051457604052809461059181610542565b8252602090818101358284015260408101359084821161055657019084601f8301121561055657813593841161051457604051946105d8601f8601601f19168301876104f2565b8486528185840101116105565783604094826000940183880137850101520152565b9080601f83011215610556578135906106128261052a565b9261062060405194856104f2565b828452602092838086019160051b8301019280841161055657848301915b84831061064e5750505050505090565b823567ffffffffffffffff81116105565786916106708484809489010161055b565b81520192019161063e565b81601f82011215610556578035916106928361052a565b926106a060405194856104f2565b808452602092838086019260051b820101928311610556578301905b8282106106ca575050505090565b8380916106d684610542565b8152019101906106bc565b90815180825260208080930193019160005b828110610701575050505090565b8351855293810193928101926001016106f3565b9061071f8261052a565b61072c60405191826104f2565b828152809261073d601f199161052a565b0190602036910137565b60001981146107565760010190565b634e487b7160e01b600052601160045260246000fd5b80518210156107805760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b919082519283825260005b8481106107c2575050826000602080949584010152601f8019910116010190565b6020818301810151848301820152016107a1565b8051156108bb576107e78151610715565b600091825b81518110156108b4576108af906001805461081461080a848761076c565b5133308446610920565b818852602091888352604091828a20558061082f868a61076c565b527fe2f8f20ddbedfce5eb59a8b930077e7f4906a01300b9318db5f90d1c96c7b6d48361085c878a61076c565b510151936001600160a01b03610872888b61076c565b51511661089b856108838a8d61076c565b51015186805194859485528401523396830190610796565b0390a46108a88154610747565b9055610747565b6107ec565b5050905090565b60405163d6f3d11560e01b8152306004820152602490fd5b9092919260408201604083528151809152606083019060208093019060005b8482821061090c57505050509360018060a01b0316910152565b8351855293840193909201916001016108f2565b9360406109809161098e9495825196879560208701998a528487015260018060a01b039182809216606088015216608086015260a08086015281511660c0850152602081015160e085015201516060610100840152610120830190610796565b03601f1981018352826104f2565b5190209056fea264697066735822122061968af3d86c5bd5ec50b243e4ca100e916052e5569330008ec9a8aa5bfa495c64736f6c63430008140033

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

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.