Skip to content

Commit

Permalink
added: example contract file
Browse files Browse the repository at this point in the history
  • Loading branch information
Salmandabbakuti committed Nov 4, 2024
1 parent 8ba3439 commit d4ed86e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
37 changes: 37 additions & 0 deletions GreeterNotifier.sol
Original file line number Diff line number Diff line change
@@ -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"
);
}
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

0 comments on commit d4ed86e

Please sign in to comment.