This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: llama message broadcaster #96
Open
0xrajath
wants to merge
8
commits into
main
Choose a base branch
from
rajath/llama-broadcast
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1ba1c70
LlamaMessageBroadcaster
0xrajath 918bbda
duck testing
0xrajath 83aeb61
natspec
0xrajath 2f96fb6
updated deploy script
0xrajath ce9d6ce
working positive test
0xrajath f1b017a
revert test
0xrajath 56e4cae
integration test
0xrajath a568a03
fix
0xrajath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.23; | ||
|
||
import {ILlamaCore} from "src/interfaces/ILlamaCore.sol"; | ||
import {ILlamaExecutor} from "src/interfaces/ILlamaExecutor.sol"; | ||
|
||
/// @title LlamaMessageBroadcaster | ||
/// @author Llama (devsdosomething@llama.xyz) | ||
/// @notice This contract enables Llama instances to broadcast an offchain message. | ||
contract LlamaMessageBroadcaster { | ||
/// @dev Emitted when a message is broadcast by a Llama instance. | ||
event MessageBroadcasted(ILlamaExecutor indexed llamaExecutor, string message); | ||
|
||
/// @notice Broadcasts a message from a Llama instance. | ||
/// @param message Message to be broadcasted. | ||
function broadcastMessage(string calldata message) external { | ||
ILlamaExecutor llamaExecutor = ILlamaExecutor(msg.sender); | ||
// Duck testing to check if the caller is a Llama instance. | ||
ILlamaCore(llamaExecutor.LLAMA_CORE()).actionsCount(); | ||
Comment on lines
+18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding the duck test here to reduce possible spam since it's an open function. |
||
emit MessageBroadcasted(llamaExecutor, message); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have made a separate deployer script for just the
LlamaMessageBroadcaster
. I'm not opposed to the idea, but I think this would be simpler to manage.