From d4ed86e709fc83c24eaa686d7eea0a06ff3bd93a Mon Sep 17 00:00:00 2001 From: Salman Dabbakuti <29351207+Salmandabbakuti@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:32:18 +0530 Subject: [PATCH] added: example contract file --- GreeterNotifier.sol | 37 +++++++++++++++++++++++++++++++++++++ README.md | 4 +++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 GreeterNotifier.sol diff --git a/GreeterNotifier.sol b/GreeterNotifier.sol new file mode 100644 index 0000000..d2a24bc --- /dev/null +++ b/GreeterNotifier.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.28; + +contract GreeterNotifier { + string greeting; + + event ReactiveNotification( + address indexed from, + address indexed to, + string title, + string description, + uint256 chainId, + string cta, + bytes data + ); + + constructor() { + greeting = "Hello, World!"; + } + + function getGreeting() public view returns (string memory) { + return greeting; + } + + function setGreeting(string memory _greeting) public { + greeting = _greeting; + emit ReactiveNotification( + address(this), + msg.sender, + "Greeting Updated", + _greeting, + block.chainid, + "https://example-cta.com", + "0x" + ); + } +} diff --git a/README.md b/README.md index 9843c46..501b609 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ emit ReactiveNotification( } ``` +You can find the complete example of the smart contract [here](GreeterNotifier.sol). + ### 2. Event Subscription: Users subscribe to the `ReactiveNotification` event on their preferred chain and smartcontract they are interested in. @@ -159,4 +161,4 @@ This is a proof of concept and is not ready for production use. It is not audite ## License -This project is licensed under the MIT License. +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.