@he1sen/hashi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/contracts/src/HashiLightbulb.sol +71 -0
- package/contracts/src/HashiSwitch.sol +47 -0
- package/contracts/src/chainlink/CCIPAdapter.sol +35 -0
- package/contracts/src/chainlink/CCIPReporter.sol +60 -0
- package/contracts/src/vea/VeaAdapter.sol +49 -0
- package/contracts/src/vea/VeaReporter.sol +51 -0
- package/contracts/src/vea/interfaces/IReceiverGateway.sol +8 -0
- package/contracts/src/vea/interfaces/ISenderGateway.sol +9 -0
- package/contracts/src/vea/interfaces/IVeaInbox.sol +11 -0
- package/dist/contracts/broadcast/1514-42161.json +8 -0
- package/dist/contracts/broadcast/42161-1514.json +8 -0
- package/dist/contracts/broadcast/421614-10200.json +12 -0
- package/dist/contracts/broadcast/421614-11155111.json +12 -0
- package/dist/sdk/abi/Adapter.json +71 -0
- package/dist/sdk/abi/Hashi.json +171 -0
- package/dist/sdk/abi/Reporter.json +169 -0
- package/dist/sdk/abi/Yaho.json +504 -0
- package/dist/sdk/abi/Yaru.json +330 -0
- package/dist/sdk/abiMapping.d.ts +6 -0
- package/dist/sdk/abiMapping.js +16 -0
- package/dist/sdk/getters.d.ts +16 -0
- package/dist/sdk/getters.js +121 -0
- package/dist/sdk/index.d.ts +5 -0
- package/dist/sdk/index.js +23 -0
- package/dist/sdk/registry.d.ts +2 -0
- package/dist/sdk/registry.js +16 -0
- package/dist/sdk/types.d.ts +35 -0
- package/dist/sdk/types.js +9 -0
- package/dist/src/utils/chains.d.ts +7 -0
- package/dist/src/utils/chains.js +52 -0
- package/dist/tsconfig.sdk.tsbuildinfo +1 -0
- package/dist/typechain-types/Adapter.d.ts +57 -0
- package/dist/typechain-types/Adapter.js +2 -0
- package/dist/typechain-types/CCIPAdapter.d.ts +227 -0
- package/dist/typechain-types/CCIPAdapter.js +2 -0
- package/dist/typechain-types/CCIPReporter.d.ts +257 -0
- package/dist/typechain-types/CCIPReporter.js +2 -0
- package/dist/typechain-types/Hashi.d.ts +68 -0
- package/dist/typechain-types/Hashi.js +2 -0
- package/dist/typechain-types/LayerZeroAdapter.d.ts +319 -0
- package/dist/typechain-types/LayerZeroAdapter.js +2 -0
- package/dist/typechain-types/LayerZeroReporter.d.ts +359 -0
- package/dist/typechain-types/LayerZeroReporter.js +2 -0
- package/dist/typechain-types/Reporter.d.ts +118 -0
- package/dist/typechain-types/Reporter.js +2 -0
- package/dist/typechain-types/VeaAdapter.d.ts +137 -0
- package/dist/typechain-types/VeaAdapter.js +2 -0
- package/dist/typechain-types/VeaReporter.d.ts +166 -0
- package/dist/typechain-types/VeaReporter.js +2 -0
- package/dist/typechain-types/Yaho.d.ts +181 -0
- package/dist/typechain-types/Yaho.js +2 -0
- package/dist/typechain-types/Yaru.d.ts +142 -0
- package/dist/typechain-types/Yaru.js +2 -0
- package/dist/typechain-types/common.d.ts +21 -0
- package/dist/typechain-types/common.js +2 -0
- package/dist/typechain-types/factories/Adapter__factory.d.ts +61 -0
- package/dist/typechain-types/factories/Adapter__factory.js +88 -0
- package/dist/typechain-types/factories/CCIPAdapter__factory.d.ts +262 -0
- package/dist/typechain-types/factories/CCIPAdapter__factory.js +350 -0
- package/dist/typechain-types/factories/CCIPReporter__factory.d.ts +295 -0
- package/dist/typechain-types/factories/CCIPReporter__factory.js +389 -0
- package/dist/typechain-types/factories/Hashi__factory.d.ts +136 -0
- package/dist/typechain-types/factories/Hashi__factory.js +188 -0
- package/dist/typechain-types/factories/LayerZeroAdapter__factory.d.ts +407 -0
- package/dist/typechain-types/factories/LayerZeroAdapter__factory.js +538 -0
- package/dist/typechain-types/factories/LayerZeroReporter__factory.d.ts +430 -0
- package/dist/typechain-types/factories/LayerZeroReporter__factory.js +565 -0
- package/dist/typechain-types/factories/Reporter__factory.d.ts +138 -0
- package/dist/typechain-types/factories/Reporter__factory.js +186 -0
- package/dist/typechain-types/factories/VeaAdapter__factory.d.ts +185 -0
- package/dist/typechain-types/factories/VeaAdapter__factory.js +250 -0
- package/dist/typechain-types/factories/VeaReporter__factory.d.ts +246 -0
- package/dist/typechain-types/factories/VeaReporter__factory.js +327 -0
- package/dist/typechain-types/factories/Yaho__factory.d.ts +395 -0
- package/dist/typechain-types/factories/Yaho__factory.js +521 -0
- package/dist/typechain-types/factories/Yaru__factory.d.ts +260 -0
- package/dist/typechain-types/factories/Yaru__factory.js +347 -0
- package/dist/typechain-types/factories/index.d.ts +11 -0
- package/dist/typechain-types/factories/index.js +28 -0
- package/dist/typechain-types/index.d.ts +23 -0
- package/dist/typechain-types/index.js +59 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/pages/api-reference/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First, run the development server:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Build
|
|
12
|
+
```bash
|
|
13
|
+
npm run build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
18
|
+
|
|
19
|
+
## Sync frontend bridge routes
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run gen:routes
|
|
23
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/**
|
|
3
|
+
* @authors: [@mani99brar]
|
|
4
|
+
* @reviewers: []
|
|
5
|
+
* @auditors: []
|
|
6
|
+
* @bounties: []
|
|
7
|
+
* @deployments: []
|
|
8
|
+
*/
|
|
9
|
+
pragma solidity ^0.8.18;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @title Lightbulb
|
|
13
|
+
* @dev A lightbulb controlled by a cross-chain switch connected with the Vea bridge.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
contract Lightbulb {
|
|
17
|
+
event LightBulbTurnedOn(address indexed lightBulbOwner, uint256 indexed messageId);
|
|
18
|
+
|
|
19
|
+
address owner;
|
|
20
|
+
address public yaru;
|
|
21
|
+
uint256 public SOURCE_CHAIN_ID = 421614;
|
|
22
|
+
address public lightBulbSwitch; // The switch on arbitrum that controls this lightbulb.
|
|
23
|
+
mapping(address => bool) public lightBulbIsOn;
|
|
24
|
+
bool switchOn = true;
|
|
25
|
+
|
|
26
|
+
modifier onlyOwner() {
|
|
27
|
+
require(msg.sender == owner);
|
|
28
|
+
_;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
constructor(address _owner, address _yaru, address _lightBulbSwitch) {
|
|
32
|
+
owner = _owner;
|
|
33
|
+
yaru = _yaru;
|
|
34
|
+
lightBulbSwitch = _lightBulbSwitch;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function flipSwitch(bool _switchOn) external onlyOwner {
|
|
38
|
+
switchOn = _switchOn;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// @dev Function that gets triggered when the message is relayed, called by Yaru contract
|
|
42
|
+
/// @param chainId chainId of the chain where message is sending from
|
|
43
|
+
/// @param sender sender contract
|
|
44
|
+
/// @param threshold threshold of the message that should be met by adapters
|
|
45
|
+
/// @param adapters an array of adapters to check the threshold with
|
|
46
|
+
/// @param data abi-encoded message
|
|
47
|
+
/// @return
|
|
48
|
+
function onMessage(
|
|
49
|
+
uint256 messageId,
|
|
50
|
+
uint256 chainId,
|
|
51
|
+
address sender,
|
|
52
|
+
uint256 threshold,
|
|
53
|
+
address[] memory adapters,
|
|
54
|
+
bytes memory data
|
|
55
|
+
) external returns (bytes memory) {
|
|
56
|
+
require(msg.sender == yaru, "only called by Yaru");
|
|
57
|
+
require(chainId == SOURCE_CHAIN_ID, "invalid source chain ID");
|
|
58
|
+
require(sender == lightBulbSwitch, "invalid sender address from source chain");
|
|
59
|
+
|
|
60
|
+
// Decode the message and store it
|
|
61
|
+
(address lightBulbOwner) = abi.decode(data, (address));
|
|
62
|
+
lightBulbIsOn[lightBulbOwner] = true;
|
|
63
|
+
|
|
64
|
+
emit LightBulbTurnedOn(lightBulbOwner, messageId);
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function offBulb() external {
|
|
69
|
+
lightBulbIsOn[msg.sender] = false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @authors: [@mani99brar]
|
|
5
|
+
* @reviewers: []
|
|
6
|
+
* @auditors: []
|
|
7
|
+
* @bounties: []
|
|
8
|
+
* @deployments: []
|
|
9
|
+
*/
|
|
10
|
+
pragma solidity ^0.8.18;
|
|
11
|
+
|
|
12
|
+
import "@hashi/interfaces/IYaho.sol";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @title Lightbulb
|
|
16
|
+
* @dev A switch on arbitrum turning a light on and off on arbitrum with the Vea bridge.
|
|
17
|
+
*/
|
|
18
|
+
contract Switch {
|
|
19
|
+
IYaho public yaho;
|
|
20
|
+
|
|
21
|
+
constructor(address _yaho){
|
|
22
|
+
yaho = IYaho(_yaho);
|
|
23
|
+
}
|
|
24
|
+
uint256 messageIndex;
|
|
25
|
+
/**
|
|
26
|
+
* @dev The Fast Bridge participants watch for these events to decide if a challenge should be submitted.
|
|
27
|
+
* @param messageId The id of the message sent to the lightbulb.
|
|
28
|
+
* @param lightBulbOwner The address of the owner of the lightbulb on the L2 side.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
event LightBulbToggled(uint256 indexed messageId, address indexed lightBulbOwner);
|
|
32
|
+
|
|
33
|
+
function turnOnLightBulb(
|
|
34
|
+
uint32 _lightBulbChainId,
|
|
35
|
+
address _targetAddress,
|
|
36
|
+
uint256 _threshold,
|
|
37
|
+
IReporter[] memory _reporters,
|
|
38
|
+
IAdapter[] memory _adapters
|
|
39
|
+
) external payable {
|
|
40
|
+
bytes memory _msgData = abi.encode(msg.sender);
|
|
41
|
+
|
|
42
|
+
(uint256 msgId,) = yaho.dispatchMessageToAdapters(
|
|
43
|
+
_lightBulbChainId, _threshold, _targetAddress, _msgData, _reporters, _adapters
|
|
44
|
+
);
|
|
45
|
+
emit LightBulbToggled(msgId, msg.sender);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
5
|
+
import {CCIPReceiver} from "@chainlink/applications/CCIPReceiver.sol";
|
|
6
|
+
import {Client} from "@chainlink/libraries/Client.sol";
|
|
7
|
+
import {Adapter} from "@hashi/adapters/Adapter.sol";
|
|
8
|
+
|
|
9
|
+
contract CCIPAdapter is Adapter, Ownable, CCIPReceiver {
|
|
10
|
+
string public constant PROVIDER = "ccip";
|
|
11
|
+
|
|
12
|
+
mapping(uint64 => address) public enabledReporters;
|
|
13
|
+
mapping(uint64 => uint256) public chainIds;
|
|
14
|
+
|
|
15
|
+
error UnauthorizedCCIPReceive();
|
|
16
|
+
|
|
17
|
+
event ReporterSet(uint256 indexed chainId, uint64 indexed chainSelector, address indexed reporter);
|
|
18
|
+
|
|
19
|
+
constructor(address ccipRouter) CCIPReceiver(ccipRouter) {} // solhint-disable no-empty-blocks
|
|
20
|
+
|
|
21
|
+
function setReporterByChain(uint256 chainId, uint64 chainSelector, address reporter) external onlyOwner {
|
|
22
|
+
enabledReporters[chainSelector] = reporter;
|
|
23
|
+
chainIds[chainSelector] = chainId;
|
|
24
|
+
emit ReporterSet(chainId, chainSelector, reporter);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _ccipReceive(Client.Any2EVMMessage memory message) internal override {
|
|
28
|
+
// NOTE: validity of `msg.sender` is ensured by `CCIPReceiver` prior this internal function invocation
|
|
29
|
+
address sender = abi.decode(message.sender, (address));
|
|
30
|
+
if (enabledReporters[message.sourceChainSelector] != sender) revert UnauthorizedCCIPReceive();
|
|
31
|
+
uint256 sourceChainId = chainIds[message.sourceChainSelector];
|
|
32
|
+
(uint256[] memory ids, bytes32[] memory hashes) = abi.decode(message.data, (uint256[], bytes32[]));
|
|
33
|
+
_storeHashes(sourceChainId, ids, hashes);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
5
|
+
import {IRouterClient} from "@chainlink/interfaces/IRouterClient.sol";
|
|
6
|
+
import {Client} from "@chainlink/libraries/Client.sol";
|
|
7
|
+
import {Reporter} from "@hashi/adapters/Reporter.sol";
|
|
8
|
+
|
|
9
|
+
contract CCIPReporter is Reporter, Ownable {
|
|
10
|
+
string public constant PROVIDER = "ccip";
|
|
11
|
+
|
|
12
|
+
IRouterClient public immutable CCIP_ROUTER;
|
|
13
|
+
|
|
14
|
+
uint256 public fee;
|
|
15
|
+
mapping(uint256 => uint64) public chainSelectors;
|
|
16
|
+
|
|
17
|
+
error ChainSelectorNotAvailable();
|
|
18
|
+
|
|
19
|
+
event ChainSelectorSet(uint256 indexed chainId, uint64 indexed chainSelector);
|
|
20
|
+
event FeeSet(uint256 fee);
|
|
21
|
+
|
|
22
|
+
constructor(address headerStorage, address yaho, address ccipRouter) Reporter(headerStorage, yaho) {
|
|
23
|
+
CCIP_ROUTER = IRouterClient(ccipRouter);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function setChainSelectorByChainId(uint256 chainId, uint64 chainSelector) external onlyOwner {
|
|
27
|
+
chainSelectors[chainId] = chainSelector;
|
|
28
|
+
emit ChainSelectorSet(chainId, chainSelector);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function setFee(uint256 fee_) external onlyOwner {
|
|
32
|
+
fee = fee_;
|
|
33
|
+
emit FeeSet(fee_);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _dispatch(uint256 targetChainId, address adapter, uint256[] memory ids, bytes32[] memory hashes)
|
|
37
|
+
internal
|
|
38
|
+
override
|
|
39
|
+
returns (bytes32)
|
|
40
|
+
{
|
|
41
|
+
uint64 targetChainSelector = chainSelectors[targetChainId];
|
|
42
|
+
if (targetChainSelector == 0) revert ChainSelectorNotAvailable();
|
|
43
|
+
bytes memory payload = abi.encode(ids, hashes);
|
|
44
|
+
Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({
|
|
45
|
+
receiver: abi.encode(adapter),
|
|
46
|
+
data: payload,
|
|
47
|
+
tokenAmounts: new Client.EVMTokenAmount[](0), // Empty array - no tokens are transferred
|
|
48
|
+
extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 200_000, strict: false})),
|
|
49
|
+
feeToken: address(0) // Pay fees with native
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
uint256 fees = CCIP_ROUTER.getFee(targetChainSelector, message);
|
|
53
|
+
|
|
54
|
+
require(fees < address(this).balance, "Insufficient fee provided");
|
|
55
|
+
CCIP_ROUTER.ccipSend{value: fees}(targetChainSelector, message);
|
|
56
|
+
return bytes32(0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
receive() external payable {}
|
|
60
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {Adapter} from "@hashi/adapters/Adapter.sol";
|
|
5
|
+
import {IReceiverGateway} from "./interfaces/IReceiverGateway.sol";
|
|
6
|
+
|
|
7
|
+
contract VeaAdapter is IReceiverGateway, Adapter {
|
|
8
|
+
string public constant PROVIDER = "vea";
|
|
9
|
+
|
|
10
|
+
address public immutable VEA_OUTBOX;
|
|
11
|
+
address public REPORTER;
|
|
12
|
+
uint256 public immutable SOURCE_CHAIN_ID;
|
|
13
|
+
|
|
14
|
+
error ArrayLengthMissmatch();
|
|
15
|
+
error InvalidVeaOutbox(address veaOutbox, address expectedVeaOutboux);
|
|
16
|
+
error InvalidReporter(address reporter, address expectedReporter);
|
|
17
|
+
|
|
18
|
+
constructor(address veaOutbox_, uint256 sourceChainId) {
|
|
19
|
+
VEA_OUTBOX = veaOutbox_;
|
|
20
|
+
SOURCE_CHAIN_ID = sourceChainId;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
modifier onlyFromAuthenticatedVeaSender(address sourceMsgSender) {
|
|
24
|
+
if (msg.sender != VEA_OUTBOX) revert InvalidVeaOutbox(msg.sender, VEA_OUTBOX);
|
|
25
|
+
if (sourceMsgSender != REPORTER) revert InvalidReporter(REPORTER, sourceMsgSender);
|
|
26
|
+
_;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function setReporter(address reporter) external {
|
|
30
|
+
REPORTER = reporter;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function senderGateway() external view override returns (address) {
|
|
34
|
+
return REPORTER;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function veaOutbox() external view override returns (address) {
|
|
38
|
+
return VEA_OUTBOX;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function receiveMessage(address sourceMsgSender, bytes calldata data)
|
|
42
|
+
external
|
|
43
|
+
override
|
|
44
|
+
onlyFromAuthenticatedVeaSender(sourceMsgSender)
|
|
45
|
+
{
|
|
46
|
+
(uint256[] memory ids, bytes32[] memory hashes) = abi.decode(data, (uint256[], bytes32[]));
|
|
47
|
+
_storeHashes(SOURCE_CHAIN_ID, ids, hashes);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {VeaAdapter} from "./VeaAdapter.sol";
|
|
5
|
+
import {Reporter} from "@hashi/adapters/Reporter.sol";
|
|
6
|
+
import {ISenderGateway} from "./interfaces/ISenderGateway.sol";
|
|
7
|
+
import {IVeaInbox} from "./interfaces/IVeaInbox.sol";
|
|
8
|
+
|
|
9
|
+
contract VeaReporter is ISenderGateway, Reporter {
|
|
10
|
+
string public constant PROVIDER = "vea";
|
|
11
|
+
|
|
12
|
+
IVeaInbox public immutable VEA_INBOX;
|
|
13
|
+
address public immutable ADAPTER;
|
|
14
|
+
uint256 public immutable EXPECTED_TARGET_CHAIN_ID;
|
|
15
|
+
|
|
16
|
+
error InvalidAdapter(address adapter, address expectedAdapter);
|
|
17
|
+
error InvalidTargetChainId(uint256 targetChainId, uint256 expectedTargetChainId);
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
address headerStorage,
|
|
21
|
+
address yaho,
|
|
22
|
+
IVeaInbox veaInbox_,
|
|
23
|
+
address adapter,
|
|
24
|
+
uint256 expectedTargetChainId
|
|
25
|
+
) Reporter(headerStorage, yaho) {
|
|
26
|
+
VEA_INBOX = veaInbox_;
|
|
27
|
+
ADAPTER = adapter;
|
|
28
|
+
EXPECTED_TARGET_CHAIN_ID = expectedTargetChainId;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function receiverGateway() external view override returns (address) {
|
|
32
|
+
return ADAPTER;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function veaInbox() external view override returns (IVeaInbox) {
|
|
36
|
+
return VEA_INBOX;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function _dispatch(uint256 targetChainId, address adapter, uint256[] memory ids, bytes32[] memory hashes)
|
|
40
|
+
internal
|
|
41
|
+
override
|
|
42
|
+
returns (bytes32)
|
|
43
|
+
{
|
|
44
|
+
if (targetChainId != EXPECTED_TARGET_CHAIN_ID) {
|
|
45
|
+
revert InvalidTargetChainId(targetChainId, EXPECTED_TARGET_CHAIN_ID);
|
|
46
|
+
}
|
|
47
|
+
if (adapter != ADAPTER) revert InvalidAdapter(adapter, ADAPTER);
|
|
48
|
+
uint64 msgId = VEA_INBOX.sendMessage(ADAPTER, abi.encode(ids, hashes));
|
|
49
|
+
return bytes32(uint256(msgId));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
interface IReceiverGateway {
|
|
5
|
+
function veaOutbox() external view returns (address);
|
|
6
|
+
function senderGateway() external view returns (address);
|
|
7
|
+
function receiveMessage(address msgSender, bytes calldata msgData) external;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import {IVeaInbox} from "./IVeaInbox.sol";
|
|
5
|
+
|
|
6
|
+
interface ISenderGateway {
|
|
7
|
+
function veaInbox() external view returns (IVeaInbox);
|
|
8
|
+
function receiverGateway() external view returns (address);
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
interface IVeaInbox {
|
|
5
|
+
/// @dev Sends an arbitrary message to receiving chain.
|
|
6
|
+
/// Note: Calls authenticated by receiving gateway checking the sender argument.
|
|
7
|
+
/// @param _to The cross-domain contract address which receives the calldata.
|
|
8
|
+
/// @param _data The message calldata, abi.encode(...)
|
|
9
|
+
/// @return msgId The index of the message in the inbox, as a message Id, needed to relay the message.
|
|
10
|
+
function sendMessage(address _to, bytes memory _data) external returns (uint64 msgId);
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lightbulb": "0x2773DCFb27C0ED863648AB0cd45e77cC77f00E94",
|
|
3
|
+
"lzAdapter": "0x0313f25f51f8846fdDFaBCb7F0672e4D3E1C0E76",
|
|
4
|
+
"lzReporter": "0x41E3cde8F10A02B329f85133F7F1f573d876c6d8",
|
|
5
|
+
"switch": "0xeD1995Ae173cb68CFd419d91AAee1698e2F5B894",
|
|
6
|
+
"yaho": "0x0313f25f51f8846fdDFaBCb7F0672e4D3E1C0E76",
|
|
7
|
+
"yaru": "0x43017e1d9f66f7E7Be4055CFf6a490F57aF9b8De"
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lightbulb": "0x1F851DE0e959ad33193e5449EC4C23A66eAdbCC7",
|
|
3
|
+
"lzAdapter": "0xd35B519d08d96188BB89dF874ED48314De84325b",
|
|
4
|
+
"lzReporter": "0xCd685286838ECdB6a307B6Ee51AcBBe7172d9757",
|
|
5
|
+
"switch": "0x592dc5Aaf28f860af5E01088C6Aa55AFCB057e61",
|
|
6
|
+
"yaho": "0xD0375320591ff87797CEb03CBeE80C82fD61BC77",
|
|
7
|
+
"yaru": "0x5f629f27BA26E17e7E309D886A8490d9e0124bd1"
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ccipReporter": "0xACe8c605BBf459f6BDEd6FEc31e5B5E2CcC39F36",
|
|
3
|
+
"ccipAdapter": "0xC1d4c6842e7388b53d09Bcc10Bd4FfC122c0c6DA",
|
|
4
|
+
"lightbulb": "0x5e6fcfCaa61e4Db57858b7611eD2eC9Fb8e450dd",
|
|
5
|
+
"lzAdapter": "0x746dfa0251A31e587E97bBe0c58ED67A343280Df",
|
|
6
|
+
"lzReporter": "0x288dA9f5b01D9118AD0A1Fb998C1295fF1cf5c80",
|
|
7
|
+
"veaReporter": "0xbfDc8d1a106041b6c71044E0d7C94050B99eff84",
|
|
8
|
+
"veaAdapter": "0xd578fa969579CB7b560446D486C8451cd454C8cd",
|
|
9
|
+
"switch": "0x69E0ADAa6571422D174fc3e43e357c09465D0E75",
|
|
10
|
+
"yaho": "0xDbdF80c87f414fac8342e04D870764197bD3bAC7",
|
|
11
|
+
"yaru": "0x231e48AAEaAC6398978a1dBA4Cd38fcA208Ec391"
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ccipReporter": "0x8777F17F5ACE97f6d1E6Df41c94F84075fAEBf1B",
|
|
3
|
+
"ccipAdapter": "0xc3613d84d156110Bc12aA4184C7EeFB1F8BD9cD2",
|
|
4
|
+
"lightbulb": "0x44d3d3d8cB731958Df78DAf531b16E23DfB27450",
|
|
5
|
+
"lzAdapter": "0x5d8FA84CB2c649b19A2F3C1EC2F3210c2AE4B2F3",
|
|
6
|
+
"lzReporter": "0x25af7138f50CEf2573bb67A0227aB44045B7CC88",
|
|
7
|
+
"veaReporter": "0xE803DA11AfC72CEa6Fa1A0AfC344015Cce5410A9",
|
|
8
|
+
"veaAdapter": "0x8C04D410B1F3B5907dDf4F017FAf7DF1D7f5F597",
|
|
9
|
+
"switch": "0x69E0ADAa6571422D174fc3e43e357c09465D0E75",
|
|
10
|
+
"yaho": "0xDbdF80c87f414fac8342e04D870764197bD3bAC7",
|
|
11
|
+
"yaru": "0x231e48AAEaAC6398978a1dBA4Cd38fcA208Ec391"
|
|
12
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "function",
|
|
4
|
+
"name": "getHash",
|
|
5
|
+
"inputs": [
|
|
6
|
+
{
|
|
7
|
+
"name": "domain",
|
|
8
|
+
"type": "uint256",
|
|
9
|
+
"internalType": "uint256"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "uint256",
|
|
14
|
+
"internalType": "uint256"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"outputs": [
|
|
18
|
+
{
|
|
19
|
+
"name": "",
|
|
20
|
+
"type": "bytes32",
|
|
21
|
+
"internalType": "bytes32"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"stateMutability": "view"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"type": "event",
|
|
28
|
+
"name": "HashStored",
|
|
29
|
+
"inputs": [
|
|
30
|
+
{
|
|
31
|
+
"name": "id",
|
|
32
|
+
"type": "uint256",
|
|
33
|
+
"indexed": true,
|
|
34
|
+
"internalType": "uint256"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "hash",
|
|
38
|
+
"type": "bytes32",
|
|
39
|
+
"indexed": true,
|
|
40
|
+
"internalType": "bytes32"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"anonymous": false
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "error",
|
|
47
|
+
"name": "ConflictingBlockHeader",
|
|
48
|
+
"inputs": [
|
|
49
|
+
{
|
|
50
|
+
"name": "blockNumber",
|
|
51
|
+
"type": "uint256",
|
|
52
|
+
"internalType": "uint256"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "blockHash",
|
|
56
|
+
"type": "bytes32",
|
|
57
|
+
"internalType": "bytes32"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "storedBlockHash",
|
|
61
|
+
"type": "bytes32",
|
|
62
|
+
"internalType": "bytes32"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"type": "error",
|
|
68
|
+
"name": "InvalidBlockHeaderRLP",
|
|
69
|
+
"inputs": []
|
|
70
|
+
}
|
|
71
|
+
]
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "function",
|
|
4
|
+
"name": "checkHashWithThresholdFromAdapters",
|
|
5
|
+
"inputs": [
|
|
6
|
+
{
|
|
7
|
+
"name": "domain",
|
|
8
|
+
"type": "uint256",
|
|
9
|
+
"internalType": "uint256"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "uint256",
|
|
14
|
+
"internalType": "uint256"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "threshold",
|
|
18
|
+
"type": "uint256",
|
|
19
|
+
"internalType": "uint256"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "adapters",
|
|
23
|
+
"type": "address[]",
|
|
24
|
+
"internalType": "contract IAdapter[]"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"outputs": [
|
|
28
|
+
{
|
|
29
|
+
"name": "",
|
|
30
|
+
"type": "bool",
|
|
31
|
+
"internalType": "bool"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"stateMutability": "view"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"type": "function",
|
|
38
|
+
"name": "getHash",
|
|
39
|
+
"inputs": [
|
|
40
|
+
{
|
|
41
|
+
"name": "domain",
|
|
42
|
+
"type": "uint256",
|
|
43
|
+
"internalType": "uint256"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "id",
|
|
47
|
+
"type": "uint256",
|
|
48
|
+
"internalType": "uint256"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "adapters",
|
|
52
|
+
"type": "address[]",
|
|
53
|
+
"internalType": "contract IAdapter[]"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"outputs": [
|
|
57
|
+
{
|
|
58
|
+
"name": "hash",
|
|
59
|
+
"type": "bytes32",
|
|
60
|
+
"internalType": "bytes32"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"stateMutability": "view"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "function",
|
|
67
|
+
"name": "getHashFromAdapter",
|
|
68
|
+
"inputs": [
|
|
69
|
+
{
|
|
70
|
+
"name": "domain",
|
|
71
|
+
"type": "uint256",
|
|
72
|
+
"internalType": "uint256"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "id",
|
|
76
|
+
"type": "uint256",
|
|
77
|
+
"internalType": "uint256"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "adapter",
|
|
81
|
+
"type": "address",
|
|
82
|
+
"internalType": "contract IAdapter"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"outputs": [
|
|
86
|
+
{
|
|
87
|
+
"name": "",
|
|
88
|
+
"type": "bytes32",
|
|
89
|
+
"internalType": "bytes32"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"stateMutability": "view"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"type": "function",
|
|
96
|
+
"name": "getHashesFromAdapters",
|
|
97
|
+
"inputs": [
|
|
98
|
+
{
|
|
99
|
+
"name": "domain",
|
|
100
|
+
"type": "uint256",
|
|
101
|
+
"internalType": "uint256"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "id",
|
|
105
|
+
"type": "uint256",
|
|
106
|
+
"internalType": "uint256"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "adapters",
|
|
110
|
+
"type": "address[]",
|
|
111
|
+
"internalType": "contract IAdapter[]"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"outputs": [
|
|
115
|
+
{
|
|
116
|
+
"name": "",
|
|
117
|
+
"type": "bytes32[]",
|
|
118
|
+
"internalType": "bytes32[]"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"stateMutability": "view"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "error",
|
|
125
|
+
"name": "AdaptersDisagree",
|
|
126
|
+
"inputs": [
|
|
127
|
+
{
|
|
128
|
+
"name": "adapterOne",
|
|
129
|
+
"type": "address",
|
|
130
|
+
"internalType": "contract IAdapter"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "adapterTwo",
|
|
134
|
+
"type": "address",
|
|
135
|
+
"internalType": "contract IAdapter"
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"type": "error",
|
|
141
|
+
"name": "HashNotAvailableInAdapter",
|
|
142
|
+
"inputs": [
|
|
143
|
+
{
|
|
144
|
+
"name": "adapter",
|
|
145
|
+
"type": "address",
|
|
146
|
+
"internalType": "contract IAdapter"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"type": "error",
|
|
152
|
+
"name": "InvalidThreshold",
|
|
153
|
+
"inputs": [
|
|
154
|
+
{
|
|
155
|
+
"name": "threshold",
|
|
156
|
+
"type": "uint256",
|
|
157
|
+
"internalType": "uint256"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "maxThreshold",
|
|
161
|
+
"type": "uint256",
|
|
162
|
+
"internalType": "uint256"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"type": "error",
|
|
168
|
+
"name": "NoAdaptersGiven",
|
|
169
|
+
"inputs": []
|
|
170
|
+
}
|
|
171
|
+
]
|