Skip to content

Commit

Permalink
feat(contracts): adds fee within LayerZeroReporter
Browse files Browse the repository at this point in the history
  • Loading branch information
allemanfredi committed May 6, 2024
1 parent 001adf7 commit 1e146b0
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ contract LayerZeroReporter is Reporter, Ownable {
ILayerZeroEndpoint public immutable LAYER_ZERO_ENDPOINT;

mapping(uint256 => uint16) public endpointIds;
uint256 public fee;

error EndpointIdNotAvailable();

event EndpointIdSet(uint256 indexed chainId, uint16 indexed endpointId);
event FeeSet(uint256 fee);

constructor(address headerStorage, address yaho, address lzEndpoint) Reporter(headerStorage, yaho) {
LAYER_ZERO_ENDPOINT = ILayerZeroEndpoint(lzEndpoint);
Expand All @@ -24,6 +26,11 @@ contract LayerZeroReporter is Reporter, Ownable {
emit EndpointIdSet(chainId, endpointId);
}

function setFee(uint256 fee_) external onlyOwner {
fee = fee_;
emit FeeSet(fee);
}

function _dispatch(
uint256 targetChainId,
address adapter,
Expand All @@ -35,7 +42,7 @@ contract LayerZeroReporter is Reporter, Ownable {
bytes memory payload = abi.encode(ids, hashes);
bytes memory path = abi.encodePacked(adapter, address(this));
// solhint-disable-next-line check-send-result
LAYER_ZERO_ENDPOINT.send{ value: msg.value }(
LAYER_ZERO_ENDPOINT.send{ value: fee }(
targetEndpointId,
path,
payload,
Expand Down

0 comments on commit 1e146b0

Please sign in to comment.