• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pooltogether / v4-periphery / 4018978700

pending completion
4018978700

push

github

GitHub
Merge pull request #61 from pooltogether/pool-2496-optimism-add-contract-to-bridge-draw

200 of 204 branches covered (98.04%)

Branch coverage included in aggregate %.

44 of 44 new or added lines in 3 files covered. (100.0%)

411 of 414 relevant lines covered (99.28%)

29.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.0
/contracts/abstract/ExecutorAware.sol
1
// SPDX-License-Identifier: GPL-3.0
2

3
pragma solidity 0.8.6;
4

5
/**
6
 * @title ExecutorAware abstract contract
7
 * @notice The ExecutorAware contract allows contracts on a receiving chain to execute messages from an origin chain.
8
 *         These messages are sent by the `MessageDispatcher` contract which live on the origin chain.
9
 *         The `MessageExecutor` contract on the receiving chain executes these messages
10
 *         and then forward them to an ExecutorAware contract on the receiving chain.
11
 * @dev This contract implements EIP-2771 (https://eips.ethereum.org/EIPS/eip-2771)
12
 *      to ensure that messages are sent by a trusted `MessageExecutor` contract.
13
 */
14
abstract contract ExecutorAware {
15
    /* ============ Variables ============ */
16

17
    /// @notice Address of the trusted executor contract.
18
    address public immutable trustedExecutor;
19

20
    /* ============ Constructor ============ */
21

22
    /**
23
     * @notice ExecutorAware constructor.
24
     * @param _executor Address of the `MessageExecutor` contract
25
     */
26
    constructor(address _executor) {
27
        require(_executor != address(0), "executor-not-zero-address");
70✔
28
        trustedExecutor = _executor;
69✔
29
    }
30

31
    /* ============ External Functions ============ */
32

33
    /**
34
     * @notice Check which executor this contract trust.
35
     * @param _executor Address to check
36
     */
37
    function isTrustedExecutor(address _executor) public view returns (bool) {
38
        return _executor == trustedExecutor;
20✔
39
    }
40

41
    /* ============ Internal Functions ============ */
42

43
    /**
44
     * @notice Retrieve messageId from message data.
45
     * @return _msgDataMessageId ID uniquely identifying the message that was executed
46
     */
47
    function _messageId() internal pure returns (bytes32 _msgDataMessageId) {
48
        _msgDataMessageId;
×
49

50
        if (msg.data.length >= 84) {
×
51
            assembly {
×
52
                _msgDataMessageId := calldataload(sub(calldatasize(), 84))
53
            }
54
        }
55
    }
56

57
    /**
58
     * @notice Retrieve fromChainId from message data.
59
     * @return _msgDataFromChainId ID of the chain that dispatched the messages
60
     */
61
    function _fromChainId() internal pure returns (uint256 _msgDataFromChainId) {
62
        _msgDataFromChainId;
13✔
63

64
        if (msg.data.length >= 52) {
13!
65
            assembly {
13✔
66
                _msgDataFromChainId := calldataload(sub(calldatasize(), 52))
67
            }
68
        }
69
    }
70

71
    /**
72
     * @notice Retrieve signer address from message data.
73
     * @return _signer Address of the signer
74
     */
75
    function _msgSender() internal view returns (address payable _signer) {
76
        _signer = payable(msg.sender);
9✔
77

78
        if (msg.data.length >= 20 && isTrustedExecutor(_signer)) {
9!
79
            assembly {
9✔
80
                _signer := shr(96, calldataload(sub(calldatasize(), 20)))
81
            }
82
        }
83
    }
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc