Skip to content

Commit 1bf8746

Browse files
authored
feat: add metadata event emitter contract (#1138)
1 parent 271da3e commit 1bf8746

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

contracts/AcrossEventEmitter.sol

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
/**
5+
* @title AcrossEventEmitter
6+
* @notice A simple contract that emits events with bytes encoded metadata
7+
*/
8+
contract AcrossEventEmitter {
9+
/**
10+
* @notice Emitted when metadata is stored
11+
* @param data The metadata bytes emitted
12+
*/
13+
event MetadataEmitted(bytes data);
14+
15+
/**
16+
* @notice Emits metadata as an event
17+
* @param data The bytes data to emit
18+
*/
19+
function emitData(bytes calldata data) external {
20+
require(data.length > 0, "Data cannot be empty");
21+
emit MetadataEmitted(data);
22+
}
23+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { DeployFunction } from "hardhat-deploy/types";
2+
import { HardhatRuntimeEnvironment } from "hardhat/types";
3+
4+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5+
const { deployer } = await hre.getNamedAccounts();
6+
const instance = await hre.deployments.deploy("AcrossEventEmitter", {
7+
from: deployer,
8+
log: true,
9+
skipIfAlreadyDeployed: true,
10+
});
11+
await hre.run("verify:verify", { address: instance.address });
12+
};
13+
14+
module.exports = func;
15+
func.tags = ["AcrossEventEmitter"];

0 commit comments

Comments
 (0)