feat: recreate remaining missing agent smart contracts from docs
This commit is contained in:
26
contracts/contracts/AgentCommunication.sol
Normal file
26
contracts/contracts/AgentCommunication.sol
Normal file
@@ -0,0 +1,26 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||
|
||||
contract AgentCommunication is Ownable {
|
||||
struct Message {
|
||||
address sender;
|
||||
address recipient;
|
||||
string encryptedContent;
|
||||
uint256 timestamp;
|
||||
}
|
||||
|
||||
mapping(address => Message[]) public inbox;
|
||||
|
||||
event MessageSent(address indexed sender, address indexed recipient);
|
||||
|
||||
function sendMessage(address _recipient, string calldata _encryptedContent) external {
|
||||
inbox[_recipient].push(Message(msg.sender, _recipient, _encryptedContent, block.timestamp));
|
||||
emit MessageSent(msg.sender, _recipient);
|
||||
}
|
||||
|
||||
function getMessages() external view returns (Message[] memory) {
|
||||
return inbox[msg.sender];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user