Skip to content

Commit

Permalink
refactor(evm): changes reporters type within Message struct
Browse files Browse the repository at this point in the history
  • Loading branch information
allemanfredi committed Jan 23, 2024
1 parent 59780e0 commit 48e4095
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions packages/evm/contracts/Yaho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {
uint256 threshold,
address receiver,
bytes calldata data,
address[] calldata reporters,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) external returns (uint256) {
_checkReportersAndAdapters(threshold, reporters, adapters);
Expand All @@ -31,7 +31,7 @@ contract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {
uint256 threshold,
address receiver,
bytes calldata data,
address[] calldata reporters,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) external returns (uint256, bytes32[] memory) {
_checkReportersAndAdapters(threshold, reporters, adapters);
Expand Down Expand Up @@ -59,7 +59,7 @@ contract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {
uint256[] calldata thresholds,
address[] calldata receivers,
bytes[] calldata data,
address[] calldata reporters,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) external payable returns (uint256[] memory, bytes32[] memory) {
if (thresholds.length != receivers.length) revert UnequalArrayLengths(thresholds.length, receivers.length);
Expand Down Expand Up @@ -129,7 +129,7 @@ contract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {

function _checkReportersAndAdapters(
uint256 threshold,
address[] calldata reporters,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) internal pure {
if (reporters.length == 0) revert NoReportersGiven();
Expand All @@ -143,7 +143,7 @@ contract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {
uint256 threshold,
address receiver,
bytes calldata data,
address[] calldata reporters,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) internal returns (uint256, bytes32) {
address sender = msg.sender;
Expand All @@ -168,7 +168,7 @@ contract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {
uint256 toChainId,
uint256 messageId,
bytes32 messageHash,
address[] memory reporters,
IReporter[] memory reporters,
IOracleAdapter[] memory adapters
) internal returns (bytes32[] memory) {
uint256[] memory messageIds = new uint256[](1);
Expand All @@ -182,13 +182,13 @@ contract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {
uint256 toChainId,
uint256[] memory messageIds,
bytes32[] memory messageHashes,
address[] memory reporters,
IReporter[] memory reporters,
IOracleAdapter[] memory adapters
) internal returns (bytes32[] memory) {
bytes32[] memory reportersReceipts = new bytes32[](reporters.length);

for (uint256 i = 0; i < reporters.length; ) {
reportersReceipts[i] = IReporter(reporters[i]).dispatchMessages(
reportersReceipts[i] = reporters[i].dispatchMessages(
toChainId,
adapters[i],
messageIds,
Expand Down
3 changes: 2 additions & 1 deletion packages/evm/contracts/interfaces/IMessage.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;

import { IReporter } from "./IReporter.sol";
import { IOracleAdapter } from "./IOracleAdapter.sol";

struct Message {
Expand All @@ -10,6 +11,6 @@ struct Message {
address sender;
address receiver;
bytes data;
address[] reporters;
IReporter[] reporters;
IOracleAdapter[] adapters;
}

0 comments on commit 48e4095

Please sign in to comment.